How to Test: Order Cancel & Refund Reversal
This guide is for QA, support, and demo presenters who need to verify that order cancellation and refund reversal works end-to-end.
What this tests
The storefront automatically reverses coupon, gift-card, and loyalty redemptions when an order is cancelled or fully returned. It does this by creating a Credit Note and a reverse Payment Entry rather than ever cancelling the original documents, so the audit trail stays intact. For the full behavioural reference, see Order Cancel & Return Reversal.
Before you start
IMPORTANT: The Cancel / Return controls render only for the storefront customer who owns the order — not for Administrator. Always test as a storefront customer. Use Desk (as Administrator) only to verify the side-effects, never to trigger the cancel/return itself.
Test site: http://ivend.localhost:8014
Path A — storefront end-to-end
- Log in on the storefront as a customer (not Administrator) at
/en/login. - Add product(s) to the cart, then apply a serial coupon (for example
WELCOME10, serialWELCOME-0001). - Proceed to checkout and place the order.
- Go to My Account → Orders (
/en/account/orders), open the order, and either Cancel it or request a full return. Partial returns intentionally do not refund. - Verify the side-effects in Desk (log in as Administrator /
Frappe@123):- Sales Order status =
Cancelledand Ecommerce Status =Cancelled. - A Credit Note exists — a Sales Invoice with Is Return ticked and Return Against pointing at the original invoice (SINV).
- A reverse Payment Entry (type
Pay) exists only if the order used a gateway payment. COD orders have no reverse Payment Entry. - The coupon is freed — its Coupon Ledger redemption transaction is cleared, so the coupon is reusable again.
- Sales Order status =
Path B — verify the logic via the test suite
The fastest proof is the integration test suite, which runs against a real, rolled-back database:
bench --site ivend.localhost run-tests --app ivendnext_ecommerce --module ivendnext_ecommerce.tests.test_order_cancel_reversal
Desk verification checklist
Sales Order with status Cancelled, Order Type Shopping Cart, and Ecommerce Status Cancelled.
Credit Note — a Sales Invoice with Is Return ticked and Return Against set to the original invoice.
Serial coupon redemption transaction in the Coupon Ledger — cleared on reversal so the coupon is reusable.
The storefront My Account → Orders page where the customer cancels or returns an order.
Known issues to watch
- Serial coupon reversal is solid — safe to demo.
- Non-serial coupons are intentionally unhandled — do not expect them to reverse.
- Loyalty double-clawback bug: points were being reversed twice. This is being fixed to reverse exactly once. When testing, verify the customer's loyalty balance nets back to its pre-redemption value.
- Gift card over-credit: gift card restore can over-credit when the redeem amount was floored, so the balance can exceed the face value. Known, under review.
- Full-return only: partial returns get no refund by design.