amzn / amazon-payments-magento-2-plugin

Extension to enable Amazon Pay on Magento 2
https://amzn.github.io/amazon-payments-magento-2-plugin/
Apache License 2.0
109 stars 77 forks source link

amazonClientLogger.ERROR: Exception: Notice: Undefined index: status #1084

Closed anant-svc closed 2 years ago

anant-svc commented 3 years ago

What I expected

Amazon order must placed successfully

What happened instead

When a customer tried to place order with Amazon Pay, it does not work. This error is found the paywithamazon.log file

Steps to reproduce the issue

  1. Add a product to cart
  2. On checkout page, select Amazon pay and click place order button

Your setup

==> var/log/paywithamazon.log <== [2021-10-14 16:18:38] amazonClientLogger.ERROR: Exception: Notice: Undefined index: status in /vendor/amzn/amazon-pay-magento-2-module/Gateway/Validator/GeneralResponseValidator.php on line 58 in /vendor/magento/framework/App/ErrorHandler.php:61 Stack trace:

0 /vendor/amzn/amazon-pay-magento-2-module/Gateway/Validator/GeneralResponseValidator.php(58): Magento\Framework\App\ErrorHandler->handler(8, 'Undefined index...', '/var/www/share/...', 58, Array)

1 /vendor/magento/module-payment/Gateway/Command/GatewayCommand.php(109): Amazon\Pay\Gateway\Validator\GeneralResponseValidator->validate(Array)

2 /vendor/amzn/amazon-pay-magento-2-module/Gateway/Command/CaptureStrategyCommand.php(110): Magento\Payment\Gateway\Command\GatewayCommand->execute(Array)

3 /vendor/magento/module-payment/Model/Method/Adapter.php(549): Amazon\Pay\Gateway\Command\CaptureStrategyCommand->execute(Array)

4 /vendor/magento/module-payment/Model/Method/Adapter.php(464): Magento\Payment\Model\Method\Adapter->executeCommand('capture', Array)

5 /vendor/magento/module-sales/Model/Order/Payment/Operations/ProcessInvoiceOperation.php(83): Magento\Payment\Model\Method\Adapter->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), 137.92)

6 /vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(73): Magento\Sales\Model\Order\Payment\Operations\ProcessInvoiceOperation->execute(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice\Interceptor), 'capture')

7 /vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payment\Operations\CaptureOperation->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice\Interceptor))

8 /vendor/magento/module-sales/Model/Order/Payment.php(488): Magento\Sales\Model\Order\Payment\Processor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), Object(Magento\Sales\Model\Order\Invoice\Interceptor))

9 /vendor/magento/module-sales/Model/Order/Invoice.php(346): Magento\Sales\Model\Order\Payment->capture(Object(Magento\Sales\Model\Order\Invoice\Interceptor))

10 /vendor/magento/module-sales/Model/Order/Payment/Operations/AbstractOperation.php(73): Magento\Sales\Model\Order\Invoice->capture()

11 /vendor/magento/module-sales/Model/Order/Payment/Operations/CaptureOperation.php(65): Magento\Sales\Model\Order\Payment\Operations\AbstractOperation->invoice(Object(Magento\Sales\Model\Order\Payment\Interceptor))

12 /vendor/magento/module-sales/Model/Order/Payment/Processor.php(85): Magento\Sales\Model\Order\Payment\Operations\CaptureOperation->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), NULL)

13 /vendor/magento/module-sales/Model/Order/Payment.php(488): Magento\Sales\Model\Order\Payment\Processor->capture(Object(Magento\Sales\Model\Order\Payment\Interceptor), NULL)

14 /vendor/magento/module-sales/Model/Order/Payment.php(468): Magento\Sales\Model\Order\Payment->capture(NULL)

15 /vendor/magento/module-sales/Model/Order/Payment.php(385): Magento\Sales\Model\Order\Payment->processAction('authorize_captu...', Object(Magento\Sales\Model\Order\Interceptor))

16 /vendor/magento/module-sales/Model/Order.php(983): Magento\Sales\Model\Order\Payment->place()

17 /vendor/magento/module-sales/Model/Order.php(1205): Magento\Sales\Model\Order->_placePayment()

18 /vendor/magento/framework/Interception/Interceptor.php(58): Magento\Sales\Model\Order->place()

19 /vendor/magento/framework/Interception/Interceptor.php(138): Magento\Sales\Model\Order\Interceptor->___callParent('place', Array)

20 /vendor/magento/framework/Interception/Interceptor.php(153): Magento\Sales\Model\Order\Interceptor->Magento\Framework\Interception{closure}()

21 /generated/code/Magento/Sales/Model/Order/Interceptor.php(41): Magento\Sales\Model\Order\Interceptor->___callPlugins('place', Array, Array)

