Payments flow adaptation for lazy payments#3
Open
Tiago-Salles wants to merge 1 commit into
Open
Conversation
This was referenced May 17, 2026
fa04a11 to
8a90d4a
Compare
8a90d4a to
fb23ff1
Compare
fb23ff1 to
8ef773c
Compare
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.
Context
When the user clicks Continuar on PayGate for asynchronous payment methods (MB references, MBWAY), the upstream payment is not yet confirmed at that moment. The previous flow tried to resolve the payment synchronously on the success callback, which raised
GatewayErrorand displayed a misleading "You have not been charged." page — even when PayGate would later confirm the payment.The chosen solution avoids background jobs entirely. Instead:
nau_extensionsendpoints; on confirmation, the Order is created in place. Pending rows stay visible with a clear status badge instead of being hidden or wrongly reported as failed.This PR implements the frontend part of that flow. The backend bits ship in companion PRs (ecommerce-plugin-paygate and ecommerce-nau-extensions).
What this PR adds
Thank-You page
src/thank-you/ThankYouPage.jsx— New page reached after the PayGate "success" callback. Reads theorder_numberquery parameter (passed byPayGateCallbackSuccessResponseView), shows a heading, an explanatory body (mentions that some payment methods are confirmed asynchronously), the order number when known, and a primary "My orders" ParagonButtonlinking to/orders.src/thank-you/ThankYouPage.messages.js— New i18n messages for heading, body, order-number line, and button label./thank-youroute alongside the existing/ordersroute.Order History — Status column, action buttons, lazy resolution
service.js — Added two helpers that call the new
nau_extensionsendpoints:fetchBasketPaymentStatus(orderNumber)→GET /payment/nau_extensions/basket-payment-status/?order_number=…fetchPendingBaskets()→GET /payment/nau_extensions/pending-baskets/getOrders()now also merges the pending baskets returned by the second endpoint into the table so that in-flight asynchronous payments are visible right next to confirmed orders. Existing fulfilled orders are flagged withstatus: "paid".OrderHistoryPage.jsx:
statusOverridesandcourseUrlOverrides.paidand callsfetchBasketPaymentStatus. This is the single place where PayGate is consulted, and only while the user is on this page (no background work).paid,pending,failed(data-testidprovided for tests).paidrows, the existing "Order details" link (using the receipt URL) and the new "Go to course" link (usingcourse_urlreturned by the backend). For non-paid rows, the cell is empty.OrderHistoryPage.messages.jsx — New messages for the column headers (
Status,Actions), the status labels (Paid,Pending payment,Payment failed) and the new action label (Go to course).src/order-history/__snapshots__/OrderHistoryPage.test.jsx.snap— Removed so jest regenerates it with the new columns. The snapshot test still runs and will commit the new baseline on first run.User flow after this PR
<MFE>/thank-you?order_number=<basket.order_number>./orders(existing Order History page).paidrow, lazily callsBasketPaymentStatusView. Confirmed payments flip topaid, fulfilling the order in place; still-pending payments keep the "Pending payment" badge; failures show "Payment failed".Related PRs
Related to: https://github.com/fccn/nau-technical/issues/767