source: main/waeup.ikoba/trunk/src/waeup/ikoba/payments/currencies.py @ 12712

Last change on this file since 12712 was 12311, checked in by uli, 10 years ago

Merge changes from uli-paypal back into trunk.

File size: 10.5 KB
RevLine 
[12248]1"""Currencies
2"""
[12294]3from waeup.ikoba.interfaces import MessageFactory as _
4from waeup.ikoba.interfaces import SimpleIkobaVocabulary
5
[12248]6#: Currencies according to ISO 4217
7#:
8#: Compiled from:
9#:   http://www.currency-iso.org/dam/downloads/table_a1.xml
10#: Entries without decimal units (such as funds or not officially
11#: traded currencies) were removed.
12#:
13#: Data published: 2014-08-15
14#:
15#: Keys are the currency codes (as given by ISO)
16#: Entries have four items:
17#:   0: Authority maintaining the currency (normally a country)
18#:   1: Name of currency
19#:   2: Number of decimals after decimal separator
20#:   3: Currency nuber in ISO listing
21#:
22ISO_4217_CURRENCIES = {
[12294]23    'AED': ('UNITED ARAB EMIRATES', _('UAE Dirham'), 2, '784'),
24    'AFN': ('AFGHANISTAN', _('Afghani'), 2, '971'),
25    'ALL': ('ALBANIA', _('Lek'), 2, '008'),
26    'AMD': ('ARMENIA', _('Armenian Dram'), 2, '051'),
[12248]27    'ANG': ('SINT MAARTEN (DUTCH PART)',
[12294]28            _('Netherlands Antillean Guilder'),
[12248]29            2,
30            '532'),
[12294]31    'AOA': ('ANGOLA', _('Kwanza'), 2, '973'),
32    'ARS': ('ARGENTINA', _('Argentine Peso'), 2, '032'),
33    'AUD': ('TUVALU', _('Australian Dollar'), 2, '036'),
34    'AWG': ('ARUBA', _('Aruban Florin'), 2, '533'),
35    'AZN': ('AZERBAIJAN', _('Azerbaijanian Manat'), 2, '944'),
36    'BAM': ('BOSNIA AND HERZEGOVINA', _('Convertible Mark'), 2, '977'),
37    'BBD': ('BARBADOS', _('Barbados Dollar'), 2, '052'),
38    'BDT': ('BANGLADESH', _('Taka'), 2, '050'),
39    'BGN': ('BULGARIA', _('Bulgarian Lev'), 2, '975'),
40    'BHD': ('BAHRAIN', _('Bahraini Dinar'), 3, '048'),
41    'BIF': ('BURUNDI', _('Burundi Franc'), 0, '108'),
42    'BMD': ('BERMUDA', _('Bermudian Dollar'), 2, '060'),
43    'BND': ('BRUNEI DARUSSALAM', _('Brunei Dollar'), 2, '096'),
44    'BOB': ('BOLIVIA, PLURINATIONAL STATE OF', _('Boliviano'), 2, '068'),
45    'BOV': ('BOLIVIA, PLURINATIONAL STATE OF', _('Mvdol'), 2, '984'),
46    'BRL': ('BRAZIL', _('Brazilian Real'), 2, '986'),
47    'BSD': ('BAHAMAS', _('Bahamian Dollar'), 2, '044'),
48    'BTN': ('BHUTAN', _('Ngultrum'), 2, '064'),
49    'BWP': ('BOTSWANA', _('Pula'), 2, '072'),
50    'BYR': ('BELARUS', _('Belarussian Ruble'), 0, '974'),
51    'BZD': ('BELIZE', _('Belize Dollar'), 2, '084'),
52    'CAD': ('CANADA', _('Canadian Dollar'), 2, '124'),
53    'CDF': ('CONGO, DEMOCRATIC REPUBLIC OF THE ',
54            _('Congolese Franc'),
55            2,
56            '976'),
57    'CHE': ('SWITZERLAND', _('WIR Euro'), 2, '947'),
58    'CHF': ('SWITZERLAND', _('Swiss Franc'), 2, '756'),
59    'CHW': ('SWITZERLAND', _('WIR Franc'), 2, '948'),
60    'CLF': ('CHILE', _('Unidad de Fomento'), 4, '990'),
61    'CLP': ('CHILE', _('Chilean Peso'), 0, '152'),
62    'CNY': ('CHINA', _('Yuan Renminbi'), 2, '156'),
63    'COP': ('COLOMBIA', _('Colombian Peso'), 2, '170'),
64    'COU': ('COLOMBIA', _('Unidad de Valor Real'), 2, '970'),
65    'CRC': ('COSTA RICA', _('Costa Rican Colon'), 2, '188'),
66    'CUC': ('CUBA', _('Peso Convertible'), 2, '931'),
67    'CUP': ('CUBA', _('Cuban Peso'), 2, '192'),
68    'CVE': ('CABO VERDE', _('Cabo Verde Escudo'), 2, '132'),
69    'CZK': ('CZECH REPUBLIC', _('Czech Koruna'), 2, '203'),
70    'DJF': ('DJIBOUTI', _('Djibouti Franc'), 0, '262'),
71    'DKK': ('GREENLAND', _('Danish Krone'), 2, '208'),
72    'DOP': ('DOMINICAN REPUBLIC', _('Dominican Peso'), 2, '214'),
73    'DZD': ('ALGERIA', _('Algerian Dinar'), 2, '012'),
74    'EGP': ('EGYPT', _('Egyptian Pound'), 2, '818'),
75    'ERN': ('ERITREA', _('-Nakfa'), 2, '232'),
76    'ETB': ('ETHIOPIA', _('Ethiopian Birr'), 2, '230'),
77    'EUR': ('SPAIN', _('Euro'), 2, '978'),
78    'FJD': ('FIJI', _('Fiji Dollar'), 2, '242'),
79    'FKP': ('FALKLAND ISLANDS (MALVINAS)',
80            _('Falkland Islands Pound'),
81            2,
82            '238'),
83    'GBP': ('UNITED KINGDOM', _('Pound Sterling'), 2, '826'),
84    'GEL': ('GEORGIA', _('Lari'), 2, '981'),
85    'GHS': ('GHANA', _('Ghana Cedi'), 2, '936'),
86    'GIP': ('GIBRALTAR', _('Gibraltar Pound'), 2, '292'),
87    'GMD': ('GAMBIA', _('Dalasi'), 2, '270'),
88    'GNF': ('GUINEA', _('Guinea Franc'), 0, '324'),
89    'GTQ': ('GUATEMALA', _('Quetzal'), 2, '320'),
90    'GYD': ('GUYANA', _('Guyana Dollar'), 2, '328'),
91    'HKD': ('HONG KONG', _('Hong Kong Dollar'), 2, '344'),
92    'HNL': ('HONDURAS', _('Lempira'), 2, '340'),
93    'HRK': ('CROATIA', _('Croatian Kuna'), 2, '191'),
94    'HTG': ('HAITI', _('Gourde'), 2, '332'),
95    'HUF': ('HUNGARY', _('Forint'), 2, '348'),
96    'IDR': ('INDONESIA', _('Rupiah'), 2, '360'),
97    'ILS': ('ISRAEL', _('New Israeli Sheqel'), 2, '376'),
98    'INR': ('INDIA', _('Indian Rupee'), 2, '356'),
99    'IQD': ('IRAQ', _('Iraqi Dinar'), 3, '368'),
100    'IRR': ('IRAN, ISLAMIC REPUBLIC OF', _('Iranian Rial'), 2, '364'),
101    'ISK': ('ICELAND', _('Iceland Krona'), 0, '352'),
102    'JMD': ('JAMAICA', _('Jamaican Dollar'), 2, '388'),
103    'JOD': ('JORDAN', _('Jordanian Dinar'), 3, '400'),
104    'JPY': ('JAPAN', _('Yen'), 0, '392'),
105    'KES': ('KENYA', _('Kenyan Shilling'), 2, '404'),
106    'KGS': ('KYRGYZSTAN', _('Som'), 2, '417'),
107    'KHR': ('CAMBODIA', _('Riel'), 2, '116'),
108    'KMF': ('COMOROS', _('Comoro Franc'), 0, '174'),
[12248]109    'KPW': (u"KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF",
[12294]110            _('North Korean Won'),
[12248]111            2,
112            '408'),
[12294]113    'KRW': ('KOREA, REPUBLIC OF', _('Won'), 0, '410'),
114    'KWD': ('KUWAIT', _('Kuwaiti Dinar'), 3, '414'),
115    'KYD': ('CAYMAN ISLANDS', _('Cayman Islands Dollar'), 2, '136'),
116    'KZT': ('KAZAKHSTAN', _('Tenge'), 2, '398'),
117    'LAK': (u"LAO PEOPLE'S DEMOCRATIC REPUBLIC", _('Kip'), 2, '418'),
118    'LBP': ('LEBANON', _('Lebanese Pound'), 2, '422'),
119    'LKR': ('SRI LANKA', _('Sri Lanka Rupee'), 2, '144'),
120    'LRD': ('LIBERIA', _('Liberian Dollar'), 2, '430'),
121    'LSL': ('LESOTHO', _('Loti'), 2, '426'),
122    'LTL': ('LITHUANIA', _('Lithuanian Litas'), 2, '440'),
123    'LYD': ('LIBYA', _('Libyan Dinar'), 3, '434'),
124    'MAD': ('WESTERN SAHARA', _('Moroccan Dirham'), 2, '504'),
125    'MDL': ('MOLDOVA, REPUBLIC OF', _('Moldovan Leu'), 2, '498'),
126    'MGA': ('MADAGASCAR', _('Malagasy Ariary'), 2, '969'),
127    'MKD': ('MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF',
128            _('Denar'),
129            2,
130            '807'),
131    'MMK': ('MYANMAR', _('Kyat'), 2, '104'),
132    'MNT': ('MONGOLIA', _('Tugrik'), 2, '496'),
133    'MOP': ('MACAO', _('Pataca'), 2, '446'),
134    'MRO': ('MAURITANIA', _('Ouguiya'), 2, '478'),
135    'MUR': ('MAURITIUS', _('Mauritius Rupee'), 2, '480'),
136    'MVR': ('MALDIVES', _('Rufiyaa'), 2, '462'),
137    'MWK': ('MALAWI', _('Kwacha'), 2, '454'),
138    'MXN': ('MEXICO', _('Mexican Peso'), 2, '484'),
139    'MXV': ('MEXICO', _('Mexican Unidad de Inversion (UDI)'), 2, '979'),
140    'MYR': ('MALAYSIA', _('Malaysian Ringgit'), 2, '458'),
141    'MZN': ('MOZAMBIQUE', _('Mozambique Metical'), 2, '943'),
142    'NAD': ('NAMIBIA', _('Namibia Dollar'), 2, '516'),
143    'NGN': ('NIGERIA', _('Naira'), 2, '566'),
144    'NIO': ('NICARAGUA', _('Cordoba Oro'), 2, '558'),
145    'NOK': ('SVALBARD AND JAN MAYEN', _('Norwegian Krone'), 2, '578'),
146    'NPR': ('NEPAL', _('Nepalese Rupee'), 2, '524'),
147    'NZD': ('TOKELAU', _('New Zealand Dollar'), 2, '554'),
148    'OMR': ('OMAN', _('Rial Omani'), 3, '512'),
149    'PAB': ('PANAMA', _('Balboa'), 2, '590'),
150    'PEN': ('PERU', _('Nuevo Sol'), 2, '604'),
151    'PGK': ('PAPUA NEW GUINEA', _('Kina'), 2, '598'),
152    'PHP': ('PHILIPPINES', _('Philippine Peso'), 2, '608'),
153    'PKR': ('PAKISTAN', _('Pakistan Rupee'), 2, '586'),
154    'PLN': ('POLAND', _('Zloty'), 2, '985'),
155    'PYG': ('PARAGUAY', _('Guarani'), 0, '600'),
156    'QAR': ('QATAR', _('Qatari Rial'), 2, '634'),
157    'RON': ('ROMANIA', _('New Romanian Leu'), 2, '946'),
158    'RSD': ('SERBIA', _('Serbian Dinar'), 2, '941'),
159    'RUB': ('RUSSIAN FEDERATION', _('Russian Ruble'), 2, '643'),
160    'RWF': ('RWANDA', _('Rwanda Franc'), 0, '646'),
161    'SAR': ('SAUDI ARABIA', _('Saudi Riyal'), 2, '682'),
162    'SBD': ('SOLOMON ISLANDS', _('Solomon Islands Dollar'), 2, '090'),
163    'SCR': ('SEYCHELLES', _('Seychelles Rupee'), 2, '690'),
164    'SDG': ('SUDAN', _('Sudanese Pound'), 2, '938'),
165    'SEK': ('SWEDEN', _('Swedish Krona'), 2, '752'),
166    'SGD': ('SINGAPORE', _('Singapore Dollar'), 2, '702'),
[12248]167    'SHP': ('SAINT HELENA, ASCENSION AND TRISTAN DA CUNHA',
[12294]168            _('Saint Helena Pound'),
[12248]169            2,
170            '654'),
[12294]171    'SLL': ('SIERRA LEONE', _('Leone'), 2, '694'),
172    'SOS': ('SOMALIA', _('Somali Shilling'), 2, '706'),
173    'SRD': ('SURINAME', _('Surinam Dollar'), 2, '968'),
174    'SSP': ('SOUTH SUDAN', _('South Sudanese Pound'), 2, '728'),
175    'STD': ('SAO TOME AND PRINCIPE', _('Dobra'), 2, '678'),
176    'SVC': ('EL SALVADOR', _('El Salvador Colon'), 2, '222'),
177    'SYP': ('SYRIAN ARAB REPUBLIC', _('Syrian Pound'), 2, '760'),
178    'SZL': ('SWAZILAND', _('Lilangeni'), 2, '748'),
179    'THB': ('THAILAND', _('Baht'), 2, '764'),
180    'TJS': ('TAJIKISTAN', _('Somoni'), 2, '972'),
181    'TMT': ('TURKMENISTAN', _('Turkmenistan New Manat'), 2, '934'),
182    'TND': ('TUNISIA', _('Tunisian Dinar'), 3, '788'),
183    'TOP': ('TONGA', _(u"Pa'anga"), 2, '776'),
184    'TRY': ('TURKEY', _('Turkish Lira'), 2, '949'),
185    'TTD': ('TRINIDAD AND TOBAGO', _('Trinidad and Tobago Dollar'), 2, '780'),
186    'TWD': ('TAIWAN, PROVINCE OF CHINA', _('New Taiwan Dollar'), 2, '901'),
187    'TZS': ('TANZANIA, UNITED REPUBLIC OF', _('Tanzanian Shilling'), 2, '834'),
188    'UAH': ('UKRAINE', _('Hryvnia'), 2, '980'),
189    'UGX': ('UGANDA', _('Uganda Shilling'), 0, '800'),
190    'USD': ('VIRGIN ISLANDS (U.S.)', _('US Dollar'), 2, '840'),
191    'USN': ('UNITED STATES', _('US Dollar (Next day)'), 2, '997'),
[12248]192    'UYI': ('URUGUAY',
[12294]193            _('Uruguay Peso en Unidades Indexadas (URUIURUI)'),
[12248]194            0,
195            '940'),
[12294]196    'UYU': ('URUGUAY', _('Peso Uruguayo'), 2, '858'),
197    'UZS': ('UZBEKISTAN', _('Uzbekistan Sum'), 2, '860'),
198    'VEF': ('VENEZUELA, BOLIVARIAN REPUBLIC OF', _('Bolivar'), 2, '937'),
199    'VND': ('VIET NAM', _('Dong'), 0, '704'),
200    'VUV': ('VANUATU', _('Vatu'), 0, '548'),
201    'WST': ('SAMOA', _('Tala'), 2, '882'),
202    'XAF': ('GABON', _('CFA Franc BEAC'), 0, '950'),
[12248]203    'XCD': ('SAINT VINCENT AND THE GRENADINES',
[12294]204            _('East Caribbean Dollar'),
[12248]205            2,
206            '951'),
[12294]207    'XOF': ('TOGO', _('CFA Franc BCEAO'), 0, '952'),
208    'XPF': ('WALLIS AND FUTUNA', _('CFP Franc'), 0, '953'),
209    'YER': ('YEMEN', _('Yemeni Rial'), 2, '886'),
210    'ZAR': ('SOUTH AFRICA', _('Rand'), 2, '710'),
211    'ZMW': ('ZAMBIA', _('Zambian Kwacha'), 2, '967'),
212    'ZWL': ('ZIMBABWE', _('Zimbabwe Dollar'), 2, '932')
[12248]213    }
214
215
216def get_decimal_units(currency_code):
217    """Get the number of decimals after decimal separator for a currency.
218
219    Pass in a three-letter currency code. Returns a number.
220    """
221    return ISO_4217_CURRENCIES[currency_code][2]
[12294]222
223
224#: A vocabulary of ISO 4217 currencies
225ISO_4217_CURRENCIES_VOCAB = SimpleIkobaVocabulary(
226    *[(val[1], key) for key, val in ISO_4217_CURRENCIES.items()])
Note: See TracBrowser for help on using the repository browser.