Adyen / adyen-magento2

Adyen Payment plugin for Magento2
MIT License
155 stars 211 forks source link

[ECP-9229] Undefined array key "order" in Plugin/GraphQlPlaceOrderAddCartId.php on line 63 #2622

Open Nuranto opened 4 months ago

Nuranto commented 4 months ago

Describe the bug

Some of our clients (very small proportion) cannot place order (Internal Server Error)

We were not able to reproduce, so we don't know how. But we found this error in logs :

`main.ERROR: Warning: Undefined array key "order" in /var/www/html/vendor/adyen/module-payment/Plugin/GraphQlPlaceOrderAddCartId.php on line 63`

And indeed, that plugin does not take into consideration that original method can return an array without order :

        if ($this->errors) {
            return [
                'errors' =>
                    $this->errors
            ];
        }
        return [
            'order' => [
                'order_number' => $order->getIncrementId(),
                // @deprecated The order_id field is deprecated, use order_number instead
                'order_id' => $order->getIncrementId(),
            ],
            'orderV2' => $this->orderFormatter->format($order),
            'errors' => []
        ];

Magento version 2.4.7

Plugin version 9.4.1

RokPopov commented 4 months ago

Hi @Nuranto,

Thank you for reporting this issue. I have created an internal ticket to address this issue, adding a check for the order. One the fix PR is merged, this issue will automatically be closed.

Kind regards, Rok

Man4x commented 3 months ago

Hi We meet this issue with all orders involving a zero total (i.e. "free" payment method), preventing any of these orders to be placed :(