Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkout: reserve a new order id if early place order has payment issues #330

Merged
merged 1 commit into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
**checkout**
* Introducing Flamingo events on final states of the place order process
* Introduce a max ttl for the checkout state machine to avoid polluting the redis with stale checkout processes, defaults to 2h
* Checkout controller: force new order id reservation if an early place happened and there was a payment issue
* API
* In case of an invalid cart during place order process we now expose the cart validation result, affected endpoints:
```
Expand Down
4 changes: 4 additions & 0 deletions checkout/interfaces/controller/checkoutcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,8 @@ func (cc *CheckoutController) PaymentAction(ctx context.Context, r *web.Request)

decoratedCart = cc.decoratedCartFactory.Create(ctx, *restoredCart)
cc.orderService.ClearLastPlacedOrder(ctx)

_, _ = cc.applicationCartService.ForceReserveOrderIDAndSave(ctx, r.Session())
}

return cc.redirectToCheckoutFormWithErrors(ctx, r, err)
Expand Down Expand Up @@ -663,6 +665,7 @@ func (cc *CheckoutController) PaymentAction(ctx context.Context, r *web.Request)
}

cc.orderService.ClearLastPlacedOrder(ctx)
_, _ = cc.applicationCartService.ForceReserveOrderIDAndSave(ctx, r.Session())
}

// mark payment selection as new payment to allow the user to retry
Expand Down Expand Up @@ -700,6 +703,7 @@ func (cc *CheckoutController) PaymentAction(ctx context.Context, r *web.Request)
}

cc.orderService.ClearLastPlacedOrder(ctx)
_, _ = cc.applicationCartService.ForceReserveOrderIDAndSave(ctx, r.Session())
}

// mark payment selection as new payment to allow the user to retry
Expand Down