-
Notifications
You must be signed in to change notification settings - Fork 8
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
Update Transaction.php to fix transaction amount error #29
base: master
Are you sure you want to change the base?
Conversation
Fix: wrong amount was being sent to API causing the following error showing up: 'Something went wrong: Transaction amount must be greater than 0'
Cleaning up code a bit
Without conversion this looks like it could result in a mix of currencies. ie. if the user picked Japanese Yen but the store's internal currency is USD. |
Without this change, it sent the wrong amount. See here log before change: Log after change: |
I mainly just mean that it needs to be sure that these are both referring to the same currency, no matter what currency the user has selected:
So they can't just pick JPY and get a massive discount or anything like that. So I think if you are using getBaseGrandTotal() then currency1 should probably be getBaseCurrencyCode() if these are the right docs https://www.magentoextensions.org/documentation/interface_magento_1_1_quote_1_1_api_1_1_data_1_1_totals_interface.html |
I tested your suggestion but it thrown an error (Transaction is not found). Actually when that error happened, the error function actually contains an error as well (error is undefined). I've fixed that as well which I will add later as well. (The error function is spelled as 'err', renamed it to 'error'.) So I reverted to before your suggestion to the fix I provided in this pull request, changed the webshop to EUR and tested placing an order. The EUR amount in cart was €9,39. After placing the order I see in CoinPaymentDebug.log currency1 is still GBP instead of EUR so that is perfect. It also took the GBP amount of 8,00 so it did not resulted in mixed currencies. |
Fix: wrong amount was being sent to API causing the following error showing up: 'Something went wrong: Transaction amount must be greater than 0'