View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007790 | module Amazon Pay | main | public | 2025-04-30 11:56 | 2025-07-10 15:31 |
Reporter | dspeckhardt | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | random |
Status | assigned | Resolution | open | ||
Product Version | 2.1.6 | ||||
Summary | 0007790: TypeError Constants::isAmazonPayment(): Argument #1 ($paymentId) must be of type string, null given | ||||
Description | 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 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 Reproduce | It happens, when $basket->getPaymentId() is null, which is allowed by the OXID Framework. | ||||
Additional Information | This Exception leads to failing order execution in the frontend, so it is critical. | ||||
Tags | No tags attached. | ||||
|
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- |
|
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 |
|
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. |