-
Notifications
You must be signed in to change notification settings - Fork 6
Add internal API to postSimulatedStoreReceipt #561
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new internal API to the Purchases SDK that allows posting test store receipts directly without the UI modal flow. The API is specifically designed for React Native SDK usage in Expo Go mode where different UI handling is required.
- Extracts receipt posting logic into a reusable helper function
- Adds internal API method
postTestStoreReceipt
to the Purchases class - Updates existing test store purchase functionality to use the extracted helper
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/main.ts | Adds INTERNAL_RC_API symbol and postTestStoreReceipt method to Purchases class |
src/helpers/test-store-post-receipt-helper.ts | New helper function that extracts receipt posting logic from purchase flow |
src/helpers/test-store-purchase-helper.ts | Refactored to use the new helper function instead of inline receipt posting |
src/tests/helpers/test-store-purchase-helper.test.ts | Updated tests to mock the new helper function |
src/tests/helpers/test-store-post-receipt-helper.test.ts | Comprehensive test suite for the new helper function |
Comments suppressed due to low confidence (1)
src/tests/helpers/test-store-post-receipt-helper.test.ts:135
- This test doesn't actually verify uniqueness since the UUID mock returns the same value. The test should either use different UUID values or verify the timestamp component changes between calls to properly test uniqueness.
test("generates unique transaction IDs", async () => {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good to me! Leaving approval to someone with deeper knowledge of JS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw the changes, now using @internal
instead of the INTERNAL_RC_API
symbol. I think it looks good! Again, will leave approval to someone with more knowledge 🙏
**This is an automatic release.** ## RevenueCat SDK ### ✨ New Features * Add Virtual Currency Functionality (#573) via Will Taylor (@fire-at-will) * [WEB-2865] Feedback loops for checkout and WPL (#575) via James O'Donnell (@james-od) ### 🔄 Other Changes * [WEB-2778] Add tax breakdown support to checkout tax responses and examples (#570) via Antonio Borrero Granell (@antoniobg) * Add internal API to postSimulatedStoreReceipt (#561) via Toni Rico (@tonidero) * Add getVirtualCurrencies backend network request (#569) via Will Taylor (@fire-at-will)
Motivation / Description
In this PR we add a new API to allow to post a purchase for a product in the simulated store. This will be used by the React native SDK when running in expo go mode, where it will need to post the receipt but needs to handle the UI differently than how it's handled on browser platforms.
Usage of this API requires to explicitely
// @ts-ignore
when calling this method.This API is not meant to be used by others, only meant for Internal RevenueCat usage.
Changes introduced
Linear ticket (if any)
Additional comments