feat(registry): reuse a pending Square checkout and check the payment's location #17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/square-checkout-reuse"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Premium phase 3 follow-ups (board row "premium 3b").
What changed
POST /api/v1/checkouthands back the account's pending checkout for the same item instead of making a second Square order, when that row is unpaid, under a day old (squareCheckoutReuse) and at today's price. Apg_advisory_xact_lockper account and item is held across the Square call, so two clicks at once make one order. Migration0006_square_checkout_url.sqlstores the link URL and adds a partial index on pending rows.payment.updatedwhoselocation_idis notSQUARE_LOCATION_ID(resultwrong location), so a sale at another location of the same Square account never grants.Assumptions
Checks
-racerun green.TestCheckoutReusesThePendingOrder(4 concurrent clicks with the fake holding the first call, a later click, another item, another account, a price change, an expired pending row; Square call counts checked) andTestSquareWebhookIgnoresAnotherLocation.TestCheckoutReusesThePendingOrderfails (4 different links), with it it passes 3 of 3.https://claude.ai/code/session_01BALUC3rCP1boWDecLeViQa