CnpOnline 12.1.1 → 12.3.0

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.
@@ -4,10 +4,11 @@ require 'test/unit'
4
4
 
5
5
  module CnpOnline
6
6
  class Cnp_certTest < Test::Unit::TestCase
7
- @@merchant_hash = {'reportGroup'=>'Planets',
8
- 'merchantId'=>'1288791',
9
- 'id'=>'test',
10
- 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
7
+ @@merchant_hash = {
8
+ 'reportGroup'=>'Planets',
9
+ 'merchantId'=>'1288791',
10
+ 'id'=>'test',
11
+ 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
11
12
  }
12
13
 
13
14
  def test_1_auth
@@ -4,10 +4,11 @@ require 'test/unit'
4
4
  module CnpOnline
5
5
  class Cnp_certTest2 < Test::Unit::TestCase
6
6
  #test enhanced data on auth response
7
- @@merchant_hash = {'reportGroup'=>'Planets',
8
- 'merchantId'=>'1288791',
9
- 'id'=>'test',
10
- 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
7
+ @@merchant_hash = {
8
+ 'reportGroup'=>'Planets',
9
+ 'merchantId'=>'1288791',
10
+ 'id'=>'test',
11
+ 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
11
12
 
12
13
  }
13
14
 
@@ -27,10 +28,10 @@ module CnpOnline
27
28
  auth_response = CnpOnlineRequest.new.authorization(hash)
28
29
  assert_equal('000', auth_response.authorizationResponse.response)
29
30
  assert_equal('Approved', auth_response.authorizationResponse.message)
30
- #assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type']) #Ruby 1.8.7 has type as an attribute of Object
31
- #assert_equal('2000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
32
- #assert_equal('NO', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
33
- #assert_equal('GIFT', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
31
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type']) #Ruby 1.8.7 has type as an attribute of Object
32
+ assert_equal('2000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
33
+ assert_equal('NO', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
34
+ assert_equal('GIFT', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
34
35
  end
35
36
 
36
37
  def test_15
@@ -48,10 +49,10 @@ module CnpOnline
48
49
  auth_response = CnpOnlineRequest.new.authorization(hash)
49
50
  assert_equal('000', auth_response.authorizationResponse.response)
50
51
  assert_equal('Approved', auth_response.authorizationResponse.message)
51
- #assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
52
- #assert_equal('2000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
53
- #assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
54
- #assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
52
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
53
+ assert_equal('2000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
54
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
55
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
55
56
  end
56
57
 
57
58
  def test_16
@@ -69,10 +70,10 @@ module CnpOnline
69
70
  auth_response = CnpOnlineRequest.new.authorization(hash)
70
71
  assert_equal('000', auth_response.authorizationResponse.response)
71
72
  assert_equal('Approved', auth_response.authorizationResponse.message)
72
- #assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
73
- #assert_equal('0', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
74
- #assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
75
- #assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
73
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
74
+ assert_equal('0', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
75
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
76
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
76
77
  end
77
78
 
78
79
  def test_17
@@ -90,10 +91,10 @@ module CnpOnline
90
91
  auth_response = CnpOnlineRequest.new.authorization(hash)
91
92
  assert_equal('000', auth_response.authorizationResponse.response)
92
93
  assert_equal('Approved', auth_response.authorizationResponse.message)
93
- #assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
94
- #assert_equal('6500', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
95
- #assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
96
- #assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
94
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
95
+ assert_equal('6500', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
96
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
97
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
97
98
  end
98
99
 
99
100
  def test_18
@@ -111,10 +112,10 @@ module CnpOnline
111
112
  auth_response = CnpOnlineRequest.new.authorization(hash)
112
113
  assert_equal('000', auth_response.authorizationResponse.response)
113
114
  assert_equal('Approved', auth_response.authorizationResponse.message)
114
- #assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
115
- #assert_equal('12200', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
116
- #assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
117
- #assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
115
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
116
+ assert_equal('12200', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
117
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
118
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
118
119
  end
119
120
 
120
121
  def test_19
@@ -132,10 +133,10 @@ module CnpOnline
132
133
  auth_response = CnpOnlineRequest.new.authorization(hash)
133
134
  assert_equal('000', auth_response.authorizationResponse.response)
134
135
  assert_equal('Approved', auth_response.authorizationResponse.message)
135
- #assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
136
- #assert_equal('20000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
137
- #assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
138
- #assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
136
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
137
+ assert_equal('20000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
138
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
139
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
139
140
  end
140
141
 
141
142
  def test_20
@@ -153,10 +154,10 @@ module CnpOnline
153
154
  auth_response = CnpOnlineRequest.new.authorization(hash)
154
155
  assert_equal('000', auth_response.authorizationResponse.response)
155
156
  assert_equal('Approved', auth_response.authorizationResponse.message)
156
- #assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
157
- #assert_equal('10050', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
158
- #assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
159
- #assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
157
+ assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
158
+ assert_equal('10050', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
159
+ assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
160
+ assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
160
161
  end
161
162
 
162
163
  def test_21
@@ -174,7 +175,7 @@ module CnpOnline
174
175
  auth_response = CnpOnlineRequest.new.authorization(hash)
175
176
  assert_equal('000', auth_response.authorizationResponse.response)
176
177
  assert_equal('Approved', auth_response.authorizationResponse.message)
177
- #assert_equal('AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
178
+ assert_equal('AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
178
179
  end
179
180
 
180
181
  def test_22
@@ -192,7 +193,7 @@ module CnpOnline
192
193
  auth_response = CnpOnlineRequest.new.authorization(hash)
193
194
  assert_equal('000', auth_response.authorizationResponse.response)
194
195
  assert_equal('Approved', auth_response.authorizationResponse.message)
195
- #assert_equal('MASS AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
196
+ assert_equal('MASS AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
196
197
  end
197
198
 
198
199
  def test_23
@@ -210,7 +211,7 @@ module CnpOnline
210
211
  auth_response = CnpOnlineRequest.new.authorization(hash)
211
212
  assert_equal('000', auth_response.authorizationResponse.response)
212
213
  assert_equal('Approved', auth_response.authorizationResponse.message)
213
- #assert_equal('AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
214
+ assert_equal('AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
214
215
  end
215
216
 
216
217
  def test_24
@@ -228,7 +229,7 @@ module CnpOnline
228
229
  auth_response = CnpOnlineRequest.new.authorization(hash)
229
230
  assert_equal('000', auth_response.authorizationResponse.response)
230
231
  assert_equal('Approved', auth_response.authorizationResponse.message)
231
- #assert_equal('MASS AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
232
+ assert_equal('MASS AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
232
233
  end
233
234
 
234
235
  def test_25
@@ -245,7 +246,7 @@ module CnpOnline
245
246
  auth_response = CnpOnlineRequest.new.authorization(hash)
246
247
  assert_equal('000', auth_response.authorizationResponse.response)
247
248
  assert_equal('Approved', auth_response.authorizationResponse.message)
248
- #assert_equal('BRA', auth_response.authorizationResponse.enhancedAuthResponse.issuerCountry)
249
+ assert_equal('BRA', auth_response.authorizationResponse.enhancedAuthResponse.issuerCountry)
249
250
  end
250
251
 
251
252
  # test 26-31 healthcare iias
@@ -268,8 +269,8 @@ module CnpOnline
268
269
  }
269
270
  hash = customer_hash.merge(@@merchant_hash)
270
271
  auth_response = CnpOnlineRequest.new.authorization(hash)
271
- #assert_equal('341', auth_response.authorizationResponse.response)
272
- # assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
272
+ assert_equal('341', auth_response.authorizationResponse.response)
273
+ assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
273
274
  end
274
275
 
275
276
  def test_27
@@ -292,8 +293,8 @@ module CnpOnline
292
293
  }
293
294
  hash = customer_hash.merge(@@merchant_hash)
294
295
  auth_response = CnpOnlineRequest.new.authorization(hash)
295
- #assert_equal('341', auth_response.authorizationResponse.response)
296
- # assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
296
+ assert_equal('341', auth_response.authorizationResponse.response)
297
+ assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
297
298
  end
298
299
 
299
300
  def test_28
@@ -316,8 +317,8 @@ module CnpOnline
316
317
  }
317
318
  hash = customer_hash.merge(@@merchant_hash)
318
319
  auth_response = CnpOnlineRequest.new.authorization(hash)
319
- #assert_equal('000', auth_response.authorizationResponse.response)
320
- #assert_equal('Approved', auth_response.authorizationResponse.message)
320
+ assert_equal('000', auth_response.authorizationResponse.response)
321
+ assert_equal('Approved', auth_response.authorizationResponse.message)
321
322
  end
322
323
 
323
324
  def test_29
@@ -343,8 +344,8 @@ module CnpOnline
343
344
  }
344
345
  hash = customer_hash.merge(@@merchant_hash)
345
346
  auth_response = CnpOnlineRequest.new.authorization(hash)
346
- #assert_equal('341', auth_response.authorizationResponse.response)
347
- # assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
347
+ assert_equal('341', auth_response.authorizationResponse.response)
348
+ assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
348
349
  end
349
350
 
350
351
  def test_30
@@ -370,8 +371,8 @@ module CnpOnline
370
371
  }
371
372
  hash = customer_hash.merge(@@merchant_hash)
372
373
  auth_response = CnpOnlineRequest.new.authorization(hash)
373
- #assert_equal('341', auth_response.authorizationResponse.response)
374
- # assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
374
+ assert_equal('341', auth_response.authorizationResponse.response)
375
+ assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
375
376
  end
376
377
 
377
378
  def test_31
@@ -395,9 +396,9 @@ module CnpOnline
395
396
  }
396
397
  hash = customer_hash.merge(@@merchant_hash)
397
398
  auth_response = CnpOnlineRequest.new.authorization(hash)
398
- #assert_equal('010', auth_response.authorizationResponse.response)
399
- #assert_equal('Partially Approved', auth_response.authorizationResponse.message)
400
- #assert_equal('18699', auth_response.authorizationResponse.approvedAmount)
399
+ assert_equal('010', auth_response.authorizationResponse.response)
400
+ assert_equal('Partially Approved', auth_response.authorizationResponse.message)
401
+ assert_equal('18699', auth_response.authorizationResponse.approvedAmount)
401
402
  end
402
403
 
403
404
  def test_32
@@ -4,9 +4,12 @@ require 'test/unit'
4
4
  module CnpOnline
5
5
  class Cnp_certTest3 < Test::Unit::TestCase
6
6
  #test auth reversal
7
- @@merchant_hash = {'reportGroup'=>'Planets','id'=>'321','customerId'=>'123',
8
- 'merchantId'=>'1288791',
9
- 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
7
+ @@merchant_hash = {
8
+ 'reportGroup'=>'Planets',
9
+ 'id'=>'321',
10
+ 'customerId'=>'123',
11
+ 'merchantId'=>'1288791',
12
+ 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
10
13
 
11
14
  }
12
15
 
@@ -4,10 +4,11 @@ require 'test/unit'
4
4
  module CnpOnline
5
5
  class Cnp_certTest4 < Test::Unit::TestCase
6
6
  # test echeck
7
- @@merchant_hash = {'reportGroup'=>'Planets',
8
- 'merchantId'=>'1288791',
9
- 'id'=>'test',
10
- 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
7
+ @@merchant_hash = {
8
+ 'reportGroup'=>'Planets',
9
+ 'merchantId'=>'1288791',
10
+ 'id'=>'test',
11
+ 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
11
12
 
12
13
  }
13
14
 
@@ -75,7 +76,7 @@ module CnpOnline
75
76
  hash = customer_hash.merge(@@merchant_hash)
76
77
  echeck_response = CnpOnlineRequest.new.echeck_verification(hash)
77
78
  assert_equal('950', echeck_response.echeckVerificationResponse.response)
78
- # assert_equal('Declined - Negative Information on File', echeck_response.echeckVerificationResponse.message)
79
+ assert_equal('Decline - Negative Information on File', echeck_response.echeckVerificationResponse.message)
79
80
  end
80
81
 
81
82
  def test_40
@@ -209,7 +210,7 @@ module CnpOnline
209
210
  hash = customer_hash.merge(@@merchant_hash)
210
211
  echeck_response = CnpOnlineRequest.new.echeck_credit(hash)
211
212
 
212
- # assert_equal('301', echeck_response.echeckCreditResponse.response)
213
+ assert_equal('301', echeck_response.echeckCreditResponse.response)
213
214
  end
214
215
 
215
216
  def test_46
@@ -3,10 +3,11 @@ require 'test/unit'
3
3
 
4
4
  module CnpOnline
5
5
  class Cnp_certTest5 < Test::Unit::TestCase
6
- @@merchant_hash = {'reportGroup'=>'Planets',
7
- 'merchantId'=>'1288791',
8
- 'id'=>'test',
9
- 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
6
+ @@merchant_hash = {
7
+ 'reportGroup'=>'Planets',
8
+ 'merchantId'=>'1288791',
9
+ 'id'=>'test',
10
+ 'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
10
11
 
11
12
  }
12
13
 
@@ -45,7 +46,8 @@ module CnpOnline
45
46
  assert_equal('445711', token_response.registerTokenResponse.bin)
46
47
  assert_equal('VI', token_response.registerTokenResponse['type'])
47
48
  assert_equal('802', token_response.registerTokenResponse.response)
48
- #assert_equal('1111222233330123', token_response.registerTokenResponse.cnpToken)
49
+ cardString = "" + token_response.registerTokenResponse.cnpToken
50
+ assert_equal('0123', cardString[12..15])
49
51
  assert_equal('Account number was previously registered', token_response.registerTokenResponse.message)
50
52
  end
51
53
 
@@ -71,7 +73,7 @@ module CnpOnline
71
73
  hash = customer_hash.merge(@@merchant_hash)
72
74
  token_response = CnpOnlineRequest.new.register_token_request(hash)
73
75
  assert_equal('900', token_response.registerTokenResponse.response)
74
- # assert_equal('Invalid bank routing number', token_response.registerTokenResponse.message)
76
+ assert_equal('Invalid Bank Routing Number', token_response.registerTokenResponse.message)
75
77
  end
76
78
 
77
79
  def test_55
@@ -101,7 +103,7 @@ module CnpOnline
101
103
  hash = customer_hash.merge(@@merchant_hash)
102
104
  token_response = CnpOnlineRequest.new.authorization(hash)
103
105
  assert_equal('301', token_response.authorizationResponse.response)
104
- # assert_equal('Invalid account number', token_response.authorizationResponse.message)
106
+ assert_equal('Invalid Account Number', token_response.authorizationResponse.message)
105
107
  end
106
108
 
107
109
  def test_57
@@ -126,12 +128,12 @@ module CnpOnline
126
128
  'orderId' => '59',
127
129
  'amount' => '15000',
128
130
  'orderSource' => 'ecommerce',
129
- 'token' => {'cnpToken' => '1712990000040196', 'expDate' => '1112'}
131
+ 'token' => {'cnpToken' => '1111000100092332', 'expDate' => '1121'}
130
132
  }
131
133
  hash = customer_hash.merge(@@merchant_hash)
132
134
  token_response = CnpOnlineRequest.new.authorization(hash)
133
- #assert_equal('822', token_response.authorizationResponse.response)
134
- #assert_equal('Token was not found', token_response.authorizationResponse.message)
135
+ assert_equal('822', token_response.authorizationResponse.response)
136
+ assert_equal('Token was not found', token_response.authorizationResponse.message)
135
137
  end
136
138
 
137
139
  def test_60
@@ -139,12 +141,12 @@ module CnpOnline
139
141
  'orderId' => '60',
140
142
  'amount' => '15000',
141
143
  'orderSource' => 'ecommerce',
142
- 'token' => {'cnpToken' => '1712999999999999', 'expDate' => '1112'}
144
+ 'token' => {'cnpToken' => '1112000100000085', 'expDate' => '1121'}
143
145
  }
144
146
  hash = customer_hash.merge(@@merchant_hash)
145
147
  token_response = CnpOnlineRequest.new.authorization(hash)
146
- #assert_equal('823', token_response.authorizationResponse.response)
147
- # assert_equal('Token was invalid', token_response.authorizationResponse.message)
148
+ assert_equal('823', token_response.authorizationResponse.response)
149
+ assert_equal('Token was invalid', token_response.authorizationResponse.message)
148
150
  end
149
151
 
150
152
  def test_61
@@ -309,7 +309,7 @@ module CnpOnline
309
309
  'number' =>'4100000000000000',
310
310
  'expDate' =>'1210'
311
311
  },
312
- 'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
312
+ 'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234', 'webSessionId' => 'sessionid1'}
313
313
  }
314
314
  response= CnpOnlineRequest.new.authorization(hash)
315
315
  assert_equal('000', response.authorizationResponse.response)
@@ -443,6 +443,36 @@ module CnpOnline
443
443
  response= CnpOnlineRequest.new.authorization(hash)
444
444
  assert_equal 'Valid Format', response.message
445
445
  end
446
+
447
+ def test_simple_auth_with_lodgingInfo
448
+ hash = {
449
+ 'merchantId' => '101',
450
+ 'id' => 'test',
451
+ 'version'=>'8.8',
452
+ 'reportGroup'=>'Planets',
453
+ 'orderId'=>'12344',
454
+ 'amount'=>'106',
455
+ 'orderSource'=>'ecommerce',
456
+ 'card'=>{
457
+ 'type'=>'VI',
458
+ 'number' =>'4100000000000000',
459
+ 'expDate' =>'1210'
460
+ },
461
+ 'lodgingInfo' => {
462
+ 'hotelFolioNumber ' => 'testFolio',
463
+ 'duration' => '111',
464
+ 'customerServicePhone' => 'testPhone1',
465
+ 'programCode' => 'LODGING',
466
+ 'roomRate' => '112233445566',
467
+ 'numAdults' => '11',
468
+ 'propertyLocalPhone' => 'testPhone2',
469
+ 'fireSafetyIndicator' => 'true',
470
+ 'lodgingCharge' => {'name' => 'RESTAURANT'}
471
+ }
472
+ }
473
+ response= CnpOnlineRequest.new.authorization(hash)
474
+ assert_equal('000', response.authorizationResponse.response)
475
+ end
446
476
 
447
477
  end
448
478
  end
@@ -39,6 +39,31 @@ module CnpOnline
39
39
  response= CnpOnlineRequest.new.capture(hash)
40
40
  assert_equal('Valid Format', response.message)
41
41
  end
42
+
43
+ def test_simple_capture_with_lodginginfo
44
+ hash = {
45
+ 'merchantId' => '101',
46
+ 'version'=>'8.8',
47
+ 'id'=>'test',
48
+ 'reportGroup'=>'Planets',
49
+ 'cnpTxnId'=>'123456000',
50
+ 'amount'=>'106',
51
+ 'lodgingInfo' => {
52
+ 'hotelFolioNumber ' => 'testFolio',
53
+ 'duration' => '111',
54
+ 'customerServicePhone' => 'testPhone1',
55
+ 'programCode' => 'LODGING',
56
+ 'roomRate' => '112233445566',
57
+ 'numAdults' => '11',
58
+ 'propertyLocalPhone' => 'testPhone2',
59
+ 'fireSafetyIndicator' => 'true',
60
+ 'lodgingCharge' => {'name' => 'RESTAURANT'}
61
+ }
62
+
63
+ }
64
+ response= CnpOnlineRequest.new.capture(hash)
65
+ assert_equal('Valid Format', response.message)
66
+ end
42
67
 
43
68
  def test_simple_capture_with_partial
44
69
  hash = {
@@ -44,7 +44,41 @@ module CnpOnline
44
44
  'type'=>'VI',
45
45
  'number' =>'4100000000000000',
46
46
  'expDate' =>'1210'
47
- }}
47
+ }
48
+ }
49
+ response= CnpOnlineRequest.new.capture_given_auth(hash)
50
+ assert_equal('Valid Format', response.message)
51
+ end
52
+
53
+ def test_simple_capture_given_lodging_info
54
+ hash = {
55
+ 'merchantId' => '101',
56
+ 'version'=>'8.8',
57
+ 'id'=>'test',
58
+ 'reportGroup'=>'Planets',
59
+ 'orderId'=>'12344',
60
+ 'amount'=>'106',
61
+ 'authInformation' => {
62
+ 'authDate'=>'2002-10-09','authCode'=>'543216',
63
+ 'authAmount'=>'12345'
64
+ },
65
+ 'orderSource'=>'ecommerce',
66
+ 'card'=>{
67
+ 'type'=>'VI',
68
+ 'number' =>'4100000000000000',
69
+ 'expDate' =>'1210'
70
+ },
71
+ 'lodgingInfo' => {
72
+ 'hotelFolioNumber ' => 'testFolio',
73
+ 'duration' => '111',
74
+ 'customerServicePhone' => 'testPhone1',
75
+ 'programCode' => 'LODGING',
76
+ 'roomRate' => '112233445566',
77
+ 'numAdults' => '11',
78
+ 'propertyLocalPhone' => 'testPhone2',
79
+ 'fireSafetyIndicator' => 'true',
80
+ 'lodgingCharge' => {'name' => 'RESTAURANT'}
81
+ }}
48
82
  response= CnpOnlineRequest.new.capture_given_auth(hash)
49
83
  assert_equal('Valid Format', response.message)
50
84
  end