LitleOnline 8.13.1 → 8.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,5 +39,29 @@ module LitleOnline
39
39
  exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_redeposit(hash)}
40
40
  assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
41
41
  end
42
+
43
+ def test_echeck_redeposit_withecheckmissingfield
44
+ hash = {
45
+ 'merchantId' => '101',
46
+ 'version'=>'8.8',
47
+ 'reportGroup'=>'Planets',
48
+ 'litleTxnId'=>'123456',
49
+ 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','checkNum'=>'123455'}
50
+ }
51
+ exception = assert_raise(RuntimeError) {LitleOnlineRequest.new.echeck_redeposit(hash)}
52
+ assert_match /If echeck is specified, it must have a routingNum/, exception.message
53
+ end
54
+
55
+ def test_echeck_redeposit_with_echeck_token_missing_field
56
+ hash = {
57
+ 'merchantId' => '101',
58
+ 'version'=>'8.8',
59
+ 'reportGroup'=>'Planets',
60
+ 'litleTxnId'=>'123456',
61
+ 'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','checkNum'=>'123455'}
62
+ }
63
+ exception = assert_raise(RuntimeError) {LitleOnlineRequest.new.echeck_redeposit(hash)}
64
+ assert_match /If echeckToken is specified, it must have a routingNum/, exception.message
65
+ end
42
66
  end
43
67
  end
@@ -45,7 +45,7 @@ module LitleOnline
45
45
  'expDate' =>'1210'
46
46
  },
47
47
  'token'=> {
48
- 'litleToken'=>'1234',
48
+ 'litleToken'=>'1234567890123',
49
49
  'expDate'=>'1210',
50
50
  'cardValidationNum'=>'555',
51
51
  'type'=>'VI'
@@ -76,7 +76,7 @@ module LitleOnline
76
76
  'cardValidationNum'=>'555',
77
77
  'type'=>'VI'},
78
78
  'token'=> {
79
- 'litleToken'=>'1234',
79
+ 'litleToken'=>'1234567890123',
80
80
  'expDate'=>'1210',
81
81
  'cardValidationNum'=>'555',
82
82
  'type'=>'VI'
@@ -93,7 +93,7 @@ module LitleOnline
93
93
  'expDate' =>'1210'
94
94
  },
95
95
  'token'=> {
96
- 'litleToken'=>'1234',
96
+ 'litleToken'=>'1234567890123',
97
97
  'expDate'=>'1210',
98
98
  'cardValidationNum'=>'555',
99
99
  'type'=>'VI'
@@ -187,7 +187,7 @@ module LitleOnline
187
187
  'token'=>'1234',
188
188
  'transactionId'=>'123456'},
189
189
  'token'=> {
190
- 'litleToken'=>'1234',
190
+ 'litleToken'=>'1234567890123',
191
191
  'expDate'=>'1210',
192
192
  'cardValidationNum'=>'555',
193
193
  'type'=>'VI'
@@ -248,6 +248,25 @@ module LitleOnline
248
248
  XMLObject.expects(:new)
249
249
  Communications.expects(:http_post).with(regexp_matches(/.*<sale.*?<fraudFilterOverride>false<\/fraudFilterOverride>.*?<\/sale>.*/m),kind_of(Hash))
250
250
  LitleOnlineRequest.new.sale(hash)
251
- end
251
+ end
252
+
253
+ def test_illegal_card_type
254
+ hash = {
255
+ 'merchantId' => '101',
256
+ 'version'=>'8.8',
257
+ 'reportGroup'=>'Planets',
258
+ 'litleTxnId'=>'123456',
259
+ 'orderId'=>'12344',
260
+ 'amount'=>'106',
261
+ 'orderSource'=>'ecommerce',
262
+ 'card'=>{
263
+ 'type'=>'NO',
264
+ 'number' =>'4100000000000002',
265
+ 'expDate' =>'1210'
266
+ }}
267
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
268
+ assert_match /If card type is specified, it must be in /, exception.message
269
+ end
270
+
252
271
  end
253
272
  end
@@ -66,7 +66,19 @@ module LitleOnline
66
66
  exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
67
67
  assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
68
68
  end
69
-
69
+
70
+ def test_token_echeck_missing_required
71
+ hash = {
72
+ 'merchantId' => '101',
73
+ 'version'=>'8.8',
74
+ 'reportGroup'=>'Planets',
75
+ 'orderId'=>'12344',
76
+ 'echeckForToken'=>{'routingNum'=>'132344565'}
77
+ }
78
+ exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
79
+ assert_match /If echeckForToken is specified, it must have a accNum/, exception.message
80
+ end
81
+
70
82
  end
71
83
 
72
84
  end
@@ -92,8 +92,8 @@ module LitleOnline
92
92
  'enhancedData'=>
93
93
  {
94
94
  'detailTax'=>[
95
- {'taxIncludedInTotal'=>'true', 'taxTypeIdentifier'=>'00'},
96
- {'taxIncludedInTotal'=>'false', 'taxTypeIdentifier'=>'01'}
95
+ {'taxIncludedInTotal'=>'true', 'taxTypeIdentifier'=>'00', 'taxAmount'=>'0'},
96
+ {'taxIncludedInTotal'=>'false', 'taxTypeIdentifier'=>'01', 'taxAmount'=>'0'}
97
97
  ]
98
98
  }
99
99
  }
@@ -127,7 +127,2389 @@ module LitleOnline
127
127
  LitleXmlMapper.expects(:request).with(regexp_matches(/.*<enhancedData>.*<detailTax>.*<taxAmount>5<\/taxAmount>.*<\/detailTax>.*<detailTax>.*<taxAmount>6<\/taxAmount>.*<\/detailTax>.*<lineItemData>.*<itemSequenceNumber>1<\/itemSequenceNumber>.*<itemDescription>desc1<\/itemDescription>.*<detailTax>.*<taxAmount>1<\/taxAmount>.*<\/detailTax>.*<detailTax>.*<taxAmount>2<\/taxAmount>.*<\/detailTax>.*<\/lineItemData>.*<lineItemData>.*<itemSequenceNumber>2<\/itemSequenceNumber>.*<itemDescription>desc2<\/itemDescription>.*<detailTax>.*<taxAmount>3<\/taxAmount>.*<\/detailTax>.*<detailTax>.*<taxAmount>4<\/taxAmount>.*<\/detailTax>.*<\/lineItemData>.*<\/enhancedData>.*/m), is_a(Hash))
128
128
  LitleOnlineRequest.new.authorization(hash)
129
129
  end
130
+
131
+ def test_customerinfo_employerName_xml
132
+ hash = {
133
+ 'merchantId' => '101',
134
+ 'version'=>'8.8',
135
+ 'reportGroup'=>'Planets',
136
+ 'customerInfo'=>
137
+ {
138
+ 'employerName'=>'Greg'
139
+ }
140
+ }
130
141
 
142
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<customerInfo>.*<employerName>Greg<\/employerName>.*<\/customerInfo>.*.*/m), is_a(Hash))
143
+ LitleOnlineRequest.new.authorization(hash)
144
+ end
145
+
146
+ def test_billMeLaterRequest_bmlProductType_xml
147
+ hash = {
148
+ 'merchantId' => '101',
149
+ 'version'=>'8.8',
150
+ 'reportGroup'=>'Planets',
151
+ 'billMeLaterRequest'=>
152
+ {
153
+ 'bmlProductType'=>'12'
154
+ }
155
+ }
156
+
157
+ LitleXmlMapper.expects(:request).with(regexp_matches(/.*<billMeLaterRequest>.*<bmlProductType>12<\/bmlProductType>.*<\/billMeLaterRequest>.*.*/m), is_a(Hash))
158
+ LitleOnlineRequest.new.authorization(hash)
131
159
  end
132
160
 
