Repository navigation
Prepaid code: a storage failure before the plan is created frees the code and asks to retry - #26256
Merged
Merged
Conversation
…code and asks to retry The second Google Play read happens with the code claimed. A storage error there escaped as a 500 and left the claim on the code with no plan. It now releases the claim and answers 503 try_again; if the release fails the claim stays with the same reader, whose retry resumes it.
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.
What changed and why
Follow-up to #26247, from its round 2 money review. When a prepaid or bundle code is redeemed, the code is claimed, then the reader's Google Play state is read once more before the no-card plan is created. If that second read failed with a storage error (not a typed refusal), the exception escaped: the route answered 500 and the claim stayed on the code with no plan created.
Now a storage failure at that point frees the code and answers the existing 503
try_again, so the reader can redeem again. If freeing the claim itself fails, the claim stays with the same reader and their retry resumes it, as before. Nothing is created in either case.Play Billing is still off in prod, and the redemption switch is
cohortwith an empty cohort, so only the one throwaway test account can reach this path today.Product invariants affected
none
How it was verified
backend/tests/unit/test_play_prepaid_code_entry.py: two new tests. A storage failure at the re-check ends in 503try_againwith the claim released and no Stripe create, and the same reader's retry then gets the plan. A failed release keeps the claim with the reader and still returns the typed refusal. Both fail without the fix.test_play_prepaid_code_entry.pyandtest_prepaid_code_redemption.py: 123 passed.Failure class
No
fix:commits; no declaration required.