Index: /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/currencies.py
===================================================================
--- /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/currencies.py	(revision 12248)
+++ /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/currencies.py	(revision 12248)
@@ -0,0 +1,209 @@
+"""Currencies
+"""
+#: Currencies according to ISO 4217
+#:
+#: Compiled from:
+#:   http://www.currency-iso.org/dam/downloads/table_a1.xml
+#: Entries without decimal units (such as funds or not officially
+#: traded currencies) were removed.
+#:
+#: Data published: 2014-08-15
+#:
+#: Keys are the currency codes (as given by ISO)
+#: Entries have four items:
+#:   0: Authority maintaining the currency (normally a country)
+#:   1: Name of currency
+#:   2: Number of decimals after decimal separator
+#:   3: Currency nuber in ISO listing
+#:
+ISO_4217_CURRENCIES = {
+    'AED': ('UNITED ARAB EMIRATES', 'UAE Dirham', 2, '784'),
+    'AFN': ('AFGHANISTAN', 'Afghani', 2, '971'),
+    'ALL': ('ALBANIA', 'Lek', 2, '008'),
+    'AMD': ('ARMENIA', 'Armenian Dram', 2, '051'),
+    'ANG': ('SINT MAARTEN (DUTCH PART)',
+            'Netherlands Antillean Guilder',
+            2,
+            '532'),
+    'AOA': ('ANGOLA', 'Kwanza', 2, '973'),
+    'ARS': ('ARGENTINA', 'Argentine Peso', 2, '032'),
+    'AUD': ('TUVALU', 'Australian Dollar', 2, '036'),
+    'AWG': ('ARUBA', 'Aruban Florin', 2, '533'),
+    'AZN': ('AZERBAIJAN', 'Azerbaijanian Manat', 2, '944'),
+    'BAM': ('BOSNIA AND HERZEGOVINA', 'Convertible Mark', 2, '977'),
+    'BBD': ('BARBADOS', 'Barbados Dollar', 2, '052'),
+    'BDT': ('BANGLADESH', 'Taka', 2, '050'),
+    'BGN': ('BULGARIA', 'Bulgarian Lev', 2, '975'),
+    'BHD': ('BAHRAIN', 'Bahraini Dinar', 3, '048'),
+    'BIF': ('BURUNDI', 'Burundi Franc', 0, '108'),
+    'BMD': ('BERMUDA', 'Bermudian Dollar', 2, '060'),
+    'BND': ('BRUNEI DARUSSALAM', 'Brunei Dollar', 2, '096'),
+    'BOB': ('BOLIVIA, PLURINATIONAL STATE OF', 'Boliviano', 2, '068'),
+    'BOV': ('BOLIVIA, PLURINATIONAL STATE OF', 'Mvdol', 2, '984'),
+    'BRL': ('BRAZIL', 'Brazilian Real', 2, '986'),
+    'BSD': ('BAHAMAS', 'Bahamian Dollar', 2, '044'),
+    'BTN': ('BHUTAN', 'Ngultrum', 2, '064'),
+    'BWP': ('BOTSWANA', 'Pula', 2, '072'),
+    'BYR': ('BELARUS', 'Belarussian Ruble', 0, '974'),
+    'BZD': ('BELIZE', 'Belize Dollar', 2, '084'),
+    'CAD': ('CANADA', 'Canadian Dollar', 2, '124'),
+    'CDF': ('CONGO, DEMOCRATIC REPUBLIC OF THE ', 'Congolese Franc', 2, '976'),
+    'CHE': ('SWITZERLAND', 'WIR Euro', 2, '947'),
+    'CHF': ('SWITZERLAND', 'Swiss Franc', 2, '756'),
+    'CHW': ('SWITZERLAND', 'WIR Franc', 2, '948'),
+    'CLF': ('CHILE', 'Unidad de Fomento', 4, '990'),
+    'CLP': ('CHILE', 'Chilean Peso', 0, '152'),
+    'CNY': ('CHINA', 'Yuan Renminbi', 2, '156'),
+    'COP': ('COLOMBIA', 'Colombian Peso', 2, '170'),
+    'COU': ('COLOMBIA', 'Unidad de Valor Real', 2, '970'),
+    'CRC': ('COSTA RICA', 'Costa Rican Colon', 2, '188'),
+    'CUC': ('CUBA', 'Peso Convertible', 2, '931'),
+    'CUP': ('CUBA', 'Cuban Peso', 2, '192'),
+    'CVE': ('CABO VERDE', 'Cabo Verde Escudo', 2, '132'),
+    'CZK': ('CZECH REPUBLIC', 'Czech Koruna', 2, '203'),
+    'DJF': ('DJIBOUTI', 'Djibouti Franc', 0, '262'),
+    'DKK': ('GREENLAND', 'Danish Krone', 2, '208'),
+    'DOP': ('DOMINICAN REPUBLIC', 'Dominican Peso', 2, '214'),
+    'DZD': ('ALGERIA', 'Algerian Dinar', 2, '012'),
+    'EGP': ('EGYPT', 'Egyptian Pound', 2, '818'),
+    'ERN': ('ERITREA', 'Nakfa', 2, '232'),
+    'ETB': ('ETHIOPIA', 'Ethiopian Birr', 2, '230'),
+    'EUR': ('SPAIN', 'Euro', 2, '978'),
+    'FJD': ('FIJI', 'Fiji Dollar', 2, '242'),
+    'FKP': ('FALKLAND ISLANDS (MALVINAS)', 'Falkland Islands Pound', 2, '238'),
+    'GBP': ('UNITED KINGDOM', 'Pound Sterling', 2, '826'),
+    'GEL': ('GEORGIA', 'Lari', 2, '981'),
+    'GHS': ('GHANA', 'Ghana Cedi', 2, '936'),
+    'GIP': ('GIBRALTAR', 'Gibraltar Pound', 2, '292'),
+    'GMD': ('GAMBIA', 'Dalasi', 2, '270'),
+    'GNF': ('GUINEA', 'Guinea Franc', 0, '324'),
+    'GTQ': ('GUATEMALA', 'Quetzal', 2, '320'),
+    'GYD': ('GUYANA', 'Guyana Dollar', 2, '328'),
+    'HKD': ('HONG KONG', 'Hong Kong Dollar', 2, '344'),
+    'HNL': ('HONDURAS', 'Lempira', 2, '340'),
+    'HRK': ('CROATIA', 'Croatian Kuna', 2, '191'),
+    'HTG': ('HAITI', 'Gourde', 2, '332'),
+    'HUF': ('HUNGARY', 'Forint', 2, '348'),
+    'IDR': ('INDONESIA', 'Rupiah', 2, '360'),
+    'ILS': ('ISRAEL', 'New Israeli Sheqel', 2, '376'),
+    'INR': ('INDIA', 'Indian Rupee', 2, '356'),
+    'IQD': ('IRAQ', 'Iraqi Dinar', 3, '368'),
+    'IRR': ('IRAN, ISLAMIC REPUBLIC OF', 'Iranian Rial', 2, '364'),
+    'ISK': ('ICELAND', 'Iceland Krona', 0, '352'),
+    'JMD': ('JAMAICA', 'Jamaican Dollar', 2, '388'),
+    'JOD': ('JORDAN', 'Jordanian Dinar', 3, '400'),
+    'JPY': ('JAPAN', 'Yen', 0, '392'),
+    'KES': ('KENYA', 'Kenyan Shilling', 2, '404'),
+    'KGS': ('KYRGYZSTAN', 'Som', 2, '417'),
+    'KHR': ('CAMBODIA', 'Riel', 2, '116'),
+    'KMF': ('COMOROS', 'Comoro Franc', 0, '174'),
+    'KPW': (u"KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF",
+            'North Korean Won',
+            2,
+            '408'),
+    'KRW': ('KOREA, REPUBLIC OF', 'Won', 0, '410'),
+    'KWD': ('KUWAIT', 'Kuwaiti Dinar', 3, '414'),
+    'KYD': ('CAYMAN ISLANDS', 'Cayman Islands Dollar', 2, '136'),
+    'KZT': ('KAZAKHSTAN', 'Tenge', 2, '398'),
+    'LAK': (u"LAO PEOPLE'S DEMOCRATIC REPUBLIC", 'Kip', 2, '418'),
+    'LBP': ('LEBANON', 'Lebanese Pound', 2, '422'),
+    'LKR': ('SRI LANKA', 'Sri Lanka Rupee', 2, '144'),
+    'LRD': ('LIBERIA', 'Liberian Dollar', 2, '430'),
+    'LSL': ('LESOTHO', 'Loti', 2, '426'),
+    'LTL': ('LITHUANIA', 'Lithuanian Litas', 2, '440'),
+    'LYD': ('LIBYA', 'Libyan Dinar', 3, '434'),
+    'MAD': ('WESTERN SAHARA', 'Moroccan Dirham', 2, '504'),
+    'MDL': ('MOLDOVA, REPUBLIC OF', 'Moldovan Leu', 2, '498'),
+    'MGA': ('MADAGASCAR', 'Malagasy Ariary', 2, '969'),
+    'MKD': ('MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', 'Denar', 2, '807'),
+    'MMK': ('MYANMAR', 'Kyat', 2, '104'),
+    'MNT': ('MONGOLIA', 'Tugrik', 2, '496'),
+    'MOP': ('MACAO', 'Pataca', 2, '446'),
+    'MRO': ('MAURITANIA', 'Ouguiya', 2, '478'),
+    'MUR': ('MAURITIUS', 'Mauritius Rupee', 2, '480'),
+    'MVR': ('MALDIVES', 'Rufiyaa', 2, '462'),
+    'MWK': ('MALAWI', 'Kwacha', 2, '454'),
+    'MXN': ('MEXICO', 'Mexican Peso', 2, '484'),
+    'MXV': ('MEXICO', 'Mexican Unidad de Inversion (UDI)', 2, '979'),
+    'MYR': ('MALAYSIA', 'Malaysian Ringgit', 2, '458'),
+    'MZN': ('MOZAMBIQUE', 'Mozambique Metical', 2, '943'),
+    'NAD': ('NAMIBIA', 'Namibia Dollar', 2, '516'),
+    'NGN': ('NIGERIA', 'Naira', 2, '566'),
+    'NIO': ('NICARAGUA', 'Cordoba Oro', 2, '558'),
+    'NOK': ('SVALBARD AND JAN MAYEN', 'Norwegian Krone', 2, '578'),
+    'NPR': ('NEPAL', 'Nepalese Rupee', 2, '524'),
+    'NZD': ('TOKELAU', 'New Zealand Dollar', 2, '554'),
+    'OMR': ('OMAN', 'Rial Omani', 3, '512'),
+    'PAB': ('PANAMA', 'Balboa', 2, '590'),
+    'PEN': ('PERU', 'Nuevo Sol', 2, '604'),
+    'PGK': ('PAPUA NEW GUINEA', 'Kina', 2, '598'),
+    'PHP': ('PHILIPPINES', 'Philippine Peso', 2, '608'),
+    'PKR': ('PAKISTAN', 'Pakistan Rupee', 2, '586'),
+    'PLN': ('POLAND', 'Zloty', 2, '985'),
+    'PYG': ('PARAGUAY', 'Guarani', 0, '600'),
+    'QAR': ('QATAR', 'Qatari Rial', 2, '634'),
+    'RON': ('ROMANIA', 'New Romanian Leu', 2, '946'),
+    'RSD': ('SERBIA', 'Serbian Dinar', 2, '941'),
+    'RUB': ('RUSSIAN FEDERATION', 'Russian Ruble', 2, '643'),
+    'RWF': ('RWANDA', 'Rwanda Franc', 0, '646'),
+    'SAR': ('SAUDI ARABIA', 'Saudi Riyal', 2, '682'),
+    'SBD': ('SOLOMON ISLANDS', 'Solomon Islands Dollar', 2, '090'),
+    'SCR': ('SEYCHELLES', 'Seychelles Rupee', 2, '690'),
+    'SDG': ('SUDAN', 'Sudanese Pound', 2, '938'),
+    'SEK': ('SWEDEN', 'Swedish Krona', 2, '752'),
+    'SGD': ('SINGAPORE', 'Singapore Dollar', 2, '702'),
+    'SHP': ('SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA',
+            'Saint Helena Pound',
+            2,
+            '654'),
+    'SLL': ('SIERRA LEONE', 'Leone', 2, '694'),
+    'SOS': ('SOMALIA', 'Somali Shilling', 2, '706'),
+    'SRD': ('SURINAME', 'Surinam Dollar', 2, '968'),
+    'SSP': ('SOUTH SUDAN', 'South Sudanese Pound', 2, '728'),
+    'STD': ('SAO TOME AND PRINCIPE', 'Dobra', 2, '678'),
+    'SVC': ('EL SALVADOR', 'El Salvador Colon', 2, '222'),
+    'SYP': ('SYRIAN ARAB REPUBLIC', 'Syrian Pound', 2, '760'),
+    'SZL': ('SWAZILAND', 'Lilangeni', 2, '748'),
+    'THB': ('THAILAND', 'Baht', 2, '764'),
+    'TJS': ('TAJIKISTAN', 'Somoni', 2, '972'),
+    'TMT': ('TURKMENISTAN', 'Turkmenistan New Manat', 2, '934'),
+    'TND': ('TUNISIA', 'Tunisian Dinar', 3, '788'),
+    'TOP': ('TONGA', u"Pa'anga", 2, '776'),
+    'TRY': ('TURKEY', 'Turkish Lira', 2, '949'),
+    'TTD': ('TRINIDAD AND TOBAGO', 'Trinidad and Tobago Dollar', 2, '780'),
+    'TWD': ('TAIWAN, PROVINCE OF CHINA', 'New Taiwan Dollar', 2, '901'),
+    'TZS': ('TANZANIA, UNITED REPUBLIC OF', 'Tanzanian Shilling', 2, '834'),
+    'UAH': ('UKRAINE', 'Hryvnia', 2, '980'),
+    'UGX': ('UGANDA', 'Uganda Shilling', 0, '800'),
+    'USD': ('VIRGIN ISLANDS (U.S.)', 'US Dollar', 2, '840'),
+    'USN': ('UNITED STATES', 'US Dollar (Next day)', 2, '997'),
+    'UYI': ('URUGUAY',
+            'Uruguay Peso en Unidades Indexadas (URUIURUI)',
+            0,
+            '940'),
+    'UYU': ('URUGUAY', 'Peso Uruguayo', 2, '858'),
+    'UZS': ('UZBEKISTAN', 'Uzbekistan Sum', 2, '860'),
+    'VEF': ('VENEZUELA, BOLIVARIAN REPUBLIC OF', 'Bolivar', 2, '937'),
+    'VND': ('VIET NAM', 'Dong', 0, '704'),
+    'VUV': ('VANUATU', 'Vatu', 0, '548'),
+    'WST': ('SAMOA', 'Tala', 2, '882'),
+    'XAF': ('GABON', 'CFA Franc BEAC', 0, '950'),
+    'XCD': ('SAINT VINCENT AND THE GRENADINES',
+            'East Caribbean Dollar',
+            2,
+            '951'),
+    'XOF': ('TOGO', 'CFA Franc BCEAO', 0, '952'),
+    'XPF': ('WALLIS AND FUTUNA', 'CFP Franc', 0, '953'),
+    'YER': ('YEMEN', 'Yemeni Rial', 2, '886'),
+    'ZAR': ('SOUTH AFRICA', 'Rand', 2, '710'),
+    'ZMW': ('ZAMBIA', 'Zambian Kwacha', 2, '967'),
+    'ZWL': ('ZIMBABWE', 'Zimbabwe Dollar', 2, '932')
+    }
+
+
+def get_decimal_units(currency_code):
+    """Get the number of decimals after decimal separator for a currency.
+
+    Pass in a three-letter currency code. Returns a number.
+    """
+    return ISO_4217_CURRENCIES[currency_code][2]
Index: /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_currencies.py
===================================================================
--- /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_currencies.py	(revision 12248)
+++ /main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/tests/test_currencies.py	(revision 12248)
@@ -0,0 +1,18 @@
+import unittest
+from waeup.ikoba.payments.currencies import (
+    get_decimal_units, ISO_4217_CURRENCIES,
+    )
+
+
+class CurrenciesTests(unittest.TestCase):
+
+    def test_get_decimal_units(self):
+        # we can get the number of decimals for a currency code
+        assert get_decimal_units('USD') == 2
+
+    def test_iso_currencies_no_linebreak(self):
+        # sanity check: make sure we didn't compile linebreaks
+        for key, value in ISO_4217_CURRENCIES.items():
+            assert '\n' not in key
+            assert '\n' not in value[0]
+            assert '\n' not in value[1]
