PAYONE-GmbH / magento-2

PAYONE Payment Extension for Magento 2
28 stars 56 forks source link

Additional cancelled order after successful payment using Paypal #479

Closed sanjuantala closed 1 year ago

sanjuantala commented 1 year ago

Steps to reproduce:

  1. Go to checkout and select Paypal as a payment method
  2. Click on place order button and get redirected to Paypal payment portal
  3. Click 'cancel' button in a browser.
  4. Success message display
  5. Order Placed on Admin

https://user-images.githubusercontent.com/11783161/199046455-0becf1b3-dae3-4295-be9d-b3da246802a8.mp4

FatchipRobert commented 1 year ago

Hmm, something seems to be very wrong in this shop.

I am not able to reproduce this behaviour in my development-shops nor would the modules code allow this to happen.

When you select payment with PayPal in the checkout and you are redirected to PayPal you should have an order with Status Pending und no invoice in your backend.

When pressing the cancel and return to shop button on the PayPal site you should be redirected to: https://YOURSHOP.URL/payone/onepage/cancel/

The order should then be cancelled here: https://github.com/PAYONE-GmbH/magento-2/blob/master/Controller/Onepage/Cancel.php#L105

There being a paid invoice is the strangest part.

The Payone module does not create an invoice at all when generating the order before redirect to PayPal nor when the order is being completed upon return after payment. The invoice is handled in the following way: Pre-auth mode: The invoice has to be created manually through the backend, it is set to paid automatically when the Capture request to Payone was successful Auth mode: When Payone sends the APPOINTED TransactionStatus to your shop (shortly after order completion) an unpaid invoice is created. When Payone sends the PAID TransactionStatus to your shop the invoice is set to paid.

This is handled here: https://github.com/PAYONE-GmbH/magento-2/blob/master/Observer/Transactionstatus/Appointed.php and here: https://github.com/PAYONE-GmbH/magento-2/blob/master/Observer/Transactionstatus/Paid.php

I can only assume that some other module is interfering with the Payone module there.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.