From 36809d4852a396f4c1ba8a6f7c4a5d9d4d538511 Mon Sep 17 00:00:00 2001 From: Nabil Berhouche Date: Tue, 2 Feb 2021 17:29:22 +0100 Subject: [PATCH] [BOT] Migrate hotfix 2.5.4 to GitHub. --- CHANGELOG.md | 3 +++ Helper/Payment.php | 13 ++++++------- composer.json | 2 +- etc/config.xml | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f3ae226..a03bee0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +2.5.4, 2021-02-02: +- Fix installment details errors introduced in 2.5.3 version. + 2.5.3, 2021-02-01: - Fix installment information when saving the payment details in the Magento Back Office. - Workarround to avoid conflict with "Payment & Shipping restrictions" plugin. diff --git a/Helper/Payment.php b/Helper/Payment.php index a746f72..81f6a4d 100644 --- a/Helper/Payment.php +++ b/Helper/Payment.php @@ -403,19 +403,18 @@ public function updatePaymentInfo(\Magento\Sales\Model\Order $order, \Lyranetwor $installmentAmount = (int) (string) (($totalAmount - $firstAmount) / ($count - 1)); $firstSeqNum = $response->get('sequence_number') ? (int) $response->get('sequence_number') : 1; - - for ($i = $firstSeqNum; $i < $firstSeqNum + $count; $i++) { - $transactionId = $response->get('trans_id') . '-' . $i; + for ($i = 1; $i <= $count; $i++) { + $transactionId = $response->get('trans_id') . '-' . ($firstSeqNum + $i - 1); $delay = (int) $option['period'] * ($i - 1); $date->setTimestamp(strtotime("+$delay days", $timestamp)); switch (true) { - case ($i == $firstSeqNum): // First transaction. + case ($i == 1): // First transaction. $amount = $firstAmount; break; - case ($i == $firstSeqNum + $count - 1): // Last transaction. + case ($i == $count): // Last transaction. $amount = $totalAmount - $firstAmount - $installmentAmount * ($i - 2); break; @@ -449,8 +448,8 @@ public function updatePaymentInfo(\Magento\Sales\Model\Order $order, \Lyranetwor \IntlDateFormatter::NONE ), 'Transaction ID' => $transactionId, - 'Transaction UUID' => ($i == $firstSeqNum) ? $response->get('trans_uuid') : '', - 'Transaction Status' => ($i == $firstSeqNum) ? $response->getTransStatus() : $this->getNextTransStatus($response->getTransStatus()), + 'Transaction UUID' => ($i == 1) ? $response->get('trans_uuid') : '', + 'Transaction Status' => ($i == 1) ? $response->getTransStatus() : $this->getNextTransStatus($response->getTransStatus()), 'Means of payment' => $response->get('card_brand'), 'Card Number' => $response->get('card_number'), 'Expiration Date' => $expiry, diff --git a/composer.json b/composer.json index e80fc15..ca0d05b 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "php" : "~5.5.0|~5.6.0|~7" }, "type" : "magento2-module", - "version" : "2.5.3", + "version" : "2.5.4", "license" : "OSL-3.0", "autoload" : { "files" : [ diff --git a/etc/config.xml b/etc/config.xml index b1ca56c..6b8b8af 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -15,7 +15,7 @@ support@payzen.eu - 2.5.3 + 2.5.4 V2 Magento_2.x 1