We needed to change the payment gateway currency to the secondary currency, so we could charge the customer with another currency other than the primary.
The issues we have rounded the prices to customers, and when we need to get the cart total in the payment gateway, we get the unrounded prices of the products.
To round the prices we used this hook:
How can I get the total of the order the same as what the customer is seeing with the rounded prices, or how can I get the order summary price to my payment gateway files?
For example, in PayPal module the following function is used if non-base currency is selected
fn_format_price_by_currency($order_info['total'], CART_PRIMARY_CURRENCY, $paypal_currency);
Yes but there is one issue with fn_format_price_by_currency
The total calculated by fn_format_price_by_currency is different than what the customer sees since we rounded the prices.
For example, our main currency is USD, and Secondary Currency is LBP. The site displays the product's price in LBP, and they are rounded using format_price_pre function.
So if the product price is USD 3.3, in LBP it would be LBP 4950, we rounded it to LBP 5000.
When the customer goes to check out the customers sees something like Total LBP400,000
If I use the fn_format_price_by_currency function in the gateway file, the total would show something like LBP400,200 instead of LBP400,000, since it just converting from USD to LBP, instead of summing up the rounded products prices.
Ok. I understand. You can go through the $cart['products'] array to calculate sub total and add shipping cost then. But it should be carefully checked with discounts, gift certificates and so on