Purchasing: fixed consumable purchases by fixing transaction-finishing#1965
Merged
Conversation
tonidero
approved these changes
Oct 7, 2022
tonidero
left a comment
Contributor
There was a problem hiding this comment.
Couple of small things but looks good.
2e80400 to
0699e18
Compare
0699e18 to
d4b5d98
Compare
Integration Tests: added tests for purchasing consumable productsde32618 to
61f6317
Compare
Contributor
Author
|
This is ready for review now. |
61f6317 to
fc37cd8
Compare
5 tasks
NachoSoto
commented
Oct 7, 2022
| self.customerInfoManager.cache(customerInfo: customerInfo, appUserID: appUserID) | ||
| completion?(transaction, customerInfo, nil, false) | ||
|
|
||
| self.finishTransactionIfNeeded(transaction) |
Contributor
Author
There was a problem hiding this comment.
This was out of order.
tonidero
approved these changes
Oct 10, 2022
66d3982 to
0a7b5a6
Compare
NachoSoto
commented
Oct 10, 2022
|
|
||
| func testCanPurchaseConsumableMultipleTimes() async throws { | ||
| // See https://revenuecats.atlassian.net/browse/TRIAGE-134 | ||
| try XCTSkipIf(Self.storeKit2Setting == .disabled, "This test is not currently passing on SK1") |
Contributor
Author
There was a problem hiding this comment.
I filed [TRIAGE-136] for this.
fc37cd8 to
436be58
Compare
The second test reproduces #1964.
436be58 to
1002300
Compare
NachoSoto
added a commit
that referenced
this pull request
Nov 14, 2022
### Changes: - Greatly increased test coverage for `StoreKit2TransactionListener` - Extracted `AsyncSequence.extractValues` - Created `MockStoreTransaction` to be able to mock and verify `finish()` calls - Simplified `StoreKit2TransactionListener`, moved `finish` call to `PurchasesOrchestrator` - Follow up to #1965, also finish SK2 transactions from `StoreKit.Transaction.updates`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1964, TRIAGE-134, TRIAGE-131, and possibly TRIAGE-82.
Depends on #1967, #1968.
Fixes:
SK2purchases we were never finishing transactions. We are now.SK1purchases, transactions were finished after the completion block was invoked (and tests were very lenient checking that eventually this happened). This could have lead to race conditions.SKTestSessions), this fixes the ability to purchase multiple consumable purchases.This is the log from the failing test using SK2:
Open
With the fix, you can see transactions are now finished at the right time:
Open