klarna 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +9 -0
- data/.travis.yml +13 -0
- data/Gemfile +14 -0
- data/Guardfile +16 -0
- data/MIT-LICENSE +20 -0
- data/README.textile +139 -0
- data/Rakefile +22 -0
- data/TODO +30 -0
- data/examples/Gemfile +8 -0
- data/examples/config/initializer.rb +15 -0
- data/examples/console.rb +71 -0
- data/examples/public/images/klarna.png +0 -0
- data/examples/public/images/ruby.png +0 -0
- data/examples/views/_address.haml +22 -0
- data/examples/views/_articles.haml +21 -0
- data/examples/views/checkout_page_example.haml +2 -0
- data/examples/views/essential/add_transaction/_form.haml +32 -0
- data/examples/views/essential/add_transaction/result.haml +7 -0
- data/examples/views/essential/calculate_monthly_cost/_form.haml +16 -0
- data/examples/views/essential/calculate_monthly_cost/result.haml +7 -0
- data/examples/views/essential/get_addresses/_form.haml +9 -0
- data/examples/views/essential/get_addresses/result.haml +8 -0
- data/examples/views/index.haml +296 -0
- data/examples/views/layout.haml +48 -0
- data/examples/views/payment_terms_example.haml +102 -0
- data/examples/views/product_page_example.haml +2 -0
- data/examples/views/reservation/activate_reservation/_form.haml +54 -0
- data/examples/views/reservation/activate_reservation/result.haml +7 -0
- data/examples/views/reservation/cancel_reservation/_form.haml +8 -0
- data/examples/views/reservation/cancel_reservation/result.haml +7 -0
- data/examples/views/reservation/change_reservation/_form.haml +10 -0
- data/examples/views/reservation/change_reservation/result.haml +7 -0
- data/examples/views/reservation/reserve_amount/_form.haml +58 -0
- data/examples/views/reservation/reserve_amount/result.haml +7 -0
- data/examples/views/reservation/reserve_ocr_numbers/_form.haml +8 -0
- data/examples/views/reservation/reserve_ocr_numbers/result.haml +7 -0
- data/examples/views/reservation/split_reservation/_form.haml +14 -0
- data/examples/views/reservation/split_reservation/result.haml +7 -0
- data/examples/views/special/get_pclasses/_form.haml +8 -0
- data/examples/views/special/get_pclasses/result.haml +7 -0
- data/examples/views/special/invoice_address/_form.haml +8 -0
- data/examples/views/special/invoice_address/result.haml +7 -0
- data/examples/views/special/invoice_amount/_form.haml +8 -0
- data/examples/views/special/invoice_amount/result.haml +7 -0
- data/examples/views/special/is_invoice_paid/_form.haml +8 -0
- data/examples/views/special/is_invoice_paid/result.haml +7 -0
- data/examples/views/special/update_charge_amount/_form.haml +15 -0
- data/examples/views/special/update_charge_amount/result.haml +7 -0
- data/examples/views/special/update_goods_quantity/_form.haml +17 -0
- data/examples/views/special/update_goods_quantity/result.haml +7 -0
- data/examples/views/special/update_order_number/_form.haml +10 -0
- data/examples/views/special/update_order_number/result.haml +7 -0
- data/examples/views/useful/activate_invoice/_form.haml +9 -0
- data/examples/views/useful/activate_invoice/result.haml +7 -0
- data/examples/views/useful/credit_invoice/_form.haml +11 -0
- data/examples/views/useful/credit_invoice/result.haml +7 -0
- data/examples/views/useful/delete_invoice/_form.haml +9 -0
- data/examples/views/useful/delete_invoice/result.haml +7 -0
- data/examples/views/useful/email_invoice/_form.haml +9 -0
- data/examples/views/useful/email_invoice/result.haml +7 -0
- data/examples/views/useful/has_account/_form.haml +9 -0
- data/examples/views/useful/has_account/result.haml +7 -0
- data/examples/views/useful/return_amount/_form.haml +15 -0
- data/examples/views/useful/return_amount/result.haml +7 -0
- data/examples/views/useful/send_invoice/_form.haml +9 -0
- data/examples/views/useful/send_invoice/result.haml +7 -0
- data/examples/web.rb +349 -0
- data/klarna.gemspec +34 -0
- data/lib/klarna.rb +175 -0
- data/lib/klarna/api.rb +170 -0
- data/lib/klarna/api/client.rb +128 -0
- data/lib/klarna/api/constants.rb +638 -0
- data/lib/klarna/api/errors.rb +154 -0
- data/lib/klarna/api/methods.rb +16 -0
- data/lib/klarna/api/methods/cost_calculations.rb +134 -0
- data/lib/klarna/api/methods/invoicing.rb +304 -0
- data/lib/klarna/api/methods/reservation.rb +149 -0
- data/lib/klarna/api/methods/standard.rb +123 -0
- data/lib/klarna/version.rb +5 -0
- data/test/fixtures/api/companies.yml +97 -0
- data/test/fixtures/api/pclasses.yml +37 -0
- data/test/fixtures/api/persons.yml +144 -0
- data/test/fixtures/api/stores.yml +6 -0
- data/test/fixtures/klarna.yml +10 -0
- data/test/klarna/api/client_test.rb +272 -0
- data/test/klarna/api/errors_test.rb +46 -0
- data/test/klarna/api/methods/cost_calculations_test.rb +78 -0
- data/test/klarna/api/methods/invoicing_test.rb +409 -0
- data/test/klarna/api/methods/reservation_test.rb +66 -0
- data/test/klarna/api/methods/standard_test.rb +244 -0
- data/test/klarna/api_test.rb +137 -0
- data/test/klarna_test.rb +204 -0
- data/test/support/assertions_helper.rb +40 -0
- data/test/test_helper.rb +55 -0
- metadata +312 -0
@@ -0,0 +1,638 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Klarna
|
4
|
+
module API
|
5
|
+
module Constants
|
6
|
+
|
7
|
+
# -----------------------------------------------------------------------
|
8
|
+
# API
|
9
|
+
# -----------------------------------------------------------------------
|
10
|
+
END_POINT = {
|
11
|
+
:test => {
|
12
|
+
:protocol => 'http',
|
13
|
+
:host => 'payment-beta.klarna.com',
|
14
|
+
:port => 80
|
15
|
+
},
|
16
|
+
:production => {
|
17
|
+
:protocol => 'https',
|
18
|
+
:host => 'payment.klarna.com',
|
19
|
+
:port => 443
|
20
|
+
}
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
PROTOCOL_ENCODING = 'iso-8859-1'.freeze # NOTE: New API supports: ['UTF-8', 'ISO-8859-1', 'US-ASCII'].freeze
|
24
|
+
PROTOCOL_VERSION = '4.0'.freeze
|
25
|
+
|
26
|
+
# -----------------------------------------------------------------------
|
27
|
+
# General
|
28
|
+
# -----------------------------------------------------------------------
|
29
|
+
AVERAGE_INTEREST_PERIOD = 45.freeze
|
30
|
+
DAYS_IN_A_YEAR = 365.25.freeze
|
31
|
+
|
32
|
+
# -----------------------------------------------------------------------
|
33
|
+
# Mode: Defaults
|
34
|
+
# -----------------------------------------------------------------------
|
35
|
+
DEFAULTS = {
|
36
|
+
:OCR => '',
|
37
|
+
:PCLASS => -1,
|
38
|
+
:YSALARY => 0
|
39
|
+
}.freeze
|
40
|
+
|
41
|
+
# -----------------------------------------------------------------------
|
42
|
+
# Flags: Campaign Type
|
43
|
+
# -----------------------------------------------------------------------
|
44
|
+
PCLASS = {
|
45
|
+
:NONE => -1,
|
46
|
+
:ANNUITY => 0,
|
47
|
+
:DIVISOR => 1
|
48
|
+
}.freeze
|
49
|
+
|
50
|
+
# -----------------------------------------------------------------------
|
51
|
+
# Flags: Mobile
|
52
|
+
# -----------------------------------------------------------------------
|
53
|
+
MOBILE = {
|
54
|
+
:PRESERVE_RESERVATION => 16,
|
55
|
+
:PHONE_TRANSACTION => 512,
|
56
|
+
:SEND_PHONE_PIN => 1024
|
57
|
+
}.freeze
|
58
|
+
|
59
|
+
# -----------------------------------------------------------------------
|
60
|
+
# Flags: Invoice
|
61
|
+
# -----------------------------------------------------------------------
|
62
|
+
INVOICE = {
|
63
|
+
:AUTO_ACTIVATE => 1,
|
64
|
+
:TEST_MODE => 2,
|
65
|
+
:MANUAL_AUTO_ACTIVATE => 4,
|
66
|
+
:PRE_PAY => 8,
|
67
|
+
:DELAYED_PAY => 16
|
68
|
+
}.freeze
|
69
|
+
|
70
|
+
# -----------------------------------------------------------------------
|
71
|
+
# Flags: Goods
|
72
|
+
# -----------------------------------------------------------------------
|
73
|
+
GOODS = {
|
74
|
+
:PRINT_1000 => 1,
|
75
|
+
:PRINT_100 => 2,
|
76
|
+
:PRINT_10 => 4,
|
77
|
+
:IS_SHIPMENT => 8,
|
78
|
+
:IS_HANDLING => 16,
|
79
|
+
:INC_VAT => 32
|
80
|
+
}.freeze
|
81
|
+
|
82
|
+
# -----------------------------------------------------------------------
|
83
|
+
# Flags: Monthly Cost
|
84
|
+
# -----------------------------------------------------------------------
|
85
|
+
MONTHLY_COST = {
|
86
|
+
:LIMIT => 0,
|
87
|
+
:ACTUAL => 1
|
88
|
+
}.freeze
|
89
|
+
|
90
|
+
# -----------------------------------------------------------------------
|
91
|
+
# Mode: Shipment Type (add_invoice)
|
92
|
+
# -----------------------------------------------------------------------
|
93
|
+
SHIPMENT_TYPES = {
|
94
|
+
:NORMAL => 1,
|
95
|
+
:EXPRESS => 2
|
96
|
+
}.freeze
|
97
|
+
|
98
|
+
# -----------------------------------------------------------------------
|
99
|
+
# Mode: Charge Type (update_charge_amount)
|
100
|
+
# -----------------------------------------------------------------------
|
101
|
+
CHARGE_TYPES = {
|
102
|
+
:SHIPMENT => 1,
|
103
|
+
:HANDLING => 2
|
104
|
+
}.freeze
|
105
|
+
|
106
|
+
# -----------------------------------------------------------------------
|
107
|
+
# Mode: Address Type
|
108
|
+
# -----------------------------------------------------------------------
|
109
|
+
ADDRESS_FORMATS = {
|
110
|
+
:OLD => 1,
|
111
|
+
:NEW => 2,
|
112
|
+
:GIVEN => 5
|
113
|
+
}.freeze
|
114
|
+
|
115
|
+
# -----------------------------------------------------------------------
|
116
|
+
# Mode: Personal Number Encodings (SSN)
|
117
|
+
# -----------------------------------------------------------------------
|
118
|
+
PNO_FORMATS = {
|
119
|
+
:FAKE => 1,
|
120
|
+
:SE => 2, # valid: yymmdd-nnnn, yymmddnnnn, yyyymmdd-nnnn, yyyymmddnnnn
|
121
|
+
:NO => 3, # valid: ddmmyynnnnn
|
122
|
+
:FI => 4, # valid: ddmmyy-nnnn, ddmmyynnnn
|
123
|
+
:DK => 5, # valid: ddmmyynnnn
|
124
|
+
:DE => 6, # valid: ?
|
125
|
+
:NL => 7, # valid: ?
|
126
|
+
:CNO => 1000
|
127
|
+
}.freeze
|
128
|
+
|
129
|
+
# -----------------------------------------------------------------------
|
130
|
+
# Mode: Currencies
|
131
|
+
# -----------------------------------------------------------------------
|
132
|
+
CURRENCIES = {
|
133
|
+
:SEK => 0,
|
134
|
+
:NOK => 1,
|
135
|
+
:EUR => 2,
|
136
|
+
:DKK => 3
|
137
|
+
}.freeze
|
138
|
+
|
139
|
+
# -----------------------------------------------------------------------
|
140
|
+
# Mode: Country (ISO3166)
|
141
|
+
# -----------------------------------------------------------------------
|
142
|
+
COUNTRIES = {
|
143
|
+
:AF => 1, # AFGHANISTAN
|
144
|
+
:AX => 2, # ÅLAND ISLANDS
|
145
|
+
:AL => 3, # ALBANIA
|
146
|
+
:DZ => 4, # ALGERIA
|
147
|
+
:AS => 5, # AMERICAN SAMOA
|
148
|
+
:AD => 6, # ANDORRA
|
149
|
+
:AO => 7, # ANGOLA
|
150
|
+
:AI => 8, # ANGUILLA
|
151
|
+
:AQ => 9, # ANTARCTICA
|
152
|
+
:AG => 10, # ANTIG. A. BARBUDA
|
153
|
+
:AR => 11, # ARGENTINA
|
154
|
+
:AM => 12, # ARMENIA
|
155
|
+
:AW => 13, # ARUBA
|
156
|
+
:AU => 14, # AUSTRALIA
|
157
|
+
:AT => 15, # AUSTRIA
|
158
|
+
:AZ => 16, # AZERBAIJAN
|
159
|
+
:BS => 17, # BAHAMAS
|
160
|
+
:BH => 18, # BAHRAIN
|
161
|
+
:BD => 19, # BANGLADESH
|
162
|
+
:BB => 20, # BARBADOS
|
163
|
+
:BY => 21, # BELARUS
|
164
|
+
:BE => 22, # BELGIUM
|
165
|
+
:BZ => 23, # BELIZE
|
166
|
+
:BJ => 24, # BENIN
|
167
|
+
:BM => 25, # BERMUDA
|
168
|
+
:BT => 26, # BHUTAN
|
169
|
+
:BO => 27, # BOLIVIA
|
170
|
+
:BA => 28, # BOS. A. HERZEGOV.
|
171
|
+
:BW => 29, # BOTSWANA
|
172
|
+
:BV => 30, # BOUVET ISLAND
|
173
|
+
:BR => 31, # BRAZIL
|
174
|
+
:IO => 32, # BR. IND. O.T.
|
175
|
+
:BN => 33, # BRUNEI DARUSSALAM
|
176
|
+
:BG => 34, # BULGARIA
|
177
|
+
:BF => 35, # BURKINA FASO
|
178
|
+
:BI => 36, # BURUNDI
|
179
|
+
:KH => 37, # CAMBODIA
|
180
|
+
:CM => 38, # CAMEROON
|
181
|
+
:CA => 39, # CANADA
|
182
|
+
:CV => 40, # CAPE VERDE
|
183
|
+
:KY => 41, # CAYMAN ISLANDS
|
184
|
+
:CF => 42, # C.A.R.
|
185
|
+
:TD => 43, # CHAD
|
186
|
+
:CL => 44, # CHILE
|
187
|
+
:CN => 45, # CHINA
|
188
|
+
:CX => 46, # CHRISTMAS ISLAND
|
189
|
+
:CC => 47, # COCOS ISLANDS
|
190
|
+
:CO => 48, # COLOMBIA
|
191
|
+
:KM => 49, # COMOROS
|
192
|
+
:CG => 50, # CONGO
|
193
|
+
:CD => 51, # CONGO
|
194
|
+
:CK => 52, # COOK ISLANDS
|
195
|
+
:CR => 53, # COSTA RICA
|
196
|
+
:CI => 54, # COTE D'IVOIRE
|
197
|
+
:HR => 55, # CROATIA
|
198
|
+
:CU => 56, # CUBA
|
199
|
+
:CY => 57, # CYPRUS
|
200
|
+
:CZ => 58, # CZECH REPUBLIC
|
201
|
+
:DK => 59, # DENMARK
|
202
|
+
:DJ => 60, # DJIBOUTI
|
203
|
+
:DM => 61, # DOMINICA
|
204
|
+
:DO => 62, # DOMINICAN REPUBLIC
|
205
|
+
:EC => 63, # ECUADOR
|
206
|
+
:EG => 64, # EGYPT
|
207
|
+
:SV => 65, # EL SALVADOR
|
208
|
+
:GQ => 66, # EQUATORIAL GUINEA
|
209
|
+
:ER => 67, # ERITREA
|
210
|
+
:EE => 68, # ESTONIA
|
211
|
+
:ET => 69, # ETHIOPIA
|
212
|
+
:FK => 70, # FALKLAND ISLANDS
|
213
|
+
:FO => 71, # FAROE ISLANDS
|
214
|
+
:FJ => 72, # FIJI
|
215
|
+
:FI => 73, # FINLAND
|
216
|
+
:FR => 74, # FRANCE
|
217
|
+
:GF => 75, # FRENCH GUIANA
|
218
|
+
:PF => 76, # FRENCH POLYNESIA
|
219
|
+
:TF => 77, # FR.S. TERRITORIES
|
220
|
+
:GA => 78, # GABON
|
221
|
+
:GM => 79, # GAMBIA
|
222
|
+
:GE => 80, # GEORGIA
|
223
|
+
:DE => 81, # GERMANY
|
224
|
+
:GH => 82, # GHANA
|
225
|
+
:GI => 83, # GIBRALTAR
|
226
|
+
:GR => 84, # GREECE
|
227
|
+
:GL => 85, # GREENLAND
|
228
|
+
:GD => 86, # GRENADA
|
229
|
+
:GP => 87, # GUADELOUPE
|
230
|
+
:GU => 88, # GUAM
|
231
|
+
:GT => 89, # GUATEMALA
|
232
|
+
:GG => 90, # GUERNSEY
|
233
|
+
:GN => 91, # GUINEA
|
234
|
+
:GW => 92, # GUINEA-BISSAU
|
235
|
+
:GY => 93, # GUYANA
|
236
|
+
:HT => 94, # HAITI
|
237
|
+
:HM => 95, # HEARD A. MCD ISL.
|
238
|
+
:VA => 96, # HOLY SEE
|
239
|
+
:HN => 97, # HONDURAS
|
240
|
+
:HK => 98, # HONG KONG
|
241
|
+
:HU => 99, # HUNGARY
|
242
|
+
:IS => 100, # ICELAND
|
243
|
+
:IN => 101, # INDIA
|
244
|
+
:ID => 102, # INDONESIA
|
245
|
+
:IR => 103, # IRAN
|
246
|
+
:IQ => 104, # IRAQ
|
247
|
+
:IE => 105, # IRELAND
|
248
|
+
:IM => 106, # ISLE OF MAN
|
249
|
+
:IL => 107, # ISRAEL
|
250
|
+
:IT => 108, # ITALY
|
251
|
+
:JM => 109, # JAMAICA
|
252
|
+
:JP => 110, # JAPAN
|
253
|
+
:JE => 111, # JERSEY
|
254
|
+
:JO => 112, # JORDAN
|
255
|
+
:KZ => 113, # KAZAKHSTAN
|
256
|
+
:KE => 114, # KENYA
|
257
|
+
:KI => 115, # KIRIBATI
|
258
|
+
:KP => 116, # KOREA, D.P.R OF
|
259
|
+
:KR => 117, # KOREA, R. OF
|
260
|
+
:KW => 118, # KUWAIT
|
261
|
+
:KG => 119, # KYRGYZSTAN
|
262
|
+
:LA => 120, # LAO P.D.R
|
263
|
+
:LV => 121, # LATVIA
|
264
|
+
:LB => 122, # LEBANON
|
265
|
+
:LS => 123, # LESOTHO
|
266
|
+
:LR => 124, # LIBERIA
|
267
|
+
:LY => 125, # LIBYAN A.J.
|
268
|
+
:LI => 126, # LIECHTENSTEIN
|
269
|
+
:LT => 127, # LITHUANIA
|
270
|
+
:LU => 128, # LUXEMBOURG
|
271
|
+
:MO => 129, # MACAO
|
272
|
+
:MK => 130, # MACEDONIA
|
273
|
+
:MG => 131, # MADAGASCAR
|
274
|
+
:MW => 132, # MALAWI
|
275
|
+
:MY => 133, # MALAYSIA
|
276
|
+
:MV => 134, # MALDIVES
|
277
|
+
:ML => 135, # MALI
|
278
|
+
:MT => 136, # MALTA
|
279
|
+
:MH => 137, # MARSHALL ISLANDS
|
280
|
+
:MQ => 138, # MARTINIQUE
|
281
|
+
:MR => 139, # MAURITANIA
|
282
|
+
:MU => 140, # MAURITIUS
|
283
|
+
:YT => 141, # MAYOTTE
|
284
|
+
:MX => 142, # MEXICO
|
285
|
+
:FM => 143, # MICRONESIA
|
286
|
+
:MD => 144, # MOLDOVA
|
287
|
+
:MC => 145, # MONACO
|
288
|
+
:MN => 146, # MONGOLIA
|
289
|
+
:MS => 147, # MONTSERRAT
|
290
|
+
:MA => 148, # MOROCCO
|
291
|
+
:MZ => 149, # MOZAMBIQUE
|
292
|
+
:MM => 150, # MYANMAR
|
293
|
+
:NA => 151, # NAMIBIA
|
294
|
+
:NR => 152, # NAURU
|
295
|
+
:NP => 153, # NEPAL
|
296
|
+
:NL => 154, # NETHERLANDS
|
297
|
+
:AN => 155, # NETH. ANTILLES
|
298
|
+
:NC => 156, # NEW CALEDONIA
|
299
|
+
:NZ => 157, # NEW ZEALAND
|
300
|
+
:NI => 158, # NICARAGUA
|
301
|
+
:NE => 159, # NIGER
|
302
|
+
:NG => 160, # NIGERIA
|
303
|
+
:NU => 161, # NIUE
|
304
|
+
:NF => 162, # NORFOLK ISLAND
|
305
|
+
:MP => 163, # N.MARIANA ISLANDS
|
306
|
+
:NO => 164, # NORWAY
|
307
|
+
:OM => 165, # OMAN
|
308
|
+
:PK => 166, # PAKISTAN
|
309
|
+
:PW => 167, # PALAU
|
310
|
+
:PS => 168, # PALESTINIAN T.O
|
311
|
+
:PA => 169, # PANAMA
|
312
|
+
:PG => 170, # PAPUA NEW GUINEA
|
313
|
+
:PY => 171, # PARAGUAY
|
314
|
+
:PE => 172, # PERU
|
315
|
+
:PH => 173, # PHILIPPINES
|
316
|
+
:PN => 174, # PITCAIRN
|
317
|
+
:PL => 175, # POLAND
|
318
|
+
:PT => 176, # PORTUGAL
|
319
|
+
:PR => 177, # PUERTO RICO
|
320
|
+
:QA => 178, # QATAR
|
321
|
+
:RE => 179, # REUNION
|
322
|
+
:RO => 180, # ROMANIA
|
323
|
+
:RU => 181, # RUSSIAN FED.
|
324
|
+
:RW => 182, # RWANDA
|
325
|
+
:SH => 183, # SAINT HELENA
|
326
|
+
:KN => 184, # ST KITTS A. NEVIS
|
327
|
+
:LC => 185, # SAINT LUCIA
|
328
|
+
:PM => 186, # ST P A MIQUELON
|
329
|
+
:VC => 187, # ST V A THE GRENA.
|
330
|
+
:WS => 188, # SAMOA
|
331
|
+
:SM => 189, # SAN MARINO
|
332
|
+
:ST => 190, # S.TOME A PRINCIPE
|
333
|
+
:SA => 191, # SAUDI ARABIA
|
334
|
+
:SN => 192, # SENEGAL
|
335
|
+
:CS => 193, # SERB. A. MONTE.
|
336
|
+
:SC => 194, # SEYCHELLES
|
337
|
+
:SL => 195, # SIERRA LEONE
|
338
|
+
:SG => 196, # SINGAPORE
|
339
|
+
:SK => 197, # SLOVAKIA
|
340
|
+
:SI => 198, # SLOVENIA
|
341
|
+
:SB => 199, # SOLOMON ISLANDS
|
342
|
+
:SO => 200, # SOMALIA
|
343
|
+
:ZA => 201, # SOUTH AFRICA
|
344
|
+
:GS => 202, # S.GEORGIA ATSSI
|
345
|
+
:ES => 203, # SPAIN
|
346
|
+
:LK => 204, # SRI LANKA
|
347
|
+
:SD => 205, # SUDAN
|
348
|
+
:SR => 206, # SURINAME
|
349
|
+
:SJ => 207, # SVALB. A J.MAYEN
|
350
|
+
:SZ => 208, # SWAZILAND
|
351
|
+
:SE => 209, # SWEDEN
|
352
|
+
:CH => 210, # SWITZERLAND
|
353
|
+
:SY => 211, # SYRIAN A.R
|
354
|
+
:TW => 212, # TAIWAN P.O. CHINA
|
355
|
+
:TJ => 213, # TAJIKISTAN
|
356
|
+
:TZ => 214, # TANZANIA
|
357
|
+
:TH => 215, # THAILAND
|
358
|
+
:TL => 216, # TIMOR-LESTE
|
359
|
+
:TG => 217, # TOGO
|
360
|
+
:TK => 218, # TOKELAU
|
361
|
+
:TO => 219, # TONGA
|
362
|
+
:TT => 220, # TR. AND TOBAGO
|
363
|
+
:TN => 221, # TUNISIA
|
364
|
+
:TR => 222, # TURKEY
|
365
|
+
:TM => 223, # TURKMENISTAN
|
366
|
+
:TC => 224, # T. A CAICOS ISL.
|
367
|
+
:TV => 225, # TUVALU
|
368
|
+
:UG => 226, # UGANDA
|
369
|
+
:UA => 227, # UKRAINE
|
370
|
+
:AE => 228, # U.A.E
|
371
|
+
:GB => 229, # UNITED KINGDOM
|
372
|
+
:US => 230, # UNITED STATES
|
373
|
+
:UM => 231, # US M.O. ISLANDS
|
374
|
+
:UY => 232, # URUGUAY
|
375
|
+
:UZ => 233, # UZBEKISTAN
|
376
|
+
:VU => 234, # VANUATU
|
377
|
+
:VE => 235, # VENEZUELA
|
378
|
+
:VN => 236, # VIET NAM
|
379
|
+
:VG => 237, # VIRGIN ISLANDS BR
|
380
|
+
:VI => 238, # VIRGIN ISLANDS US
|
381
|
+
:WF => 239, # WALLIS AND FUTUNA
|
382
|
+
:EH => 240, # WESTERN SAHARA
|
383
|
+
:YE => 241, # YEMEN
|
384
|
+
:ZM => 242, # ZAMBIA
|
385
|
+
:ZW => 243 # ZIMBABWE
|
386
|
+
}.freeze
|
387
|
+
|
388
|
+
# -----------------------------------------------------------------------
|
389
|
+
# Mode: Language (ISO639)
|
390
|
+
# -----------------------------------------------------------------------
|
391
|
+
LANGUAGES = {
|
392
|
+
:AA => 1, # Afar
|
393
|
+
:AB => 2, # Abkhazian
|
394
|
+
:AE => 3, # Avestan
|
395
|
+
:AF => 4, # Afrikaans
|
396
|
+
:AM => 5, # Amharic
|
397
|
+
:AR => 6, # Arabic
|
398
|
+
:AS => 7, # Assamese
|
399
|
+
:AY => 8, # Aymara
|
400
|
+
:AZ => 9, # Azerbaijani
|
401
|
+
:BA => 10, # Bashkir
|
402
|
+
:BE => 11, # Belarusian
|
403
|
+
:BG => 12, # Bulgarian
|
404
|
+
:BH => 13, # Bihari
|
405
|
+
:BI => 14, # Bislama
|
406
|
+
:BN => 15, # Bengali; Bangla
|
407
|
+
:BO => 16, # Tibetan
|
408
|
+
:BR => 17, # Breton
|
409
|
+
:BS => 18, # Bosnian
|
410
|
+
:CA => 19, # Catalan
|
411
|
+
:CE => 20, # Chechen
|
412
|
+
:CH => 21, # Chamorro
|
413
|
+
:CO => 22, # Corsican
|
414
|
+
:CS => 23, # Czech
|
415
|
+
:CU => 24, # Church Slavic
|
416
|
+
:CV => 25, # Chuvash
|
417
|
+
:CY => 26, # Welsh
|
418
|
+
:DA => 27, # Danish
|
419
|
+
:DE => 28, # German
|
420
|
+
:DZ => 29, # Dzongkha; Bhutani
|
421
|
+
:EL => 30, # Greek
|
422
|
+
:EN => 31, # English
|
423
|
+
:EO => 32, # Esperanto
|
424
|
+
:ES => 33, # Spanish
|
425
|
+
:ET => 34, # Estonian
|
426
|
+
:EU => 35, # Basque
|
427
|
+
:FA => 36, # Persian
|
428
|
+
:FI => 37, # Finnish
|
429
|
+
:FJ => 38, # Fijian; Fiji
|
430
|
+
:FO => 39, # Faroese
|
431
|
+
:FR => 40, # French
|
432
|
+
:FY => 41, # Frisian
|
433
|
+
:GA => 42, # Irish
|
434
|
+
:GD => 43, # Scots; Gaelic
|
435
|
+
:GL => 44, # Gallegan; Galician
|
436
|
+
:GN => 45, # Guarani
|
437
|
+
:GU => 46, # Gujarati
|
438
|
+
:GV => 47, # Manx
|
439
|
+
:HA => 48, # Hausa (?)
|
440
|
+
:HE => 49, # Hebrew
|
441
|
+
:HI => 50, # Hindi
|
442
|
+
:HO => 51, # Hiri Motu
|
443
|
+
:HR => 52, # Croatian
|
444
|
+
:HU => 53, # Hungarian
|
445
|
+
:HY => 54, # Armenian
|
446
|
+
:HZ => 55, # Herero
|
447
|
+
:IA => 56, # Interlingua
|
448
|
+
:ID => 57, # Indonesian
|
449
|
+
:IE => 58, # Interlingue
|
450
|
+
:IK => 59, # Inupiak
|
451
|
+
:IO => 60, # Ido
|
452
|
+
:IS => 61, # Icelandic
|
453
|
+
:IT => 62, # Italian
|
454
|
+
:IU => 63, # Inuktitut
|
455
|
+
:JA => 64, # Japanese
|
456
|
+
:JV => 65, # Javanese
|
457
|
+
:KA => 66, # Georgian
|
458
|
+
:KI => 67, # Kikuyu
|
459
|
+
:KJ => 68, # Kuanyama
|
460
|
+
:KK => 69, # Kazakh
|
461
|
+
:KL => 70, # Kalaallisut
|
462
|
+
:KM => 71, # Khmer; Cambodian
|
463
|
+
:KN => 72, # Kannada
|
464
|
+
:KO => 73, # Korean
|
465
|
+
:KS => 74, # Kashmiri
|
466
|
+
:KU => 75, # Kurdish
|
467
|
+
:KV => 76, # Komi
|
468
|
+
:KW => 77, # Cornish
|
469
|
+
:KY => 78, # Kirghiz
|
470
|
+
:LA => 79, # Latin
|
471
|
+
:LB => 80, # Letzeburgesch
|
472
|
+
:LN => 81, # Lingala
|
473
|
+
:LO => 82, # Lao; Laotian
|
474
|
+
:LT => 83, # Lithuanian
|
475
|
+
:LV => 84, # Latvian; Lettish
|
476
|
+
:MG => 85, # Malagasy
|
477
|
+
:MH => 86, # Marshall
|
478
|
+
:MI => 87, # Maori
|
479
|
+
:MK => 88, # Macedonian
|
480
|
+
:ML => 89, # Malayalam
|
481
|
+
:MN => 90, # Mongolian
|
482
|
+
:MO => 91, # Moldavian
|
483
|
+
:MR => 92, # Marathi
|
484
|
+
:MS => 93, # Malay
|
485
|
+
:MT => 94, # Maltese
|
486
|
+
:MY => 95, # Burmese
|
487
|
+
:NA => 96, # Nauru
|
488
|
+
:NB => 97, # Norwegian Bokmål
|
489
|
+
:ND => 98, # Ndebele, North
|
490
|
+
:NE => 99, # Nepali
|
491
|
+
:NG => 100, # Ndonga
|
492
|
+
:NL => 101, # Dutch
|
493
|
+
:NN => 102, # Norwegian Nynorsk
|
494
|
+
:NO => 103, # Norwegian
|
495
|
+
:NR => 104, # Ndebele, South
|
496
|
+
:NV => 105, # Navajo
|
497
|
+
:NY => 106, # Chichewa; Nyanja
|
498
|
+
:OC => 107, # Occitan; Provençal
|
499
|
+
:OM => 108, # (Afan) Oromo
|
500
|
+
:OR => 109, # Oriya
|
501
|
+
:OS => 110, # Ossetian; Ossetic
|
502
|
+
:PA => 111, # Panjabi; Punjabi
|
503
|
+
:PI => 112, # Pali
|
504
|
+
:PL => 113, # Polish
|
505
|
+
:PS => 114, # Pashto, Pushto
|
506
|
+
:PT => 115, # Portuguese
|
507
|
+
:QU => 116, # Quechua
|
508
|
+
:RM => 117, # Rhaeto-Romance
|
509
|
+
:RN => 118, # Rundi; Kirundi
|
510
|
+
:RO => 119, # Romanian
|
511
|
+
:RU => 120, # Russian
|
512
|
+
:RW => 121, # Kinyarwanda
|
513
|
+
:SA => 122, # Sanskrit
|
514
|
+
:SC => 123, # Sardinian
|
515
|
+
:SD => 124, # Sindhi
|
516
|
+
:SE => 125, # Northern Sami
|
517
|
+
:SG => 126, # Sango; Sangro
|
518
|
+
:SI => 127, # Sinhalese
|
519
|
+
:SK => 128, # Slovak
|
520
|
+
:SL => 129, # Slovenian
|
521
|
+
:SM => 130, # Samoan
|
522
|
+
:SN => 131, # Shona
|
523
|
+
:SO => 132, # Somali
|
524
|
+
:SQ => 133, # Albanian
|
525
|
+
:SR => 134, # Serbian
|
526
|
+
:SS => 135, # Swati; Siswati
|
527
|
+
:ST => 136, # Sesotho
|
528
|
+
:SU => 137, # Sundanese
|
529
|
+
:SV => 138, # Swedish
|
530
|
+
:SW => 139, # Swahili
|
531
|
+
:TA => 140, # Tamil
|
532
|
+
:TE => 141, # Telugu
|
533
|
+
:TG => 142, # Tajik
|
534
|
+
:TH => 143, # Thai
|
535
|
+
:TI => 144, # Tigrinya
|
536
|
+
:TK => 145, # Turkmen
|
537
|
+
:TL => 146, # Tagalog
|
538
|
+
:TN => 147, # Tswana; Setswana
|
539
|
+
:TO => 148, # Tonga (?)
|
540
|
+
:TR => 149, # Turkish
|
541
|
+
:TS => 150, # Tsonga
|
542
|
+
:TT => 151, # Tatar
|
543
|
+
:TW => 152, # Twi
|
544
|
+
:TY => 153, # Tahitian
|
545
|
+
:UG => 154, # Uighur
|
546
|
+
:UK => 155, # Ukrainian
|
547
|
+
:UR => 156, # Urdu
|
548
|
+
:UZ => 157, # Uzbek
|
549
|
+
:VI => 158, # Vietnamese
|
550
|
+
:VO => 159, # Volapuk
|
551
|
+
:WA => 160, # Walloon
|
552
|
+
:WO => 161, # Wolof
|
553
|
+
:XH => 162, # Xhosa
|
554
|
+
:YI => 163, # Yiddish
|
555
|
+
:YO => 164, # Yoruba
|
556
|
+
:ZA => 165, # Zhuang
|
557
|
+
:ZH => 166, # Chinese
|
558
|
+
:ZU => 167 # Zulu
|
559
|
+
}.freeze
|
560
|
+
|
561
|
+
# -----------------------------------------------------------------------
|
562
|
+
# Mode: Interest Rates (TODO: Remove - deprecated?)
|
563
|
+
# -----------------------------------------------------------------------
|
564
|
+
INTEREST_RATES = {
|
565
|
+
:SE => 19.50,
|
566
|
+
:NO => 22.00,
|
567
|
+
:DK => 21.60,
|
568
|
+
:FI => 22.00,
|
569
|
+
:DE => 14.95,
|
570
|
+
:NL => 14.95
|
571
|
+
}.freeze
|
572
|
+
|
573
|
+
# -----------------------------------------------------------------------
|
574
|
+
# Amounts
|
575
|
+
# -----------------------------------------------------------------------
|
576
|
+
|
577
|
+
LOWEST_PAYMENT_BY_COUNTRY = {
|
578
|
+
:SE => 5000.00,
|
579
|
+
:NO => 9500.00,
|
580
|
+
:FI => 895.00,
|
581
|
+
:DK => 8900.00,
|
582
|
+
:DE => 695.00,
|
583
|
+
:NL => 500.00
|
584
|
+
}.freeze
|
585
|
+
|
586
|
+
# TODO: Remove - deprecated?
|
587
|
+
LOWEST_PAYMENT_BY_CURRENCY = {
|
588
|
+
CURRENCIES[:SEK] => 5000.00,
|
589
|
+
CURRENCIES[:NOK] => 9500.00,
|
590
|
+
CURRENCIES[:EUR] => 895.00,
|
591
|
+
CURRENCIES[:DKK] => 8900.00
|
592
|
+
}.freeze
|
593
|
+
|
594
|
+
# -----------------------------------------------------------------------
|
595
|
+
# Country defaults
|
596
|
+
# -----------------------------------------------------------------------
|
597
|
+
COUNTRY_DEFAULTS = {
|
598
|
+
:SE => {
|
599
|
+
:country => COUNTRIES[:SE],
|
600
|
+
:lang => LANGUAGES[:SV],
|
601
|
+
:currency => CURRENCIES[:SEK],
|
602
|
+
:pno => PNO_FORMATS[:SE]
|
603
|
+
},
|
604
|
+
:NO => {
|
605
|
+
:country => COUNTRIES[:NO],
|
606
|
+
:lang => LANGUAGES[:NO],
|
607
|
+
:currency => CURRENCIES[:NOK],
|
608
|
+
:pno => PNO_FORMATS[:NO]
|
609
|
+
},
|
610
|
+
:DK => {
|
611
|
+
:country => COUNTRIES[:DK],
|
612
|
+
:lang => LANGUAGES[:DA],
|
613
|
+
:currency => CURRENCIES[:DKK],
|
614
|
+
:pno => PNO_FORMATS[:DK]
|
615
|
+
},
|
616
|
+
:FI => {
|
617
|
+
:country => COUNTRIES[:FI],
|
618
|
+
:lang => LANGUAGES[:FI],
|
619
|
+
:currency => CURRENCIES[:EUR],
|
620
|
+
:pno => PNO_FORMATS[:FI]
|
621
|
+
},
|
622
|
+
:DE => {
|
623
|
+
:country => COUNTRIES[:DE],
|
624
|
+
:lang => LANGUAGES[:DE],
|
625
|
+
:currency => CURRENCIES[:EUR],
|
626
|
+
:pno => PNO_FORMATS[:DE]
|
627
|
+
},
|
628
|
+
:NL => {
|
629
|
+
:country => COUNTRIES[:NL],
|
630
|
+
:lang => LANGUAGES[:NL],
|
631
|
+
:currency => CURRENCIES[:EUR],
|
632
|
+
:pno => PNO_FORMATS[:NL]
|
633
|
+
}
|
634
|
+
}.freeze
|
635
|
+
|
636
|
+
end
|
637
|
+
end
|
638
|
+
end
|