Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue with wrong totals when instalments are used #338

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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