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

[PW-6878] Capture webhook not working in 8.3.0 #1595

Closed
dronerdk opened this issue Jul 4, 2022 · 13 comments · Fixed by #1596
Closed

[PW-6878] Capture webhook not working in 8.3.0 #1595

dronerdk opened this issue Jul 4, 2022 · 13 comments · Fixed by #1596
Assignees
Labels
Bug report Indicates that issue has been marked as a possible bug Confirmed bug Indicates that issue has been confirmed to be a bug by an Adyen developer

Comments

@dronerdk
Copy link

dronerdk commented Jul 4, 2022

In the latest version 8.3.0 we do not get the capture webhook.
We get this error when we try in magneto 2 to reprocess the webhook for capture.

Error: Call to a member function pay() on null in /var/www/droner.dk/public_html/vendor/magento/module-sales/Model/Order/Invoice.php:368
Stack trace:
#0 /var/www/droner.dk/public_html/generated/code/Magento/Sales/Model/Order/Invoice/Interceptor.php(149): Magento\Sales\Model\Order\Invoice->pay()
#1 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Helper/Invoice.php(196): Magento\Sales\Model\Order\Invoice\Interceptor->pay()
#2 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Helper/Webhook.php(1821): Adyen\Payment\Helper\Invoice->handleCaptureWebhook()
#3 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Helper/Webhook.php(420): Adyen\Payment\Helper\Webhook->handleManualCapture()
#4 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Helper/Webhook.php(344): Adyen\Payment\Helper\Webhook->handleOrderTransition()
#5 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Controller/Adminhtml/Notifications/WebhookReprocess.php(71): Adyen\Payment\Helper\Webhook->processNotification()
#6 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess->execute()
#7 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->___callParent()
#8 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->Magento\Framework\Interception{closure}()
#9 /var/www/droner.dk/public_html/generated/code/Adyen/Payment/Controller/Adminhtml/Notifications/WebhookReprocess/Interceptor.php(23): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->___callPlugins()
#10 /var/www/droner.dk/public_html/vendor/magento/framework/App/Action/Action.php(111): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->execute()
#11 /var/www/droner.dk/public_html/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch()
#12 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch()
#13 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->___callParent()
#14 /var/www/droner.dk/public_html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->Magento\Framework\Interception{closure}()
#15 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch()
#16 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->Magento\Framework\Interception{closure}()
#17 /var/www/droner.dk/public_html/generated/code/Adyen/Payment/Controller/Adminhtml/Notifications/WebhookReprocess/Interceptor.php(32): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->___callPlugins()
#18 /var/www/droner.dk/public_html/vendor/magento/framework/App/FrontController.php(245): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->dispatch()
#19 /var/www/droner.dk/public_html/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse()
#20 /var/www/droner.dk/public_html/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest()
#21 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch()
#22 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent()
#23 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}()
#24 /var/www/droner.dk/public_html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins()
#25 /var/www/droner.dk/public_html/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch()
#26 /var/www/droner.dk/public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
#27 /var/www/droner.dk/public_html/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
#28 /var/www/droner.dk/public_html/pub/index.php(29): Magento\Framework\App\Bootstrap->run()
#29 {main}

@dronerdk dronerdk added the Bug report Indicates that issue has been marked as a possible bug label Jul 4, 2022
@RokPopov RokPopov self-assigned this Jul 4, 2022
@RokPopov
Copy link
Contributor

RokPopov commented Jul 4, 2022

Hi @dronerdk,

Thank you for opening this issue.

Please kindly provide us with the specific steps that you have taken to recapture the payment so we would be able to try to replicate the issue you are experiencing.

Looking forward to your reply,

Kind regards,
Rok,
Adyen

@RokPopov RokPopov added the Needs more info Indicates that issue requires more info from its creator label Jul 4, 2022
@dronerdk
Copy link
Author

dronerdk commented Jul 5, 2022

Hello

