Design pattern for payment gateways
Looks like we need a multicurrency aware design pattern for payment gateways.
Following issue in the Commerce Multicurrency queue contains several reports of problems with payment gateways when using multiple currencies: http://drupal.org/node/1932598
In comment 10 I tried to outline a possible "design pattern" payment gateways should follow:
Payment gateways can't assume that they get the amount in a supported currency. However they should always be able to use
commerce_currency_conversion() to convert the given amount from the provided to a supported currency.
Payment gateways that support multiple currencies could / should allow to configure which currency has to be used (generally or for the case the provided currency isn't supported).
Addition by Ryans comment:
Payment gateways can't assume that they get the amount in a certain precision, even if the currency supports a certain precision by default. Thus the payment gateway has to ensure the amount meets the required precision.
Attention rounding to a certain precision can be tricky. Check out
Could this become part of the developer documentation?