View Issue Details

IDProjectCategoryView StatusLast Update
0007790module Amazon Paymainpublic2025-07-10 15:31
Reporterdspeckhardt Assigned To 
PrioritynormalSeverityminorReproducibilityrandom
Status assignedResolutionopen 
Product Version2.1.6 
Summary0007790: TypeError Constants::isAmazonPayment(): Argument #1 ($paymentId) must be of type string, null given
DescriptionOxidSolutionCatalysts\AmazonPay\Core\Constants::isAmazonPayment(): Argument #1 ($paymentId) must be of type string, null given, called in .../vendor/oxid-esales/amazon-pay-module/src/Controller/OrderController.php on line 131

In there OrderController on one place you have a fallback to empty string, which is probably necessary.
See: https://github.com/OXID-eSales/amazon-pay-module/blob/v2.1.6/src/Controller/OrderController.php#L49

But in other places in the OrderController you are not applying the fallback. For example in the line 131, where the type error occurs.
https://github.com/OXID-eSales/amazon-pay-module/blob/v2.1.6/src/Controller/OrderController.php#L131

You should make sure, that the parameter is never null by applying the fallback OR change the method to accest also NULL, which is probably the best solution, because the method Constants::isAmazonPayment() is also called from other classes then the OrderController...
Steps To ReproduceIt happens, when $basket->getPaymentId() is null, which is allowed by the OXID Framework.
Additional InformationThis Exception leads to failing order execution in the frontend, so it is critical.
TagsNo tags attached.

Activities

QA

2025-05-02 10:55

administrator   ~0017941

Dear dspeckhardt,

thanks for this report.

I acknowlegde this issue for code enhancment. If no paymentID is provided there should be a redirect at this point.

Could you please provide for better context your scenario that this happens?

Best Regards
QA -SG-

dspeckhardt

2025-06-26 14:16

reporter   ~0018014

Hello QA,

this happens frequently in our production shop and is tracked by our error monitoring.

I was not able to resproduce it myself.

The issue is ongoing.

Thanks

dspeckhardt

2025-07-03 16:41

reporter   ~0018018

Last edited: 2025-07-03 16:45

I am having now a better description how the exception happens, but honestly, i think my initial report description already proves the wrong behaviour.

It is obvious, that the AmazonPay Module in any case, even if it is not an AmazonPay payment type, calls:
OxidSolutionCatalysts\AmazonPay\Core\Constants::isAmazonPayment(): Argument #1 ($paymentId) must be of type string, null given, called in .../vendor/oxid-esales/amazon-pay-module/src/Controller/OrderController.php on line 131

The case is, that other payment modules could also hook in OrderController::execute() method and manipulate the order $paymentId, which is called before the OrderController::init() method.

So, the case is clear, that the AmazonPay module OxidSolutionCatalysts\AmazonPay\Core\Constants::isAmazonPayment() method needs to accept also NULL as a parameter, and then consider the payment method as not an AmazonPay payment type.

The error is not happening much more often, since we integrated another payment module (mollie), additionally to AmazonPay and OePaypal.

Here a new example exception, that happened during the order submission with a mollie payment service provider payment method:
Exception:
TypeError: OxidSolutionCatalysts\AmazonPay\Core\Constants::isAmazonPayment(): Argument #1 ($paymentId) must be of type string, null given, called in /xxx/vendor/oxid-esales/amazon-pay-module/src/Controller/OrderController.php on line 131
Reques Query:
cl=order&fnc=handleMollieReturn&stoken=xxx&sDeliveryAddressMD5=xxx…

So, please fix this soon! I think it is an easy fix.

Thank you.