Payments flow adaptation for lazy payments - #37
Open
Tiago-Salles wants to merge 1 commit into
Open
Conversation
This was referenced May 17, 2026
Tiago-Salles
force-pushed
the
Tiago-Salles/issues/767-lazy-payments-flow
branch
from
May 17, 2026 17:48
4d19c74 to
54991a3
Compare
Tiago-Salles
marked this pull request as ready for review
May 19, 2026 09:15
Tiago-Salles
force-pushed
the
Tiago-Salles/issues/767-lazy-payments-flow
branch
2 times, most recently
from
May 30, 2026 20:59
93c6fa4 to
dc399cf
Compare
Tiago-Salles
force-pushed
the
Tiago-Salles/issues/767-lazy-payments-flow
branch
from
August 7, 2026 07:48
dc399cf to
ee4f27f
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
The payment flow on our Open edX ecommerce instance currently checks asynchronous payments (MB references and MBWAY) synchronously, right after the user clicks Continuar on PayGate. Because the upstream payment is not yet confirmed at that point,
handle_processor_responseraisesGatewayError ("PayGate couldn't double check if basket has been payed")and the user is shown the misleading message "You have not been charged." — even when, in many cases, the payment will be successfully confirmed by PayGate a few seconds/minutes later.We do not want to introduce a background queue. The chosen solution is to defer the payment confirmation to the moment the user opens the Order History page, where each row will lazily consult the payment processor and update its status (and create the Order in place if the payment was confirmed).
This PR introduces the backend pieces of that lazy resolution in
nau_extensions. The MFE (frontend-app-ecommerce) consumes these endpoints and the ecommerce-plugin-paygate redirects the user to the new Thank-You page; those changes ship in their own PRs.What this PR adds
BasketPaymentStatusView—GET /payment/nau_extensions/basket-payment-status/?order_number=…paid,pendingorfailed.Orderalready exists for the basket → returnspaidimmediately, without hitting PayGate.PaymentProcessorResponseyet → returnspendingwithout hitting PayGate (nothing to confirm).get_processor_class_by_name("paygate")and callshandle_payment+create_order+handle_post_orderusing a tinyEdxOrderPlacementMixinadapter (_LazyOrderPlacement). OnGatewayErrorthe response ispending. On otherPaymentErroror order-creation failures the response isfailed.PendingBasketsListView—GET /payment/nau_extensions/pending-baskets/Orderyet, so the Order History page can show in-flight asynchronous payments alongside the standard/api/v2/orders/results._serialize_basketand_build_course_urlto produce the JSON payload consumed by the MFE (including a best-effort LMS course URL used by the new "Go to course" action button).What this PR changes
GatewayError,PaymentError,Response,EdxOrderPlacementMixin,get_processor_class_by_name,PaymentProcessorResponse,OrderNumberGenerator,django_settings) and the two new API views described above.basket-payment-status/→basket_payment_statuspending-baskets/→pending_basketsRelated PRs
Related to: https://github.com/fccn/nau-technical/issues/923