[IMP] website_sale_aplicoop: pay on the checkout page, not a step later
The separate /eskaera/<slug>/payment step is gone. Members review the summary, choose home delivery and pick a payment method on the checkout, in one screen; the old URL redirects there so bookmarks and sessions that were mid-flow do not hit a 404. The checkout now renders the member's draft sale.order instead of the localStorage cart. That is what fixes the products appearing "out of nowhere" between the two pages: the summary was a snapshot of localStorage taken at page load, and `_autoLoadDraftOnInit` then pulled the draft back into localStorage without re-rendering. Deleting a product in the shop removed it from the cart but left the line on the draft, so the autoload resurrected it, the confirm button sent it back, and it only became visible one page later. The checkout no longer auto-loads the draft — it renders it, and what it shows is what the payment form charges. "Proceed to Checkout" pushes the cart to that draft before navigating. Saving is idempotent: `_merge_or_replace_draft` reuses the cycle's draft and, through the new `_draft_matches_lines`, rewrites `order_line` only when the lines actually differ — replacing them unlinks and recreates every one of them, which is pure churn when nothing changed. The home delivery checkbox goes through the new /eskaera/set-home-delivery so the delivery line moves on the order itself. Writing only to localStorage would have changed the summary and left the amount alone, which with online payment on is the amount being charged. Also fixes the confirmation notice nobody ever saw: saving answered with the payment step URL and the frontend followed it immediately, destroying the toast in the same tick. Saving no longer navigates; the caller decides whether it is staying or moving on. Along the way: checkout_labels.js and the eskaera_checkout_summary / eskaera_payment templates are removed, superseded by the server-rendered summary and checkout, and the stale sessionStorage delivery preference no longer overrides the checkbox the order just rendered. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
f81c1ca8e7
commit
e625b0c2f3
11 changed files with 873 additions and 746 deletions
|
|
@ -50,9 +50,11 @@ Paying an order online
|
|||
When the group order has online payment enabled:
|
||||
|
||||
#. Build the cart in ``/eskaera/<slug>`` as usual
|
||||
#. Go to the checkout, review the summary and choose home delivery if offered
|
||||
#. Press **Confirm and pay**: the order is saved and the payment step opens
|
||||
#. Pick a payment method and pay; you are sent to the provider and back
|
||||
#. Press **Proceed to Checkout**: the cart is saved to your order first, so
|
||||
the checkout shows the very lines and amounts that will be charged
|
||||
#. Review the summary, choose home delivery if offered, and pick a payment
|
||||
method — all on the same page
|
||||
#. Press **Confirm and pay**; you are sent to the provider and back
|
||||
#. The confirmation page shows the outcome and empties the local cart
|
||||
|
||||
The order is confirmed the moment the payment goes through, so it can no
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue