MultiSafepay / Magento2Msp

MultiSafepay plugin for Magento 2 (Deprecated) see: https://github.com/MultiSafepay/magento2
Open Software License 3.0
29 stars 25 forks source link

getMethodInstance() on null after QR code redirect #88

Closed akosglue closed 3 years ago

akosglue commented 5 years ago

Hello,

Thanks for the plugin. We noticed an error in it. We select the Bancontact payment method. After we scan the QR code on the payment page with the smartphone, the payment is accepted and the phone is redirected back to the website, but we get this error: AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getMethodInstance() on null in ... app/code/MultiSafepay/Connect/Model/Connect.php:1626

The desktop computer redirects back to success page, no problem.

So it is related to this line: $order->getPayment()->getMethodInstance()->_code So getPayment return null when payment method is Bancontact and the QR code is scanned. (and this is in the paying device, not on the device where the purchase is made)

Do you know about this problem? Is there a patch for it ?

Jasper-MultiSafepay commented 5 years ago

@akosglue Could you send an email to techsupport@multisafepay.com with the accountID. We will respond as soon as possible.

akosglue commented 5 years ago

I don't understand this question. What kind of account id do you need ? This is only the steps to reproduce the bug/error, and it would be nice to get a patch for it, or kind of advise for the fix, otherwise I need to override 'initializeClient'

akosglue commented 5 years ago

Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getMethodInstance() on null in

/app/code/MultiSafepay/Connect/Model/Connect.php:1626\nStack trace:

0 /app/code/MultiSafepay/Connect/Model/Connect.php(1039): MultiSafepay\Connect\Model\Connect->initializeClient(NULL, Object(Magento\Sales\Model\Order\Interceptor))

1 /app/code/MultiSafepay/Connect/Controller/Connect/Success.php(107): MultiSafepay\Connect\Model\Connect->notification(Object(Magento\Sales\Model\Order\Interceptor), true)\n

2 /vendor/magento/framework/App/Action/Action.php(108): MultiSafepay\Connect\Controller\Connec...\n'

Jasper-MultiSafepay commented 5 years ago

We have added patch to initializeClient which should solve this issue. 23b2d00af0d6b4002deb54abb0a3b7c1148e2b67 Could you apply this commit and confirm?

akosglue commented 5 years ago

Very good, thank you. I will add this next week. I will have then results as well. It seems to be ok, however.

akosglue commented 5 years ago

Nice, no error on that particular line in the last 3 days. It would be nice to have this patch in the main line.

However, I found this error in the log file:

`Got error 'PHP message: PHP Fatal error: Uncaught Error: Call to a member function getMethodInstance() on null in ... app/code/MultiSafepay/Connect/Model/Connect.php:367

Stack trace:\n#0 ... app/code/MultiSafepay/Connect/Controller/Connect/Redirect.php(80): MultiSafepay\Connect\Model\Connect->transactionRequest(Object(Magento\Sales\Model\Order\Interceptor), Object(Magento\Catalog\Model\Product\Interceptor), false)\n

1 ... vendor/magento/framework/App/Action/Action.php(108): MultiSafepay\Connect\Controller\Connect\Redirect->execute()\n

2 ... vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\A...\n'`

akosglue commented 5 years ago

Do you have any comment to this? This duplicated line failes everywhere in Model/Connect.php $order->getPayment()->getMethodInstance() getPayment returns always null, hence the error.

concerns the latest MSP version on Magento 2.3.0, default magento checkout, after placing the order at this url: .../multisafepay/connect/redirect/

Jasper-MultiSafepay commented 5 years ago

Could you add the following before line 367

        if (is_null($order->getPayment())) {
            return false;
        }
vinodsowdagar commented 3 years ago

Hi @akosglue ,

Thank you for reporting this.

Unfortunately, this plugin is deprecated and we are not providing support for it anymore. Please upgrade to our New Magento 2 plugin..

This issue has not occurred in the new plugin and the new plugin also has tons of other improvements. I am closing this issue for now. If you have any more comments or questions, feel free to create a new issue in the new plugin repo.