Skip to content

Commit

Permalink
Merge branch 'hotfix/2.5.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabil Berhouche committed Feb 2, 2021
2 parents e2f954b + 36809d4 commit d4a5dfc
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
13 changes: 6 additions & 7 deletions Helper/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : [
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<payzen>
<general>
<support_email>[email protected]</support_email>
<plugin_version>2.5.3</plugin_version>
<plugin_version>2.5.4</plugin_version>
<gateway_version>V2</gateway_version>
<cms_identifier>Magento_2.x</cms_identifier>
<enable_logs>1</enable_logs>
Expand Down

0 comments on commit d4a5dfc

Please sign in to comment.