a credit card provider needs the transaction amount in cents or smallest available unit of the currency. since I want the code to be portable I have to get the smallest unit of a given currency and it’s factor to the main unit. I’ve tried to get it from the locale module but i had no luck.
http://docs.python.org/library/locale.html
Example
i have a currency code as described in iso 4217
EUR for Euro
then i need 1 Euro is 100 Eurocents (only the information 1/100, no text is needed)
according to wikipedia there currencies which have more than 2 units like the old pund sterling
Alternatively cou can use following simple mapping module: http://pastebin.com/K7kVXi8P
Save this pastebin into a module within your project (e.g. simple_currency_helper.py) and use the map (or the helper method
get_currency_subunit) to get out the currency subunit for a given ISO-Code.