Posted on 13/05/2013 10:34:28
Hi Anders,
When you say "user clicks 'back'", where does this happen? The problem is, that if it happens at the gateway, you may not have the option of passing the needed parameter. CartV2 looks for a specific parameter in the request, and calls CheckoutHandler.Redirect(Order) if it finds it. Whether you can handle the 'back' click depends on your options to add the parameter to the request. Normally, the gateway tries to encourage using the 'Cancel' button as the action for this is normally something you can override.
The reason for this is that CartV2 removes the order from the users context when redirecting to the gateway. At this point CartV2 awaits callbacks and redirects from the gateway. In order for CartV2 to know about the order, the gateway has to pass the OrderID as the value for a specific parameter in the request (the parameter mentioned above). If this value is missing--as it most likely will be in this scenario--CartV2 has no idea about the order or the CheckoutHandler associated with it. Therefore, it tries to render an empty cart.
You could probably work around this by adding the OrderID to a session parameter and creating a notification subscriber for Cart.BeforeRenderingEmptyCart. Then read the OrderID from the session and downgrade the order and set it as the context cart, then redirect back to CartV2.
- Jeppe