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

Send initiation_source in post receipt requests #1212

Conversation

tonidero
Copy link
Contributor

@tonidero tonidero commented Aug 30, 2023

Description

This PR adds a new initiation_source field to the post receipt body that indicates where the receipt was originated from. This is already done in iOS.

@tonidero tonidero added the refactor A code change that neither fixes a bug nor adds a feature label Aug 30, 2023
@tonidero tonidero marked this pull request as ready for review August 30, 2023 09:12
@tonidero tonidero requested a review from a team August 30, 2023 09:12
@tonidero tonidero changed the title Send initiation_source in post receipt requests Send initiation_source in post receipt requests Aug 30, 2023
@codecov
Copy link

codecov bot commented Aug 30, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.04% 🎉

Comparison is base (baad435) 85.89% compared to head (c3b3634) 85.93%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1212      +/-   ##
==========================================
+ Coverage   85.89%   85.93%   +0.04%     
==========================================
  Files         183      184       +1     
  Lines        6251     6269      +18     
  Branches      910      911       +1     
==========================================
+ Hits         5369     5387      +18     
  Misses        536      536              
  Partials      346      346              
Files Changed Coverage Δ
...enuecat/purchases/PostPendingTransactionsHelper.kt 85.71% <100.00%> (+0.25%) ⬆️
...tlin/com/revenuecat/purchases/PostReceiptHelper.kt 94.31% <100.00%> (+0.20%) ⬆️
...evenuecat/purchases/PostReceiptInitiationSource.kt 100.00% <100.00%> (ø)
...rchases/PostTransactionWithProductDetailsHelper.kt 86.48% <100.00%> (+0.77%) ⬆️
.../com/revenuecat/purchases/PurchasesOrchestrator.kt 83.15% <100.00%> (+0.08%) ⬆️
...in/com/revenuecat/purchases/SyncPurchasesHelper.kt 100.00% <100.00%> (ø)
.../kotlin/com/revenuecat/purchases/common/Backend.kt 85.18% <100.00%> (+0.05%) ⬆️

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

@@ -234,6 +234,7 @@ internal class PurchasesOrchestrator constructor(
this.allowSharingPlayStoreAccount,
appUserID,
marketplace = null,
PostReceiptInitiationSource.RESTORE,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm assuming RESTORE for syncing amazon here... which might depends on the user's implementation. Alternatively, we could add another source for this, but seemed unnecessary since it's still kinda a sync, even if it happens right after a purchase. Lmk if you think otherwise @aboedo

Copy link
Member

Choose a reason for hiding this comment

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

yeah, this is a tricky one.

For observer mode for any other store we'd do queue, right? Maybe we should do the same here? It'd mean we don't alias unless you specifically call logIn I suppose, which should be a good thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, for observer mode in android we would actually do purchase, since it's coming from the listener.

In Android, we only use queue when syncing unsynced purchases on app open/foreground. That doesn't actually use the listener.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So for purchases outside the app, it would also be purchase

@tonidero tonidero merged commit 5a6b78e into main Aug 30, 2023
7 checks passed
@tonidero tonidero deleted the toniricodiez/sdk-2858-android-code-to-send-headers-to-match-ios-with-queue-restore branch August 30, 2023 11:12
Copy link
Contributor

@NachoSoto NachoSoto left a comment

Choose a reason for hiding this comment

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

Nice!

This was referenced Aug 30, 2023
tonidero pushed a commit that referenced this pull request Aug 31, 2023
**This is an automatic release.**

### Dependency Updates
* Bump fastlane-plugin-revenuecat_internal from `b2108fb` to `a297205`
(#1210) via dependabot[bot] (@dependabot[bot])
### Other Changes
* Rename `queue` initiation source to `unsynced_active_purchases`
(#1214) via Toni Rico (@tonidero)
* Send `initiation_source` in post receipt requests (#1212) via Toni
Rico (@tonidero)
* CustomEntitlementComputation: Add `restorePurchases` (#1211) via Toni
Rico (@tonidero)
* Unify caching offerings and updating update timestamp (#1206) via Toni
Rico (@tonidero)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor A code change that neither fixes a bug nor adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants