Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct product context with DEFERRED purchases #1766

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

tonidero
Copy link
Contributor

Description

Another followup to #1751 and #1764

When making DEFERRED purchases, Google returns the result using the old product id. We need to cache all the context information using the old product id so we can attribute it correctly.

@tonidero tonidero added the pr:fix A bug fix label Jun 27, 2024
@@ -92,7 +92,8 @@ internal class BillingWrapper(
@Volatile
var billingClient: BillingClient? = null

private val purchaseContext = mutableMapOf<String, PurchaseContext>()
@VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
internal val purchaseContext = mutableMapOf<String, PurchaseContext>()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing this using Google's callback was trickier, since we would need to use Jsons to create a google Purchase object. This is easier and allows to verify this behavior.

@tonidero tonidero marked this pull request as ready for review June 27, 2024 13:08
@tonidero tonidero requested review from MarkVillacampa and a team June 27, 2024 13:08
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.26%. Comparing base (a36b1cc) to head (3c2bdad).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1766   +/-   ##
=======================================
  Coverage   83.25%   83.26%           
=======================================
  Files         223      223           
  Lines        7614     7617    +3     
  Branches     1070     1071    +1     
=======================================
+ Hits         6339     6342    +3     
  Misses        854      854           
  Partials      421      421           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@vegaro vegaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense!

@tonidero tonidero merged commit b5bc297 into main Jun 28, 2024
9 checks passed
@tonidero tonidero deleted the add-deferred-replacement-mode-3 branch June 28, 2024 11:26
@tonidero tonidero mentioned this pull request Jul 1, 2024
tonidero added a commit that referenced this pull request Jul 1, 2024
### Description
Another followup to #1751 and #1764 

When making `DEFERRED` purchases, Google returns the result using the
old product id. We need to cache all the context information using the
old product id so we can attribute it correctly.
tonidero pushed a commit that referenced this pull request Jul 1, 2024
**This is an automatic release.**

### New Features
* Add `DEFERRED` replacement mode (#1751) via Toni Rico (@tonidero)
### Bugfixes
* Use correct product context with `DEFERRED` purchases (#1766) via Toni
Rico (@tonidero)
* Call callbacks on `DEFERRED` purchases (#1764) via Toni Rico
(@tonidero)
### Dependency Updates
* Bump fastlane from 2.221.0 to 2.221.1 (#1758) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Adds .aiexclude (#1762) via JayShortway (@JayShortway)

Co-authored-by: revenuecat-ops <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr:fix A bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants