Skip to content

Conversation

@rvelhote
Copy link
Contributor

Hello,

We have an issue in our shop where orders processed with Ebanx that contain instalments have their totals messed up.

if ($interestAmount > 0) {
    $address->setEbanxInterestAmount($interestAmount);
    $address->setGrandTotal($address->getGrandTotal() + $interestAmount);
    $address->setBaseGrandTotal($address->getBaseGrandTotal() + $interestAmount);
}

The setBaseGrandTotal method is set with the interest amount in the original currency (e.g. BRL, MXN) rather than the base currency (e.g. EUR) therefore it has to be converted to the base currency amount.

$address->setBaseGrandTotal(
    $address->getBaseGrandTotal() + ($interestAmount / $quote->getBaseToQuoteRate())
);

This issue also exists in all the classes rewritten by the Ebanx module that add the ebanx_interest parcel to the totals:

  • Mage_Adminhtml_Block_Sales_Order_Totals
  • Ebanx_Gateway_Block_Adminhtml_Sales_Order_Creditmemo_Totals
  • Ebanx_Gateway_Block_Adminhtml_Sales_Order_Invoice_Totals

These are all the places I could find to solve this issue. Please have a look to see if there are more situations where this can be an issue.

Best regards,
Ricardo

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant