You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Store.order() returns undefined if a receipt or transaction has been updated while the purchase dialog is opened, thus never calling cancel or error
#1548
Open
DavidTalevski opened this issue
Mar 18, 2024
· 1 comment
When the purchase dialog is opened, and some of the receipts get updated they trigger the order promise to resolve and return undefined, thus making it impossible to listen for cancel or error events during the current ordering of a product. The easiest way to reproduce this is to order a product, when the purchase dialog appears minimize the app, upon returning to the app some of the receipts might have gotten updated and then they trigger the order to resolve. The order is resolved and the purchase dialog is left open and then it is impossible for us to listen to cancel or error events for the currently opened dialog. In the previous versions this could've been remedied with the store.when().cancelled event but now that everything is tied to store.order() this makes it impossible to handle.
These are the logs when the app is resumed and the purchase dialog is still opened:
After the order falsely finishes, in logcat when the close dialog is closed this is the output:
onPurchasesUpdated() -> Cancelled: USER_CANCELED: User pressed back or canceled a dialog
callError({code:6777006, msg:"USER_CANCELED")
This error is no longer listened to because the order has finished and the js code never gets notified that this dialog has closed.
Expected behavior
When ordering a product and some of the receipt get updated, this should not affect the current order that is taking place. The promise should not resolve with "undefined" if a different receipt has been updated, it should only resolve when the order is completed or it has failed.
The text was updated successfully, but these errors were encountered:
This is a bug that will happen mostly in dev. A user has to try to update a subscription he owns, keep the purchase window open long enough that the subscription renews at that exact moment. In dev, with 3 minutes renewal it might happen. In prod with monthly renewal it's extremely unlikely.
That's a minor bug nevertheless, I'll dig into it.
Observed behavior
When the purchase dialog is opened, and some of the receipts get updated they trigger the order promise to resolve and return undefined, thus making it impossible to listen for cancel or error events during the current ordering of a product. The easiest way to reproduce this is to order a product, when the purchase dialog appears minimize the app, upon returning to the app some of the receipts might have gotten updated and then they trigger the order to resolve. The order is resolved and the purchase dialog is left open and then it is impossible for us to listen to cancel or error events for the currently opened dialog. In the previous versions this could've been remedied with the
store.when().cancelled
event but now that everything is tied tostore.order()
this makes it impossible to handle.These are the logs when the app is resumed and the purchase dialog is still opened:
After the order falsely finishes, in logcat when the close dialog is closed this is the output:
This error is no longer listened to because the order has finished and the js code never gets notified that this dialog has closed.
Expected behavior
When ordering a product and some of the receipt get updated, this should not affect the current order that is taking place. The promise should not resolve with "undefined" if a different receipt has been updated, it should only resolve when the order is completed or it has failed.
The text was updated successfully, but these errors were encountered: