concretecms-community-store / community_store_paypal_standard

Paypal Standard payments for Community Store for Concrete CMS
MIT License
6 stars 7 forks source link

Return to seller site does not close checkout automatically #1

Closed lota closed 7 years ago

lota commented 7 years ago

I tested Paypal Standard in live mode, all works fine. After I paid the paypay web site refer to /checkout and not automatically finalize the order. So the check out is not completed and ask for another payment again and again.

is it possible to improve call-back and close order automatically

TIA Alessandro

Mesuva commented 7 years ago

Are you testing this on a publically accessible server or localhost?

On 16 Dec. 2016 10:42 pm, "Lota Bi" notifications@github.com wrote:

I tested Paypal Standard in live mode, all works fine. After I paid the paypay web site refer to /checkout and not automatically finalize the order. So the check out is not completed and ask for another payment again and again.

is it possible to improve call-back and close order automatically

TIA Alessandro

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/concrete5-community-store/community_store_paypal_standard/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/ABB5MOhhmRViWvb5DiPXRLYegJvf6VKHks5rIoBEgaJpZM4LPIR0 .

lota commented 7 years ago

yes, a public server http://trango.it.x4wlab.net/

lota commented 7 years ago

I added a test product with € 0,02

http://trango.it.x4wlab.net/prodotti/articolo-di-test

lota commented 7 years ago

For strange reason I installed "Paypal Payment Method v.0.9.2", activate it, but it not appears as available method during checkout.

lota commented 7 years ago

Hi Mesuva, finally I discover the origin of two problem:

if in chart total is € 0,02 PayPal method not showed

controllers/single_page/checkout.php:184 if ($totals['total'] >= $emmc->getPaymentMinimum() && $totals['total'] <= $emmc->getPaymentMaximum())

from € 0,04 PayPal method showed and works fine

PayPal IPN return a correct value POST /checkout/paypalresponse

Mesuva commented 7 years ago

I've worked out what was going wrong here. I'd only recently put in a couple of extra checks into the checkout/complete page to test for unpaid transactions for external gateways.

What I found is that if you complete a live paypal transaction and then wait 10 seconds or so before hitting the return button it shows the complete screen. But if you immediately click return, you return to the shop before the IPN return has happened, the checkout/complete page checks and sees that the order hasn't completed and kicks you to the checkout page and doesn't clear the cart.

So I've simply removed this extra check, it wasn't necessary to protect anything. It's an easy one to change manually too: https://github.com/concrete5-community-store/community_store/commit/792d9a575ad9480125a8edbfc3713a9814da2427

Let me know how you go with that

lota commented 7 years ago

!$order->getPaid() sound like "if payment unsuccessful".

I do not know how happen if paypal payment failed

could be use a landing page for "paypal_error" with some extra log, do you agree?

Mesuva commented 7 years ago

That line was saying 'if the customer has elected to pay externally (paypal), but there's no paid date, it hasn't been paid so redirect to the checkout'.

But as I've said, sometimes you can get to this page before Paypay has sent the IPN, so this check simply shouldn't be there.

In terms's of a cancelled/failed transaction, there's another Payapl variable for that. I've just set that to the site's checkout screen. If you cancel from Paypal it could be because you want to pick a different payment method, so the checkout screen makes sense. https://github.com/concrete5-community-store/community_store_paypal_standard/commit/744e5535ecb4cd0e2c710f37ec4e645ce848e5c6