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

feat(auth): update capability service to query App Store purchases #12724

Merged
merged 1 commit into from
May 4, 2022

Conversation

biancadanforth
Copy link
Contributor

@biancadanforth biancadanforth commented May 2, 2022

Because:

  • We want to include any Apple IAP subscriptions along with other subscriptions when requested by RPs.
  • We want to broadcast any Apple IAP subscription state changes to RPs.

This commit:

  • Modifies existing Stripe helper methods, priceToPlaySkus --> priceToIapIdentifiers and purchasesToPriceIds --> iapPurchasesToPriceIds, to determine which App Store productIds map to which Stripe priceIds.
  • Creates new capability service method fetchSubcribedPricesFromAppStore and modifies playStoreUpdate --> iapUpdate.
  • Adds a feature flag for the Apple App Store API and conditionally initializes the AppleIAP module based on the flag in key_server.js.
  • Renames SubscriptionPurchase classes for Google IAP and Apple IAP to PlayStoreSubscriptionPurchase and AppStoreSubscriptionPurchase, respectively.
  • [BONUS] Fixes a bug in the AppStoreHelper constructor method where only the first underscore was being replaced with a period in the config bundleId transform.

Closes #10386

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).

@biancadanforth
Copy link
Contributor Author

Just need to add new tests. @bbangert if you're available to start looking at the source code changes sooner, that'd be great.

@biancadanforth biancadanforth force-pushed the fxa-3968-apple-iap-capability-service branch from b021e6a to 5f15592 Compare May 3, 2022 14:03
@biancadanforth biancadanforth marked this pull request as ready for review May 3, 2022 14:03
@biancadanforth biancadanforth requested a review from a team as a code owner May 3, 2022 14:03
Copy link
Contributor Author

@biancadanforth biancadanforth left a comment

Choose a reason for hiding this comment

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

I added a few specific questions/comments inline for the review.

@biancadanforth biancadanforth force-pushed the fxa-3968-apple-iap-capability-service branch from 5f15592 to f3c4f29 Compare May 3, 2022 15:29
@biancadanforth biancadanforth force-pushed the fxa-3968-apple-iap-capability-service branch from f3c4f29 to 74dfff6 Compare May 3, 2022 19:30
@biancadanforth biancadanforth requested a review from bbangert May 3, 2022 19:48
@biancadanforth biancadanforth force-pushed the fxa-3968-apple-iap-capability-service branch from 74dfff6 to 319168a Compare May 4, 2022 15:57
@biancadanforth
Copy link
Contributor Author

I filed #12759 and #12758 to cover updating dev docs and enabling Apple IAP in stage, respectively.

Copy link
Member

@bbangert bbangert left a comment

Choose a reason for hiding this comment

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

LGTM! Nice job!

@biancadanforth biancadanforth force-pushed the fxa-3968-apple-iap-capability-service branch from 319168a to d437783 Compare May 4, 2022 19:52
@biancadanforth
Copy link
Contributor Author

Thanks; I tried to sneak in a fix for mismatched property names on PlanConfig relative to the Apple/Google IAP Stripe Plan metadata keys, and I neglected to push some changes to fxa-shared. I'll make sure CI passes before merging.

Because:

* We want to include any Apple IAP subscriptions along with other subscriptions when requested by RPs.
* We want to broadcast any Apple IAP subscription state changes to RPs.

This commit:

* Modifies existing Stripe helper methods, priceToPlaySkus --> priceToIapIdentifiers and purchasesToPriceIds --> iapPurchasesToPriceIds, to determine which App Store productIds map to which Stripe priceIds.
* Creates new capability service method fetchSubcribedPricesFromAppStore and modifies playStoreUpdate --> iapUpdate.
* Adds a feature flag for the Apple App Store API and conditionally initializes the AppleIAP module based on the flag in key_server.js.
* Renames SubscriptionPurchase classes for Google IAP and Apple IAP to PlayStoreSubscriptionPurchase and AppStoreSubscriptionPurchase, respectively.
* [BONUS] Fixes a bug in the AppStoreHelper constructor method where only the first underscore was being replaced with a period in the config bundleId transform.
* [BONUS] Fixes some typos in PlanConfig properties for Google and Apple IAP plan metadata keys.

Closes #10386
@biancadanforth biancadanforth force-pushed the fxa-3968-apple-iap-capability-service branch from d437783 to 7da4966 Compare May 4, 2022 20:43
@biancadanforth biancadanforth merged commit 11d59b1 into main May 4, 2022
@biancadanforth biancadanforth deleted the fxa-3968-apple-iap-capability-service branch May 4, 2022 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update capability service to query apple purchases
2 participants