Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix an issue with wrong totals when instalments are used
The setBaseGrandTotal method is set with the interest amount in the
original currency rather than the base currency therefore it has to
be converted to the base currency amount
  • Loading branch information
rvelhote committed Feb 12, 2019
commit 5fe3b419662b6f300e8fd323c20e7bd768aaf129
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected function _initTotals()
$this->addTotalBefore(new Varien_Object(array(
'code' => 'ebanx_interest',
'value' => $amount,
'base_value'=> $amount,
'base_value'=> $amount / $this->getOrder()->getBaseToOrderRate(),
'label' => $this->helper('ebanx')->__('Interest Amount'),
), array('tax')));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected function _initTotals()
$this->addTotal(new Varien_Object(array(
'code' => 'ebanx_interest',
'value' => $amount,
'base_value'=> $amount,
'base_value'=> $amount / $this->getOrder()->getBaseToOrderRate(),
'label' => $this->helper('ebanx')->__('Interest Amount'),
)));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected function _initTotals()
$this->addTotal(new Varien_Object(array(
'code' => 'ebanx_interest',
'value' => $amount,
'base_value'=> $amount,
'base_value'=> $amount / $this->getOrder()->getBaseToOrderRate(),
'label' => $this->helper('ebanx')->__('Interest Amount'),
), array('tax')));
}
Expand Down
4 changes: 3 additions & 1 deletion app/code/community/Ebanx/Gateway/Model/Quote/Interest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ public function collect(Mage_Sales_Model_Quote_Address $address)
if ($interestAmount > 0) {
$address->setEbanxInterestAmount($interestAmount);
$address->setGrandTotal($address->getGrandTotal() + $interestAmount);
$address->setBaseGrandTotal($address->getBaseGrandTotal() + $interestAmount);
$address->setBaseGrandTotal(
$address->getBaseGrandTotal() + ($interestAmount / $quote->getBaseToQuoteRate())
);
}

return $this;
Expand Down