fix(checkout): send cart total so /checkout can complete an order - #130
Open
sentry[bot] wants to merge 1 commit into
Open
fix(checkout): send cart total so /checkout can complete an order#130sentry[bot] wants to merge 1 commit into
sentry[bot] wants to merge 1 commit into
Conversation
The Flask /checkout endpoint reads `cart["total"]` when an order is fulfilled, but the app only sent `items` and `quantities`, so the request failed with a 500 once the backend reached the success path. Include the cart total (the same value already logged as `totalValue`) so the payload matches the structure the backend expects. Fixes [MOBILE-REACT-NATIVE-62](https://demo.sentry.io/issues/7671831403/)
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.
Summary
This pull request was triggered by a Seer handoff from Sentry.
Placing an order returned
500 - INTERNAL SERVER ERRORfrom the Flask/checkoutendpoint. The root cause was server-side: the endpoint's empty-cart guard readquantitiesbefore it was assigned, so every request raised anUnboundLocalError(fixed in sentry-demos/empower#1649).While verifying that fix against the payload this app sends, a second, client-side problem showed up: on the successful checkout path the backend reads
cart["total"], but this screen only sentitemsandquantities, so a fulfilled order would still fail with aKeyError. This change adds the cart total to the checkout payload so it matches the structure the backend (and the React web app) expects, and reuses that value for the existingtotalValuesuccess log instead of recomputing it.Verification
totalnpx jestpasses;npx eslint src/screens/CheckoutScreen.tsxreports no new findings versusmasterFixes MOBILE-REACT-NATIVE-62