We did have module 8.2.5 and did not have any issues with processing webhooks from adyen.
Now we updated to 8.3.0 and it seems like the capture webhook from adyen is not processed properly in Mangeto.
I dont know if this is a module error or a webhook error, but we dont have any issues with 8.2.5.

We now face a lot of invoices in pending state because we did create the invoice and capture online. Adyen captures the payment but we do not get the capture webhook processed in magento.

If we now go to System -> Adyen Notifications Overview we can see all the capture webhook is not processed.
This is only for all the invoiced we made from 8.3.0. We did downgrade and now the processing works.
But we cannot get the pending invoices to a paid state.
We try to click reprocess webhook and then we get the error above.
Skærmbillede 2022-07-05 kl  10 49 57

@RokPopov RokPopov added Confirmed bug Indicates that issue has been confirmed to be a bug by an Adyen developer and removed Needs more info Indicates that issue requires more info from its creator labels Jul 6, 2022
@RokPopov
Copy link
Contributor

RokPopov commented Jul 6, 2022

Hi @dronerdk

Thank you for your reply.
I have managed to replicate the issue on our end. I have opened an internal ticket and will be investigating the behaviour of processing of the CAPTURE notifications in the above mentioned version of our plugin.

Cheers,
Rok,
Adyen

@dronerdk
Copy link
Author

dronerdk commented Jul 6, 2022

Thanks Rok for fast respons.
When you have a quick fix please let me know so we can get the missing hooks reprocesesd.

@jonathanribas
Copy link
Contributor

@candemiralp @RokPopov, unfortunately your fix from #1596 is not resolving this issue as we have the problem on 8.3.2 too.

@RokPopov
Copy link
Contributor

RokPopov commented Aug 2, 2022

Hey @jonathanribas,

This does indeed seem strange. I have re-tested this on the version you mentioned, and the CAPTURE notification is getting processed accordingly in the default environment:
Screen Shot 2022-08-02 at 18 23 50

Could you please elaborate a bit on what specific error are you seeing when the notification is trying to get processed?

Looking forward to your reply,

Kind regards,
Rok,
Adyen

@RokPopov RokPopov reopened this Aug 2, 2022
@jonathanribas
Copy link
Contributor

jonathanribas commented Aug 3, 2022

In the latest version 8.3.0 we do not get the capture webhook. We get this error when we try in magneto 2 to reprocess the webhook for capture.

Error: Call to a member function pay() on null in /var/www/droner.dk/public_html/vendor/magento/module-sales/Model/Order/Invoice.php:368 Stack trace: #0 /var/www/droner.dk/public_html/generated/code/Magento/Sales/Model/Order/Invoice/Interceptor.php(149): Magento\Sales\Model\Order\Invoice->pay() #1 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Helper/Invoice.php(196): Magento\Sales\Model\Order\Invoice\Interceptor->pay() #2 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Helper/Webhook.php(1821): Adyen\Payment\Helper\Invoice->handleCaptureWebhook() #3 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Helper/Webhook.php(420): Adyen\Payment\Helper\Webhook->handleManualCapture() #4 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Helper/Webhook.php(344): Adyen\Payment\Helper\Webhook->handleOrderTransition() #5 /var/www/droner.dk/public_html/vendor/adyen/module-payment/Controller/Adminhtml/Notifications/WebhookReprocess.php(71): Adyen\Payment\Helper\Webhook->processNotification() #6 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess->execute() #7 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->___callParent() #8 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->Magento\Framework\Interception{closure}() #9 /var/www/droner.dk/public_html/generated/code/Adyen/Payment/Controller/Adminhtml/Notifications/WebhookReprocess/Interceptor.php(23): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->___callPlugins() #10 /var/www/droner.dk/public_html/vendor/magento/framework/App/Action/Action.php(111): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->execute() #11 /var/www/droner.dk/public_html/vendor/magento/module-backend/App/AbstractAction.php(151): Magento\Framework\App\Action\Action->dispatch() #12 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Backend\App\AbstractAction->dispatch() #13 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->___callParent() #14 /var/www/droner.dk/public_html/vendor/magento/module-backend/App/Action/Plugin/Authentication.php(143): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->Magento\Framework\Interception{closure}() #15 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() #16 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->Magento\Framework\Interception{closure}() #17 /var/www/droner.dk/public_html/generated/code/Adyen/Payment/Controller/Adminhtml/Notifications/WebhookReprocess/Interceptor.php(32): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->___callPlugins() #18 /var/www/droner.dk/public_html/vendor/magento/framework/App/FrontController.php(245): Adyen\Payment\Controller\Adminhtml\Notifications\WebhookReprocess\Interceptor->dispatch() #19 /var/www/droner.dk/public_html/vendor/magento/framework/App/FrontController.php(212): Magento\Framework\App\FrontController->getActionResponse() #20 /var/www/droner.dk/public_html/vendor/magento/framework/App/FrontController.php(147): Magento\Framework\App\FrontController->processRequest() #21 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch() #22 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent() #23 /var/www/droner.dk/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}() #24 /var/www/droner.dk/public_html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins() #25 /var/www/droner.dk/public_html/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch() #26 /var/www/droner.dk/public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch() #27 /var/www/droner.dk/public_html/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch() #28 /var/www/droner.dk/public_html/pub/index.php(29): Magento\Framework\App\Bootstrap->run() #29 {main}

