-
Notifications
You must be signed in to change notification settings - Fork 161
Description
I opened issue #1212 and provided a fix in pull request #1211, but the issue has been closed, incorrectly in my opinion.
The problem is in file Plugins/magento/magento23_vivawallet/Ced/VivaPayments/Model/PaymentMethods.php
On lines 91 and 92 the order total is obtained using the $order->getGrandTotal() method. This method will return the order total in the display currency. Then on line 102, the currency code is obtained using $order->getBaseCurrencyCode(), which returns the stores base currency code.
If the store's base currency is set to EUR, but a customer has checked out with the display currency of USD, then the order value in USD will be sent to Viva for processing along with the EUR currency code, resulting in the customer being charged the incorrect amount.
The update to issue #1212 from @VivaWalletSupport suggests that the preferred set up would use various currencies with various Viva accounts. This answer misunderstands the purpose of Magento's display currency and it also would not work with Viva's current plugin code.
Magento 2 has a display currency to allow customers to browse the store and be shown an invoice in their preferred currency, but at check out they will be charged the correctly converted value in the base currency.
Currently, getting the currency code from the base and the total from display will mean that your Magento plugin code can only work when there is one display currency and that currency is the same as the base, otherwise you code will always charge the incorrect amount.
When I last asked, Viva wallet wouldn't allow an account to have multiple currencies. If as you're last update suggested you'd need multiple viva accounts, each with a different currency, then your code would not support this. The magento 2 plugin can only accept a single merchant ID and password, so you could not use different Viva accounts based on the currency selected.
The fix in my pull request doesn't break anything, as you're code wouldn't work in the way you've suggest and it fixes the problem I've raised. Please can you review it again and let me know.