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.