@RokPopov, we have this error too.

@RokPopov
Copy link
Contributor

RokPopov commented Aug 3, 2022

Hey @jonathanribas,

Please correct me if I am wrong, however if I understand your case correctly, you are getting this error when reprocessing the CAPTURE notifications for orders that were made with the version before the fix was introduced?
This does seem correct, the notifications for the orders that were made in the version that wrongfully processed the CAPTURE notifications, cannot be reprocessed even when you update to a version that contains the fix. The way to do that would be to run the following script manually for each of the unprocessed notifications:

SET @CAPTURE_PSPREFERENCE = 'PUT YOUR CAPTURE NOTIFICATION PSPREFERENCE HERE';

SELECT @ORIGINAL_REFERENCE := original_reference FROM adyen_notification WHERE pspreference = @CAPTURE_PSPREFERENCE;
SELECT @ENTITYID := entity_id FROM sales_invoice WHERE transaction_id LIKE "'%" + @ORIGINAL_REFERENCE + "%'";
UPDATE adyen_invoice SET invoice_id = @ENTITYID WHERE pspreference = @CAPTURE_PSPREFERENCE;`

I hope this helps.

Kind regards,
Rok,
Adyen

@RokPopov RokPopov changed the title Capture webhook not working in 8.3.0 [PW-6878] Capture webhook not working in 8.3.0 Aug 3, 2022
@jonathanribas
Copy link
Contributor

jonathanribas commented Aug 3, 2022

Hi @RokPopov, issue happens for orders placed with updated module version.
Invoice is not created.

@Morerice
Copy link
Contributor

Morerice commented Aug 9, 2022

Hi @jonathanribas,

Would it be possible to check what the output of:

  • $adyenInvoiceObject->getInvoiceId() and
  • $magentoInvoice

here for the cases where this issue is occurring?

Thanks,
Jean
Adyen

@jonathanribas
Copy link
Contributor

Hi @Morerice, someone from my team will take a look at it this morning and we will let you know.

@jonathanribas
Copy link
Contributor

Hi @Morerice, we noticed we were missing a parameter in one of our Adyen preference constructor that was causing this issue.
We will run further tests next week to make sure everything is ok on Adyen's module version 8.3.3 too.

@Morerice
Copy link
Contributor

Hi @jonathanribas

In that case I will close the issue for now. If however it persists after updating to 8.3.3 feel free to re-open it and provide some additional details.

Thanks,
Jean
Adyen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug report Indicates that issue has been marked as a possible bug Confirmed bug Indicates that issue has been confirmed to be a bug by an Adyen developer
Projects
None yet
4 participants