Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ internal class PostReceiptHelper(
?.values
?.firstOrNull()
?.shouldConsume
?: true
?: false
Copy link
Contributor

Choose a reason for hiding this comment

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

One thing that I think could be important... In this scenario, where it gets to this default, we shouldn't add the token to the cache of successfully posted tokens so we retry to post it on next app foreground. This way, if it was meant to be a consumable, we wouldn't have the issue of it not being able to be repurchased much longer. Wdyt?

billing.consumeAndSave(finishTransactions, purchase, shouldConsume, initiationSource)
onSuccess?.let { it(purchase, postReceiptResponse.customerInfo) }
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ class PostReceiptHelperTest {
}

@Test
fun `postTransactionAndConsumeIfNeeded tries to consume products if product data not available`() {
fun `postTransactionAndConsumeIfNeeded does not consume products if product data not available`() {
mockPostReceiptSuccess(
purchasedProductsInfo = mapOf()
)
Expand All @@ -1589,14 +1589,14 @@ class PostReceiptHelperTest {
billing.consumeAndSave(
finishTransactions = true,
purchase = mockStoreTransaction,
shouldConsume = true,
shouldConsume = false,
initiationSource = initiationSource
)
}
}

@Test
fun `postTransactionAndConsumeIfNeeded tries to consume products if product data product id does not match transactions`() {
fun `postTransactionAndConsumeIfNeeded does not consume products if product data product id does not match transactions`() {
mockPostReceiptSuccess(
purchasedProductsInfo = mapOf("other_product" to false)
)
Expand All @@ -1616,7 +1616,7 @@ class PostReceiptHelperTest {
billing.consumeAndSave(
finishTransactions = true,
purchase = mockStoreTransaction,
shouldConsume = true,
shouldConsume = false,
initiationSource = initiationSource
)
}
Expand Down