-
Notifications
You must be signed in to change notification settings - Fork 122
Closed
Description
Bug Description
Coupon usage is incremented before invoice submission fully completes, and the helper commits that increment immediately.
If a later validation, stock, or submit step fails, the sale can roll back while the coupon remains consumed.
Expected Behavior
Coupon usage should only be finalized if the invoice submission completes successfully.
Actual Behavior
Coupon usage can be incremented and committed before the rest of the sale lifecycle succeeds.
Steps to Reproduce
- Start a sale that uses a limited-use or gift-card-style coupon
- Trigger a failure after coupon usage is incremented but before the invoice submission finishes
- Check the coupon usage counter afterward
Impact
- coupon usage counts can drift away from successful invoices
- failed checkouts can permanently consume limited-use coupons
- operators may need manual correction after a failed sale
Suggested Fix
- move coupon usage increment into the same transaction boundary as successful invoice submission
- avoid helper-level commits during coupon consumption
- roll back coupon usage automatically when submission fails
Notes
This is separate from coupon cancel rollback and separate from the race-condition issue. The problem here is that a single failed checkout can still consume usage.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels