lyra / plugin-magento

An open source plugin that links Magento based e-commerce websites to PayZen secure payment gateway developed by Lyra Network.
https://lyra.com/fr/guides/magento/
Open Software License 3.0
10 stars 12 forks source link

REST - wrong order id handling? #42

Open Krossfire opened 1 month ago

Krossfire commented 1 month ago

Hi, The REST integration (SmartForms) does not handle the order ID value well (or at least it looks so). In files: Lyranetwork/Lyra/Controller/Payment/Rest/Check.php:103 and Lyranetwork/Lyra/Controller/Payment/Rest/Response.php:92 the response values are converted, and the "orderId" becomes a "vads_order_id". However, in Check.php:116 and Response.php:105 there is code: $orderId = (int) $response->get('order_id'); Which tries to get the orderId (and cast it to an integer) from a non-existing "order_id" element. This cause all orders (in M2) to fail, however, Lyra still processes the payment and capture the required amount, but order status is not updated, because of the "Received empty Order ID." error. It seems that changing the $orderId = (int) $response->get('order_id'); to $orderId = $response->get('vads_order_id'); in both mentioned files fixes the issue (no more errors in logs, orders are properly updated, payments are captured), and also supports increment_order_id with letters.

Best regards

nberhouche commented 1 month ago

Hello @Krossfire

Thank you for bringing this issue to our attention. We'll look into it and get back to you as soon as possible.

Best regards.