joshmcarthur / spree-hosted-gateway

Hosted Gateway extension for Spree, supporting redirect to external third-party payment gateways.
BSD 3-Clause "New" or "Revised" License
11 stars 12 forks source link

confirmation page #4

Open ghost opened 13 years ago

ghost commented 13 years ago

The redirect does not go back to the confirmation page. It looks like it automatically places the order after the redirect from the hosted gateway. Is there a way to show the confirmation page before placing the order?

joshmcarthur commented 13 years ago

Hi scrumph.

I'll review Spree's checkout procedure for you in a day or two - your issue here has just prompted me to think that, actually, we should be redirecting to checkout_path after the order payment is accepted, not completing the order ourselves and redirecting to the completion route. I'll have to try this out though on my demo store, and ensure that I don't break anything. I'll update here when I know more :-)

joshmcarthur commented 13 years ago

I've taken a look at the code surrounding this, but I'm not so sure that there is a way around this - showing a confirmation page after the payment step doesn't make sense to me, because we have already moved offsite to make payment, came back, verified the payment and completed the order - there is no way to go back, or undo, with this type of gateway.

I believe my implementation of this at the moment should allow for the confirmation page to be shown - it only specifically redirdects to the completion route if the order is actually in the complete state. If there is a state for an order between paid and complete, then the hosted_gateway extension will render the appropriate view after redirecting back to checkouts_controller#edit.

Does this make sense to you? It's not a case of me not wanting to implement this, it's just that I don't quite understand whether it's something that makes sense given the nature of offsite gateways.

ghost commented 13 years ago

I totally understand your points. It's just that in most of the existing payment gateways, during the verification of the payment step, they still give the chance to confirm the order. I guess another solution would be to present the confirmation page inside the hosted payment gateway. But the question now becomes, how would the extension handle the redirect if the user chooses not to proceed with the order?

joshmcarthur commented 13 years ago

I'll have a think about this one. The solution I'm thinking of at the moment would involve basically rendering the confirmation page at some point - perhaps between them selecting the payment gateway in the checkout and the redirect to the gateway. If they choose to cancel the order, that's fine - we can just go back to their cart, where they can change the items they have ordered, or abandon the order altogether

LouisStAmour commented 12 years ago

The way Moneris Hosted Pay Page works, you've a checkbox on your page configuration to add a confirmation or summary screen at the end. I believe you can even pass along order details and such, but I'm not sure.

Myself, I only care about such things if I'm not already presented with a summary page. Think of what the site/shopping cart makes as an invoice. Once you've confirmed the purchase on the site, the invoice is shown, and you then click "Pay" to pay it and once you pay, it's marked Paid... E.g. a summary should be shown before and after, where the change is the paid status. If the payment doesn't go through, we can present the summary/invoice again, noting the error and offering the ability to re-try the payment.