MultiSafepay / magento2

MultiSafepay plugin for Magento 2
Open Software License 3.0
19 stars 8 forks source link

Uncaught TypeError: Argument 1 passed to MultiSafepay\\ConnectCore\\Logger\\Logger::logPaymentLinkError() must be of the type string, null given #35

Closed hostep closed 1 year ago

hostep commented 1 year ago

Describe the bug Using:

I've found the following error report in var/report/api/{some-number}:

"Fatal Error: 'Uncaught TypeError: Argument 1 passed to MultiSafepay\\ConnectCore\\Logger\\Logger::logPaymentLinkError() must be of the type string, null given, called in \/vendor\/multisafepay\/magento2-core\/Gateway\/Http\/Client\/RecurringClient.php on line 72 and defined in \/vendor\/multisafepay\/magento2-core\/Logger\/Logger.php:37
Stack trace:
#0 \/vendor\/multisafepay\/magento2-core\/Gateway\/Http\/Client\/RecurringClient.php(72): MultiSafepay\\ConnectCore\\Logger\\Logger->logPaymentLinkError(NULL, Object(MultiSafepay\\Exception\\ApiException))
#1 \/vendor\/magento\/module-payment\/Gateway\/Command\/GatewayCommand.php(106): MultiSafepay\\ConnectCore\\Gateway\\Http\\Client\\RecurringClient->placeRequest(Object(Magento\\Payment\\Gateway\\Http\\Transfer))
#2 \/vendor\/magento\/module-payment\/Gateway\/Command\/CommandManager.php(65): Magent' in '\/vendor\/multisafepay\/magento2-core\/Logger\/Logger.php' on line 37

Is there a known case where $orderId could be null over here? If there is a chance it can be null, that code will probably have to be rewritten a little bit to be able to deal with that?

To Reproduce Steps to reproduce the behavior:

  1. No idea, found this in var/report/api/{some-number}

Expected behavior No errors

Screenshots N/A

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context N/A

hostep commented 1 year ago

The multisafepay.log contains (next to a bunch of info & debug messages) one error in the same minute where that report file was created:

[2022-08-22 06:44:14] MultiSafepay.ERROR: The MultiSafepay API key is invalid. Invalid API key [] []

(UTC timestamp)

Which is a weird error since there are plenty of transactions that work fine and all using the same API key ... In fact, I count 308 such errors today only on this shop, which is really unexpected...

vinodsowdagar commented 1 year ago

Hi @hostep ,

We've improved the logging so at least the error is not going to show up anymore whenever the Order ID is not present. What exactly is happening related to the retrieval of the payment link itself we could unfortunately not yet figure out. More information about this will follow.

hostep commented 1 year ago

As far as I can see, this was fixed in version 2.20.1 of this module, so let's close this ticket. Thanks!

If I'm mistaken, let me know 🙂