133
- end
161
+
162
+ def test_contact_name
163
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).name)
164
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'name'=>'abc' }}).name)
165
+ assert_equal("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", Contact.from_hash({ 'contact'=>{'name'=>'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' }}).name)
166
+ exception = assert_raise(RuntimeError){
167
+ Contact.from_hash({ 'contact'=>{'name'=>'12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901' }})
168
+ }
169
+ assert_equal "If contact name is specified, it must be between 1 and 100 characters long", exception.message
170
+ end
171
+
172
+ def test_contact_firstName
173
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).firstName)
174
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'firstName'=>'abc' }}).firstName)
175
+ assert_equal("1234567890123456789012345", Contact.from_hash({ 'contact'=>{'firstName'=>'1234567890123456789012345' }}).firstName)
176
+ exception = assert_raise(RuntimeError){
177
+ Contact.from_hash({ 'contact'=>{'firstName'=>'12345678901234567890123456' }})
178
+ }
179
+ assert_equal "If contact firstName is specified, it must be between 1 and 25 characters long", exception.message
180
+ end
181
+
182
+ def test_contact_middleInitial
183
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).middleInitial)
184
+ assert_equal("A", Contact.from_hash({ 'contact'=>{'middleInitial'=>'A' }}).middleInitial)
185
+ exception = assert_raise(RuntimeError){
186
+ Contact.from_hash({ 'contact'=>{'middleInitial'=>'AB' }})
187
+ }
188
+ assert_equal "If contact middleInitial is specified, it must be between 1 and 1 characters long", exception.message
189
+ end
190
+
191
+ def test_contact_lastName
192
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).lastName)
193
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'lastName'=>'abc' }}).lastName)
194
+ assert_equal("1234567890123456789012345", Contact.from_hash({ 'contact'=>{'lastName'=>'1234567890123456789012345' }}).lastName)
195
+ exception = assert_raise(RuntimeError){
196
+ Contact.from_hash({ 'contact'=>{'lastName'=>'12345678901234567890123456' }})
197
+ }
198
+ assert_equal "If contact lastName is specified, it must be between 1 and 25 characters long", exception.message
199
+ end
200
+
201
+ def test_contact_companyName
202
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).companyName)
203
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'companyName'=>'abc' }}).companyName)
204
+ assert_equal("1234567890123456789012345678901234567890", Contact.from_hash({ 'contact'=>{'companyName'=>'1234567890123456789012345678901234567890' }}).companyName)
205
+ exception = assert_raise(RuntimeError){
206
+ Contact.from_hash({ 'contact'=>{'companyName'=>'12345678901234567890123456789012345678901' }})
207
+ }
208
+ assert_equal "If contact companyName is specified, it must be between 1 and 40 characters long", exception.message
209
+ end
210
+
211
+ def test_contact_addressLine1
212
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).addressLine1)
213
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'addressLine1'=>'abc' }}).addressLine1)
214
+ assert_equal("12345678901234567890123456789012345", Contact.from_hash({ 'contact'=>{'addressLine1'=>'12345678901234567890123456789012345' }}).addressLine1)
215
+ exception = assert_raise(RuntimeError){
216
+ Contact.from_hash({ 'contact'=>{'addressLine1'=>'123456789012345678901234567890123456' }})
217
+ }
218
+ assert_equal "If contact addressLine1 is specified, it must be between 1 and 35 characters long", exception.message
219
+ end
220
+
221
+ def test_contact_addressLine2
222
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).addressLine2)
223
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'addressLine2'=>'abc' }}).addressLine2)
224
+ assert_equal("12345678901234567890123456789012345", Contact.from_hash({ 'contact'=>{'addressLine2'=>'12345678901234567890123456789012345' }}).addressLine2)
225
+ exception = assert_raise(RuntimeError){
226
+ Contact.from_hash({ 'contact'=>{'addressLine2'=>'123456789012345678901234567890123456' }})
227
+ }
228
+ assert_equal "If contact addressLine2 is specified, it must be between 1 and 35 characters long", exception.message
229
+ end
230
+
231
+ def test_contact_addressLine3
232
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).addressLine3)
233
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'addressLine3'=>'abc' }}).addressLine3)
234
+ assert_equal("12345678901234567890123456789012345", Contact.from_hash({ 'contact'=>{'addressLine3'=>'12345678901234567890123456789012345' }}).addressLine3)
235
+ exception = assert_raise(RuntimeError){
236
+ Contact.from_hash({ 'contact'=>{'addressLine3'=>'123456789012345678901234567890123456' }})
237
+ }
238
+ assert_equal "If contact addressLine3 is specified, it must be between 1 and 35 characters long", exception.message
239
+ end
240
+
241
+ def test_contact_city
242
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).city)
243
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'city'=>'abc' }}).city)
244
+ assert_equal("12345678901234567890123456789012345", Contact.from_hash({ 'contact'=>{'city'=>'12345678901234567890123456789012345' }}).city)
245
+ exception = assert_raise(RuntimeError){
246
+ Contact.from_hash({ 'contact'=>{'city'=>'123456789012345678901234567890123456' }})
247
+ }
248
+ assert_equal "If contact city is specified, it must be between 1 and 35 characters long", exception.message
249
+ end
250
+
251
+ def test_contact_state
252
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).state)
253
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'state'=>'abc' }}).state)
254
+ assert_equal("123456789012345678901234567890", Contact.from_hash({ 'contact'=>{'state'=>'123456789012345678901234567890' }}).state)
255
+ exception = assert_raise(RuntimeError){
256
+ Contact.from_hash({ 'contact'=>{'state'=>'1234567890123456789012345678901' }})
257
+ }
258
+ assert_equal "If contact state is specified, it must be between 1 and 30 characters long", exception.message
259
+ end
260
+
261
+ def test_contact_zip
262
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).zip)
263
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'zip'=>'abc' }}).zip)
264
+ assert_equal("12345678901234567890", Contact.from_hash({ 'contact'=>{'zip'=>'12345678901234567890' }}).zip)
265
+ exception = assert_raise(RuntimeError){
266
+ Contact.from_hash({ 'contact'=>{'zip'=>'123456789012345678901' }})
267
+ }
268
+ assert_equal "If contact zip is specified, it must be between 1 and 20 characters long", exception.message
269
+ end
270
+
271
+ def test_contact_country
272
+ assert_equal("USA", Contact.from_hash({ 'contact'=>{'country'=>'USA' }}).country)
273
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).country)
274
+ assert_equal("AF", Contact.from_hash({ 'contact'=>{'country'=>'AF' }}).country)
275
+ assert_equal("AX", Contact.from_hash({ 'contact'=>{'country'=>'AX' }}).country)
276
+ assert_equal("AL", Contact.from_hash({ 'contact'=>{'country'=>'AL' }}).country)
277
+ assert_equal("DZ", Contact.from_hash({ 'contact'=>{'country'=>'DZ' }}).country)
278
+ assert_equal("AS", Contact.from_hash({ 'contact'=>{'country'=>'AS' }}).country)
279
+ assert_equal("AD", Contact.from_hash({ 'contact'=>{'country'=>'AD' }}).country)
280
+ assert_equal("AO", Contact.from_hash({ 'contact'=>{'country'=>'AO' }}).country)
281
+ assert_equal("AI", Contact.from_hash({ 'contact'=>{'country'=>'AI' }}).country)
282
+ assert_equal("AQ", Contact.from_hash({ 'contact'=>{'country'=>'AQ' }}).country)
283
+ assert_equal("AG", Contact.from_hash({ 'contact'=>{'country'=>'AG' }}).country)
284
+ assert_equal("AR", Contact.from_hash({ 'contact'=>{'country'=>'AR' }}).country)
285
+ assert_equal("AM", Contact.from_hash({ 'contact'=>{'country'=>'AM' }}).country)
286
+ assert_equal("AW", Contact.from_hash({ 'contact'=>{'country'=>'AW' }}).country)
287
+ assert_equal("AU", Contact.from_hash({ 'contact'=>{'country'=>'AU' }}).country)
288
+ assert_equal("AZ", Contact.from_hash({ 'contact'=>{'country'=>'AZ' }}).country)
289
+ assert_equal("BS", Contact.from_hash({ 'contact'=>{'country'=>'BS' }}).country)
290
+ assert_equal("BH", Contact.from_hash({ 'contact'=>{'country'=>'BH' }}).country)
291
+ assert_equal("BD", Contact.from_hash({ 'contact'=>{'country'=>'BD' }}).country)
292
+ assert_equal("BB", Contact.from_hash({ 'contact'=>{'country'=>'BB' }}).country)
293
+ assert_equal("BY", Contact.from_hash({ 'contact'=>{'country'=>'BY' }}).country)
294
+ assert_equal("BE", Contact.from_hash({ 'contact'=>{'country'=>'BE' }}).country)
295
+ assert_equal("BZ", Contact.from_hash({ 'contact'=>{'country'=>'BZ' }}).country)
296
+ assert_equal("BJ", Contact.from_hash({ 'contact'=>{'country'=>'BJ' }}).country)
297
+ assert_equal("BM", Contact.from_hash({ 'contact'=>{'country'=>'BM' }}).country)
298
+ assert_equal("BT", Contact.from_hash({ 'contact'=>{'country'=>'BT' }}).country)
299
+ assert_equal("BO", Contact.from_hash({ 'contact'=>{'country'=>'BO' }}).country)
300
+ assert_equal("BQ", Contact.from_hash({ 'contact'=>{'country'=>'BQ' }}).country)
301
+ assert_equal("BA", Contact.from_hash({ 'contact'=>{'country'=>'BA' }}).country)
302
+ assert_equal("BW", Contact.from_hash({ 'contact'=>{'country'=>'BW' }}).country)
303
+ assert_equal("BV", Contact.from_hash({ 'contact'=>{'country'=>'BV' }}).country)
304
+ assert_equal("BR", Contact.from_hash({ 'contact'=>{'country'=>'BR' }}).country)
305
+ assert_equal("IO", Contact.from_hash({ 'contact'=>{'country'=>'IO' }}).country)
306
+ assert_equal("BN", Contact.from_hash({ 'contact'=>{'country'=>'BN' }}).country)
307
+ assert_equal("BG", Contact.from_hash({ 'contact'=>{'country'=>'BG' }}).country)
308
+ assert_equal("BF", Contact.from_hash({ 'contact'=>{'country'=>'BF' }}).country)
309
+ assert_equal("BI", Contact.from_hash({ 'contact'=>{'country'=>'BI' }}).country)
310
+ assert_equal("KH", Contact.from_hash({ 'contact'=>{'country'=>'KH' }}).country)
311
+ assert_equal("CM", Contact.from_hash({ 'contact'=>{'country'=>'CM' }}).country)
312
+ assert_equal("CA", Contact.from_hash({ 'contact'=>{'country'=>'CA' }}).country)
313
+ assert_equal("CV", Contact.from_hash({ 'contact'=>{'country'=>'CV' }}).country)
314
+ assert_equal("KY", Contact.from_hash({ 'contact'=>{'country'=>'KY' }}).country)
315
+ assert_equal("CF", Contact.from_hash({ 'contact'=>{'country'=>'CF' }}).country)
316
+ assert_equal("TD", Contact.from_hash({ 'contact'=>{'country'=>'TD' }}).country)
317
+ assert_equal("CL", Contact.from_hash({ 'contact'=>{'country'=>'CL' }}).country)
318
+ assert_equal("CN", Contact.from_hash({ 'contact'=>{'country'=>'CN' }}).country)
319
+ assert_equal("CX", Contact.from_hash({ 'contact'=>{'country'=>'CX' }}).country)
320
+ assert_equal("CC", Contact.from_hash({ 'contact'=>{'country'=>'CC' }}).country)
321
+ assert_equal("CO", Contact.from_hash({ 'contact'=>{'country'=>'CO' }}).country)
322
+ assert_equal("KM", Contact.from_hash({ 'contact'=>{'country'=>'KM' }}).country)
323
+ assert_equal("CG", Contact.from_hash({ 'contact'=>{'country'=>'CG' }}).country)
324
+ assert_equal("CD", Contact.from_hash({ 'contact'=>{'country'=>'CD' }}).country)
325
+ assert_equal("CK", Contact.from_hash({ 'contact'=>{'country'=>'CK' }}).country)
326
+ assert_equal("CR", Contact.from_hash({ 'contact'=>{'country'=>'CR' }}).country)
327
+ assert_equal("CI", Contact.from_hash({ 'contact'=>{'country'=>'CI' }}).country)
328
+ assert_equal("HR", Contact.from_hash({ 'contact'=>{'country'=>'HR' }}).country)
329
+ assert_equal("CU", Contact.from_hash({ 'contact'=>{'country'=>'CU' }}).country)
330
+ assert_equal("CW", Contact.from_hash({ 'contact'=>{'country'=>'CW' }}).country)
331
+ assert_equal("CY", Contact.from_hash({ 'contact'=>{'country'=>'CY' }}).country)
332
+ assert_equal("CZ", Contact.from_hash({ 'contact'=>{'country'=>'CZ' }}).country)
333
+ assert_equal("DK", Contact.from_hash({ 'contact'=>{'country'=>'DK' }}).country)
334
+ assert_equal("DJ", Contact.from_hash({ 'contact'=>{'country'=>'DJ' }}).country)
335
+ assert_equal("DM", Contact.from_hash({ 'contact'=>{'country'=>'DM' }}).country)
336
+ assert_equal("DO", Contact.from_hash({ 'contact'=>{'country'=>'DO' }}).country)
337
+ assert_equal("TL", Contact.from_hash({ 'contact'=>{'country'=>'TL' }}).country)
338
+ assert_equal("EC", Contact.from_hash({ 'contact'=>{'country'=>'EC' }}).country)
339
+ assert_equal("EG", Contact.from_hash({ 'contact'=>{'country'=>'EG' }}).country)
340
+ assert_equal("SV", Contact.from_hash({ 'contact'=>{'country'=>'SV' }}).country)
341
+ assert_equal("GQ", Contact.from_hash({ 'contact'=>{'country'=>'GQ' }}).country)
342
+ assert_equal("ER", Contact.from_hash({ 'contact'=>{'country'=>'ER' }}).country)
343
+ assert_equal("EE", Contact.from_hash({ 'contact'=>{'country'=>'EE' }}).country)
344
+ assert_equal("ET", Contact.from_hash({ 'contact'=>{'country'=>'ET' }}).country)
345
+ assert_equal("FK", Contact.from_hash({ 'contact'=>{'country'=>'FK' }}).country)
346
+ assert_equal("FO", Contact.from_hash({ 'contact'=>{'country'=>'FO' }}).country)
347
+ assert_equal("FJ", Contact.from_hash({ 'contact'=>{'country'=>'FJ' }}).country)
348
+ assert_equal("FI", Contact.from_hash({ 'contact'=>{'country'=>'FI' }}).country)
349
+ assert_equal("FR", Contact.from_hash({ 'contact'=>{'country'=>'FR' }}).country)
350
+ assert_equal("GF", Contact.from_hash({ 'contact'=>{'country'=>'GF' }}).country)
351
+ assert_equal("PF", Contact.from_hash({ 'contact'=>{'country'=>'PF' }}).country)
352
+ assert_equal("TF", Contact.from_hash({ 'contact'=>{'country'=>'TF' }}).country)
353
+ assert_equal("GA", Contact.from_hash({ 'contact'=>{'country'=>'GA' }}).country)
354
+ assert_equal("GM", Contact.from_hash({ 'contact'=>{'country'=>'GM' }}).country)
355
+ assert_equal("GE", Contact.from_hash({ 'contact'=>{'country'=>'GE' }}).country)
356
+ assert_equal("DE", Contact.from_hash({ 'contact'=>{'country'=>'DE' }}).country)
357
+ assert_equal("GH", Contact.from_hash({ 'contact'=>{'country'=>'GH' }}).country)
358
+ assert_equal("GI", Contact.from_hash({ 'contact'=>{'country'=>'GI' }}).country)
359
+ assert_equal("GR", Contact.from_hash({ 'contact'=>{'country'=>'GR' }}).country)
360
+ assert_equal("GL", Contact.from_hash({ 'contact'=>{'country'=>'GL' }}).country)
361
+ assert_equal("GD", Contact.from_hash({ 'contact'=>{'country'=>'GD' }}).country)
362
+ assert_equal("GP", Contact.from_hash({ 'contact'=>{'country'=>'GP' }}).country)
363
+ assert_equal("GU", Contact.from_hash({ 'contact'=>{'country'=>'GU' }}).country)
364
+ assert_equal("GT", Contact.from_hash({ 'contact'=>{'country'=>'GT' }}).country)
365
+ assert_equal("GG", Contact.from_hash({ 'contact'=>{'country'=>'GG' }}).country)
366
+ assert_equal("GN", Contact.from_hash({ 'contact'=>{'country'=>'GN' }}).country)
367
+ assert_equal("GW", Contact.from_hash({ 'contact'=>{'country'=>'GW' }}).country)
368
+ assert_equal("GY", Contact.from_hash({ 'contact'=>{'country'=>'GY' }}).country)
369
+ assert_equal("HT", Contact.from_hash({ 'contact'=>{'country'=>'HT' }}).country)
370
+ assert_equal("HM", Contact.from_hash({ 'contact'=>{'country'=>'HM' }}).country)
371
+ assert_equal("HN", Contact.from_hash({ 'contact'=>{'country'=>'HN' }}).country)
372
+ assert_equal("HK", Contact.from_hash({ 'contact'=>{'country'=>'HK' }}).country)
373
+ assert_equal("HU", Contact.from_hash({ 'contact'=>{'country'=>'HU' }}).country)
374
+ assert_equal("IS", Contact.from_hash({ 'contact'=>{'country'=>'IS' }}).country)
375
+ assert_equal("IN", Contact.from_hash({ 'contact'=>{'country'=>'IN' }}).country)
376
+ assert_equal("ID", Contact.from_hash({ 'contact'=>{'country'=>'ID' }}).country)
377
+ assert_equal("IR", Contact.from_hash({ 'contact'=>{'country'=>'IR' }}).country)
378
+ assert_equal("IQ", Contact.from_hash({ 'contact'=>{'country'=>'IQ' }}).country)
379
+ assert_equal("IE", Contact.from_hash({ 'contact'=>{'country'=>'IE' }}).country)
380
+ assert_equal("IM", Contact.from_hash({ 'contact'=>{'country'=>'IM' }}).country)
381
+ assert_equal("IL", Contact.from_hash({ 'contact'=>{'country'=>'IL' }}).country)
382
+ assert_equal("IT", Contact.from_hash({ 'contact'=>{'country'=>'IT' }}).country)
383
+ assert_equal("JM", Contact.from_hash({ 'contact'=>{'country'=>'JM' }}).country)
384
+ assert_equal("JP", Contact.from_hash({ 'contact'=>{'country'=>'JP' }}).country)
385
+ assert_equal("JE", Contact.from_hash({ 'contact'=>{'country'=>'JE' }}).country)
386
+ assert_equal("JO", Contact.from_hash({ 'contact'=>{'country'=>'JO' }}).country)
387
+ assert_equal("KZ", Contact.from_hash({ 'contact'=>{'country'=>'KZ' }}).country)
388
+ assert_equal("KE", Contact.from_hash({ 'contact'=>{'country'=>'KE' }}).country)
389
+ assert_equal("KI", Contact.from_hash({ 'contact'=>{'country'=>'KI' }}).country)
390
+ assert_equal("KP", Contact.from_hash({ 'contact'=>{'country'=>'KP' }}).country)
391
+ assert_equal("KR", Contact.from_hash({ 'contact'=>{'country'=>'KR' }}).country)
392
+ assert_equal("KW", Contact.from_hash({ 'contact'=>{'country'=>'KW' }}).country)
393
+ assert_equal("KG", Contact.from_hash({ 'contact'=>{'country'=>'KG' }}).country)
394
+ assert_equal("LA", Contact.from_hash({ 'contact'=>{'country'=>'LA' }}).country)
395
+ assert_equal("LV", Contact.from_hash({ 'contact'=>{'country'=>'LV' }}).country)
396
+ assert_equal("LB", Contact.from_hash({ 'contact'=>{'country'=>'LB' }}).country)
397
+ assert_equal("LS", Contact.from_hash({ 'contact'=>{'country'=>'LS' }}).country)
398
+ assert_equal("LR", Contact.from_hash({ 'contact'=>{'country'=>'LR' }}).country)
399
+ assert_equal("LY", Contact.from_hash({ 'contact'=>{'country'=>'LY' }}).country)
400
+ assert_equal("LI", Contact.from_hash({ 'contact'=>{'country'=>'LI' }}).country)
401
+ assert_equal("LT", Contact.from_hash({ 'contact'=>{'country'=>'LT' }}).country)
402
+ assert_equal("LU", Contact.from_hash({ 'contact'=>{'country'=>'LU' }}).country)
403
+ assert_equal("MO", Contact.from_hash({ 'contact'=>{'country'=>'MO' }}).country)
404
+ assert_equal("MK", Contact.from_hash({ 'contact'=>{'country'=>'MK' }}).country)
405
+ assert_equal("MG", Contact.from_hash({ 'contact'=>{'country'=>'MG' }}).country)
406
+ assert_equal("MW", Contact.from_hash({ 'contact'=>{'country'=>'MW' }}).country)
407
+ assert_equal("MY", Contact.from_hash({ 'contact'=>{'country'=>'MY' }}).country)
408
+ assert_equal("MV", Contact.from_hash({ 'contact'=>{'country'=>'MV' }}).country)
409
+ assert_equal("ML", Contact.from_hash({ 'contact'=>{'country'=>'ML' }}).country)
410
+ assert_equal("MT", Contact.from_hash({ 'contact'=>{'country'=>'MT' }}).country)
411
+ assert_equal("MH", Contact.from_hash({ 'contact'=>{'country'=>'MH' }}).country)
412
+ assert_equal("MQ", Contact.from_hash({ 'contact'=>{'country'=>'MQ' }}).country)
413
+ assert_equal("MR", Contact.from_hash({ 'contact'=>{'country'=>'MR' }}).country)
414
+ assert_equal("MU", Contact.from_hash({ 'contact'=>{'country'=>'MU' }}).country)
415
+ assert_equal("YT", Contact.from_hash({ 'contact'=>{'country'=>'YT' }}).country)
416
+ assert_equal("MX", Contact.from_hash({ 'contact'=>{'country'=>'MX' }}).country)
417
+ assert_equal("FM", Contact.from_hash({ 'contact'=>{'country'=>'FM' }}).country)
418
+ assert_equal("MD", Contact.from_hash({ 'contact'=>{'country'=>'MD' }}).country)
419
+ assert_equal("MC", Contact.from_hash({ 'contact'=>{'country'=>'MC' }}).country)
420
+ assert_equal("MN", Contact.from_hash({ 'contact'=>{'country'=>'MN' }}).country)
421
+ assert_equal("MS", Contact.from_hash({ 'contact'=>{'country'=>'MS' }}).country)
422
+ assert_equal("MA", Contact.from_hash({ 'contact'=>{'country'=>'MA' }}).country)
423
+ assert_equal("MZ", Contact.from_hash({ 'contact'=>{'country'=>'MZ' }}).country)
424
+ assert_equal("MM", Contact.from_hash({ 'contact'=>{'country'=>'MM' }}).country)
425
+ assert_equal("NA", Contact.from_hash({ 'contact'=>{'country'=>'NA' }}).country)
426
+ assert_equal("NR", Contact.from_hash({ 'contact'=>{'country'=>'NR' }}).country)
427
+ assert_equal("NP", Contact.from_hash({ 'contact'=>{'country'=>'NP' }}).country)
428
+ assert_equal("NL", Contact.from_hash({ 'contact'=>{'country'=>'NL' }}).country)
429
+ assert_equal("AN", Contact.from_hash({ 'contact'=>{'country'=>'AN' }}).country)
430
+ assert_equal("NC", Contact.from_hash({ 'contact'=>{'country'=>'NC' }}).country)
431
+ assert_equal("NZ", Contact.from_hash({ 'contact'=>{'country'=>'NZ' }}).country)
432
+ assert_equal("NI", Contact.from_hash({ 'contact'=>{'country'=>'NI' }}).country)
433
+ assert_equal("NE", Contact.from_hash({ 'contact'=>{'country'=>'NE' }}).country)
434
+ assert_equal("NG", Contact.from_hash({ 'contact'=>{'country'=>'NG' }}).country)
435
+ assert_equal("NU", Contact.from_hash({ 'contact'=>{'country'=>'NU' }}).country)
436
+ assert_equal("NF", Contact.from_hash({ 'contact'=>{'country'=>'NF' }}).country)
437
+ assert_equal("MP", Contact.from_hash({ 'contact'=>{'country'=>'MP' }}).country)
438
+ assert_equal("NO", Contact.from_hash({ 'contact'=>{'country'=>'NO' }}).country)
439
+ assert_equal("OM", Contact.from_hash({ 'contact'=>{'country'=>'OM' }}).country)
440
+ assert_equal("PK", Contact.from_hash({ 'contact'=>{'country'=>'PK' }}).country)
441
+ assert_equal("PW", Contact.from_hash({ 'contact'=>{'country'=>'PW' }}).country)
442
+ assert_equal("PS", Contact.from_hash({ 'contact'=>{'country'=>'PS' }}).country)
443
+ assert_equal("PA", Contact.from_hash({ 'contact'=>{'country'=>'PA' }}).country)
444
+ assert_equal("PG", Contact.from_hash({ 'contact'=>{'country'=>'PG' }}).country)
445
+ assert_equal("PY", Contact.from_hash({ 'contact'=>{'country'=>'PY' }}).country)
446
+ assert_equal("PE", Contact.from_hash({ 'contact'=>{'country'=>'PE' }}).country)
447
+ assert_equal("PH", Contact.from_hash({ 'contact'=>{'country'=>'PH' }}).country)
448
+ assert_equal("PN", Contact.from_hash({ 'contact'=>{'country'=>'PN' }}).country)
449
+ assert_equal("PL", Contact.from_hash({ 'contact'=>{'country'=>'PL' }}).country)
450
+ assert_equal("PT", Contact.from_hash({ 'contact'=>{'country'=>'PT' }}).country)
451
+ assert_equal("PR", Contact.from_hash({ 'contact'=>{'country'=>'PR' }}).country)
452
+ assert_equal("QA", Contact.from_hash({ 'contact'=>{'country'=>'QA' }}).country)
453
+ assert_equal("RE", Contact.from_hash({ 'contact'=>{'country'=>'RE' }}).country)
454
+ assert_equal("RO", Contact.from_hash({ 'contact'=>{'country'=>'RO' }}).country)
455
+ assert_equal("RU", Contact.from_hash({ 'contact'=>{'country'=>'RU' }}).country)
456
+ assert_equal("RW", Contact.from_hash({ 'contact'=>{'country'=>'RW' }}).country)
457
+ assert_equal("BL", Contact.from_hash({ 'contact'=>{'country'=>'BL' }}).country)
458
+ assert_equal("KN", Contact.from_hash({ 'contact'=>{'country'=>'KN' }}).country)
459
+ assert_equal("LC", Contact.from_hash({ 'contact'=>{'country'=>'LC' }}).country)
460
+ assert_equal("MF", Contact.from_hash({ 'contact'=>{'country'=>'MF' }}).country)
461
+ assert_equal("VC", Contact.from_hash({ 'contact'=>{'country'=>'VC' }}).country)
462
+ assert_equal("WS", Contact.from_hash({ 'contact'=>{'country'=>'WS' }}).country)
463
+ assert_equal("SM", Contact.from_hash({ 'contact'=>{'country'=>'SM' }}).country)
464
+ assert_equal("ST", Contact.from_hash({ 'contact'=>{'country'=>'ST' }}).country)
465
+ assert_equal("SA", Contact.from_hash({ 'contact'=>{'country'=>'SA' }}).country)
466
+ assert_equal("SN", Contact.from_hash({ 'contact'=>{'country'=>'SN' }}).country)
467
+ assert_equal("SC", Contact.from_hash({ 'contact'=>{'country'=>'SC' }}).country)
468
+ assert_equal("SL", Contact.from_hash({ 'contact'=>{'country'=>'SL' }}).country)
469
+ assert_equal("SG", Contact.from_hash({ 'contact'=>{'country'=>'SG' }}).country)
470
+ assert_equal("SX", Contact.from_hash({ 'contact'=>{'country'=>'SX' }}).country)
471
+ assert_equal("SK", Contact.from_hash({ 'contact'=>{'country'=>'SK' }}).country)
472
+ assert_equal("SI", Contact.from_hash({ 'contact'=>{'country'=>'SI' }}).country)
473
+ assert_equal("SB", Contact.from_hash({ 'contact'=>{'country'=>'SB' }}).country)
474
+ assert_equal("SO", Contact.from_hash({ 'contact'=>{'country'=>'SO' }}).country)
475
+ assert_equal("ZA", Contact.from_hash({ 'contact'=>{'country'=>'ZA' }}).country)
476
+ assert_equal("GS", Contact.from_hash({ 'contact'=>{'country'=>'GS' }}).country)
477
+ assert_equal("ES", Contact.from_hash({ 'contact'=>{'country'=>'ES' }}).country)
478
+ assert_equal("LK", Contact.from_hash({ 'contact'=>{'country'=>'LK' }}).country)
479
+ assert_equal("SH", Contact.from_hash({ 'contact'=>{'country'=>'SH' }}).country)
480
+ assert_equal("PM", Contact.from_hash({ 'contact'=>{'country'=>'PM' }}).country)
481
+ assert_equal("SD", Contact.from_hash({ 'contact'=>{'country'=>'SD' }}).country)
482
+ assert_equal("SR", Contact.from_hash({ 'contact'=>{'country'=>'SR' }}).country)
483
+ assert_equal("SJ", Contact.from_hash({ 'contact'=>{'country'=>'SJ' }}).country)
484
+ assert_equal("SZ", Contact.from_hash({ 'contact'=>{'country'=>'SZ' }}).country)
485
+ assert_equal("SE", Contact.from_hash({ 'contact'=>{'country'=>'SE' }}).country)
486
+ assert_equal("CH", Contact.from_hash({ 'contact'=>{'country'=>'CH' }}).country)
487
+ assert_equal("SY", Contact.from_hash({ 'contact'=>{'country'=>'SY' }}).country)
488
+ assert_equal("TW", Contact.from_hash({ 'contact'=>{'country'=>'TW' }}).country)
489
+ assert_equal("TJ", Contact.from_hash({ 'contact'=>{'country'=>'TJ' }}).country)
490
+ assert_equal("TZ", Contact.from_hash({ 'contact'=>{'country'=>'TZ' }}).country)
491
+ assert_equal("TH", Contact.from_hash({ 'contact'=>{'country'=>'TH' }}).country)
492
+ assert_equal("TG", Contact.from_hash({ 'contact'=>{'country'=>'TG' }}).country)
493
+ assert_equal("TK", Contact.from_hash({ 'contact'=>{'country'=>'TK' }}).country)
494
+ assert_equal("TO", Contact.from_hash({ 'contact'=>{'country'=>'TO' }}).country)
495
+ assert_equal("TT", Contact.from_hash({ 'contact'=>{'country'=>'TT' }}).country)
496
+ assert_equal("TN", Contact.from_hash({ 'contact'=>{'country'=>'TN' }}).country)
497
+ assert_equal("TR", Contact.from_hash({ 'contact'=>{'country'=>'TR' }}).country)
498
+ assert_equal("TM", Contact.from_hash({ 'contact'=>{'country'=>'TM' }}).country)
499
+ assert_equal("TC", Contact.from_hash({ 'contact'=>{'country'=>'TC' }}).country)
500
+ assert_equal("TV", Contact.from_hash({ 'contact'=>{'country'=>'TV' }}).country)
501
+ assert_equal("UG", Contact.from_hash({ 'contact'=>{'country'=>'UG' }}).country)
502
+ assert_equal("UA", Contact.from_hash({ 'contact'=>{'country'=>'UA' }}).country)
503
+ assert_equal("AE", Contact.from_hash({ 'contact'=>{'country'=>'AE' }}).country)
504
+ assert_equal("GB", Contact.from_hash({ 'contact'=>{'country'=>'GB' }}).country)
505
+ assert_equal("US", Contact.from_hash({ 'contact'=>{'country'=>'US' }}).country)
506
+ assert_equal("UM", Contact.from_hash({ 'contact'=>{'country'=>'UM' }}).country)
507
+ assert_equal("UY", Contact.from_hash({ 'contact'=>{'country'=>'UY' }}).country)
508
+ assert_equal("UZ", Contact.from_hash({ 'contact'=>{'country'=>'UZ' }}).country)
509
+ assert_equal("VU", Contact.from_hash({ 'contact'=>{'country'=>'VU' }}).country)
510
+ assert_equal("VA", Contact.from_hash({ 'contact'=>{'country'=>'VA' }}).country)
511
+ assert_equal("VE", Contact.from_hash({ 'contact'=>{'country'=>'VE' }}).country)
512
+ assert_equal("VN", Contact.from_hash({ 'contact'=>{'country'=>'VN' }}).country)
513
+ assert_equal("VG", Contact.from_hash({ 'contact'=>{'country'=>'VG' }}).country)
514
+ assert_equal("VI", Contact.from_hash({ 'contact'=>{'country'=>'VI' }}).country)
515
+ assert_equal("WF", Contact.from_hash({ 'contact'=>{'country'=>'WF' }}).country)
516
+ assert_equal("EH", Contact.from_hash({ 'contact'=>{'country'=>'EH' }}).country)
517
+ assert_equal("YE", Contact.from_hash({ 'contact'=>{'country'=>'YE' }}).country)
518
+ assert_equal("ZM", Contact.from_hash({ 'contact'=>{'country'=>'ZM' }}).country)
519
+ assert_equal("ZW", Contact.from_hash({ 'contact'=>{'country'=>'ZW' }}).country)
520
+ assert_equal("RS", Contact.from_hash({ 'contact'=>{'country'=>'RS' }}).country)
521
+ assert_equal("ME", Contact.from_hash({ 'contact'=>{'country'=>'ME' }}).country)
522
+
523
+ exception = assert_raise(RuntimeError){
524
+ Contact.from_hash({ 'contact'=>{'country'=>'ABC' }})
525
+ }
526
+ assert_equal "If contact country is specified, it must be valid. You specified ABC", exception.message
527
+ end
528
+
529
+ def test_contact_email
530
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).email)
531
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'email'=>'abc' }}).email)
532
+ assert_equal("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", Contact.from_hash({ 'contact'=>{'email'=>'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' }}).email)
533
+ exception = assert_raise(RuntimeError){
534
+ Contact.from_hash({ 'contact'=>{'email'=>'12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901' }})
535
+ }
536
+ assert_equal "If contact email is specified, it must be between 1 and 100 characters long", exception.message
537
+ end
538
+
539
+ def test_contact_phone
540
+ assert_equal(nil, Contact.from_hash({ 'contact'=>{}}).phone)
541
+ assert_equal("abc", Contact.from_hash({ 'contact'=>{'phone'=>'abc' }}).phone)
542
+ assert_equal("12345678901234567890", Contact.from_hash({ 'contact'=>{'phone'=>'12345678901234567890' }}).phone)
543
+ exception = assert_raise(RuntimeError){
544
+ Contact.from_hash({ 'contact'=>{'phone'=>'123456789012345678901' }})
545
+ }
546
+ assert_equal "If contact phone is specified, it must be between 1 and 20 characters long", exception.message
547
+ end
548
+
549
+ def test_customInfo_ssn
550
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).ssn)
551
+ exception = assert_raise(RuntimeError){
552
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'1' }})
553
+ }
554
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
555
+ exception = assert_raise(RuntimeError){
556
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'12' }})
557
+ }
558
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
559
+ exception = assert_raise(RuntimeError){
560
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'123' }})
561
+ }
562
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
563
+ exception = assert_raise(RuntimeError){
564
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'1234' }})
565
+ }
566
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
567
+ exception = assert_raise(RuntimeError){
568
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'12345' }})
569
+ }
570
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
571
+ exception = assert_raise(RuntimeError){
572
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'123456' }})
573
+ }
574
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
575
+ exception = assert_raise(RuntimeError){
576
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'1234567' }})
577
+ }
578
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
579
+ exception = assert_raise(RuntimeError){
580
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'12345678' }})
581
+ }
582
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
583
+ assert_equal("123456789", CustomerInfo.from_hash({'customerInfo'=>{'ssn'=>'123456789'}}).ssn)
584
+ exception = assert_raise(RuntimeError){
585
+ CustomerInfo.from_hash({ 'customerInfo'=>{'ssn'=>'1234567890' }})
586
+ }
587
+ assert_equal "If customerInfo ssn is specified, it must match the regular expression /\\A\\d{9}\\Z/", exception.message
588
+ end
589
+
590
+ def test_customerInfo_dob
591
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).dob)
592
+ assert_equal("2012-04-11", CustomerInfo.from_hash({'customerInfo'=>{'dob'=>'2012-04-11'}}).dob)
593
+ assert_equal("2012-11-04", CustomerInfo.from_hash({'customerInfo'=>{'dob'=>'2012-11-04'}}).dob)
594
+ exception = assert_raise(RuntimeError){
595
+ CustomerInfo.from_hash({ 'customerInfo'=>{'dob'=>'04-11-2012' }})
596
+ }
597
+ assert_equal "If customerInfo dob is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
598
+ exception = assert_raise(RuntimeError){
599
+ CustomerInfo.from_hash({ 'customerInfo'=>{'dob'=>'11-04-2012' }})
600
+ }
601
+ assert_equal "If customerInfo dob is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
602
+ exception = assert_raise(RuntimeError){
603
+ CustomerInfo.from_hash({ 'customerInfo'=>{'dob'=>'2012-4-11' }})
604
+ }
605
+ assert_equal "If customerInfo dob is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
606
+ exception = assert_raise(RuntimeError){
607
+ CustomerInfo.from_hash({ 'customerInfo'=>{'dob'=>'2012-11-4' }})
608
+ }
609
+ assert_equal "If customerInfo dob is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
610
+ exception = assert_raise(RuntimeError){
611
+ CustomerInfo.from_hash({ 'customerInfo'=>{'dob'=>'12-11-04' }})
612
+ }
613
+ assert_equal "If customerInfo dob is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
614
+ exception = assert_raise(RuntimeError){
615
+ CustomerInfo.from_hash({ 'customerInfo'=>{'dob'=>'aaaa-mm-dd' }})
616
+ }
617
+ assert_equal "If customerInfo dob is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
618
+ end
619
+
620
+ def test_customerInfo_customerRegistrationDate
621
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).customerRegistrationDate)
622
+ assert_equal("2012-04-11", CustomerInfo.from_hash({'customerInfo'=>{'customerRegistrationDate'=>'2012-04-11'}}).customerRegistrationDate)
623
+ assert_equal("2012-11-04", CustomerInfo.from_hash({'customerInfo'=>{'customerRegistrationDate'=>'2012-11-04'}}).customerRegistrationDate)
624
+ exception = assert_raise(RuntimeError){
625
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerRegistrationDate'=>'04-11-2012' }})
626
+ }
627
+ assert_equal "If customerInfo customerRegistrationDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}/", exception.message
628
+ exception = assert_raise(RuntimeError){
629
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerRegistrationDate'=>'11-04-2012' }})
630
+ }
631
+ assert_equal "If customerInfo customerRegistrationDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}/", exception.message
632
+ exception = assert_raise(RuntimeError){
633
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerRegistrationDate'=>'2012-4-11' }})
634
+ }
635
+ assert_equal "If customerInfo customerRegistrationDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}/", exception.message
636
+ exception = assert_raise(RuntimeError){
637
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerRegistrationDate'=>'2012-11-4' }})
638
+ }
639
+ assert_equal "If customerInfo customerRegistrationDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}/", exception.message
640
+ exception = assert_raise(RuntimeError){
641
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerRegistrationDate'=>'12-11-04' }})
642
+ }
643
+ assert_equal "If customerInfo customerRegistrationDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}/", exception.message
644
+ exception = assert_raise(RuntimeError){
645
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerRegistrationDate'=>'aaaa-mm-dd' }})
646
+ }
647
+ assert_equal "If customerInfo customerRegistrationDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}/", exception.message
648
+ end
649
+
650
+ def test_customerInfo_customerType
651
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).customerType)
652
+ assert_equal("New", CustomerInfo.from_hash({'customerInfo'=>{'customerType'=>'New'}}).customerType)
653
+ assert_equal("Existing", CustomerInfo.from_hash({'customerInfo'=>{'customerType'=>'Existing'}}).customerType)
654
+ exception = assert_raise(RuntimeError){
655
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerType'=>'Deleted' }})
656
+ }
657
+ assert_equal "If customerInfo customerType is specified, it must be in [\"New\", \"Existing\"]", exception.message
658
+ end
659
+
660
+ def test_customerInfo_incomeAmount
661
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).incomeAmount)
662
+ assert_equal("41235", CustomerInfo.from_hash({'customerInfo'=>{'incomeAmount'=>'41235'}}).incomeAmount)
663
+ assert_equal("-9223372036854775808", CustomerInfo.from_hash({'customerInfo'=>{'incomeAmount'=>'-9223372036854775808'}}).incomeAmount)
664
+ assert_equal("9223372036854775807", CustomerInfo.from_hash({'customerInfo'=>{'incomeAmount'=>'9223372036854775807'}}).incomeAmount)
665
+ exception = assert_raise(RuntimeError){
666
+ CustomerInfo.from_hash({ 'customerInfo'=>{'incomeAmount'=>'14.2' }})
667
+ }
668
+ assert_equal "If customerInfo incomeAmount is specified, it must be between -9223372036854775808 and 9223372036854775807", exception.message
669
+ exception = assert_raise(RuntimeError){
670
+ CustomerInfo.from_hash({ 'customerInfo'=>{'incomeAmount'=>'-9223372036854775809' }})
671
+ }
672
+ assert_equal "If customerInfo incomeAmount is specified, it must be between -9223372036854775808 and 9223372036854775807", exception.message
673
+ exception = assert_raise(RuntimeError){
674
+ CustomerInfo.from_hash({ 'customerInfo'=>{'incomeAmount'=>'9223372036854775808' }})
675
+ }
676
+ assert_equal "If customerInfo incomeAmount is specified, it must be between -9223372036854775808 and 9223372036854775807", exception.message
677
+ end
678
+
679
+ def test_customerInfo_incomeCurrency
680
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).incomeCurrency)
681
+ assert_equal("AUD", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'AUD'}}).incomeCurrency)
682
+ assert_equal("CAD", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'CAD'}}).incomeCurrency)
683
+ assert_equal("CHF", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'CHF'}}).incomeCurrency)
684
+ assert_equal("DKK", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'DKK'}}).incomeCurrency)
685
+ assert_equal("EUR", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'EUR'}}).incomeCurrency)
686
+ assert_equal("GBP", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'GBP'}}).incomeCurrency)
687
+ assert_equal("HKD", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'HKD'}}).incomeCurrency)
688
+ assert_equal("JPY", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'JPY'}}).incomeCurrency)
689
+ assert_equal("NOK", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'NOK'}}).incomeCurrency)
690
+ assert_equal("NZD", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'NZD'}}).incomeCurrency)
691
+ assert_equal("SEK", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'SEK'}}).incomeCurrency)
692
+ assert_equal("SGD", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'SGD'}}).incomeCurrency)
693
+ assert_equal("USD", CustomerInfo.from_hash({'customerInfo'=>{'incomeCurrency'=>'USD'}}).incomeCurrency)
694
+ exception = assert_raise(RuntimeError){
695
+ CustomerInfo.from_hash({ 'customerInfo'=>{'incomeCurrency'=>'US' }})
696
+ }
697
+ assert_equal "If customerInfo incomeCurrency is specified, it must be in [\"AUD\", \"CAD\", \"CHF\", \"DKK\", \"EUR\", \"GBP\", \"HKD\", \"JPY\", \"NOK\", \"NZD\", \"SEK\", \"SGD\", \"USD\"]", exception.message
698
+ end
699
+
700
+ def test_customerInfo_customerCheckingAccount
701
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).customerCheckingAccount)
702
+ assert_equal("true", CustomerInfo.from_hash({'customerInfo'=>{'customerCheckingAccount'=>'true'}}).customerCheckingAccount)
703
+ assert_equal("false", CustomerInfo.from_hash({'customerInfo'=>{'customerCheckingAccount'=>'false'}}).customerCheckingAccount)
704
+ assert_equal("1", CustomerInfo.from_hash({'customerInfo'=>{'customerCheckingAccount'=>'1'}}).customerCheckingAccount)
705
+ assert_equal("0", CustomerInfo.from_hash({'customerInfo'=>{'customerCheckingAccount'=>'0'}}).customerCheckingAccount)
706
+ exception = assert_raise(RuntimeError){
707
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerCheckingAccount'=>'vrai' }}) #French true
708
+ }
709
+ assert_equal "If customerInfo customerCheckingAccount is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
710
+ end
711
+
712
+ def test_customerInfo_customerSavingAccount
713
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).customerSavingAccount)
714
+ assert_equal("true", CustomerInfo.from_hash({'customerInfo'=>{'customerSavingAccount'=>'true'}}).customerSavingAccount)
715
+ assert_equal("false", CustomerInfo.from_hash({'customerInfo'=>{'customerSavingAccount'=>'false'}}).customerSavingAccount)
716
+ assert_equal("1", CustomerInfo.from_hash({'customerInfo'=>{'customerSavingAccount'=>'1'}}).customerSavingAccount)
717
+ assert_equal("0", CustomerInfo.from_hash({'customerInfo'=>{'customerSavingAccount'=>'0'}}).customerSavingAccount)
718
+ exception = assert_raise(RuntimeError){
719
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerSavingAccount'=>'vrai' }}) #French true
720
+ }
721
+ assert_equal "If customerInfo customerSavingAccount is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
722
+ end
723
+
724
+ def test_contact_employerName
725
+ assert_equal(nil, CustomerInfo.from_hash({ 'customerInfo'=>{}}).employerName)
726
+ assert_equal("abc", CustomerInfo.from_hash({ 'customerInfo'=>{'employerName'=>'abc' }}).employerName)
727
+ assert_equal("12345678901234567890", CustomerInfo.from_hash({ 'customerInfo'=>{'employerName'=>'12345678901234567890' }}).employerName)
728
+ exception = assert_raise(RuntimeError){
729
+ CustomerInfo.from_hash({ 'customerInfo'=>{'employerName'=>'123456789012345678901' }})
730
+ }
731
+ assert_equal "If customerInfo employerName is specified, it must be between 1 and 20 characters long", exception.message
732
+ end
733
+
734
+ def test_contact_customerWorkTelephone
735
+ assert_equal(nil, CustomerInfo.from_hash({ 'customerInfo'=>{}}).customerWorkTelephone)
736
+ assert_equal("abc", CustomerInfo.from_hash({ 'customerInfo'=>{'customerWorkTelephone'=>'abc' }}).customerWorkTelephone)
737
+ assert_equal("12345678901234567890", CustomerInfo.from_hash({ 'customerInfo'=>{'customerWorkTelephone'=>'12345678901234567890' }}).customerWorkTelephone)
738
+ exception = assert_raise(RuntimeError){
739
+ CustomerInfo.from_hash({ 'customerInfo'=>{'customerWorkTelephone'=>'123456789012345678901' }})
740
+ }
741
+ assert_equal "If customerInfo customerWorkTelephone is specified, it must be between 1 and 20 characters long", exception.message
742
+ end
743
+
744
+ def test_customerInfo_residenceStatus
745
+ assert_equal(nil, CustomerInfo.from_hash({'customerInfo'=>{}}).residenceStatus)
746
+ assert_equal("Own", CustomerInfo.from_hash({'customerInfo'=>{'residenceStatus'=>'Own'}}).residenceStatus)
747
+ assert_equal("Rent", CustomerInfo.from_hash({'customerInfo'=>{'residenceStatus'=>'Rent'}}).residenceStatus)
748
+ assert_equal("Other", CustomerInfo.from_hash({'customerInfo'=>{'residenceStatus'=>'Other'}}).residenceStatus)
749
+ exception = assert_raise(RuntimeError){
750
+ CustomerInfo.from_hash({ 'customerInfo'=>{'residenceStatus'=>'Lease' }})
751
+ }
752
+ assert_equal "If customerInfo residenceStatus is specified, it must be in [\"Own\", \"Rent\", \"Other\"]", exception.message
753
+ end
754
+
755
+ def test_contact_yearsAtResidence
756
+ assert_equal(nil, CustomerInfo.from_hash({ 'customerInfo'=>{}}).yearsAtResidence)
757
+ assert_equal("0", CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtResidence'=>'0' }}).yearsAtResidence)
758
+ assert_equal("1", CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtResidence'=>'1' }}).yearsAtResidence)
759
+ assert_equal("99", CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtResidence'=>'99' }}).yearsAtResidence)
760
+ exception = assert_raise(RuntimeError){
761
+ CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtResidence'=>'100' }})
762
+ }
763
+ assert_equal "If customerInfo yearsAtResidence is specified, it must be between 0 and 99", exception.message
764
+ exception = assert_raise(RuntimeError){
765
+ CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtResidence'=>'abc' }})
766
+ }
767
+ assert_equal "If customerInfo yearsAtResidence is specified, it must be between 0 and 99", exception.message
768
+ end
769
+
770
+ def test_contact_yearsAtEmployer
771
+ assert_equal(nil, CustomerInfo.from_hash({ 'customerInfo'=>{}}).yearsAtEmployer)
772
+ assert_equal("0", CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtEmployer'=>'0' }}).yearsAtEmployer)
773
+ assert_equal("1", CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtEmployer'=>'1' }}).yearsAtEmployer)
774
+ assert_equal("99", CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtEmployer'=>'99' }}).yearsAtEmployer)
775
+ exception = assert_raise(RuntimeError){
776
+ CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtEmployer'=>'100' }})
777
+ }
778
+ assert_equal "If customerInfo yearsAtEmployer is specified, it must be between 0 and 99", exception.message
779
+ exception = assert_raise(RuntimeError){
780
+ CustomerInfo.from_hash({ 'customerInfo'=>{'yearsAtEmployer'=>'abc' }})
781
+ }
782
+ assert_equal "If customerInfo yearsAtEmployer is specified, it must be between 0 and 99", exception.message
783
+ end
784
+
785
+ def test_billMeLaterRequest_bmlMerchantId
786
+ assert_equal(nil, BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{}}).bmlMerchantId)
787
+ assert_equal("41235", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'bmlMerchantId'=>'41235'}}).bmlMerchantId)
788
+ assert_equal("-9223372036854775808", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'bmlMerchantId'=>'-9223372036854775808'}}).bmlMerchantId)
789
+ assert_equal("9223372036854775807", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'bmlMerchantId'=>'9223372036854775807'}}).bmlMerchantId)
790
+ exception = assert_raise(RuntimeError){
791
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'bmlMerchantId'=>'14.2' }})
792
+ }
793
+ assert_equal "If billMeLaterRequest bmlMerchantId is specified, it must be between -9223372036854775808 and 9223372036854775807", exception.message
794
+ exception = assert_raise(RuntimeError){
795
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'bmlMerchantId'=>'-9223372036854775809' }})
796
+ }
797
+ assert_equal "If billMeLaterRequest bmlMerchantId is specified, it must be between -9223372036854775808 and 9223372036854775807", exception.message
798
+ exception = assert_raise(RuntimeError){
799
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'bmlMerchantId'=>'9223372036854775808' }})
800
+ }
801
+ assert_equal "If billMeLaterRequest bmlMerchantId is specified, it must be between -9223372036854775808 and 9223372036854775807", exception.message
802
+ end
803
+
804
+ def test_billMeLaterRequest_bmlProductType
805
+ assert_equal(nil, BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{}}).bmlProductType)
806
+ assert_equal("a", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'bmlProductType'=>'a' }}).bmlProductType)
807
+ assert_equal("12", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'bmlProductType'=>'12' }}).bmlProductType)
808
+ exception = assert_raise(RuntimeError){
809
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'bmlProductType'=>'123' }})
810
+ }
811
+ assert_equal "If billMeLaterRequest bmlProductType is specified, it must be between 1 and 2 characters long", exception.message
812
+ end
813
+
814
+ def test_billMeLaterRequest_termsAndConditions
815
+ assert_equal(nil, BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{}}).termsAndConditions)
816
+ assert_equal("99999", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'termsAndConditions'=>'99999'}}).termsAndConditions)
817
+ assert_equal("-99999", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'termsAndConditions'=>'-99999'}}).termsAndConditions)
818
+ exception = assert_raise(RuntimeError){
819
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'termsAndConditions'=>'14.2' }})
820
+ }
821
+ assert_equal "If billMeLaterRequest termsAndConditions is specified, it must be between -99999 and 99999", exception.message
822
+ exception = assert_raise(RuntimeError){
823
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'termsAndConditions'=>'-100000' }})
824
+ }
825
+ assert_equal "If billMeLaterRequest termsAndConditions is specified, it must be between -99999 and 99999", exception.message
826
+ exception = assert_raise(RuntimeError){
827
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'termsAndConditions'=>'100000' }})
828
+ }
829
+ assert_equal "If billMeLaterRequest termsAndConditions is specified, it must be between -99999 and 99999", exception.message
830
+ end
831
+
832
+ def test_billMeLaterRequest_preapprovalNumber
833
+ assert_equal(nil, BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{}}).preapprovalNumber)
834
+ assert_equal("abcdefghijklmn", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'preapprovalNumber'=>'abcdefghijklmn' }}).preapprovalNumber)
835
+ assert_equal("1234567890123", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'preapprovalNumber'=>'1234567890123' }}).preapprovalNumber)
836
+ assert_equal("1234567890123456789012345", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'preapprovalNumber'=>'1234567890123456789012345' }}).preapprovalNumber)
837
+ exception = assert_raise(RuntimeError){
838
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'preapprovalNumber'=>'12345678901234567890123456' }})
839
+ }
840
+ assert_equal "If billMeLaterRequest preapprovalNumber is specified, it must be between 13 and 25 characters long", exception.message
841
+ end
842
+
843
+ def test_billMeLaterRequest_merchantPromotionalCode
844
+ assert_equal(nil, BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{}}).merchantPromotionalCode)
845
+ assert_equal("9999", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'merchantPromotionalCode'=>'9999'}}).merchantPromotionalCode)
846
+ assert_equal("-9999", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'merchantPromotionalCode'=>'-9999'}}).merchantPromotionalCode)
847
+ exception = assert_raise(RuntimeError){
848
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'merchantPromotionalCode'=>'14.2' }})
849
+ }
850
+ assert_equal "If billMeLaterRequest merchantPromotionalCode is specified, it must be between -9999 and 9999", exception.message
851
+ exception = assert_raise(RuntimeError){
852
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'merchantPromotionalCode'=>'-10000' }})
853
+ }
854
+ assert_equal "If billMeLaterRequest merchantPromotionalCode is specified, it must be between -9999 and 9999", exception.message
855
+ exception = assert_raise(RuntimeError){
856
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'merchantPromotionalCode'=>'10000' }})
857
+ }
858
+ assert_equal "If billMeLaterRequest merchantPromotionalCode is specified, it must be between -9999 and 9999", exception.message
859
+ end
860
+
861
+ def test_billMeLaterRequest_customerPasswordChanged
862
+ assert_equal(nil, BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{}}).customerPasswordChanged)
863
+ assert_equal("true", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerPasswordChanged'=>'true'}}).customerPasswordChanged)
864
+ assert_equal("false", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerPasswordChanged'=>'false'}}).customerPasswordChanged)
865
+ assert_equal("1", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerPasswordChanged'=>'1'}}).customerPasswordChanged)
866
+ assert_equal("0", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerPasswordChanged'=>'0'}}).customerPasswordChanged)
867
+ exception = assert_raise(RuntimeError){
868
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'customerPasswordChanged'=>'vrai' }}) #French true
869
+ }
870
+ assert_equal "If billMeLaterRequest customerPasswordChanged is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
871
+ end
872
+
873
+ def test_billMeLaterRequest_customerBillingAddressChanged
874
+ assert_equal(nil, BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{}}).customerBillingAddressChanged)
875
+ assert_equal("true", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerBillingAddressChanged'=>'true'}}).customerBillingAddressChanged)
876
+ assert_equal("false", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerBillingAddressChanged'=>'false'}}).customerBillingAddressChanged)
877
+ assert_equal("1", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerBillingAddressChanged'=>'1'}}).customerBillingAddressChanged)
878
+ assert_equal("0", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerBillingAddressChanged'=>'0'}}).customerBillingAddressChanged)
879
+ exception = assert_raise(RuntimeError){
880
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'customerBillingAddressChanged'=>'vrai' }}) #French true
881
+ }
882
+ assert_equal "If billMeLaterRequest customerBillingAddressChanged is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
883
+ end
884
+
885
+ def test_billMeLaterRequest_customerEmailChanged
886
+ assert_equal(nil, BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{}}).customerEmailChanged)
887
+ assert_equal("true", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerEmailChanged'=>'true'}}).customerEmailChanged)
888
+ assert_equal("false", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerEmailChanged'=>'false'}}).customerEmailChanged)
889
+ assert_equal("1", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerEmailChanged'=>'1'}}).customerEmailChanged)
890
+ assert_equal("0", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerEmailChanged'=>'0'}}).customerEmailChanged)
891
+ exception = assert_raise(RuntimeError){
892
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'customerEmailChanged'=>'vrai' }}) #French true
893
+ }
894
+ assert_equal "If billMeLaterRequest customerEmailChanged is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
895
+ end
896
+
897
+ def test_billMeLaterRequest_customerPhoneChanged
898
+ assert_equal(nil, BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{}}).customerPhoneChanged)
899
+ assert_equal("true", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerPhoneChanged'=>'true'}}).customerPhoneChanged)
900
+ assert_equal("false", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerPhoneChanged'=>'false'}}).customerPhoneChanged)
901
+ assert_equal("1", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerPhoneChanged'=>'1'}}).customerPhoneChanged)
902
+ assert_equal("0", BillMeLaterRequest.from_hash({'billMeLaterRequest'=>{'customerPhoneChanged'=>'0'}}).customerPhoneChanged)
903
+ exception = assert_raise(RuntimeError){
904
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'customerPhoneChanged'=>'vrai' }}) #French true
905
+ }
906
+ assert_equal "If billMeLaterRequest customerPhoneChanged is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
907
+ end
908
+
909
+ def test_billMeLaterRequest_secretQuestionCode
910
+ assert_equal(nil, BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{}}).secretQuestionCode)
911
+ assert_equal("a", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'secretQuestionCode'=>'a' }}).secretQuestionCode)
912
+ assert_equal("12", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'secretQuestionCode'=>'12' }}).secretQuestionCode)
913
+ exception = assert_raise(RuntimeError){
914
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'secretQuestionCode'=>'123' }})
915
+ }
916
+ assert_equal "If billMeLaterRequest secretQuestionCode is specified, it must be between 1 and 2 characters long", exception.message
917
+ end
918
+
919
+ def test_billMeLaterRequest_secretQuestionAnswer
920
+ assert_equal(nil, BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{}}).secretQuestionAnswer)
921
+ assert_equal("abc", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'secretQuestionAnswer'=>'abc' }}).secretQuestionAnswer)
922
+ assert_equal("1234567890123456789012345", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'secretQuestionAnswer'=>'1234567890123456789012345' }}).secretQuestionAnswer)
923
+ exception = assert_raise(RuntimeError){
924
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'secretQuestionAnswer'=>'12345678901234567890123456' }})
925
+ }
926
+ assert_equal "If billMeLaterRequest secretQuestionAnswer is specified, it must be between 1 and 25 characters long", exception.message
927
+ end
928
+
929
+ def test_billMeLaterRequest_virtualAuthenticationKeyPresenceIndicator
930
+ assert_equal(nil, BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{}}).virtualAuthenticationKeyPresenceIndicator)
931
+ assert_equal("a", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'virtualAuthenticationKeyPresenceIndicator'=>'a' }}).virtualAuthenticationKeyPresenceIndicator)
932
+ exception = assert_raise(RuntimeError){
933
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'virtualAuthenticationKeyPresenceIndicator'=>'12' }})
934
+ }
935
+ assert_equal "If billMeLaterRequest virtualAuthenticationKeyPresenceIndicator is specified, it must be between 1 and 1 characters long", exception.message
936
+ end
937
+
938
+ def test_billMeLaterRequest_virtualAuthenticationKeyData
939
+ assert_equal(nil, BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{}}).virtualAuthenticationKeyData)
940
+ assert_equal("a", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'virtualAuthenticationKeyData'=>'a' }}).virtualAuthenticationKeyData)
941
+ assert_equal("abcd", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'virtualAuthenticationKeyData'=>'abcd' }}).virtualAuthenticationKeyData)
942
+ assert_equal("1234", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'virtualAuthenticationKeyData'=>'1234' }}).virtualAuthenticationKeyData)
943
+ exception = assert_raise(RuntimeError){
944
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'virtualAuthenticationKeyData'=>'12345' }})
945
+ }
946
+ assert_equal "If billMeLaterRequest virtualAuthenticationKeyData is specified, it must be between 1 and 4 characters long", exception.message
947
+ end
948
+
949
+ def test_billMeLaterRequest_itemCategoryCode
950
+ assert_equal(nil, BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{}}).itemCategoryCode)
951
+ assert_equal("1", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'itemCategoryCode'=>'1' }}).itemCategoryCode)
952
+ assert_equal("1234", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'itemCategoryCode'=>'1234' }}).itemCategoryCode)
953
+ exception = assert_raise(RuntimeError){
954
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'itemCategoryCode'=>'12345' }})
955
+ }
956
+ assert_equal "If billMeLaterRequest itemCategoryCode is specified, it must be between -9999 and 9999", exception.message
957
+ exception = assert_raise(RuntimeError){
958
+ BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'itemCategoryCode'=>'a' }})
959
+ }
960
+ assert_equal "If billMeLaterRequest itemCategoryCode is specified, it must be between -9999 and 9999", exception.message
961
+ end
962
+
963
+ def test_billMeLaterRequest_authorizationSourcePlatform
964
+ assert_equal("a", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'authorizationSourcePlatform'=>'a' }}).authorizationSourcePlatform)
965
+ assert_equal(nil, BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{}}).authorizationSourcePlatform)
966
+ assert_equal("abcd", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'authorizationSourcePlatform'=>'abcd' }}).authorizationSourcePlatform)
967
+ assert_equal("1234", BillMeLaterRequest.from_hash({ 'billMeLaterRequest'=>{'authorizationSourcePlatform'=>'1234' }}).authorizationSourcePlatform)
968
+ end
969
+
970
+ def test_fraudCheck_authenticationValue
971
+ assert_equal("abc", FraudCheck.from_hash({ 'fraudCheck'=>{'authenticationValue'=>'abc' }}).authenticationValue)
972
+ assert_equal(nil, FraudCheck.from_hash({ 'fraudCheck'=>{}}).authenticationValue)
973
+ assert_equal("12345678901234567890123456789012", FraudCheck.from_hash({ 'fraudCheck'=>{'authenticationValue'=>'12345678901234567890123456789012' }}).authenticationValue)
974
+ exception = assert_raise(RuntimeError){
975
+ FraudCheck.from_hash({ 'fraudCheck'=>{'authenticationValue'=>'123456789012345678901234567890123' }})
976
+ }
977
+ assert_equal "If fraudCheck authenticationValue is specified, it must be between 1 and 32 characters long", exception.message
978
+ end
979
+
980
+ def test_fraudCheck_authenticationTransactionId
981
+ assert_equal("abc", FraudCheck.from_hash({ 'fraudCheck'=>{'authenticationTransactionId'=>'abc' }}).authenticationTransactionId)
982
+ assert_equal(nil, FraudCheck.from_hash({ 'fraudCheck'=>{}}).authenticationTransactionId)
983
+ assert_equal("1234567890123456789012345678", FraudCheck.from_hash({ 'fraudCheck'=>{'authenticationTransactionId'=>'1234567890123456789012345678' }}).authenticationTransactionId)
984
+ exception = assert_raise(RuntimeError){
985
+ FraudCheck.from_hash({ 'fraudCheck'=>{'authenticationTransactionId'=>'12345678901234567890123456789' }})
986
+ }
987
+ assert_equal "If fraudCheck authenticationTransactionId is specified, it must be between 1 and 28 characters long", exception.message
988
+ end
989
+
990
+ def test_fraudCheck_customerIpAddress
991
+ assert_equal("123.123.123.123", FraudCheck.from_hash({ 'fraudCheck'=>{'customerIpAddress'=>'123.123.123.123' }}).customerIpAddress)
992
+ assert_equal("1.1.1.1", FraudCheck.from_hash({ 'fraudCheck'=>{'customerIpAddress'=>'1.1.1.1' }}).customerIpAddress)
993
+ assert_equal(nil, FraudCheck.from_hash({ 'fraudCheck'=>{}}).customerIpAddress)
994
+ assert_equal("123123123123", FraudCheck.from_hash({ 'fraudCheck'=>{'customerIpAddress'=>'123123123123' }}).customerIpAddress) #Our schema doesn't stop this
995
+ exception = assert_raise(RuntimeError){
996
+ FraudCheck.from_hash({ 'fraudCheck'=>{'customerIpAddress'=>'1.1.1.1.' }})
997
+ }
998
+ assert_equal "If fraudCheck customerIpAddress is specified, it must match the regular expression /\\A(\\d{1,3}.){3}\\d{1,3}\\Z/", exception.message
999
+ exception = assert_raise(RuntimeError){
1000
+ FraudCheck.from_hash({ 'fraudCheck'=>{'customerIpAddress'=>'a.b.c.d' }})
1001
+ }
1002
+ assert_equal "If fraudCheck customerIpAddress is specified, it must match the regular expression /\\A(\\d{1,3}.){3}\\d{1,3}\\Z/", exception.message
1003
+ end
1004
+
1005
+ def test_fraudCheck_authenticatedByMerchant
1006
+ assert_equal(nil, FraudCheck.from_hash({'fraudCheck'=>{}}).authenticatedByMerchant)
1007
+ assert_equal("true", FraudCheck.from_hash({'fraudCheck'=>{'authenticatedByMerchant'=>'true'}}).authenticatedByMerchant)
1008
+ assert_equal("false", FraudCheck.from_hash({'fraudCheck'=>{'authenticatedByMerchant'=>'false'}}).authenticatedByMerchant)
1009
+ assert_equal("1", FraudCheck.from_hash({'fraudCheck'=>{'authenticatedByMerchant'=>'1'}}).authenticatedByMerchant)
1010
+ assert_equal("0", FraudCheck.from_hash({'fraudCheck'=>{'authenticatedByMerchant'=>'0'}}).authenticatedByMerchant)
1011
+ exception = assert_raise(RuntimeError){
1012
+ FraudCheck.from_hash({ 'fraudCheck'=>{'authenticatedByMerchant'=>'vrai' }}) #French true
1013
+ }
1014
+ assert_equal "If fraudCheck authenticatedByMerchant is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
1015
+ end
1016
+
1017
+ def test_fraudResult_avsResult
1018
+ assert_equal("a", FraudResult.from_hash({ 'fraudResult'=>{'avsResult'=>'a' }}).avsResult)
1019
+ assert_equal(nil, FraudResult.from_hash({ 'fraudResult'=>{}}).avsResult)
1020
+ assert_equal("ab", FraudResult.from_hash({ 'fraudResult'=>{'avsResult'=>'ab' }}).avsResult)
1021
+ assert_equal("12", FraudResult.from_hash({ 'fraudResult'=>{'avsResult'=>'12' }}).avsResult)
1022
+ exception = assert_raise(RuntimeError){
1023
+ FraudResult.from_hash({ 'fraudResult'=>{'avsResult'=>'123' }})
1024
+ }
1025
+ assert_equal "If fraudResult avsResult is specified, it must be between 1 and 2 characters long", exception.message
1026
+ end
1027
+
1028
+ def test_fraudResult_cardValidationResult
1029
+ assert_equal("a", FraudResult.from_hash({ 'fraudResult'=>{'cardValidationResult'=>'a' }}).cardValidationResult)
1030
+ assert_equal("", FraudResult.from_hash({ 'fraudResult'=>{'cardValidationResult'=>'' }}).cardValidationResult)
1031
+ assert_equal(nil, FraudResult.from_hash({ 'fraudResult'=>{}}).cardValidationResult)
1032
+ assert_equal("ab", FraudResult.from_hash({ 'fraudResult'=>{'cardValidationResult'=>'ab' }}).cardValidationResult)
1033
+ assert_equal("12", FraudResult.from_hash({ 'fraudResult'=>{'cardValidationResult'=>'12' }}).cardValidationResult)
1034
+ end
1035
+
1036
+ def test_fraudResult_authenticationResult
1037
+ assert_equal("a", FraudResult.from_hash({ 'fraudResult'=>{'authenticationResult'=>'a' }}).authenticationResult)
1038
+ assert_equal(nil, FraudResult.from_hash({ 'fraudResult'=>{}}).authenticationResult)
1039
+ assert_equal("1", FraudResult.from_hash({ 'fraudResult'=>{'authenticationResult'=>'1' }}).authenticationResult)
1040
+ exception = assert_raise(RuntimeError){
1041
+ FraudResult.from_hash({ 'fraudResult'=>{'authenticationResult'=>'12' }})
1042
+ }
1043
+ assert_equal "If fraudResult authenticationResult is specified, it must be between 1 and 1 characters long", exception.message
1044
+ end
1045
+
1046
+ def test_fraudResult_advancedAVSResult
1047
+ assert_equal("a", FraudResult.from_hash({ 'fraudResult'=>{'advancedAVSResult'=>'a' }}).advancedAVSResult)
1048
+ assert_equal("1", FraudResult.from_hash({ 'fraudResult'=>{'advancedAVSResult'=>'1' }}).advancedAVSResult)
1049
+ assert_equal(nil, FraudResult.from_hash({ 'fraudResult'=>{}}).advancedAVSResult)
1050
+ assert_equal("abc", FraudResult.from_hash({ 'fraudResult'=>{'advancedAVSResult'=>'abc' }}).advancedAVSResult)
1051
+ assert_equal("123", FraudResult.from_hash({ 'fraudResult'=>{'advancedAVSResult'=>'123' }}).advancedAVSResult)
1052
+ exception = assert_raise(RuntimeError){
1053
+ FraudResult.from_hash({ 'fraudResult'=>{'advancedAVSResult'=>'1234' }})
1054
+ }
1055
+ assert_equal "If fraudResult advancedAVSResult is specified, it must be between 1 and 3 characters long", exception.message
1056
+ end
1057
+
1058
+ def test_authInformation_authDate
1059
+ assert_equal(nil, AuthInformation.from_hash({'authInformation'=>{}}).authDate)
1060
+ assert_equal("2012-04-11", AuthInformation.from_hash({'authInformation'=>{'authDate'=>'2012-04-11'}}).authDate)
1061
+ assert_equal("2012-11-04", AuthInformation.from_hash({'authInformation'=>{'authDate'=>'2012-11-04'}}).authDate)
1062
+ exception = assert_raise(RuntimeError){
1063
+ AuthInformation.from_hash({ 'authInformation'=>{'authDate'=>'04-11-2012' }})
1064
+ }
1065
+ assert_equal "If authInformation authDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1066
+ exception = assert_raise(RuntimeError){
1067
+ AuthInformation.from_hash({ 'authInformation'=>{'authDate'=>'11-04-2012' }})
1068
+ }
1069
+ assert_equal "If authInformation authDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1070
+ exception = assert_raise(RuntimeError){
1071
+ AuthInformation.from_hash({ 'authInformation'=>{'authDate'=>'2012-4-11' }})
1072
+ }
1073
+ assert_equal "If authInformation authDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1074
+ exception = assert_raise(RuntimeError){
1075
+ AuthInformation.from_hash({ 'authInformation'=>{'authDate'=>'2012-11-4' }})
1076
+ }
1077
+ assert_equal "If authInformation authDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1078
+ exception = assert_raise(RuntimeError){
1079
+ AuthInformation.from_hash({ 'authInformation'=>{'authDate'=>'12-11-04' }})
1080
+ }
1081
+ assert_equal "If authInformation authDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1082
+ exception = assert_raise(RuntimeError){
1083
+ AuthInformation.from_hash({ 'authInformation'=>{'authDate'=>'aaaa-mm-dd' }})
1084
+ }
1085
+ assert_equal "If authInformation authDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1086
+ end
1087
+
1088
+ def test_authInformation_authCode
1089
+ assert_equal(nil, AuthInformation.from_hash({ 'authInformation'=>{}}).authCode)
1090
+ assert_equal("a", AuthInformation.from_hash({ 'authInformation'=>{'authCode'=>'a' }}).authCode)
1091
+ assert_equal("1", AuthInformation.from_hash({ 'authInformation'=>{'authCode'=>'1' }}).authCode)
1092
+ assert_equal("abcdef", AuthInformation.from_hash({ 'authInformation'=>{'authCode'=>'abcdef' }}).authCode)
1093
+ assert_equal("123456", AuthInformation.from_hash({ 'authInformation'=>{'authCode'=>'123456' }}).authCode)
1094
+ exception = assert_raise(RuntimeError){
1095
+ AuthInformation.from_hash({ 'authInformation'=>{'authCode'=>'1234567' }})
1096
+ }
1097
+ assert_equal "If authInformation authCode is specified, it must be between 1 and 6 characters long", exception.message
1098
+ end
1099
+
1100
+ def test_authInformation_authAmount
1101
+ assert_equal(nil, AuthInformation.from_hash({ 'authInformation'=>{}}).authAmount)
1102
+ assert_equal("1", AuthInformation.from_hash({ 'authInformation'=>{'authAmount'=>'1' }}).authAmount)
1103
+ assert_equal("123456789012", AuthInformation.from_hash({ 'authInformation'=>{'authAmount'=>'123456789012' }}).authAmount)
1104
+ exception = assert_raise(RuntimeError){
1105
+ AuthInformation.from_hash({ 'authInformation'=>{'authAmount'=>'1234567890123' }})
1106
+ }
1107
+ assert_equal "If authInformation authAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1108
+ exception = assert_raise(RuntimeError){
1109
+ AuthInformation.from_hash({ 'authInformation'=>{'authAmount'=>'14.2' }})
1110
+ }
1111
+ assert_equal "If authInformation authAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1112
+ exception = assert_raise(RuntimeError){
1113
+ AuthInformation.from_hash({ 'authInformation'=>{'authAmount'=>'a' }})
1114
+ }
1115
+ assert_equal "If authInformation authAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1116
+ end
1117
+
1118
+ def test_healthcareAmounts_totalHealthcareAmount
1119
+ assert_equal("1", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'1' }}).totalHealthcareAmount)
1120
+ assert_equal("123456789012", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'123456789012' }}).totalHealthcareAmount)
1121
+ exception = assert_raise(RuntimeError){
1122
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'1234567890123' }})
1123
+ }
1124
+ assert_equal "If healthcareAmounts totalHealthcareAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1125
+ exception = assert_raise(RuntimeError){
1126
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'14.2' }})
1127
+ }
1128
+ assert_equal "If healthcareAmounts totalHealthcareAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1129
+ exception = assert_raise(RuntimeError){
1130
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'a' }})
1131
+ }
1132
+ assert_equal "If healthcareAmounts totalHealthcareAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1133
+ exception = assert_raise(RuntimeError){
1134
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'' }})
1135
+ }
1136
+ assert_equal "If healthcareAmounts totalHealthcareAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1137
+ exception = assert_raise(RuntimeError){
1138
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{}})
1139
+ }
1140
+ assert_equal "If healthcareAmounts is specified, it must have a totalHealthcareAmount", exception.message
1141
+ end
1142
+
1143
+ def test_healthcareAmounts_rxAmount
1144
+ assert_equal("1", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'RxAmount'=>'1','totalHealthcareAmount'=>'1' }}).rxAmount)
1145
+ assert_equal(nil, HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'1' }}).rxAmount)
1146
+ assert_equal("123456789012", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'RxAmount'=>'123456789012','totalHealthcareAmount'=>'1' }}).rxAmount)
1147
+ exception = assert_raise(RuntimeError){
1148
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'RxAmount'=>'1234567890123','totalHealthcareAmount'=>'1' }})
1149
+ }
1150
+ assert_equal "If healthcareAmounts RxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1151
+ exception = assert_raise(RuntimeError){
1152
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'RxAmount'=>'14.2','totalHealthcareAmount'=>'1' }})
1153
+ }
1154
+ assert_equal "If healthcareAmounts RxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1155
+ exception = assert_raise(RuntimeError){
1156
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'RxAmount'=>'a','totalHealthcareAmount'=>'1' }})
1157
+ }
1158
+ assert_equal "If healthcareAmounts RxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1159
+ end
1160
+
1161
+ def test_healthcareAmounts_visionAmount
1162
+ assert_equal(nil, HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'1' }}).visionAmount)
1163
+ assert_equal("1", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'visionAmount'=>'1','totalHealthcareAmount'=>'1' }}).visionAmount)
1164
+ assert_equal("123456789012", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'visionAmount'=>'123456789012','totalHealthcareAmount'=>'1' }}).visionAmount)
1165
+ exception = assert_raise(RuntimeError){
1166
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'visionAmount'=>'1234567890123','totalHealthcareAmount'=>'1' }})
1167
+ }
1168
+ assert_equal "If healthcareAmounts visionAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1169
+ exception = assert_raise(RuntimeError){
1170
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'visionAmount'=>'14.2','totalHealthcareAmount'=>'1' }})
1171
+ }
1172
+ assert_equal "If healthcareAmounts visionAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1173
+ exception = assert_raise(RuntimeError){
1174
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'visionAmount'=>'a','totalHealthcareAmount'=>'1' }})
1175
+ }
1176
+ assert_equal "If healthcareAmounts visionAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1177
+ end
1178
+
1179
+ def test_healthcareAmounts_clinicOtherAmount
1180
+ assert_equal(nil, HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'1' }}).clinicOtherAmount)
1181
+ assert_equal("1", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'clinicOtherAmount'=>'1','totalHealthcareAmount'=>'1' }}).clinicOtherAmount)
1182
+ assert_equal("123456789012", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'clinicOtherAmount'=>'123456789012','totalHealthcareAmount'=>'1' }}).clinicOtherAmount)
1183
+ exception = assert_raise(RuntimeError){
1184
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'clinicOtherAmount'=>'1234567890123','totalHealthcareAmount'=>'1' }})
1185
+ }
1186
+ assert_equal "If healthcareAmounts clinicOtherAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1187
+ exception = assert_raise(RuntimeError){
1188
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'clinicOtherAmount'=>'14.2','totalHealthcareAmount'=>'1' }})
1189
+ }
1190
+ assert_equal "If healthcareAmounts clinicOtherAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1191
+ exception = assert_raise(RuntimeError){
1192
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'clinicOtherAmount'=>'a','totalHealthcareAmount'=>'1' }})
1193
+ }
1194
+ assert_equal "If healthcareAmounts clinicOtherAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1195
+ end
1196
+
1197
+ def test_healthcareAmounts_dentalAmount
1198
+ assert_equal("1", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'dentalAmount'=>'1','totalHealthcareAmount'=>'1' }}).dentalAmount)
1199
+ assert_equal(nil, HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'totalHealthcareAmount'=>'1' }}).dentalAmount)
1200
+ assert_equal("123456789012", HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'dentalAmount'=>'123456789012','totalHealthcareAmount'=>'1' }}).dentalAmount)
1201
+ exception = assert_raise(RuntimeError){
1202
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'dentalAmount'=>'1234567890123','totalHealthcareAmount'=>'1' }})
1203
+ }
1204
+ assert_equal "If healthcareAmounts dentalAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1205
+ exception = assert_raise(RuntimeError){
1206
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'dentalAmount'=>'14.2','totalHealthcareAmount'=>'1' }})
1207
+ }
1208
+ assert_equal "If healthcareAmounts dentalAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1209
+ exception = assert_raise(RuntimeError){
1210
+ HealthcareAmounts.from_hash({ 'healthcareAmounts'=>{'dentalAmount'=>'a','totalHealthcareAmount'=>'1' }})
1211
+ }
1212
+ assert_equal "If healthcareAmounts dentalAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1213
+ end
1214
+
1215
+ def test_healthcareIIAS_IIASFlag
1216
+ assert_equal("Y", HealthcareIIAS.from_hash({'healthcareIIAS'=>{'IIASFlag'=>'Y'}}).iiasFlag)
1217
+ exception = assert_raise(RuntimeError){
1218
+ HealthcareIIAS.from_hash({ 'healthcareIIAS'=>{'IIASFlag'=>'N' }})
1219
+ }
1220
+ assert_equal "If healthcareIIAS IIASFlag is specified, it must be in [\"Y\"]", exception.message
1221
+ exception = assert_raise(RuntimeError){
1222
+ HealthcareIIAS.from_hash({ 'healthcareIIAS'=>{'IIASFlag'=>'' }})
1223
+ }
1224
+ assert_equal "If healthcareIIAS IIASFlag is specified, it must be in [\"Y\"]", exception.message
1225
+ exception = assert_raise(RuntimeError){
1226
+ HealthcareIIAS.from_hash({ 'healthcareIIAS'=>{}})
1227
+ }
1228
+ assert_equal "If healthcareIIAS is specified, it must have a IIASFlag", exception.message
1229
+ end
1230
+
1231
+ def test_pos_capability
1232
+ assert_equal("notused", Pos.from_hash({'pos'=>{'capability'=>'notused','entryMode'=>'notused','cardholderId'=>'pin'}}).capability)
1233
+ assert_equal("magstripe", Pos.from_hash({'pos'=>{'capability'=>'magstripe','entryMode'=>'notused','cardholderId'=>'pin'}}).capability)
1234
+ assert_equal("keyedonly", Pos.from_hash({'pos'=>{'capability'=>'keyedonly','entryMode'=>'notused','cardholderId'=>'pin'}}).capability)
1235
+ exception = assert_raise(RuntimeError){
1236
+ Pos.from_hash({ 'pos'=>{'capability'=>'something','entryMode'=>'notused','cardholderId'=>'pin' }})
1237
+ }
1238
+ assert_equal "If pos capability is specified, it must be in [\"notused\", \"magstripe\", \"keyedonly\"]", exception.message
1239
+ exception = assert_raise(RuntimeError){
1240
+ Pos.from_hash({ 'pos'=>{'capability'=>'','entryMode'=>'notused','cardholderId'=>'pin' }})
1241
+ }
1242
+ assert_equal "If pos capability is specified, it must be in [\"notused\", \"magstripe\", \"keyedonly\"]", exception.message
1243
+ exception = assert_raise(RuntimeError){
1244
+ Pos.from_hash({ 'pos'=>{'entryMode'=>'notused','cardholderId'=>'pin' }})
1245
+ }
1246
+ assert_equal "If pos is specified, it must have a capability", exception.message
1247
+ end
1248
+
1249
+ def test_pos_entryMode
1250
+ assert_equal("notused", Pos.from_hash({'pos'=>{'entryMode'=>'notused','capability'=>'notused','cardholderId'=>'pin'}}).entryMode)
1251
+ assert_equal("keyed", Pos.from_hash({'pos'=>{'entryMode'=>'keyed','capability'=>'notused','cardholderId'=>'pin'}}).entryMode)
1252
+ assert_equal("track1", Pos.from_hash({'pos'=>{'entryMode'=>'track1','capability'=>'notused','cardholderId'=>'pin'}}).entryMode)
1253
+ assert_equal("track2", Pos.from_hash({'pos'=>{'entryMode'=>'track2','capability'=>'notused','cardholderId'=>'pin'}}).entryMode)
1254
+ assert_equal("completeread", Pos.from_hash({'pos'=>{'entryMode'=>'completeread','capability'=>'notused','cardholderId'=>'pin'}}).entryMode)
1255
+ exception = assert_raise(RuntimeError){
1256
+ Pos.from_hash({ 'pos'=>{'entryMode'=>'something','capability'=>'notused','cardholderId'=>'pin' }})
1257
+ }
1258
+ assert_equal "If pos entryMode is specified, it must be in [\"notused\", \"keyed\", \"track1\", \"track2\", \"completeread\"]", exception.message
1259
+ exception = assert_raise(RuntimeError){
1260
+ Pos.from_hash({ 'pos'=>{'entryMode'=>'','capability'=>'notused','cardholderId'=>'pin' }})
1261
+ }
1262
+ assert_equal "If pos entryMode is specified, it must be in [\"notused\", \"keyed\", \"track1\", \"track2\", \"completeread\"]", exception.message
1263
+ exception = assert_raise(RuntimeError){
1264
+ Pos.from_hash({ 'pos'=>{'capability'=>'notused','cardholderId'=>'pin' }})
1265
+ }
1266
+ assert_equal "If pos is specified, it must have a entryMode", exception.message
1267
+ end
1268
+
1269
+ def test_pos_cardholderId
1270
+ assert_equal("signature", Pos.from_hash({'pos'=>{'cardholderId'=>'signature','entryMode'=>'notused','capability'=>'notused'}}).cardholderId)
1271
+ assert_equal("pin", Pos.from_hash({'pos'=>{'cardholderId'=>'pin','entryMode'=>'keyed','capability'=>'notused'}}).cardholderId)
1272
+ assert_equal("nopin", Pos.from_hash({'pos'=>{'cardholderId'=>'nopin','entryMode'=>'track1','capability'=>'notused'}}).cardholderId)
1273
+ assert_equal("directmarket", Pos.from_hash({'pos'=>{'cardholderId'=>'directmarket','entryMode'=>'track2','capability'=>'notused'}}).cardholderId)
1274
+ exception = assert_raise(RuntimeError){
1275
+ Pos.from_hash({ 'pos'=>{'cardholderId'=>'notused','entryMode'=>'notused','capability'=>'notused' }})
1276
+ }
1277
+ assert_equal "If pos cardholderId is specified, it must be in [\"signature\", \"pin\", \"nopin\", \"directmarket\"]", exception.message
1278
+ exception = assert_raise(RuntimeError){
1279
+ Pos.from_hash({ 'pos'=>{'cardholderId'=>'','entryMode'=>'notused','capability'=>'notused' }})
1280
+ }
1281
+ assert_equal "If pos cardholderId is specified, it must be in [\"signature\", \"pin\", \"nopin\", \"directmarket\"]", exception.message
1282
+ exception = assert_raise(RuntimeError){
1283
+ Pos.from_hash({ 'pos'=>{'entryMode'=>'notused','capability'=>'notused' }})
1284
+ }
1285
+ assert_equal "If pos is specified, it must have a cardholderId", exception.message
1286
+ end
1287
+
1288
+ def test_detailTax_taxIncludedInTotal
1289
+ assert_equal(nil, DetailTax.from_hash({'detailTax'=>[{'taxAmount'=>'1'}]},0).taxIncludedInTotal)
1290
+ assert_equal("true", DetailTax.from_hash({'detailTax'=>[{'taxIncludedInTotal'=>'true','taxAmount'=>'1'}]},0).taxIncludedInTotal)
1291
+ assert_equal("false", DetailTax.from_hash({'detailTax'=>[{'taxIncludedInTotal'=>'false','taxAmount'=>'1'}]},0).taxIncludedInTotal)
1292
+ assert_equal("1", DetailTax.from_hash({'detailTax'=>[{'taxIncludedInTotal'=>'1','taxAmount'=>'1'}]},0).taxIncludedInTotal)
1293
+ assert_equal("0", DetailTax.from_hash({'detailTax'=>[{'taxIncludedInTotal'=>'0','taxAmount'=>'1'}]},0).taxIncludedInTotal)
1294
+ exception = assert_raise(RuntimeError){
1295
+ DetailTax.from_hash({ 'detailTax'=>[{'taxIncludedInTotal'=>'vrai','taxAmount'=>'1' }]},0) #French true
1296
+ }
1297
+ assert_equal "If detailTax taxIncludedInTotal is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
1298
+ end
1299
+
1300
+ def test_detailTax_taxAmount
1301
+ assert_equal("1", DetailTax.from_hash({ 'detailTax'=>[{'taxAmount'=>'1' }]},0).taxAmount)
1302
+ assert_equal("123456789012", DetailTax.from_hash({ 'detailTax'=>[{'taxAmount'=>'123456789012' }]},0).taxAmount)
1303
+ exception = assert_raise(RuntimeError){
1304
+ DetailTax.from_hash({ 'detailTax'=>[{'taxAmount'=>'1234567890123' }]},0)
1305
+ }
1306
+ assert_equal "If detailTax taxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1307
+ exception = assert_raise(RuntimeError){
1308
+ DetailTax.from_hash({ 'detailTax'=>[{'taxAmount'=>'14.2' }]},0)
1309
+ }
1310
+ assert_equal "If detailTax taxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1311
+ exception = assert_raise(RuntimeError){
1312
+ DetailTax.from_hash({ 'detailTax'=>[{'taxAmount'=>'a' }]},0)
1313
+ }
1314
+ assert_equal "If detailTax taxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1315
+ exception = assert_raise(RuntimeError){
1316
+ DetailTax.from_hash({ 'detailTax'=>[{'taxAmount'=>'' }]},0)
1317
+ }
1318
+ assert_equal "If detailTax taxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1319
+ exception = assert_raise(RuntimeError){
1320
+ DetailTax.from_hash({ 'detailTax'=>[{}]},0)
1321
+ }
1322
+ assert_equal "If detailTax is specified, it must have a taxAmount", exception.message
1323
+ end
1324
+
1325
+ def test_detailTax_taxRate
1326
+ assert_equal("123.45", DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'123.45','taxAmount'=>'1' }]},0).taxRate)
1327
+ assert_equal("+123.45", DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'+123.45','taxAmount'=>'1' }]},0).taxRate)
1328
+ assert_equal("-123.45", DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'-123.45','taxAmount'=>'1' }]},0).taxRate)
1329
+ assert_equal("-.456", DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'-.456','taxAmount'=>'1' }]},0).taxRate)
1330
+ assert_equal("-456", DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'-456','taxAmount'=>'1' }]},0).taxRate)
1331
+ exception = assert_raise(RuntimeError){
1332
+ DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'1 234.5','taxAmount'=>'1' }]},0)
1333
+ }
1334
+ assert_equal "If detailTax taxRate is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1335
+ exception = assert_raise(RuntimeError){
1336
+ DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'12.45E+2','taxAmount'=>'1' }]},0)
1337
+ }
1338
+ assert_equal "If detailTax taxRate is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1339
+ exception = assert_raise(RuntimeError){
1340
+ DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'+ 123.45','taxAmount'=>'1' }]},0)
1341
+ }
1342
+ assert_equal "If detailTax taxRate is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1343
+ exception = assert_raise(RuntimeError){
1344
+ DetailTax.from_hash({ 'detailTax'=>[{'taxRate'=>'1,234.5','taxAmount'=>'1' }]},0)
1345
+ }
1346
+ assert_equal "If detailTax taxRate is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1347
+ end
1348
+
1349
+ def test_detailTax_taxTypeIdentifier
1350
+ assert_equal(nil, DetailTax.from_hash({'detailTax'=>[{'taxAmount'=>'1'}]},0).taxTypeIdentifier)
1351
+ assert_equal("00", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'00','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1352
+ assert_equal("01", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'01','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1353
+ assert_equal("02", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'02','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1354
+ assert_equal("03", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'03','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1355
+ assert_equal("04", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'04','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1356
+ assert_equal("05", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'05','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1357
+ assert_equal("06", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'06','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1358
+ assert_equal("10", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'10','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1359
+ assert_equal("11", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'11','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1360
+ assert_equal("12", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'12','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1361
+ assert_equal("13", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'13','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1362
+ assert_equal("14", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'14','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1363
+ assert_equal("20", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'20','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1364
+ assert_equal("21", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'21','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1365
+ assert_equal("22", DetailTax.from_hash({'detailTax'=>[{'taxTypeIdentifier'=>'22','taxAmount'=>'1'}]},0).taxTypeIdentifier)
1366
+ exception = assert_raise(RuntimeError){
1367
+ DetailTax.from_hash({ 'detailTax'=>[{'taxTypeIdentifier'=>'07','taxAmount'=>'1' }]},0)
1368
+ }
1369
+ assert_equal "If detailTax taxTypeIdentifier is specified, it must be in [\"00\", \"01\", \"02\", \"03\", \"04\", \"05\", \"06\", \"10\", \"11\", \"12\", \"13\", \"14\", \"20\", \"21\", \"22\"]", exception.message
1370
+ end
1371
+
1372
+ def test_detailTax_cardAcceptorTaxId
1373
+ assert_equal(nil, DetailTax.from_hash({'detailTax'=>[{'taxAmount'=>'1'}]},0).cardAcceptorTaxId)
1374
+ assert_equal("a", DetailTax.from_hash({'detailTax'=>[{'cardAcceptorTaxId'=>'a','taxAmount'=>'1'}]},0).cardAcceptorTaxId)
1375
+ assert_equal("1", DetailTax.from_hash({'detailTax'=>[{'cardAcceptorTaxId'=>'1','taxAmount'=>'1'}]},0).cardAcceptorTaxId)
1376
+ assert_equal("12345678901234567890", DetailTax.from_hash({'detailTax'=>[{'cardAcceptorTaxId'=>'12345678901234567890','taxAmount'=>'1'}]},0).cardAcceptorTaxId)
1377
+ exception = assert_raise(RuntimeError){
1378
+ DetailTax.from_hash({ 'detailTax'=>[{'cardAcceptorTaxId'=>'123456789012345678901','taxAmount'=>'1' }]},0)
1379
+ }
1380
+ assert_equal "If detailTax cardAcceptorTaxId is specified, it must be between 1 and 20 characters long", exception.message
1381
+ end
1382
+
1383
+ def test_lineItemData_itemSequenceNumber
1384
+ assert_equal(nil, LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'desc'}]},0).itemSequenceNumber)
1385
+ assert_equal("1", LineItemData.from_hash({'lineItemData'=>[{'itemSequenceNumber'=>'1','itemDescription'=>'desc'}]},0).itemSequenceNumber)
1386
+ assert_equal("99", LineItemData.from_hash({'lineItemData'=>[{'itemSequenceNumber'=>'99','itemDescription'=>'desc'}]},0).itemSequenceNumber)
1387
+ exception = assert_raise(RuntimeError){
1388
+ LineItemData.from_hash({ 'lineItemData'=>[{'itemSequenceNumber'=>'a','itemDescription'=>'desc'}]},0)
1389
+ }
1390
+ assert_equal "If lineItemData itemSequenceNumber is specified, it must be between 1 and 99", exception.message
1391
+ end
1392
+
1393
+ def test_lineItemData_itemDescription
1394
+ assert_equal("a", LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'a'}]},0).itemDescription)
1395
+ assert_equal("1", LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'1'}]},0).itemDescription)
1396
+ assert_equal("12345678901234567890123456", LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'12345678901234567890123456'}]},0).itemDescription)
1397
+ exception = assert_raise(RuntimeError){
1398
+ LineItemData.from_hash({ 'lineItemData'=>[{'itemDescription'=>'123456789012345678901234567'}]},0)
1399
+ }
1400
+ assert_equal "If lineItemData itemDescription is specified, it must be between 1 and 26 characters long", exception.message
1401
+ exception = assert_raise(RuntimeError){
1402
+ LineItemData.from_hash({ 'lineItemData'=>[{'itemDescription'=>''}]},0)
1403
+ }
1404
+ assert_equal "If lineItemData itemDescription is specified, it must be between 1 and 26 characters long", exception.message
1405
+ exception = assert_raise(RuntimeError){
1406
+ LineItemData.from_hash({ 'lineItemData'=>[{}]},0)
1407
+ }
1408
+ assert_equal "If lineItemData is specified, it must have a itemDescription", exception.message
1409
+ end
1410
+
1411
+ def test_lineItemData_productCode
1412
+ assert_equal(nil, LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'desc'}]},0).productCode)
1413
+ assert_equal("a", LineItemData.from_hash({'lineItemData'=>[{'productCode'=>'a','itemDescription'=>'desc'}]},0).productCode)
1414
+ assert_equal("123456789012", LineItemData.from_hash({'lineItemData'=>[{'productCode'=>'123456789012','itemDescription'=>'desc'}]},0).productCode)
1415
+ exception = assert_raise(RuntimeError){
1416
+ LineItemData.from_hash({ 'lineItemData'=>[{'productCode'=>'1234567890123','itemDescription'=>'desc'}]},0)
1417
+ }
1418
+ assert_equal "If lineItemData productCode is specified, it must be between 1 and 12 characters long", exception.message
1419
+ end
1420
+
1421
+ def test_lineItemData_quantity
1422
+ assert_equal("123.45", LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'123.45','itemDescription'=>'1' }]},0).quantity)
1423
+ assert_equal("+123.45", LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'+123.45','itemDescription'=>'1' }]},0).quantity)
1424
+ assert_equal("-123.45", LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'-123.45','itemDescription'=>'1' }]},0).quantity)
1425
+ assert_equal("-.456", LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'-.456','itemDescription'=>'1' }]},0).quantity)
1426
+ assert_equal("-456", LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'-456','itemDescription'=>'1' }]},0).quantity)
1427
+ exception = assert_raise(RuntimeError){
1428
+ LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'1 234.5','itemDescription'=>'1' }]},0)
1429
+ }
1430
+ assert_equal "If lineItemData quantity is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1431
+ exception = assert_raise(RuntimeError){
1432
+ LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'12.45E+2','itemDescription'=>'1' }]},0)
1433
+ }
1434
+ assert_equal "If lineItemData quantity is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1435
+ exception = assert_raise(RuntimeError){
1436
+ LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'+ 123.45','itemDescription'=>'1' }]},0)
1437
+ }
1438
+ assert_equal "If lineItemData quantity is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1439
+ exception = assert_raise(RuntimeError){
1440
+ LineItemData.from_hash({ 'lineItemData'=>[{'quantity'=>'1,234.5','itemDescription'=>'1' }]},0)
1441
+ }
1442
+ assert_equal "If lineItemData quantity is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1443
+ end
1444
+
1445
+ def test_lineItemData_unitOfMeasure
1446
+ assert_equal(nil, LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'desc'}]},0).unitOfMeasure)
1447
+ assert_equal("a", LineItemData.from_hash({'lineItemData'=>[{'unitOfMeasure'=>'a','itemDescription'=>'desc'}]},0).unitOfMeasure)
1448
+ assert_equal("123456789012", LineItemData.from_hash({'lineItemData'=>[{'unitOfMeasure'=>'123456789012','itemDescription'=>'desc'}]},0).unitOfMeasure)
1449
+ exception = assert_raise(RuntimeError){
1450
+ LineItemData.from_hash({ 'lineItemData'=>[{'unitOfMeasure'=>'1234567890123','itemDescription'=>'desc'}]},0)
1451
+ }
1452
+ assert_equal "If lineItemData unitOfMeasure is specified, it must be between 1 and 12 characters long", exception.message
1453
+ end
1454
+
1455
+ def test_lineItemData_taxAmount
1456
+ assert_equal(nil, LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'desc'}]},0).taxAmount)
1457
+ assert_equal("-123456789012", LineItemData.from_hash({'lineItemData'=>[{'taxAmount'=>'-123456789012','itemDescription'=>'desc'}]},0).taxAmount)
1458
+ assert_equal("123456789012", LineItemData.from_hash({'lineItemData'=>[{'taxAmount'=>'123456789012','itemDescription'=>'desc'}]},0).taxAmount)
1459
+ exception = assert_raise(RuntimeError){
1460
+ LineItemData.from_hash({ 'lineItemData'=>[{'taxAmount'=>'1234567890123','itemDescription'=>'desc'}]},0)
1461
+ }
1462
+ assert_equal "If lineItemData taxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1463
+ exception = assert_raise(RuntimeError){
1464
+ LineItemData.from_hash({ 'lineItemData'=>[{'taxAmount'=>'a','itemDescription'=>'desc'}]},0)
1465
+ }
1466
+ assert_equal "If lineItemData taxAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1467
+ end
1468
+
1469
+ def test_lineItemData_lineItemTotal
1470
+ assert_equal(nil, LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'desc'}]},0).lineItemTotal)
1471
+ assert_equal("-123456789012", LineItemData.from_hash({'lineItemData'=>[{'lineItemTotal'=>'-123456789012','itemDescription'=>'desc'}]},0).lineItemTotal)
1472
+ assert_equal("123456789012", LineItemData.from_hash({'lineItemData'=>[{'lineItemTotal'=>'123456789012','itemDescription'=>'desc'}]},0).lineItemTotal)
1473
+ exception = assert_raise(RuntimeError){
1474
+ LineItemData.from_hash({ 'lineItemData'=>[{'lineItemTotal'=>'1234567890123','itemDescription'=>'desc'}]},0)
1475
+ }
1476
+ assert_equal "If lineItemData lineItemTotal is specified, it must be between -999999999999 and 999999999999", exception.message
1477
+ exception = assert_raise(RuntimeError){
1478
+ LineItemData.from_hash({ 'lineItemData'=>[{'lineItemTotal'=>'a','itemDescription'=>'desc'}]},0)
1479
+ }
1480
+ assert_equal "If lineItemData lineItemTotal is specified, it must be between -999999999999 and 999999999999", exception.message
1481
+ end
1482
+
1483
+ def test_lineItemData_lineItemTotalWithTax
1484
+ assert_equal(nil, LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'desc'}]},0).lineItemTotalWithTax)
1485
+ assert_equal("-123456789012", LineItemData.from_hash({'lineItemData'=>[{'lineItemTotalWithTax'=>'-123456789012','itemDescription'=>'desc'}]},0).lineItemTotalWithTax)
1486
+ assert_equal("123456789012", LineItemData.from_hash({'lineItemData'=>[{'lineItemTotalWithTax'=>'123456789012','itemDescription'=>'desc'}]},0).lineItemTotalWithTax)
1487
+ exception = assert_raise(RuntimeError){
1488
+ LineItemData.from_hash({ 'lineItemData'=>[{'lineItemTotalWithTax'=>'1234567890123','itemDescription'=>'desc'}]},0)
1489
+ }
1490
+ assert_equal "If lineItemData lineItemTotalWithTax is specified, it must be between -999999999999 and 999999999999", exception.message
1491
+ exception = assert_raise(RuntimeError){
1492
+ LineItemData.from_hash({ 'lineItemData'=>[{'lineItemTotalWithTax'=>'a','itemDescription'=>'desc'}]},0)
1493
+ }
1494
+ assert_equal "If lineItemData lineItemTotalWithTax is specified, it must be between -999999999999 and 999999999999", exception.message
1495
+ end
1496
+
1497
+ def test_lineItemData_itemDiscountAmount
1498
+ assert_equal(nil, LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'desc'}]},0).itemDiscountAmount)
1499
+ assert_equal("-123456789012", LineItemData.from_hash({'lineItemData'=>[{'itemDiscountAmount'=>'-123456789012','itemDescription'=>'desc'}]},0).itemDiscountAmount)
1500
+ assert_equal("123456789012", LineItemData.from_hash({'lineItemData'=>[{'itemDiscountAmount'=>'123456789012','itemDescription'=>'desc'}]},0).itemDiscountAmount)
1501
+ exception = assert_raise(RuntimeError){
1502
+ LineItemData.from_hash({ 'lineItemData'=>[{'itemDiscountAmount'=>'1234567890123','itemDescription'=>'desc'}]},0)
1503
+ }
1504
+ assert_equal "If lineItemData itemDiscountAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1505
+ exception = assert_raise(RuntimeError){
1506
+ LineItemData.from_hash({ 'lineItemData'=>[{'itemDiscountAmount'=>'a','itemDescription'=>'desc'}]},0)
1507
+ }
1508
+ assert_equal "If lineItemData itemDiscountAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1509
+ end
1510
+
1511
+ def test_lineItemData_commodityCode
1512
+ assert_equal(nil, LineItemData.from_hash({'lineItemData'=>[{'itemDescription'=>'desc'}]},0).commodityCode)
1513
+ assert_equal("a", LineItemData.from_hash({'lineItemData'=>[{'commodityCode'=>'a','itemDescription'=>'desc'}]},0).commodityCode)
1514
+ assert_equal("123456789012", LineItemData.from_hash({'lineItemData'=>[{'commodityCode'=>'123456789012','itemDescription'=>'desc'}]},0).commodityCode)
1515
+ exception = assert_raise(RuntimeError){
1516
+ LineItemData.from_hash({ 'lineItemData'=>[{'commodityCode'=>'1234567890123','itemDescription'=>'desc'}]},0)
1517
+ }
1518
+ assert_equal "If lineItemData commodityCode is specified, it must be between 1 and 12 characters long", exception.message
1519
+ end
1520
+
1521
+ def test_lineItemData_unitCost
1522
+ assert_equal("123.45", LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'123.45','itemDescription'=>'1' }]},0).unitCost)
1523
+ assert_equal("+123.45", LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'+123.45','itemDescription'=>'1' }]},0).unitCost)
1524
+ assert_equal("-123.45", LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'-123.45','itemDescription'=>'1' }]},0).unitCost)
1525
+ assert_equal("-.456", LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'-.456','itemDescription'=>'1' }]},0).unitCost)
1526
+ assert_equal("-456", LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'-456','itemDescription'=>'1' }]},0).unitCost)
1527
+ exception = assert_raise(RuntimeError){
1528
+ LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'1 234.5','itemDescription'=>'1' }]},0)
1529
+ }
1530
+ assert_equal "If lineItemData unitCost is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1531
+ exception = assert_raise(RuntimeError){
1532
+ LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'12.45E+2','itemDescription'=>'1' }]},0)
1533
+ }
1534
+ assert_equal "If lineItemData unitCost is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1535
+ exception = assert_raise(RuntimeError){
1536
+ LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'+ 123.45','itemDescription'=>'1' }]},0)
1537
+ }
1538
+ assert_equal "If lineItemData unitCost is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1539
+ exception = assert_raise(RuntimeError){
1540
+ LineItemData.from_hash({ 'lineItemData'=>[{'unitCost'=>'1,234.5','itemDescription'=>'1' }]},0)
1541
+ }
1542
+ assert_equal "If lineItemData unitCost is specified, it must match the regular expression /\\A(\\+|\\-)?\\d*\\.?\\d*\\Z/", exception.message
1543
+ end
1544
+
1545
+ def test_enhancedData_customerReference
1546
+ assert_equal(nil, EnhancedData.from_hash({'enhancedData'=>{}}).customerReference)
1547
+ assert_equal("a", EnhancedData.from_hash({'enhancedData'=>{'customerReference'=>'a'}}).customerReference)
1548
+ assert_equal("12345678901234567", EnhancedData.from_hash({'enhancedData'=>{'customerReference'=>'12345678901234567'}}).customerReference)
1549
+ exception = assert_raise(RuntimeError){
1550
+ EnhancedData.from_hash({ 'enhancedData'=>{'customerReference'=>'123456789012345678'}})
1551
+ }
1552
+ assert_equal "If enhancedData customerReference is specified, it must be between 1 and 17 characters long", exception.message
1553
+ end
1554
+
1555
+ def test_enhancedData_salesTax
1556
+ assert_equal(nil, EnhancedData.from_hash({ 'enhancedData'=>{}}).salesTax)
1557
+ assert_equal("1", EnhancedData.from_hash({ 'enhancedData'=>{'salesTax'=>'1' }}).salesTax)
1558
+ assert_equal("123456789012", EnhancedData.from_hash({ 'enhancedData'=>{'salesTax'=>'123456789012' }}).salesTax)
1559
+ exception = assert_raise(RuntimeError){
1560
+ EnhancedData.from_hash({ 'enhancedData'=>{'salesTax'=>'1234567890123' }})
1561
+ }
1562
+ assert_equal "If enhancedData salesTax is specified, it must be between -999999999999 and 999999999999", exception.message
1563
+ exception = assert_raise(RuntimeError){
1564
+ EnhancedData.from_hash({ 'enhancedData'=>{'salesTax'=>'14.2' }})
1565
+ }
1566
+ assert_equal "If enhancedData salesTax is specified, it must be between -999999999999 and 999999999999", exception.message
1567
+ exception = assert_raise(RuntimeError){
1568
+ EnhancedData.from_hash({ 'enhancedData'=>{'salesTax'=>'a' }})
1569
+ }
1570
+ assert_equal "If enhancedData salesTax is specified, it must be between -999999999999 and 999999999999", exception.message
1571
+ end
1572
+
1573
+ def test_enhancedData_deliveryType
1574
+ assert_equal(nil, EnhancedData.from_hash({'enhancedData'=>{}}).deliveryType)
1575
+ assert_equal("CNC", EnhancedData.from_hash({'enhancedData'=>{'deliveryType'=>'CNC'}}).deliveryType)
1576
+ assert_equal("DIG", EnhancedData.from_hash({'enhancedData'=>{'deliveryType'=>'DIG'}}).deliveryType)
1577
+ assert_equal("PHY", EnhancedData.from_hash({'enhancedData'=>{'deliveryType'=>'PHY'}}).deliveryType)
1578
+ assert_equal("SVC", EnhancedData.from_hash({'enhancedData'=>{'deliveryType'=>'SVC'}}).deliveryType)
1579
+ assert_equal("TBD", EnhancedData.from_hash({'enhancedData'=>{'deliveryType'=>'TBD'}}).deliveryType)
1580
+ exception = assert_raise(RuntimeError){
1581
+ EnhancedData.from_hash({ 'enhancedData'=>{'deliveryType'=>'GAD' }})
1582
+ }
1583
+ assert_equal "If enhancedData deliveryType is specified, it must be in [\"CNC\", \"DIG\", \"PHY\", \"SVC\", \"TBD\"]", exception.message
1584
+ end
1585
+
1586
+ def test_enhancedData_taxExempt
1587
+ assert_equal(nil, EnhancedData.from_hash({'enhancedData'=>{}}).taxExempt)
1588
+ assert_equal("true", EnhancedData.from_hash({'enhancedData'=>{'taxExempt'=>'true'}}).taxExempt)
1589
+ assert_equal("false", EnhancedData.from_hash({'enhancedData'=>{'taxExempt'=>'false'}}).taxExempt)
1590
+ assert_equal("1", EnhancedData.from_hash({'enhancedData'=>{'taxExempt'=>'1'}}).taxExempt)
1591
+ assert_equal("0", EnhancedData.from_hash({'enhancedData'=>{'taxExempt'=>'0'}}).taxExempt)
1592
+ exception = assert_raise(RuntimeError){
1593
+ EnhancedData.from_hash({ 'enhancedData'=>{'taxExempt'=>'vrai' }}) #French true
1594
+ }
1595
+ assert_equal "If enhancedData taxExempt is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
1596
+ end
1597
+
1598
+ def test_enhancedData_discountAmount
1599
+ assert_equal(nil, EnhancedData.from_hash({ 'enhancedData'=>{}}).discountAmount)
1600
+ assert_equal("1", EnhancedData.from_hash({ 'enhancedData'=>{'discountAmount'=>'1' }}).discountAmount)
1601
+ assert_equal("123456789012", EnhancedData.from_hash({ 'enhancedData'=>{'discountAmount'=>'123456789012' }}).discountAmount)
1602
+ exception = assert_raise(RuntimeError){
1603
+ EnhancedData.from_hash({ 'enhancedData'=>{'discountAmount'=>'1234567890123' }})
1604
+ }
1605
+ assert_equal "If enhancedData discountAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1606
+ exception = assert_raise(RuntimeError){
1607
+ EnhancedData.from_hash({ 'enhancedData'=>{'discountAmount'=>'14.2' }})
1608
+ }
1609
+ assert_equal "If enhancedData discountAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1610
+ exception = assert_raise(RuntimeError){
1611
+ EnhancedData.from_hash({ 'enhancedData'=>{'discountAmount'=>'a' }})
1612
+ }
1613
+ assert_equal "If enhancedData discountAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1614
+ end
1615
+
1616
+ def test_enhancedData_shippingAmount
1617
+ assert_equal(nil, EnhancedData.from_hash({ 'enhancedData'=>{}}).shippingAmount)
1618
+ assert_equal("1", EnhancedData.from_hash({ 'enhancedData'=>{'shippingAmount'=>'1' }}).shippingAmount)
1619
+ assert_equal("123456789012", EnhancedData.from_hash({ 'enhancedData'=>{'shippingAmount'=>'123456789012' }}).shippingAmount)
1620
+ exception = assert_raise(RuntimeError){
1621
+ EnhancedData.from_hash({ 'enhancedData'=>{'shippingAmount'=>'1234567890123' }})
1622
+ }
1623
+ assert_equal "If enhancedData shippingAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1624
+ exception = assert_raise(RuntimeError){
1625
+ EnhancedData.from_hash({ 'enhancedData'=>{'shippingAmount'=>'14.2' }})
1626
+ }
1627
+ assert_equal "If enhancedData shippingAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1628
+ exception = assert_raise(RuntimeError){
1629
+ EnhancedData.from_hash({ 'enhancedData'=>{'shippingAmount'=>'a' }})
1630
+ }
1631
+ assert_equal "If enhancedData shippingAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1632
+ end
1633
+
1634
+ def test_enhancedData_dutyAmount
1635
+ assert_equal(nil, EnhancedData.from_hash({ 'enhancedData'=>{}}).dutyAmount)
1636
+ assert_equal("1", EnhancedData.from_hash({ 'enhancedData'=>{'dutyAmount'=>'1' }}).dutyAmount)
1637
+ assert_equal("123456789012", EnhancedData.from_hash({ 'enhancedData'=>{'dutyAmount'=>'123456789012' }}).dutyAmount)
1638
+ exception = assert_raise(RuntimeError){
1639
+ EnhancedData.from_hash({ 'enhancedData'=>{'dutyAmount'=>'1234567890123' }})
1640
+ }
1641
+ assert_equal "If enhancedData dutyAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1642
+ exception = assert_raise(RuntimeError){
1643
+ EnhancedData.from_hash({ 'enhancedData'=>{'dutyAmount'=>'14.2' }})
1644
+ }
1645
+ assert_equal "If enhancedData dutyAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1646
+ exception = assert_raise(RuntimeError){
1647
+ EnhancedData.from_hash({ 'enhancedData'=>{'dutyAmount'=>'a' }})
1648
+ }
1649
+ assert_equal "If enhancedData dutyAmount is specified, it must be between -999999999999 and 999999999999", exception.message
1650
+ end
1651
+
1652
+ def test_enhancedData_shipFromPostalCode
1653
+ assert_equal(nil, EnhancedData.from_hash({'enhancedData'=>{}}).shipFromPostalCode)
1654
+ assert_equal("a", EnhancedData.from_hash({'enhancedData'=>{'shipFromPostalCode'=>'a'}}).shipFromPostalCode)
1655
+ assert_equal("12345678901234567890", EnhancedData.from_hash({'enhancedData'=>{'shipFromPostalCode'=>'12345678901234567890'}}).shipFromPostalCode)
1656
+ exception = assert_raise(RuntimeError){
1657
+ EnhancedData.from_hash({ 'enhancedData'=>{'shipFromPostalCode'=>'123456789012345678901'}})
1658
+ }
1659
+ assert_equal "If enhancedData shipFromPostalCode is specified, it must be between 1 and 20 characters long", exception.message
1660
+ end
1661
+
1662
+ def test_enhancedData_destinationPostalCode
1663
+ assert_equal(nil, EnhancedData.from_hash({'enhancedData'=>{}}).destinationPostalCode)
1664
+ assert_equal("a", EnhancedData.from_hash({'enhancedData'=>{'destinationPostalCode'=>'a'}}).destinationPostalCode)
1665
+ assert_equal("12345678901234567890", EnhancedData.from_hash({'enhancedData'=>{'destinationPostalCode'=>'12345678901234567890'}}).destinationPostalCode)
1666
+ exception = assert_raise(RuntimeError){
1667
+ EnhancedData.from_hash({ 'enhancedData'=>{'destinationPostalCode'=>'123456789012345678901'}})
1668
+ }
1669
+ assert_equal "If enhancedData destinationPostalCode is specified, it must be between 1 and 20 characters long", exception.message
1670
+ end
1671
+
1672
+ def test_enhancedData_destinationCountryCode
1673
+ assert_equal("USA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'USA' }}).destinationCountryCode)
1674
+ assert_equal(nil, EnhancedData.from_hash({ 'enhancedData'=>{}}).destinationCountryCode)
1675
+ assert_equal("AF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AF' }}).destinationCountryCode)
1676
+ assert_equal("AX", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AX' }}).destinationCountryCode)
1677
+ assert_equal("AL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AL' }}).destinationCountryCode)
1678
+ assert_equal("DZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'DZ' }}).destinationCountryCode)
1679
+ assert_equal("AS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AS' }}).destinationCountryCode)
1680
+ assert_equal("AD", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AD' }}).destinationCountryCode)
1681
+ assert_equal("AO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AO' }}).destinationCountryCode)
1682
+ assert_equal("AI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AI' }}).destinationCountryCode)
1683
+ assert_equal("AQ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AQ' }}).destinationCountryCode)
1684
+ assert_equal("AG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AG' }}).destinationCountryCode)
1685
+ assert_equal("AR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AR' }}).destinationCountryCode)
1686
+ assert_equal("AM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AM' }}).destinationCountryCode)
1687
+ assert_equal("AW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AW' }}).destinationCountryCode)
1688
+ assert_equal("AU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AU' }}).destinationCountryCode)
1689
+ assert_equal("AZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AZ' }}).destinationCountryCode)
1690
+ assert_equal("BS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BS' }}).destinationCountryCode)
1691
+ assert_equal("BH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BH' }}).destinationCountryCode)
1692
+ assert_equal("BD", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BD' }}).destinationCountryCode)
1693
+ assert_equal("BB", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BB' }}).destinationCountryCode)
1694
+ assert_equal("BY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BY' }}).destinationCountryCode)
1695
+ assert_equal("BE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BE' }}).destinationCountryCode)
1696
+ assert_equal("BZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BZ' }}).destinationCountryCode)
1697
+ assert_equal("BJ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BJ' }}).destinationCountryCode)
1698
+ assert_equal("BM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BM' }}).destinationCountryCode)
1699
+ assert_equal("BT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BT' }}).destinationCountryCode)
1700
+ assert_equal("BO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BO' }}).destinationCountryCode)
1701
+ assert_equal("BQ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BQ' }}).destinationCountryCode)
1702
+ assert_equal("BA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BA' }}).destinationCountryCode)
1703
+ assert_equal("BW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BW' }}).destinationCountryCode)
1704
+ assert_equal("BV", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BV' }}).destinationCountryCode)
1705
+ assert_equal("BR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BR' }}).destinationCountryCode)
1706
+ assert_equal("IO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IO' }}).destinationCountryCode)
1707
+ assert_equal("BN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BN' }}).destinationCountryCode)
1708
+ assert_equal("BG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BG' }}).destinationCountryCode)
1709
+ assert_equal("BF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BF' }}).destinationCountryCode)
1710
+ assert_equal("BI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BI' }}).destinationCountryCode)
1711
+ assert_equal("KH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KH' }}).destinationCountryCode)
1712
+ assert_equal("CM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CM' }}).destinationCountryCode)
1713
+ assert_equal("CA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CA' }}).destinationCountryCode)
1714
+ assert_equal("CV", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CV' }}).destinationCountryCode)
1715
+ assert_equal("KY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KY' }}).destinationCountryCode)
1716
+ assert_equal("CF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CF' }}).destinationCountryCode)
1717
+ assert_equal("TD", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TD' }}).destinationCountryCode)
1718
+ assert_equal("CL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CL' }}).destinationCountryCode)
1719
+ assert_equal("CN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CN' }}).destinationCountryCode)
1720
+ assert_equal("CX", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CX' }}).destinationCountryCode)
1721
+ assert_equal("CC", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CC' }}).destinationCountryCode)
1722
+ assert_equal("CO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CO' }}).destinationCountryCode)
1723
+ assert_equal("KM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KM' }}).destinationCountryCode)
1724
+ assert_equal("CG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CG' }}).destinationCountryCode)
1725
+ assert_equal("CD", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CD' }}).destinationCountryCode)
1726
+ assert_equal("CK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CK' }}).destinationCountryCode)
1727
+ assert_equal("CR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CR' }}).destinationCountryCode)
1728
+ assert_equal("CI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CI' }}).destinationCountryCode)
1729
+ assert_equal("HR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'HR' }}).destinationCountryCode)
1730
+ assert_equal("CU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CU' }}).destinationCountryCode)
1731
+ assert_equal("CW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CW' }}).destinationCountryCode)
1732
+ assert_equal("CY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CY' }}).destinationCountryCode)
1733
+ assert_equal("CZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CZ' }}).destinationCountryCode)
1734
+ assert_equal("DK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'DK' }}).destinationCountryCode)
1735
+ assert_equal("DJ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'DJ' }}).destinationCountryCode)
1736
+ assert_equal("DM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'DM' }}).destinationCountryCode)
1737
+ assert_equal("DO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'DO' }}).destinationCountryCode)
1738
+ assert_equal("TL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TL' }}).destinationCountryCode)
1739
+ assert_equal("EC", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'EC' }}).destinationCountryCode)
1740
+ assert_equal("EG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'EG' }}).destinationCountryCode)
1741
+ assert_equal("SV", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SV' }}).destinationCountryCode)
1742
+ assert_equal("GQ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GQ' }}).destinationCountryCode)
1743
+ assert_equal("ER", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ER' }}).destinationCountryCode)
1744
+ assert_equal("EE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'EE' }}).destinationCountryCode)
1745
+ assert_equal("ET", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ET' }}).destinationCountryCode)
1746
+ assert_equal("FK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'FK' }}).destinationCountryCode)
1747
+ assert_equal("FO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'FO' }}).destinationCountryCode)
1748
+ assert_equal("FJ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'FJ' }}).destinationCountryCode)
1749
+ assert_equal("FI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'FI' }}).destinationCountryCode)
1750
+ assert_equal("FR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'FR' }}).destinationCountryCode)
1751
+ assert_equal("GF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GF' }}).destinationCountryCode)
1752
+ assert_equal("PF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PF' }}).destinationCountryCode)
1753
+ assert_equal("TF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TF' }}).destinationCountryCode)
1754
+ assert_equal("GA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GA' }}).destinationCountryCode)
1755
+ assert_equal("GM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GM' }}).destinationCountryCode)
1756
+ assert_equal("GE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GE' }}).destinationCountryCode)
1757
+ assert_equal("DE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'DE' }}).destinationCountryCode)
1758
+ assert_equal("GH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GH' }}).destinationCountryCode)
1759
+ assert_equal("GI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GI' }}).destinationCountryCode)
1760
+ assert_equal("GR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GR' }}).destinationCountryCode)
1761
+ assert_equal("GL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GL' }}).destinationCountryCode)
1762
+ assert_equal("GD", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GD' }}).destinationCountryCode)
1763
+ assert_equal("GP", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GP' }}).destinationCountryCode)
1764
+ assert_equal("GU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GU' }}).destinationCountryCode)
1765
+ assert_equal("GT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GT' }}).destinationCountryCode)
1766
+ assert_equal("GG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GG' }}).destinationCountryCode)
1767
+ assert_equal("GN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GN' }}).destinationCountryCode)
1768
+ assert_equal("GW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GW' }}).destinationCountryCode)
1769
+ assert_equal("GY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GY' }}).destinationCountryCode)
1770
+ assert_equal("HT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'HT' }}).destinationCountryCode)
1771
+ assert_equal("HM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'HM' }}).destinationCountryCode)
1772
+ assert_equal("HN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'HN' }}).destinationCountryCode)
1773
+ assert_equal("HK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'HK' }}).destinationCountryCode)
1774
+ assert_equal("HU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'HU' }}).destinationCountryCode)
1775
+ assert_equal("IS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IS' }}).destinationCountryCode)
1776
+ assert_equal("IN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IN' }}).destinationCountryCode)
1777
+ assert_equal("ID", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ID' }}).destinationCountryCode)
1778
+ assert_equal("IR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IR' }}).destinationCountryCode)
1779
+ assert_equal("IQ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IQ' }}).destinationCountryCode)
1780
+ assert_equal("IE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IE' }}).destinationCountryCode)
1781
+ assert_equal("IM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IM' }}).destinationCountryCode)
1782
+ assert_equal("IL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IL' }}).destinationCountryCode)
1783
+ assert_equal("IT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'IT' }}).destinationCountryCode)
1784
+ assert_equal("JM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'JM' }}).destinationCountryCode)
1785
+ assert_equal("JP", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'JP' }}).destinationCountryCode)
1786
+ assert_equal("JE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'JE' }}).destinationCountryCode)
1787
+ assert_equal("JO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'JO' }}).destinationCountryCode)
1788
+ assert_equal("KZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KZ' }}).destinationCountryCode)
1789
+ assert_equal("KE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KE' }}).destinationCountryCode)
1790
+ assert_equal("KI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KI' }}).destinationCountryCode)
1791
+ assert_equal("KP", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KP' }}).destinationCountryCode)
1792
+ assert_equal("KR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KR' }}).destinationCountryCode)
1793
+ assert_equal("KW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KW' }}).destinationCountryCode)
1794
+ assert_equal("KG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KG' }}).destinationCountryCode)
1795
+ assert_equal("LA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LA' }}).destinationCountryCode)
1796
+ assert_equal("LV", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LV' }}).destinationCountryCode)
1797
+ assert_equal("LB", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LB' }}).destinationCountryCode)
1798
+ assert_equal("LS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LS' }}).destinationCountryCode)
1799
+ assert_equal("LR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LR' }}).destinationCountryCode)
1800
+ assert_equal("LY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LY' }}).destinationCountryCode)
1801
+ assert_equal("LI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LI' }}).destinationCountryCode)
1802
+ assert_equal("LT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LT' }}).destinationCountryCode)
1803
+ assert_equal("LU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LU' }}).destinationCountryCode)
1804
+ assert_equal("MO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MO' }}).destinationCountryCode)
1805
+ assert_equal("MK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MK' }}).destinationCountryCode)
1806
+ assert_equal("MG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MG' }}).destinationCountryCode)
1807
+ assert_equal("MW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MW' }}).destinationCountryCode)
1808
+ assert_equal("MY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MY' }}).destinationCountryCode)
1809
+ assert_equal("MV", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MV' }}).destinationCountryCode)
1810
+ assert_equal("ML", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ML' }}).destinationCountryCode)
1811
+ assert_equal("MT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MT' }}).destinationCountryCode)
1812
+ assert_equal("MH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MH' }}).destinationCountryCode)
1813
+ assert_equal("MQ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MQ' }}).destinationCountryCode)
1814
+ assert_equal("MR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MR' }}).destinationCountryCode)
1815
+ assert_equal("MU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MU' }}).destinationCountryCode)
1816
+ assert_equal("YT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'YT' }}).destinationCountryCode)
1817
+ assert_equal("MX", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MX' }}).destinationCountryCode)
1818
+ assert_equal("FM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'FM' }}).destinationCountryCode)
1819
+ assert_equal("MD", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MD' }}).destinationCountryCode)
1820
+ assert_equal("MC", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MC' }}).destinationCountryCode)
1821
+ assert_equal("MN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MN' }}).destinationCountryCode)
1822
+ assert_equal("MS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MS' }}).destinationCountryCode)
1823
+ assert_equal("MA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MA' }}).destinationCountryCode)
1824
+ assert_equal("MZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MZ' }}).destinationCountryCode)
1825
+ assert_equal("MM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MM' }}).destinationCountryCode)
1826
+ assert_equal("NA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NA' }}).destinationCountryCode)
1827
+ assert_equal("NR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NR' }}).destinationCountryCode)
1828
+ assert_equal("NP", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NP' }}).destinationCountryCode)
1829
+ assert_equal("NL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NL' }}).destinationCountryCode)
1830
+ assert_equal("AN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AN' }}).destinationCountryCode)
1831
+ assert_equal("NC", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NC' }}).destinationCountryCode)
1832
+ assert_equal("NZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NZ' }}).destinationCountryCode)
1833
+ assert_equal("NI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NI' }}).destinationCountryCode)
1834
+ assert_equal("NE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NE' }}).destinationCountryCode)
1835
+ assert_equal("NG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NG' }}).destinationCountryCode)
1836
+ assert_equal("NU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NU' }}).destinationCountryCode)
1837
+ assert_equal("NF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NF' }}).destinationCountryCode)
1838
+ assert_equal("MP", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MP' }}).destinationCountryCode)
1839
+ assert_equal("NO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'NO' }}).destinationCountryCode)
1840
+ assert_equal("OM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'OM' }}).destinationCountryCode)
1841
+ assert_equal("PK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PK' }}).destinationCountryCode)
1842
+ assert_equal("PW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PW' }}).destinationCountryCode)
1843
+ assert_equal("PS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PS' }}).destinationCountryCode)
1844
+ assert_equal("PA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PA' }}).destinationCountryCode)
1845
+ assert_equal("PG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PG' }}).destinationCountryCode)
1846
+ assert_equal("PY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PY' }}).destinationCountryCode)
1847
+ assert_equal("PE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PE' }}).destinationCountryCode)
1848
+ assert_equal("PH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PH' }}).destinationCountryCode)
1849
+ assert_equal("PN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PN' }}).destinationCountryCode)
1850
+ assert_equal("PL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PL' }}).destinationCountryCode)
1851
+ assert_equal("PT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PT' }}).destinationCountryCode)
1852
+ assert_equal("PR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PR' }}).destinationCountryCode)
1853
+ assert_equal("QA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'QA' }}).destinationCountryCode)
1854
+ assert_equal("RE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'RE' }}).destinationCountryCode)
1855
+ assert_equal("RO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'RO' }}).destinationCountryCode)
1856
+ assert_equal("RU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'RU' }}).destinationCountryCode)
1857
+ assert_equal("RW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'RW' }}).destinationCountryCode)
1858
+ assert_equal("BL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'BL' }}).destinationCountryCode)
1859
+ assert_equal("KN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'KN' }}).destinationCountryCode)
1860
+ assert_equal("LC", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LC' }}).destinationCountryCode)
1861
+ assert_equal("MF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'MF' }}).destinationCountryCode)
1862
+ assert_equal("VC", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'VC' }}).destinationCountryCode)
1863
+ assert_equal("WS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'WS' }}).destinationCountryCode)
1864
+ assert_equal("SM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SM' }}).destinationCountryCode)
1865
+ assert_equal("ST", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ST' }}).destinationCountryCode)
1866
+ assert_equal("SA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SA' }}).destinationCountryCode)
1867
+ assert_equal("SN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SN' }}).destinationCountryCode)
1868
+ assert_equal("SC", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SC' }}).destinationCountryCode)
1869
+ assert_equal("SL", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SL' }}).destinationCountryCode)
1870
+ assert_equal("SG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SG' }}).destinationCountryCode)
1871
+ assert_equal("SX", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SX' }}).destinationCountryCode)
1872
+ assert_equal("SK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SK' }}).destinationCountryCode)
1873
+ assert_equal("SI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SI' }}).destinationCountryCode)
1874
+ assert_equal("SB", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SB' }}).destinationCountryCode)
1875
+ assert_equal("SO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SO' }}).destinationCountryCode)
1876
+ assert_equal("ZA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ZA' }}).destinationCountryCode)
1877
+ assert_equal("GS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GS' }}).destinationCountryCode)
1878
+ assert_equal("ES", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ES' }}).destinationCountryCode)
1879
+ assert_equal("LK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'LK' }}).destinationCountryCode)
1880
+ assert_equal("SH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SH' }}).destinationCountryCode)
1881
+ assert_equal("PM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'PM' }}).destinationCountryCode)
1882
+ assert_equal("SD", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SD' }}).destinationCountryCode)
1883
+ assert_equal("SR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SR' }}).destinationCountryCode)
1884
+ assert_equal("SJ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SJ' }}).destinationCountryCode)
1885
+ assert_equal("SZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SZ' }}).destinationCountryCode)
1886
+ assert_equal("SE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SE' }}).destinationCountryCode)
1887
+ assert_equal("CH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'CH' }}).destinationCountryCode)
1888
+ assert_equal("SY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'SY' }}).destinationCountryCode)
1889
+ assert_equal("TW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TW' }}).destinationCountryCode)
1890
+ assert_equal("TJ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TJ' }}).destinationCountryCode)
1891
+ assert_equal("TZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TZ' }}).destinationCountryCode)
1892
+ assert_equal("TH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TH' }}).destinationCountryCode)
1893
+ assert_equal("TG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TG' }}).destinationCountryCode)
1894
+ assert_equal("TK", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TK' }}).destinationCountryCode)
1895
+ assert_equal("TO", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TO' }}).destinationCountryCode)
1896
+ assert_equal("TT", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TT' }}).destinationCountryCode)
1897
+ assert_equal("TN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TN' }}).destinationCountryCode)
1898
+ assert_equal("TR", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TR' }}).destinationCountryCode)
1899
+ assert_equal("TM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TM' }}).destinationCountryCode)
1900
+ assert_equal("TC", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TC' }}).destinationCountryCode)
1901
+ assert_equal("TV", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'TV' }}).destinationCountryCode)
1902
+ assert_equal("UG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'UG' }}).destinationCountryCode)
1903
+ assert_equal("UA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'UA' }}).destinationCountryCode)
1904
+ assert_equal("AE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'AE' }}).destinationCountryCode)
1905
+ assert_equal("GB", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'GB' }}).destinationCountryCode)
1906
+ assert_equal("US", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'US' }}).destinationCountryCode)
1907
+ assert_equal("UM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'UM' }}).destinationCountryCode)
1908
+ assert_equal("UY", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'UY' }}).destinationCountryCode)
1909
+ assert_equal("UZ", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'UZ' }}).destinationCountryCode)
1910
+ assert_equal("VU", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'VU' }}).destinationCountryCode)
1911
+ assert_equal("VA", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'VA' }}).destinationCountryCode)
1912
+ assert_equal("VE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'VE' }}).destinationCountryCode)
1913
+ assert_equal("VN", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'VN' }}).destinationCountryCode)
1914
+ assert_equal("VG", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'VG' }}).destinationCountryCode)
1915
+ assert_equal("VI", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'VI' }}).destinationCountryCode)
1916
+ assert_equal("WF", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'WF' }}).destinationCountryCode)
1917
+ assert_equal("EH", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'EH' }}).destinationCountryCode)
1918
+ assert_equal("YE", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'YE' }}).destinationCountryCode)
1919
+ assert_equal("ZM", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ZM' }}).destinationCountryCode)
1920
+ assert_equal("ZW", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ZW' }}).destinationCountryCode)
1921
+ assert_equal("RS", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'RS' }}).destinationCountryCode)
1922
+ assert_equal("ME", EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ME' }}).destinationCountryCode)
1923
+
1924
+ exception = assert_raise(RuntimeError){
1925
+ EnhancedData.from_hash({ 'enhancedData'=>{'destinationCountryCode'=>'ABC' }})
1926
+ }
1927
+ assert_equal "If enhancedData destinationCountryCode is specified, it must be valid. You specified ABC", exception.message
1928
+ end
1929
+
1930
+ def test_enhancedData_invoiceReferenceNumber
1931
+ assert_equal(nil, EnhancedData.from_hash({'enhancedData'=>{}}).invoiceReferenceNumber)
1932
+ assert_equal("a", EnhancedData.from_hash({'enhancedData'=>{'invoiceReferenceNumber'=>'a'}}).invoiceReferenceNumber)
1933
+ assert_equal("123456789012345", EnhancedData.from_hash({'enhancedData'=>{'invoiceReferenceNumber'=>'123456789012345'}}).invoiceReferenceNumber)
1934
+ exception = assert_raise(RuntimeError){
1935
+ EnhancedData.from_hash({ 'enhancedData'=>{'invoiceReferenceNumber'=>'1234567890123456'}})
1936
+ }
1937
+ assert_equal "If enhancedData invoiceReferenceNumber is specified, it must be between 1 and 15 characters long", exception.message
1938
+ end
1939
+
1940
+ def test_enhancedData_orderDate
1941
+ assert_equal(nil, EnhancedData.from_hash({'enhancedData'=>{}}).orderDate)
1942
+ assert_equal("2012-04-11", EnhancedData.from_hash({'enhancedData'=>{'orderDate'=>'2012-04-11'}}).orderDate)
1943
+ assert_equal("2012-11-04", EnhancedData.from_hash({'enhancedData'=>{'orderDate'=>'2012-11-04'}}).orderDate)
1944
+ exception = assert_raise(RuntimeError){
1945
+ EnhancedData.from_hash({ 'enhancedData'=>{'orderDate'=>'04-11-2012' }})
1946
+ }
1947
+ assert_equal "If enhancedData orderDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1948
+ exception = assert_raise(RuntimeError){
1949
+ EnhancedData.from_hash({ 'enhancedData'=>{'orderDate'=>'11-04-2012' }})
1950
+ }
1951
+ assert_equal "If enhancedData orderDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1952
+ exception = assert_raise(RuntimeError){
1953
+ EnhancedData.from_hash({ 'enhancedData'=>{'orderDate'=>'2012-4-11' }})
1954
+ }
1955
+ assert_equal "If enhancedData orderDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1956
+ exception = assert_raise(RuntimeError){
1957
+ EnhancedData.from_hash({ 'enhancedData'=>{'orderDate'=>'2012-11-4' }})
1958
+ }
1959
+ assert_equal "If enhancedData orderDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1960
+ exception = assert_raise(RuntimeError){
1961
+ EnhancedData.from_hash({ 'enhancedData'=>{'orderDate'=>'12-11-04' }})
1962
+ }
1963
+ assert_equal "If enhancedData orderDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1964
+ exception = assert_raise(RuntimeError){
1965
+ EnhancedData.from_hash({ 'enhancedData'=>{'orderDate'=>'aaaa-mm-dd' }})
1966
+ }
1967
+ assert_equal "If enhancedData orderDate is specified, it must match the regular expression /\\A\\d{4}-\\d{2}-\\d{2}\\Z/", exception.message
1968
+ end
1969
+
1970
+ def test_amexAggregatorData_sellerId
1971
+ assert_equal(nil, AmexAggregatorData.from_hash({'amexAggregatorData'=>{}}).sellerId)
1972
+ assert_equal("a", AmexAggregatorData.from_hash({'amexAggregatorData'=>{'sellerId'=>'a'}}).sellerId)
1973
+ assert_equal("1234567890123456", AmexAggregatorData.from_hash({'amexAggregatorData'=>{'sellerId'=>'1234567890123456'}}).sellerId)
1974
+ exception = assert_raise(RuntimeError){
1975
+ AmexAggregatorData.from_hash({ 'amexAggregatorData'=>{'sellerId'=>'12345678901234567'}})
1976
+ }
1977
+ assert_equal "If amexAggregatorData sellerId is specified, it must be between 1 and 16 characters long", exception.message
1978
+ end
1979
+
1980
+ def test_amexAggregatorData_sellerMerchantCategoryCode
1981
+ assert_equal(nil, AmexAggregatorData.from_hash({'amexAggregatorData'=>{}}).sellerMerchantCategoryCode)
1982
+ assert_equal("a", AmexAggregatorData.from_hash({'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'a'}}).sellerMerchantCategoryCode)
1983
+ assert_equal("1234", AmexAggregatorData.from_hash({'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'1234'}}).sellerMerchantCategoryCode)
1984
+ exception = assert_raise(RuntimeError){
1985
+ AmexAggregatorData.from_hash({ 'amexAggregatorData'=>{'sellerMerchantCategoryCode'=>'12345'}})
1986
+ }
1987
+ assert_equal "If amexAggregatorData sellerMerchantCategoryCode is specified, it must be between 1 and 4 characters long", exception.message
1988
+ end
1989
+
1990
+ def test_card_mop
1991
+ assert_equal(nil, Card.from_hash({'card'=>{}}).mop)
1992
+ assert_equal("", Card.from_hash({'card'=>{'type'=>''}}).mop)
1993
+ assert_equal("MC", Card.from_hash({'card'=>{'type'=>'MC'}}).mop)
1994
+ assert_equal("VI", Card.from_hash({'card'=>{'type'=>'VI'}}).mop)
1995
+ assert_equal("AX", Card.from_hash({'card'=>{'type'=>'AX'}}).mop)
1996
+ assert_equal("DC", Card.from_hash({'card'=>{'type'=>'DC'}}).mop)
1997
+ assert_equal("DI", Card.from_hash({'card'=>{'type'=>'DI'}}).mop)
1998
+ assert_equal("PP", Card.from_hash({'card'=>{'type'=>'PP'}}).mop)
1999
+ assert_equal("JC", Card.from_hash({'card'=>{'type'=>'JC'}}).mop)
2000
+ assert_equal("BL", Card.from_hash({'card'=>{'type'=>'BL'}}).mop)
2001
+ assert_equal("EC", Card.from_hash({'card'=>{'type'=>'EC'}}).mop)
2002
+ exception = assert_raise(RuntimeError){
2003
+ Card.from_hash({ 'card'=>{'type'=>'ZZ' }})
2004
+ }
2005
+ assert_equal "If card type is specified, it must be in [\"\", \"MC\", \"VI\", \"AX\", \"DC\", \"DI\", \"PP\", \"JC\", \"BL\", \"EC\"]", exception.message
2006
+ end
2007
+
2008
+ def test_card_track
2009
+ assert_equal(nil, Card.from_hash({'card'=>{}}).track)
2010
+ assert_equal("a", Card.from_hash({'card'=>{'track'=>'a'}}).track)
2011
+ assert_equal("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456", Card.from_hash({'card'=>{'track'=>'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456'}}).track)
2012
+ exception = assert_raise(RuntimeError){
2013
+ Card.from_hash({ 'card'=>{'track'=>'12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567'}})
2014
+ }
2015
+ assert_equal "If card track is specified, it must be between 1 and 256 characters long", exception.message
2016
+ end
2017
+
2018
+ def test_card_number
2019
+ assert_equal(nil, Card.from_hash({'card'=>{}}).number)
2020
+ assert_equal("abcdefghijklm", Card.from_hash({'card'=>{'number'=>'abcdefghijklm'}}).number)
2021
+ assert_equal("1234567890123", Card.from_hash({'card'=>{'number'=>'1234567890123'}}).number)
2022
+ assert_equal("1234567890123456789012345", Card.from_hash({'card'=>{'number'=>'1234567890123456789012345'}}).number)
2023
+ exception = assert_raise(RuntimeError){
2024
+ Card.from_hash({ 'card'=>{'number'=>'12345678901234567890123456'}})
2025
+ }
2026
+ assert_equal "If card number is specified, it must be between 13 and 25 characters long", exception.message
2027
+ end
2028
+
2029
+ def test_card_expDate
2030
+ assert_equal(nil, Card.from_hash({'card'=>{}}).expDate)
2031
+ assert_equal("abcd", Card.from_hash({'card'=>{'expDate'=>'abcd'}}).expDate)
2032
+ assert_equal("1234", Card.from_hash({'card'=>{'expDate'=>'1234'}}).expDate)
2033
+ exception = assert_raise(RuntimeError){
2034
+ Card.from_hash({ 'card'=>{'expDate'=>'123'}})
2035
+ }
2036
+ assert_equal "If card expDate is specified, it must be between 4 and 4 characters long", exception.message
2037
+ exception = assert_raise(RuntimeError){
2038
+ Card.from_hash({ 'card'=>{'expDate'=>'12345'}})
2039
+ }
2040
+ assert_equal "If card expDate is specified, it must be between 4 and 4 characters long", exception.message
2041
+ end
2042
+
2043
+ def test_card_cardValidationNum
2044
+ assert_equal(nil, Card.from_hash({'card'=>{}}).cardValidationNum)
2045
+ assert_equal("a", Card.from_hash({'card'=>{'cardValidationNum'=>'a'}}).cardValidationNum)
2046
+ assert_equal("1234", Card.from_hash({'card'=>{'cardValidationNum'=>'1234'}}).cardValidationNum)
2047
+ exception = assert_raise(RuntimeError){
2048
+ Card.from_hash({ 'card'=>{'cardValidationNum'=>'12345'}})
2049
+ }
2050
+ assert_equal "If card cardValidationNum is specified, it must be between 1 and 4 characters long", exception.message
2051
+ end
2052
+
2053
+ def test_cardToken_litleToken
2054
+ assert_equal("abcdefghijklm", CardToken.from_hash({'cardToken'=>{'litleToken'=>'abcdefghijklm'}}).litleToken)
2055
+ assert_equal("1234567890123", CardToken.from_hash({'cardToken'=>{'litleToken'=>'1234567890123'}}).litleToken)
2056
+ assert_equal("1234567890123456789012345", CardToken.from_hash({'cardToken'=>{'litleToken'=>'1234567890123456789012345'}}).litleToken)
2057
+ exception = assert_raise(RuntimeError){
2058
+ CardToken.from_hash({ 'cardToken'=>{'litleToken'=>'12345678901234567890123456'}})
2059
+ }
2060
+ assert_equal "If cardToken litleToken is specified, it must be between 13 and 25 characters long", exception.message
2061
+ exception = assert_raise(RuntimeError){
2062
+ CardToken.from_hash({ 'cardToken'=>{}})
2063
+ }
2064
+ assert_equal "If cardToken is specified, it must have a litleToken", exception.message
2065
+ end
2066
+
2067
+ def test_cardToken_expDate
2068
+ assert_equal(nil, CardToken.from_hash({'cardToken'=>{'litleToken'=>'1234567890123'}}).expDate)
2069
+ assert_equal("abcd", CardToken.from_hash({'cardToken'=>{'expDate'=>'abcd','litleToken'=>'1234567890123'}}).expDate)
2070
+ assert_equal("1234", CardToken.from_hash({'cardToken'=>{'expDate'=>'1234','litleToken'=>'1234567890123'}}).expDate)
2071
+ exception = assert_raise(RuntimeError){
2072
+ CardToken.from_hash({ 'cardToken'=>{'expDate'=>'123','litleToken'=>'1234567890123'}})
2073
+ }
2074
+ assert_equal "If cardToken expDate is specified, it must be between 4 and 4 characters long", exception.message
2075
+ exception = assert_raise(RuntimeError){
2076
+ CardToken.from_hash({ 'cardToken'=>{'expDate'=>'12345','litleToken'=>'1234567890123'}})
2077
+ }
2078
+ assert_equal "If cardToken expDate is specified, it must be between 4 and 4 characters long", exception.message
2079
+ end
2080
+
2081
+ def test_cardToken_cardValidationNum
2082
+ assert_equal(nil, CardToken.from_hash({'cardToken'=>{'litleToken'=>'1234567890123'}}).cardValidationNum)
2083
+ assert_equal("a", CardToken.from_hash({'cardToken'=>{'cardValidationNum'=>'a','litleToken'=>'1234567890123'}}).cardValidationNum)
2084
+ assert_equal("1234", CardToken.from_hash({'cardToken'=>{'cardValidationNum'=>'1234','litleToken'=>'1234567890123'}}).cardValidationNum)
2085
+ exception = assert_raise(RuntimeError){
2086
+ CardToken.from_hash({ 'cardToken'=>{'cardValidationNum'=>'12345','litleToken'=>'1234567890123'}})
2087
+ }
2088
+ assert_equal "If cardToken cardValidationNum is specified, it must be between 1 and 4 characters long", exception.message
2089
+ end
2090
+
2091
+ def test_cardToken_mop
2092
+ assert_equal(nil, CardToken.from_hash({'cardToken'=>{'litleToken'=>'1234567890123'}}).mop)
2093
+ assert_equal("", CardToken.from_hash({'cardToken'=>{'type'=>'','litleToken'=>'1234567890123'}}).mop)
2094
+ assert_equal("MC", CardToken.from_hash({'cardToken'=>{'type'=>'MC','litleToken'=>'1234567890123'}}).mop)
2095
+ assert_equal("VI", CardToken.from_hash({'cardToken'=>{'type'=>'VI','litleToken'=>'1234567890123'}}).mop)
2096
+ assert_equal("AX", CardToken.from_hash({'cardToken'=>{'type'=>'AX','litleToken'=>'1234567890123'}}).mop)
2097
+ assert_equal("DC", CardToken.from_hash({'cardToken'=>{'type'=>'DC','litleToken'=>'1234567890123'}}).mop)
2098
+ assert_equal("DI", CardToken.from_hash({'cardToken'=>{'type'=>'DI','litleToken'=>'1234567890123'}}).mop)
2099
+ assert_equal("PP", CardToken.from_hash({'cardToken'=>{'type'=>'PP','litleToken'=>'1234567890123'}}).mop)
2100
+ assert_equal("JC", CardToken.from_hash({'cardToken'=>{'type'=>'JC','litleToken'=>'1234567890123'}}).mop)
2101
+ assert_equal("BL", CardToken.from_hash({'cardToken'=>{'type'=>'BL','litleToken'=>'1234567890123'}}).mop)
2102
+ assert_equal("EC", CardToken.from_hash({'cardToken'=>{'type'=>'EC','litleToken'=>'1234567890123'}}).mop)
2103
+ exception = assert_raise(RuntimeError){
2104
+ CardToken.from_hash({ 'cardToken'=>{'type'=>'ZZ','litleToken'=>'1234567890123'}})
2105
+ }
2106
+ assert_equal "If cardToken type is specified, it must be in [\"\", \"MC\", \"VI\", \"AX\", \"DC\", \"DI\", \"PP\", \"JC\", \"BL\", \"EC\"]", exception.message
2107
+ end
2108
+
2109
+ def test_cardPaypage_paypageRegistrationId
2110
+ assert_equal("a", CardPaypage.from_hash({'cardPaypage'=>{'paypageRegistrationId'=>'a'}}).paypageRegistrationId)
2111
+ assert_equal("1234567890123", CardPaypage.from_hash({'cardPaypage'=>{'paypageRegistrationId'=>'1234567890123'}}).paypageRegistrationId)
2112
+ assert_equal("12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012", CardPaypage.from_hash({'cardPaypage'=>{'paypageRegistrationId'=>'12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012'}}).paypageRegistrationId)
2113
+ exception = assert_raise(RuntimeError){
2114
+ CardPaypage.from_hash({ 'cardPaypage'=>{'paypageRegistrationId'=>'123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123'}})
2115
+ }
2116
+ assert_equal "If cardPaypage paypageRegistrationId is specified, it must be between 1 and 512 characters long", exception.message
2117
+ exception = assert_raise(RuntimeError){
2118
+ CardPaypage.from_hash({ 'cardPaypage'=>{}})
2119
+ }
2120
+ assert_equal "If cardPaypage is specified, it must have a paypageRegistrationId", exception.message
2121
+ end
2122
+
2123
+ def test_cardPaypage_expDate
2124
+ assert_equal(nil, CardPaypage.from_hash({'cardPaypage'=>{'paypageRegistrationId'=>'1'}}).expDate)
2125
+ assert_equal("abcd", CardPaypage.from_hash({'cardPaypage'=>{'expDate'=>'abcd','paypageRegistrationId'=>'1'}}).expDate)
2126
+ assert_equal("1234", CardPaypage.from_hash({'cardPaypage'=>{'expDate'=>'1234','paypageRegistrationId'=>'1'}}).expDate)
2127
+ exception = assert_raise(RuntimeError){
2128
+ CardPaypage.from_hash({ 'cardPaypage'=>{'expDate'=>'123','paypageRegistrationId'=>'1'}})
2129
+ }
2130
+ assert_equal "If cardPaypage expDate is specified, it must be between 4 and 4 characters long", exception.message
2131
+ exception = assert_raise(RuntimeError){
2132
+ CardPaypage.from_hash({ 'cardPaypage'=>{'expDate'=>'12345','paypageRegistrationId'=>'1'}})
2133
+ }
2134
+ assert_equal "If cardPaypage expDate is specified, it must be between 4 and 4 characters long", exception.message
2135
+ end
2136
+
2137
+ def test_cardPaypage_cardValidationNum
2138
+ assert_equal(nil, CardPaypage.from_hash({'cardPaypage'=>{'paypageRegistrationId'=>'1234567890123'}}).cardValidationNum)
2139
+ assert_equal("a", CardPaypage.from_hash({'cardPaypage'=>{'cardValidationNum'=>'a','paypageRegistrationId'=>'1234567890123'}}).cardValidationNum)
2140
+ assert_equal("1234", CardPaypage.from_hash({'cardPaypage'=>{'cardValidationNum'=>'1234','paypageRegistrationId'=>'1234567890123'}}).cardValidationNum)
2141
+ exception = assert_raise(RuntimeError){
2142
+ CardPaypage.from_hash({ 'cardPaypage'=>{'cardValidationNum'=>'12345','paypageRegistrationId'=>'1234567890123'}})
2143
+ }
2144
+ assert_equal "If cardPaypage cardValidationNum is specified, it must be between 1 and 4 characters long", exception.message
2145
+ end
2146
+
2147
+ def test_cardPaypage_mop
2148
+ assert_equal(nil, CardPaypage.from_hash({'cardPaypage'=>{'paypageRegistrationId'=>'1234567890123'}}).mop)
2149
+ assert_equal("", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'','paypageRegistrationId'=>'1234567890123'}}).mop)
2150
+ assert_equal("MC", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'MC','paypageRegistrationId'=>'1234567890123'}}).mop)
2151
+ assert_equal("VI", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'VI','paypageRegistrationId'=>'1234567890123'}}).mop)
2152
+ assert_equal("AX", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'AX','paypageRegistrationId'=>'1234567890123'}}).mop)
2153
+ assert_equal("DC", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'DC','paypageRegistrationId'=>'1234567890123'}}).mop)
2154
+ assert_equal("DI", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'DI','paypageRegistrationId'=>'1234567890123'}}).mop)
2155
+ assert_equal("PP", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'PP','paypageRegistrationId'=>'1234567890123'}}).mop)
2156
+ assert_equal("JC", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'JC','paypageRegistrationId'=>'1234567890123'}}).mop)
2157
+ assert_equal("BL", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'BL','paypageRegistrationId'=>'1234567890123'}}).mop)
2158
+ assert_equal("EC", CardPaypage.from_hash({'cardPaypage'=>{'type'=>'EC','paypageRegistrationId'=>'1234567890123'}}).mop)
2159
+ exception = assert_raise(RuntimeError){
2160
+ CardPaypage.from_hash({ 'cardPaypage'=>{'type'=>'ZZ','paypageRegistrationId'=>'1234567890123'}})
2161
+ }
2162
+ assert_equal "If cardPaypage type is specified, it must be in [\"\", \"MC\", \"VI\", \"AX\", \"DC\", \"DI\", \"PP\", \"JC\", \"BL\", \"EC\"]", exception.message
2163
+ end
2164
+
2165
+ def test_payPal_payerId
2166
+ assert_equal("a", PayPal.from_hash({'payPal'=>{'payerId'=>'a','transactionId'=>'b'}}).payerId)
2167
+ assert_equal("1234567890123", PayPal.from_hash({'payPal'=>{'payerId'=>'1234567890123','transactionId'=>'b'}}).payerId)
2168
+ assert_equal("123", PayPal.from_hash({'payPal'=>{'payerId'=>'123','transactionId'=>'b'}}).payerId)
2169
+ exception = assert_raise(RuntimeError){
2170
+ PayPal.from_hash({ 'payPal'=>{'transactionId'=>'b'}})
2171
+ }
2172
+ assert_equal "If payPal is specified, it must have a payerId", exception.message
2173
+ end
2174
+
2175
+ def test_payPal_token
2176
+ assert_equal(nil, PayPal.from_hash({'payPal'=>{'payerId'=>'1','transactionId'=>'b'}}).token)
2177
+ assert_equal("a", PayPal.from_hash({'payPal'=>{'payerId'=>'1','transactionId'=>'b','token'=>'a'}}).token)
2178
+ assert_equal("1234567890123", PayPal.from_hash({'payPal'=>{'payerId'=>'1','transactionId'=>'b','token'=>'1234567890123'}}).token)
2179
+ assert_equal("123", PayPal.from_hash({'payPal'=>{'payerId'=>'1','transactionId'=>'b','token'=>'123'}}).token)
2180
+ end
2181
+
2182
+ def test_payPal_transactionId
2183
+ assert_equal("b", PayPal.from_hash({'payPal'=>{'payerId'=>'a','transactionId'=>'b'}}).transactionId)
2184
+ exception = assert_raise(RuntimeError){
2185
+ PayPal.from_hash({ 'payPal'=>{'payerId'=>'a'}})
2186
+ }
2187
+ assert_equal "If payPal is specified, it must have a transactionId", exception.message
2188
+ end
2189
+
2190
+ def test_creditPaypal_payerId
2191
+ assert_equal(nil, CreditPayPal.from_hash({'creditPaypal'=>{'payerEmail'=>'b'}}).payerId)
2192
+ assert_equal("a", CreditPayPal.from_hash({'creditPaypal'=>{'payerId'=>'a','payerEmail'=>'b'}}).payerId)
2193
+ assert_equal("12345678901234567", CreditPayPal.from_hash({'creditPaypal'=>{'payerId'=>'12345678901234567','payerEmail'=>'b'}}).payerId)
2194
+ assert_equal("123", CreditPayPal.from_hash({'creditPaypal'=>{'payerId'=>'123','payerEmail'=>'b'}}).payerId)
2195
+ exception = assert_raise(RuntimeError){
2196
+ CreditPayPal.from_hash({ 'creditPaypal'=>{'payerId'=>'123456789012345678','payerEmail'=>'b'}})
2197
+ }
2198
+ assert_equal "If creditPaypal payerId is specified, it must be between 1 and 17 characters long", exception.message
2199
+ end
2200
+
2201
+ def test_creditPaypal_payerEmail
2202
+ assert_equal(nil, CreditPayPal.from_hash({'creditPaypal'=>{'payerId'=>'a'}}).payerEmail)
2203
+ assert_equal("b", CreditPayPal.from_hash({'creditPaypal'=>{'payerId'=>'a','payerEmail'=>'b'}}).payerEmail)
2204
+ assert_equal("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567", CreditPayPal.from_hash({'creditPaypal'=>{'payerId'=>'12345678901234567','payerEmail'=>'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567'}}).payerEmail)
2205
+ exception = assert_raise(RuntimeError){
2206
+ CreditPayPal.from_hash({ 'creditPaypal'=>{'payerId'=>'1','payerEmail'=>'12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678'}})
2207
+ }
2208
+ assert_equal "If creditPaypal payerEmail is specified, it must be between 1 and 127 characters long", exception.message
2209
+ end
2210
+
2211
+ def test_customBilling_phone
2212
+ assert_equal(nil, CustomBilling.from_hash({'customBilling'=>{}}).phone)
2213
+ assert_equal("1", CustomBilling.from_hash({'customBilling'=>{'phone'=>'1'}}).phone)
2214
+ assert_equal("1234567890123", CustomBilling.from_hash({'customBilling'=>{'phone'=>'1234567890123'}}).phone)
2215
+ exception = assert_raise(RuntimeError){
2216
+ CustomBilling.from_hash({ 'customBilling'=>{'phone'=>'12345678901234'}})
2217
+ }
2218
+ assert_equal "If customBilling phone is specified, it must match the regular expression /\\A\\d{1,13}\\Z/", exception.message
2219
+ exception = assert_raise(RuntimeError){
2220
+ CustomBilling.from_hash({ 'customBilling'=>{'phone'=>'abc'}})
2221
+ }
2222
+ assert_equal "If customBilling phone is specified, it must match the regular expression /\\A\\d{1,13}\\Z/", exception.message
2223
+ end
2224
+
2225
+ def test_customBilling_city
2226
+ assert_equal(nil, CustomBilling.from_hash({'customBilling'=>{}}).city)
2227
+ assert_equal("a", CustomBilling.from_hash({'customBilling'=>{'city'=>'a'}}).city)
2228
+ assert_equal("12345678901234567890123456789012345", CustomBilling.from_hash({'customBilling'=>{'city'=>'12345678901234567890123456789012345'}}).city)
2229
+ exception = assert_raise(RuntimeError){
2230
+ CustomBilling.from_hash({ 'customBilling'=>{'city'=>'123456789012345678901234567890123456'}})
2231
+ }
2232
+ assert_equal "If customBilling city is specified, it must be between 1 and 35 characters long", exception.message
2233
+ end
2234
+
2235
+ def test_customBilling_url
2236
+ assert_equal(nil, CustomBilling.from_hash({'customBilling'=>{}}).url)
2237
+ assert_equal("1", CustomBilling.from_hash({'customBilling'=>{'url'=>'1'}}).url)
2238
+ assert_equal("1234567890123", CustomBilling.from_hash({'customBilling'=>{'url'=>'1234567890123'}}).url)
2239
+ exception = assert_raise(RuntimeError){
2240
+ CustomBilling.from_hash({ 'customBilling'=>{'url'=>'12345678901234'}})
2241
+ }
2242
+ assert_equal "If customBilling url is specified, it must match the regular expression /\\A([A-Z,a-z,0-9,\\/,\\-,_,.]){1,13}\\Z/", exception.message
2243
+ exception = assert_raise(RuntimeError){
2244
+ CustomBilling.from_hash({ 'customBilling'=>{'url'=>'^&*(%$#@'}})
2245
+ }
2246
+ assert_equal "If customBilling url is specified, it must match the regular expression /\\A([A-Z,a-z,0-9,\\/,\\-,_,.]){1,13}\\Z/", exception.message
2247
+ end
2248
+
2249
+ def test_customBilling_descriptor
2250
+ assert_equal(nil, CustomBilling.from_hash({'customBilling'=>{}}).descriptor)
2251
+ assert_equal("abcd", CustomBilling.from_hash({'customBilling'=>{'descriptor'=>'abcd'}}).descriptor)
2252
+ assert_equal("1234567890123456789012345", CustomBilling.from_hash({'customBilling'=>{'descriptor'=>'1234567890123456789012345'}}).descriptor)
2253
+ exception = assert_raise(RuntimeError){
2254
+ CustomBilling.from_hash({ 'customBilling'=>{'descriptor'=>'12345678901234567890123456'}})
2255
+ }
2256
+ assert_equal "If customBilling descriptor is specified, it must match the regular expression /\\A([A-Z,a-z,0-9, ,\\*,,,\\-,',#,&,.]){4,25}\\Z/", exception.message
2257
+ exception = assert_raise(RuntimeError){
2258
+ CustomBilling.from_hash({ 'customBilling'=>{'descriptor'=>'123'}})
2259
+ }
2260
+ assert_equal "If customBilling descriptor is specified, it must match the regular expression /\\A([A-Z,a-z,0-9, ,\\*,,,\\-,',#,&,.]){4,25}\\Z/", exception.message
2261
+ exception = assert_raise(RuntimeError){
2262
+ CustomBilling.from_hash({ 'customBilling'=>{'descriptor'=>'^&*(%$#@'}})
2263
+ }
2264
+ assert_equal "If customBilling descriptor is specified, it must match the regular expression /\\A([A-Z,a-z,0-9, ,\\*,,,\\-,',#,&,.]){4,25}\\Z/", exception.message
2265
+ end
2266
+
2267
+ def test_processingInstructions_bypassVelocityCheck
2268
+ assert_equal(nil, ProcessingInstructions.from_hash({'processingInstructions'=>{}}).bypassVelocityCheck)
2269
+ assert_equal("true", ProcessingInstructions.from_hash({'processingInstructions'=>{'bypassVelocityCheck'=>'true'}}).bypassVelocityCheck)
2270
+ assert_equal("false", ProcessingInstructions.from_hash({'processingInstructions'=>{'bypassVelocityCheck'=>'false'}}).bypassVelocityCheck)
2271
+ assert_equal("1", ProcessingInstructions.from_hash({'processingInstructions'=>{'bypassVelocityCheck'=>'1'}}).bypassVelocityCheck)
2272
+ assert_equal("0", ProcessingInstructions.from_hash({'processingInstructions'=>{'bypassVelocityCheck'=>'0'}}).bypassVelocityCheck)
2273
+ exception = assert_raise(RuntimeError){
2274
+ ProcessingInstructions.from_hash({ 'processingInstructions'=>{'bypassVelocityCheck'=>'vrai' }}) #French true
2275
+ }
2276
+ assert_equal "If processingInstructions bypassVelocityCheck is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
2277
+ end
2278
+
2279
+ def test_echeckForToken_accNum
2280
+ assert_equal("a", EcheckForToken.from_hash({'echeckForToken'=>{'accNum'=>'a','routingNum'=>'123456789'}}).accNum)
2281
+ assert_equal("12345678901234567", EcheckForToken.from_hash({'echeckForToken'=>{'accNum'=>'12345678901234567','routingNum'=>'123456789'}}).accNum)
2282
+ exception = assert_raise(RuntimeError){
2283
+ EcheckForToken.from_hash({ 'echeckForToken'=>{'accNum'=>'123456789012345678','routingNum'=>'123456789'}})
2284
+ }
2285
+ assert_equal "If echeckForToken accNum is specified, it must be between 1 and 17 characters long", exception.message
2286
+ exception = assert_raise(RuntimeError){
2287
+ EcheckForToken.from_hash({ 'echeckForToken'=>{'routingNum'=>'123456789'}})
2288
+ }
2289
+ assert_equal "If echeckForToken is specified, it must have a accNum", exception.message
2290
+ end
2291
+
2292
+ def test_echeckForToken_routingNum
2293
+ assert_equal("123456789", EcheckForToken.from_hash({'echeckForToken'=>{'accNum'=>'1','routingNum'=>'123456789'}}).routingNum)
2294
+ assert_equal("abcdefghi", EcheckForToken.from_hash({'echeckForToken'=>{'accNum'=>'1','routingNum'=>'abcdefghi'}}).routingNum)
2295
+ exception = assert_raise(RuntimeError){
2296
+ EcheckForToken.from_hash({ 'echeckForToken'=>{'accNum'=>'1','routingNum'=>'12345678'}})
2297
+ }
2298
+ assert_equal "If echeckForToken routingNum is specified, it must be between 9 and 9 characters long", exception.message
2299
+ exception = assert_raise(RuntimeError){
2300
+ EcheckForToken.from_hash({ 'echeckForToken'=>{'accNum'=>'1','routingNum'=>'1234567890'}})
2301
+ }
2302
+ assert_equal "If echeckForToken routingNum is specified, it must be between 9 and 9 characters long", exception.message
2303
+ exception = assert_raise(RuntimeError){
2304
+ EcheckForToken.from_hash({ 'echeckForToken'=>{'accNum'=>'1'}})
2305
+ }
2306
+ assert_equal "If echeckForToken is specified, it must have a routingNum", exception.message
2307
+ end
2308
+
2309
+ def test_filtering_prepaid
2310
+ assert_equal(nil, Filtering.from_hash({'filtering'=>{}}).prepaid)
2311
+ assert_equal("true", Filtering.from_hash({'filtering'=>{'prepaid'=>'true'}}).prepaid)
2312
+ assert_equal("false", Filtering.from_hash({'filtering'=>{'prepaid'=>'false'}}).prepaid)
2313
+ assert_equal("1", Filtering.from_hash({'filtering'=>{'prepaid'=>'1'}}).prepaid)
2314
+ assert_equal("0", Filtering.from_hash({'filtering'=>{'prepaid'=>'0'}}).prepaid)
2315
+ exception = assert_raise(RuntimeError){
2316
+ Filtering.from_hash({ 'filtering'=>{'prepaid'=>'vrai' }}) #French true
2317
+ }
2318
+ assert_equal "If filtering prepaid is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
2319
+ end
2320
+
2321
+ def test_filtering_international
2322
+ assert_equal(nil, Filtering.from_hash({'filtering'=>{}}).international)
2323
+ assert_equal("true", Filtering.from_hash({'filtering'=>{'international'=>'true'}}).international)
2324
+ assert_equal("false", Filtering.from_hash({'filtering'=>{'international'=>'false'}}).international)
2325
+ assert_equal("1", Filtering.from_hash({'filtering'=>{'international'=>'1'}}).international)
2326
+ assert_equal("0", Filtering.from_hash({'filtering'=>{'international'=>'0'}}).international)
2327
+ exception = assert_raise(RuntimeError){
2328
+ Filtering.from_hash({ 'filtering'=>{'international'=>'vrai' }}) #French true
2329
+ }
2330
+ assert_equal "If filtering international is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
2331
+ end
2332
+
2333
+ def test_filtering_chargeback
2334
+ assert_equal(nil, Filtering.from_hash({'filtering'=>{}}).chargeback)
2335
+ assert_equal("true", Filtering.from_hash({'filtering'=>{'chargeback'=>'true'}}).chargeback)
2336
+ assert_equal("false", Filtering.from_hash({'filtering'=>{'chargeback'=>'false'}}).chargeback)
2337
+ assert_equal("1", Filtering.from_hash({'filtering'=>{'chargeback'=>'1'}}).chargeback)
2338
+ assert_equal("0", Filtering.from_hash({'filtering'=>{'chargeback'=>'0'}}).chargeback)
2339
+ exception = assert_raise(RuntimeError){
2340
+ Filtering.from_hash({ 'filtering'=>{'chargeback'=>'vrai' }}) #French true
2341
+ }
2342
+ assert_equal "If filtering chargeback is specified, it must be in [\"true\", \"false\", \"1\", \"0\"]", exception.message
2343
+ end
2344
+
2345
+ def test_merchantData_campaign
2346
+ assert_equal(nil, MerchantData.from_hash({'merchantData'=>{}}).campaign)
2347
+ assert_equal("a", MerchantData.from_hash({'merchantData'=>{'campaign'=>'a'}}).campaign)
2348
+ assert_equal("1234567890123456789012345", MerchantData.from_hash({'merchantData'=>{'campaign'=>'1234567890123456789012345'}}).campaign)
2349
+ exception = assert_raise(RuntimeError){
2350
+ MerchantData.from_hash({ 'merchantData'=>{'campaign'=>'12345678901234567890123456'}})
2351
+ }
2352
+ assert_equal "If merchantData campaign is specified, it must be between 1 and 25 characters long", exception.message
2353
+ end
2354
+
2355
+ def test_merchantData_affiliate
2356
+ assert_equal(nil, MerchantData.from_hash({'merchantData'=>{}}).affiliate)
2357
+ assert_equal("a", MerchantData.from_hash({'merchantData'=>{'affiliate'=>'a'}}).affiliate)
2358
+ assert_equal("1234567890123456789012345", MerchantData.from_hash({'merchantData'=>{'affiliate'=>'1234567890123456789012345'}}).affiliate)
2359
+ exception = assert_raise(RuntimeError){
2360
+ MerchantData.from_hash({ 'merchantData'=>{'affiliate'=>'12345678901234567890123456'}})
2361
+ }
2362
+ assert_equal "If merchantData affiliate is specified, it must be between 1 and 25 characters long", exception.message
2363
+ end
2364
+
2365
+ def test_merchantData_merchantGroupingId
2366
+ assert_equal(nil, MerchantData.from_hash({'merchantData'=>{}}).merchantGroupingId)
2367
+ assert_equal("a", MerchantData.from_hash({'merchantData'=>{'merchantGroupingId'=>'a'}}).merchantGroupingId)
2368
+ assert_equal("1234567890123456789012345", MerchantData.from_hash({'merchantData'=>{'merchantGroupingId'=>'1234567890123456789012345'}}).merchantGroupingId)
2369
+ exception = assert_raise(RuntimeError){
2370
+ MerchantData.from_hash({ 'merchantData'=>{'merchantGroupingId'=>'12345678901234567890123456'}})
2371
+ }
2372
+ assert_equal "If merchantData merchantGroupingId is specified, it must be between 1 and 25 characters long", exception.message
2373
+ end
2374
+
2375
+ def test_echeck_accType
2376
+ assert_equal("Checking", Echeck.from_hash({'echeck'=>{'accType'=>'Checking','accNum'=>'2','routingNum'=>'123456789'}}).accType)
2377
+ assert_equal("Savings", Echeck.from_hash({'echeck'=>{'accType'=>'Savings','accNum'=>'2','routingNum'=>'123456789'}}).accType)
2378
+ assert_equal("Corporate", Echeck.from_hash({'echeck'=>{'accType'=>'Corporate','accNum'=>'2','routingNum'=>'123456789'}}).accType)
2379
+ assert_equal("Corp Savings", Echeck.from_hash({'echeck'=>{'accType'=>'Corp Savings','accNum'=>'2','routingNum'=>'123456789'}}).accType)
2380
+ exception = assert_raise(RuntimeError){
2381
+ Echeck.from_hash({ 'echeck'=>{'accNum'=>'1','routingNum'=>'123456789'}})
2382
+ }
2383
+ assert_equal "If echeck is specified, it must have a accType", exception.message
2384
+ exception = assert_raise(RuntimeError){
2385
+ Echeck.from_hash({ 'echeck'=>{'accNum'=>'1','routingNum'=>'123456789','accType'=>'Other'}})
2386
+ }
2387
+ assert_equal "If echeck accType is specified, it must be in [\"Checking\", \"Savings\", \"Corporate\", \"Corp Savings\"]", exception.message
2388
+ exception = assert_raise(RuntimeError){
2389
+ Echeck.from_hash({ 'echeck'=>{'accNum'=>'1','routingNum'=>'123456789'}})
2390
+ }
2391
+ assert_equal "If echeck is specified, it must have a accType", exception.message
2392
+ end
2393
+
2394
+ def test_echeck_accNum
2395
+ assert_equal("a", Echeck.from_hash({'echeck'=>{'accType'=>'Checking','accNum'=>'a','routingNum'=>'123456789'}}).accNum)
2396
+ assert_equal("12345678901234567", Echeck.from_hash({'echeck'=>{'accType'=>'Checking','accNum'=>'12345678901234567','routingNum'=>'123456789'}}).accNum)
2397
+ exception = assert_raise(RuntimeError){
2398
+ Echeck.from_hash({ 'echeck'=>{'accNum'=>'123456789012345678','routingNum'=>'123456789','accType'=>'Checking'}})
2399
+ }
2400
+ assert_equal "If echeck accNum is specified, it must be between 1 and 17 characters long", exception.message
2401
+ exception = assert_raise(RuntimeError){
2402
+ Echeck.from_hash({ 'echeck'=>{'routingNum'=>'123456789','accType'=>'Checking'}})
2403
+ }
2404
+ assert_equal "If echeck is specified, it must have a accNum", exception.message
2405
+ end
2406
+
2407
+ def test_echeck_routingNum
2408
+ assert_equal("abcdefghi", Echeck.from_hash({'echeck'=>{'accType'=>'Checking','accNum'=>'a','routingNum'=>'abcdefghi'}}).routingNum)
2409
+ assert_equal("123456789", Echeck.from_hash({'echeck'=>{'accType'=>'Checking','accNum'=>'12345678901234567','routingNum'=>'123456789'}}).routingNum)
2410
+ exception = assert_raise(RuntimeError){
2411
+ Echeck.from_hash({ 'echeck'=>{'accNum'=>'123','routingNum'=>'1234567890','accType'=>'Checking'}})
2412
+ }
2413
+ assert_equal "If echeck routingNum is specified, it must be between 9 and 9 characters long", exception.message
2414
+ exception = assert_raise(RuntimeError){
2415
+ Echeck.from_hash({ 'echeck'=>{'accNum'=>'123','routingNum'=>'12345678','accType'=>'Checking'}})
2416
+ }
2417
+ assert_equal "If echeck routingNum is specified, it must be between 9 and 9 characters long", exception.message
2418
+ exception = assert_raise(RuntimeError){
2419
+ Echeck.from_hash({ 'echeck'=>{'accNum'=>'123','accType'=>'Checking'}})
2420
+ }
2421
+ assert_equal "If echeck is specified, it must have a routingNum", exception.message
2422
+ end
2423
+
2424
+ def test_echeck_checkNum
2425
+ assert_equal(nil, Echeck.from_hash({'echeck'=>{'accType'=>'Checking','accNum'=>'b','routingNum'=>'abcdefghi'}}).checkNum)
2426
+ assert_equal("a", Echeck.from_hash({'echeck'=>{'accType'=>'Checking','accNum'=>'b','routingNum'=>'abcdefghi','checkNum'=>'a'}}).checkNum)
2427
+ assert_equal("123456789012345", Echeck.from_hash({'echeck'=>{'accType'=>'Checking','accNum'=>'12345678901234567','routingNum'=>'123456789','checkNum'=>'123456789012345'}}).checkNum)
2428
+ exception = assert_raise(RuntimeError){
2429
+ Echeck.from_hash({ 'echeck'=>{'accNum'=>'123','routingNum'=>'123456789','accType'=>'Checking','checkNum'=>'1234567890123456'}})
2430
+ }
2431
+ assert_equal "If echeck checkNum is specified, it must be between 1 and 15 characters long", exception.message
2432
+ end
2433
+
2434
+ def test_echeckToken_litleToken
2435
+ assert_equal("abcdefhijklmn", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Checking','litleToken'=>'abcdefhijklmn','routingNum'=>'123456789'}}).litleToken)
2436
+ assert_equal("1234567890123456789012345", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Checking','litleToken'=>'1234567890123456789012345','routingNum'=>'123456789'}}).litleToken)
2437
+ exception = assert_raise(RuntimeError){
2438
+ EcheckToken.from_hash({ 'echeckToken'=>{'litleToken'=>'123456789012','routingNum'=>'123456789','accType'=>'Checking'}})
2439
+ }
2440
+ assert_equal "If echeckToken litleToken is specified, it must be between 13 and 25 characters long", exception.message
2441
+ exception = assert_raise(RuntimeError){
2442
+ EcheckToken.from_hash({ 'echeckToken'=>{'litleToken'=>'12345678901234567890123456','routingNum'=>'123456789','accType'=>'Checking'}})
2443
+ }
2444
+ assert_equal "If echeckToken litleToken is specified, it must be between 13 and 25 characters long", exception.message
2445
+ exception = assert_raise(RuntimeError){
2446
+ EcheckToken.from_hash({ 'echeckToken'=>{'routingNum'=>'123456789','accType'=>'Checking'}})
2447
+ }
2448
+ assert_equal "If echeckToken is specified, it must have a litleToken", exception.message
2449
+ end
2450
+
2451
+ def test_echeckToken_routingNum
2452
+ assert_equal("abcdefghi", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Checking','litleToken'=>'1234567890123','routingNum'=>'abcdefghi'}}).routingNum)
2453
+ assert_equal("123456789", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Checking','litleToken'=>'1234567890123','routingNum'=>'123456789'}}).routingNum)
2454
+ exception = assert_raise(RuntimeError){
2455
+ EcheckToken.from_hash({ 'echeckToken'=>{'litleToken'=>'1234567890123','routingNum'=>'1234567890','accType'=>'Checking'}})
2456
+ }
2457
+ assert_equal "If echeckToken routingNum is specified, it must be between 9 and 9 characters long", exception.message
2458
+ exception = assert_raise(RuntimeError){
2459
+ EcheckToken.from_hash({ 'echeckToken'=>{'litleToken'=>'1234567890123','routingNum'=>'12345678','accType'=>'Checking'}})
2460
+ }
2461
+ assert_equal "If echeckToken routingNum is specified, it must be between 9 and 9 characters long", exception.message
2462
+ exception = assert_raise(RuntimeError){
2463
+ EcheckToken.from_hash({ 'echeckToken'=>{'litleToken'=>'1234567890123','accType'=>'Checking'}})
2464
+ }
2465
+ assert_equal "If echeckToken is specified, it must have a routingNum", exception.message
2466
+ end
2467
+
2468
+ def test_echeckToken_accType
2469
+ assert_equal("Checking", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Checking','litleToken'=>'1234567890123','routingNum'=>'123456789'}}).accType)
2470
+ assert_equal("Savings", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Savings','litleToken'=>'1234567890123','routingNum'=>'123456789'}}).accType)
2471
+ assert_equal("Corporate", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Corporate','litleToken'=>'1234567890123','routingNum'=>'123456789'}}).accType)
2472
+ assert_equal("Corp Savings", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Corp Savings','litleToken'=>'1234567890123','routingNum'=>'123456789'}}).accType)
2473
+ exception = assert_raise(RuntimeError){
2474
+ EcheckToken.from_hash({ 'echeckToken'=>{'litleToken'=>'1234567890123','routingNum'=>'123456789','accType'=>'Other'}})
2475
+ }
2476
+ assert_equal "If echeckToken accType is specified, it must be in [\"Checking\", \"Savings\", \"Corporate\", \"Corp Savings\"]", exception.message
2477
+ exception = assert_raise(RuntimeError){
2478
+ EcheckToken.from_hash({ 'echeckToken'=>{'litleToken'=>'1234567890123','routingNum'=>'123456789'}})
2479
+ }
2480
+ assert_equal "If echeckToken is specified, it must have a accType", exception.message
2481
+ end
2482
+
2483
+ def test_echeckToken_checkNum
2484
+ assert_equal(nil, EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Checking','litleToken'=>'1234567890123','routingNum'=>'abcdefghi'}}).checkNum)
2485
+ assert_equal("a", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Checking','litleToken'=>'1234567890123','routingNum'=>'abcdefghi','checkNum'=>'a'}}).checkNum)
2486
+ assert_equal("123456789012345", EcheckToken.from_hash({'echeckToken'=>{'accType'=>'Checking','litleToken'=>'1234567890123','routingNum'=>'123456789','checkNum'=>'123456789012345'}}).checkNum)
2487
+ exception = assert_raise(RuntimeError){
2488
+ EcheckToken.from_hash({ 'echeckToken'=>{'litleToken'=>'1234567890123','routingNum'=>'123456789','accType'=>'Checking','checkNum'=>'1234567890123456'}})
2489
+ }
2490
+ assert_equal "If echeckToken checkNum is specified, it must be between 1 and 15 characters long", exception.message
2491
+ end
2492
+
2493
+ def test_recyclingRequest_recycleBy
2494
+ assert_equal(nil, RecyclingRequest.from_hash({'recyclingRequest'=>{}}).recycleBy)
2495
+ assert_equal("Merchant", RecyclingRequest.from_hash({'recyclingRequest'=>{'recycleBy'=>'Merchant'}}).recycleBy)
2496
+ assert_equal("Litle", RecyclingRequest.from_hash({'recyclingRequest'=>{'recycleBy'=>'Litle'}}).recycleBy)
2497
+ assert_equal("None", RecyclingRequest.from_hash({'recyclingRequest'=>{'recycleBy'=>'None'}}).recycleBy)
2498
+ exception = assert_raise(RuntimeError){
2499
+ RecyclingRequest.from_hash({ 'recyclingRequest'=>{'recycleBy'=>'Other' }})
2500
+ }
2501
+ assert_equal "If recyclingRequest recycleBy is specified, it must be in [\"Merchant\", \"Litle\", \"None\"]", exception.message
2502
+ end
2503
+
2504
+ def test_recyclingRequest_recycleId
2505
+ assert_equal(nil, RecyclingRequest.from_hash({'recyclingRequest'=>{}}).recycleId)
2506
+ assert_equal("a", RecyclingRequest.from_hash({'recyclingRequest'=>{'recycleId'=>'a'}}).recycleId)
2507
+ assert_equal("1234567890123456789012345", RecyclingRequest.from_hash({'recyclingRequest'=>{'recycleId'=>'1234567890123456789012345'}}).recycleId)
2508
+ exception = assert_raise(RuntimeError){
2509
+ RecyclingRequest.from_hash({ 'recyclingRequest'=>{'recycleId'=>'12345678901234567890123456' }})
2510
+ }
2511
+ assert_equal "If recyclingRequest recycleId is specified, it must be between 1 and 25 characters long", exception.message
2512
+ end
2513
+
2514
+ end
2515
+ end