22 /vendor/magento/module-sales/Model/Service/OrderService.php(209): Magento\Sales\Model\Order\Interceptor->place()

23 /vendor/magento/module-quote/Model/QuoteManagement.php(566): Magento\Sales\Model\Service\OrderService->place(Object(Magento\Sales\Model\Order\Interceptor))

24 /vendor/magento/module-quote/Model/QuoteManagement.php(456): Magento\Quote\Model\QuoteManagement->submitQuote(Object(Magento\Quote\Model\Quote\Interceptor), Array)

25 /vendor/magento/framework/Interception/Interceptor.php(58): Magento\Quote\Model\QuoteManagement->submit(Object(Magento\Quote\Model\Quote\Interceptor))

26 /vendor/magento/framework/Interception/Interceptor.php(138): Magento\Quote\Model\QuoteManagement\Interceptor->___callParent('submit', Array)

27 /vendor/magento/framework/Interception/Interceptor.php(153): Magento\Quote\Model\QuoteManagement\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Quote\Model\Quote\Interceptor))

28 /generated/code/Magento/Quote/Model/QuoteManagement/Interceptor.php(23): Magento\Quote\Model\QuoteManagement\Interceptor->___callPlugins('submit', Array, Array)

29 /vendor/magento/module-quote/Model/QuoteManagement.php(414): Magento\Quote\Model\QuoteManagement\Interceptor->submit(Object(Magento\Quote\Model\Quote\Interceptor))

30 /vendor/magento/module-quote/Model/GuestCart/GuestCartManagement.php(87): Magento\Quote\Model\QuoteManagement->placeOrder('35772', NULL)

31 /vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php(127): Magento\Quote\Model\GuestCart\GuestCartManagement->placeOrder('oiQCdd5L9WLEFtu...')

32 /vendor/magento/framework/Interception/Interceptor.php(58): Magento\Checkout\Model\GuestPaymentInformationManagement->savePaymentInformationAndPlaceOrder('oiQCdd5L9WLEFtu...', 'test@gmail.com', Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address\Interceptor))

33 /vendor/magento/framework/Interception/Interceptor.php(138): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->___callParent('savePaymentInfo...', Array)

34 /vendor/magento/framework/Interception/Interceptor.php(153): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->Magento\Framework\Interception{closure}('oiQCdd5L9WLEFtu...', 'test@gmail.com', Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address\Interceptor))

35 /generated/code/Magento/Checkout/Model/GuestPaymentInformationManagement/Interceptor.php(23): Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->___callPlugins('savePaymentInfo...', Array, Array)

36 [internal function]: Magento\Checkout\Model\GuestPaymentInformationManagement\Interceptor->savePaymentInformationAndPlaceOrder('oiQCdd5L9WLEFtu...', 'test@gmail.com', Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address\Interceptor))

37 /vendor/magento/module-webapi/Controller/Rest/SynchronousRequestProcessor.php(95): call_user_func_array(Array, Array)

38 /vendor/magento/module-webapi/Controller/Rest.php(188): Magento\Webapi\Controller\Rest\SynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy))

39 /vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))

40 /vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)

41 /vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception{closure}(Object(Magento\Framework\App\Request\Http))

42 /generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)

43 /vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))

44 /generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()

45 /vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http\Interceptor->launch()

46 /pub/index.php(29): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))

47 {main} [] []

jaybeckr commented 3 years ago

Hi @anant-svc - this is odd behavior, the exception is coming from some code that is simply validating the response received from Amazon servers. We have added some protection against having an empty "status" index in the response array in this commit - are you able to test applying that change and let us know what response from Amazon does not include a status?

Otherwise it will be included in the next release, and you can update at that point.

jaybeckr commented 3 years ago

@anant-svc - this fix was included in 5.9.0, please upgrade and let us know if the issue is resolved.

anant-svc commented 3 years ago

@jaybeckr Great, we are updating it on Live and let you if it works

anant-svc commented 2 years ago

@christianzichichi We have updated the module to v5.9.1 but still it is not working. Please confirm if the issue was tested it on Magento instance. it throwing this error message - The IPS Log File throws an error "SNS message type header not provided".

sgabhart22 commented 2 years ago

Hello @anant-svc , we have tested our module on Magento 2.3.6 and 2.4.2 including this fix and have not seen this issue. I tested on a local 2.4.2 community edition instance this morning, and was also unable to reproduce there. Are you able to successfully place orders with Amazon Pay, and just the notifications are having problems? Or are you still unable to place an order?

This error is a little confusing; I found a couple related issues concerning the aws-php-sns-message-validator throwing this same error, but they seem to be related to security measures on the server (CSRF prevention or POST restrictions). Would you happen to have anything in your environment setup that would prevent or alter a POST request to /amazon_pay/payment/ipn/?

zichicc commented 2 years ago

closing this issue for now. Please reopen in case it occurs again.

Thanks Christian