Adyen / adyen-magento2

Adyen Payment plugin for Magento2
MIT License
155 stars 211 forks source link

[ECP-9097] MobilePay incidental error `component.handleReject() is not a function` #2552

Closed kweij closed 4 months ago

kweij commented 8 months ago

Describe the bug On our client's webshop, incidentally a successful captured MobilePay payment fails to continue the checkout and place the order. This results in customers retrying finishing the order and thus creating multiple orders. After some investigation we found that it coincides with the following JS errors:

  1. Error: Unhandled Promise Rejection: {"readyState":4,"responseText":"{\"message\":\"ReCaptcha validation failed, please try again\"}","responseJSON":{"message":"ReCaptcha validation failed, please try again"},"status":400,"statusText":"error"}
  2. Error: component.handleReject is not a function. (In 'component.handleReject(response)', 'component.handleReject' is undefined)

It appears that first a ReCaptcha validation fails. I can only find this exact message in Magento's codebase in the Rest & GraphQL API validation, but I cannot connect the dots to the Adyen payment with my limited knowledge of this process. If this message doesn't come from Magento's API endpoint(s), then I can but only guess the origin of this error message.

What happens next is that the component.handleReject() is called in Adyen code (view/frontend/web/js/view/payment/method-renderer/adyen-hpp-method.js), but this method does not exist on the component object (this concerns MobilePay). This could be fixed in the Adyen code (I'm going to make a patch) by first checking the availability of the handleReject() method.

As a matter of fact, after decompiling the the adyen.js.map file, I can that see the handleReject() method is only implemented by the PayPal payment method (in ../src/components/PayPal/Paypal.tsx).

To Reproduce Steps to reproduce the behavior:

  1. We can't reproduce the issue

Expected behavior

Magento version Enterprise 2.4.5-p4

Plugin version 8.14.0

Desktop (please complete the following information):

Smartphone (please complete the following information):

candemiralp commented 7 months ago

Hello @kweij,

Thank you for reporting this issue. We have created an internal investigation ticket to solve this issue.

Best Regards, Can

khushboo-singhvi commented 4 months ago

Hey @kweij,

We have created a PR to address the reported issue. This fix will be included in our upcoming release.

Thank you for your patience!

Best regards, Khushboo