Skip to content

Conversation

@NickSxti
Copy link

Summary

  • Extends QEntitlementsUpdateListener with a new overloaded onEntitlementsUpdated(entitlements, purchaseResult) method
  • When deferred purchases complete in background (no active callback), the listener now receives QPurchaseResult with full purchase details
  • Fixes the issue where consumable purchases that don't create entitlements resulted in an empty map with no transaction info (1768+ instances in API Gateway logs)

Changes

  • QEntitlementsUpdateListener: Added second method with QPurchaseResult? parameter. Both methods have default implementations for mutual delegation — fully backward compatible
  • QProductCenterManager: Success path (line ~1047) and fallback path (calculatePurchasePermissionsLocally) now pass QPurchaseResult to listener when no purchase callback exists
  • Sample app: Updated EntitlementsFragment to demonstrate the new method with consumable purchase handling
  • Tests: Added tests verifying listener receives QPurchaseResult for deferred purchases, and is NOT called when a callback exists

Backward compatibility

  • Old implementations (override only old method) continue to work — new method default calls old
  • New implementations (override only new method) work — old method default calls new
  • @Deprecated annotation guides new adopters to the new method
  • Java interop preserved — both method signatures accessible from Java

Test plan

  • Verify SDK compiles: ./gradlew :sdk:assemble
  • Run unit tests: ./gradlew :sdk:test
  • Verify sample app compiles without changes to old listener code
  • Test deferred consumable purchase flow — listener should receive non-null QPurchaseResult
  • Test normal purchase flow — callback receives result, listener is NOT called

Resolves: SUP3-58

🤖 Generated with Claude Code

…ases

When deferred consumable purchases complete in background (no active
callback), the SDK now passes QPurchaseResult to the entitlements
update listener. This allows developers to access purchase details
for consumables that don't create entitlements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants