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

Order "Processing" without payment #1236

Open
darektw opened this issue Apr 29, 2024 · 13 comments
Open

Order "Processing" without payment #1236

darektw opened this issue Apr 29, 2024 · 13 comments

Comments

@darektw
Copy link

darektw commented Apr 29, 2024

What I expected

I expect orders with a processing status that have invoices created after payment.

What happened instead

There are orders that have a processing status, no invoice, even though the payment has been cancelled.

What actual results you or customer got

Dispatched orders that have not been paid for.

Reproduction path

Unfortunately, I do not yet know the exact steps to repeat this error. It only occurs with some orders.

In the previous version 5.16.1 everything worked correctly.

We observe the following errors in the logs:

var/log/paywithamazon.log-[2024-04-25T22:04:45.899437+00:00] amazonClientLogger.ERROR: 
Exception: Warning: Undefined variable $order in 
/var/www/magento/releases/20240424T160438/vendor/amzn/amazon-pay-magento-2-module/Model/CheckoutSessionManagement.php on line 781 
in /var/www/magento/releases/20240424T160438/vendor/magento/framework/App/ErrorHandler.php:62

Your setup

  • Magento version: 2.4.6-p5
  • Amazon Pay Extension Version: 5.17.0
  • Magento Edition: Enterprise
@dimitriBouteille
Copy link
Contributor

Hi @darektw

I also have the problem. I have just proposed an MR, hoping that it is quickly validated 🚀

@markfischmann
Copy link

markfischmann commented May 3, 2024

Hello @darektw and @dimitriBouteille,
I was wondering if you both also had the issue where these specific orders can't be canceled ?

I have the exact same issue that you describe where an order is placed, no invoice is created but the order is in the "processing" state.
The order status message is something like "Authorization of X Euros, Transaction ID YYY".
The thing is, the Transaction ID can't be found in Amazon Seller Central, and when trying to cancel the Order, I have the following error :

[2024-05-02T15:02:09.025721+00:00] amazonClientLogger.DEBUG: closeChargePermission <-  ["1","<some_id_here>","MerchantClosed",true] []
[2024-05-02T15:02:09.026458+00:00] amazonClientLogger.ERROR: closeChargePermission ->  {"reasonCode":"ResourceNotFound","message":"Resource you are trying to access is not available. Requested path '/live/v2/chargePermissions/<some_id_here>/close'","status":404} []

Is it in any way related to your issue ?

I have tried changing the Authorization Mode to "Automatic". It seems to fix the issues of Orders without payment being in the "Processing" state.
Can't really confirm anything yet.

@jonesio
Copy link

jonesio commented May 3, 2024

@markfischmann We are also seeing this issue which is a major problem since "processing" should indicate that an order payment is correctly received and can be dispatched.

Debugging so far has revealed that the updateCheckoutSession REST API endpoint and subsequent placeOrder controller endpoint is hit (hence the order being placed) but the subsequent completeSession controller is not in instances where the payment does not actually complete. This leads to no "errors" being shown in the logs but the Amazon Pay session close/payment capture does not actually complete as intended.

We have seen instances whereby orders are marked as processing even if the Auth has subsequently been declined etc.

Order status should be Pending Payment (or similar) until the Auth and subsequent Capture have been 100% confirmed.

Ref: #1186 - As mentioned in a recent comment. We too had no issues when using 5.16.1 This appears to be a new issue introduced in 5.17.0

@markfischmann
Copy link

It seems that with the new 5.17.0 update, orders are being placed when there is a potential error with the payment transaction.
If you change the "Authorization Mode" to "Automatic", you will have an order placed with the "Payment Review" status, and a pending invoice that you can either cancel or capture manually.

@dallin-beargroup
Copy link
Contributor

@darektw @dimitriBouteille @markfischmann Thank you all for your investigation, and the feedback. We are working to get this fixed. Please let us know if you've come across any other helpful details.

@dimitriBouteille
Copy link
Contributor

Hi @dallin-beargroup To avoid this kind of problem in the future, it might be good to use code quality tools (phpstan, PHPMD Mess Detector, ...) ❤️

@dallin-beargroup
Copy link
Contributor

We are working to roll out the next minor version addressing these issues. In the meantime you can use this patch to stop orders moving into a processing state before authorization.
github-issue-1236_initial_order_state.txt
source

@dimitriBouteille Thank you for your suggested fix. I was unable to recreate the symptoms with undefined variables, but I did test it alone, and along side the above patch, and everything appeared to function normally. We will keep it under review and likely will roll it into the next minor release.

@faisal2010
Copy link

Hi @dallin-beargroup , do you have an ETA for next release with this issue fixed, as we disabled the extension for now. As we have high order volume, causing issues to ship orders without payments.

Thank you

@sgabhart22
Copy link
Contributor

Hello @faisal2010 ,

We're trying to wrap up testing for the 5.17.1 release, which will include these fixes plus a few other minor patches. Hopefully this could go live next week.

Thanks,
Spencer

@sgabhart22
Copy link
Contributor

Hi everyone,

I'm happy to finally announce that version 5.17.1 is live on the Marketplace! We'll close this issue shortly, but of course, please don't hesitate to reach out with future problems. We appreciate all your contributions!

Thanks,
Spencer

@kestraly
Copy link

Experiencing this issue after updating to 5.17.1. Starting the debug

@kestraly
Copy link

My issue is the plugin now uses type MIXED and is no longer PHP7.4 compatible

@sgabhart22
Copy link
Contributor

Hi @kestraly , you've probably addressed this on your own at this point, but for anyone else who may come across this, I'll drop a patch here for PHP 7.4 compatibility despite it having been EOL for quite some time now. We can remove the mixed references in the function signatures in the next patch version.

php74-compat.patch.txt

Thanks,
Spencer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants