CnpOnline 11.4.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -164
- data/CHANGELOG~ +0 -0
- data/CONTRIBUTORS +0 -2
- data/DESCRIPTION +1 -1
- data/LICENSE +0 -0
- data/README.md +13 -15
- data/Rakefile +3 -2
- data/Rakefile~ +4 -3
- data/SETUP.md +13 -10
- data/bin/Setup.rb +26 -22
- data/bin/sample_batch_driver.rb +15 -15
- data/bin/sample_driver.rb +5 -5
- data/lib/{LitleBatchRequest.rb → CnpBatchRequest.rb} +68 -66
- data/lib/{LitleListeners.rb → CnpListeners.rb} +48 -40
- data/lib/{LitleOnline.rb → CnpOnline.rb} +8 -7
- data/lib/{LitleOnlineRequest.rb → CnpOnlineRequest.rb} +53 -53
- data/lib/{LitleRequest.rb → CnpRequest.rb} +186 -192
- data/lib/{LitleTransaction.rb → CnpTransaction.rb} +53 -52
- data/lib/{LitleXmlMapper.rb → CnpXmlMapper.rb} +7 -7
- data/lib/Communications.rb +8 -7
- data/lib/Configuration.rb +7 -6
- data/lib/EnvironmentVariables.rb +2 -2
- data/lib/XMLFields.rb +98 -108
- data/lib/cacert.pem +0 -0
- data/samples/Auth/CnpAuthReversalTransaction.rb +15 -0
- data/samples/Auth/{LitleAuthorizationTransaction.rb → CnpAuthorizationTransaction.rb} +4 -4
- data/samples/Auth/{LitlePaymentFullLifeCycle.rb → CnpPaymentFullLifeCycle.rb} +11 -11
- data/samples/Batch/AccountUpdate.rb +11 -11
- data/samples/Batch/SampleBatchDriver.rb +16 -16
- data/samples/Capture/{LitleCaptureGivenAuthTransaction.rb → CnpCaptureGivenAuthTransaction.rb} +4 -4
- data/samples/Capture/CnpCaptureTransaction.rb +14 -0
- data/samples/Capture/{LitleForceCaptureTransaction.rb → CnpForceCaptureTransaction.rb} +5 -5
- data/samples/Capture/CnpPartialCapture.rb +16 -0
- data/samples/Credit/CnpCreditTransaction.rb +16 -0
- data/samples/Credit/{LitleRefundTransaction.rb → CnpRefundTransaction.rb} +4 -4
- data/samples/Other/{LitleAvsTransaction.rb → CnpAvsTransaction.rb} +4 -4
- data/samples/Other/CnpVoidTransaction.rb +19 -0
- data/samples/Paypage/FullPaypageLifeCycle.rb +16 -16
- data/samples/Run_all.rb +12 -12
- data/samples/Sale/{LitleSaleTransaction.rb → CnpSaleTransaction.rb} +4 -4
- data/samples/Sale/SampleSaleTransaction.rb +5 -5
- data/test/certification/certTest1_base.rb +104 -103
- data/test/certification/certTest2_authenhanced.rb +90 -88
- data/test/certification/certTest3_authreversal.rb +29 -28
- data/test/certification/certTest4_echeck.rb +22 -20
- data/test/certification/certTest5_token.rb +51 -49
- data/test/certification/certTest_batchAll.rb +60 -60
- data/test/certification/ts_all.rb +1 -1
- data/test/functional/test_activate.rb +9 -8
- data/test/functional/test_activateReversal.rb +5 -5
- data/test/functional/test_auth.rb +31 -30
- data/test/functional/test_authReversal.rb +8 -8
- data/test/functional/test_balanceInquiry.rb +6 -6
- data/test/functional/test_batch.rb +32 -32
- data/test/functional/test_batchStream.rb +14 -14
- data/test/functional/test_cancelSubscription.rb +4 -4
- data/test/functional/test_capture.rb +14 -14
- data/test/functional/test_captureGivenAuth.rb +16 -16
- data/test/functional/test_configuration.rb +26 -26
- data/test/functional/test_createPlan.rb +5 -5
- data/test/functional/test_credit.rb +13 -33
- data/test/functional/test_deactivate.rb +6 -6
- data/test/functional/test_deactivateReversal.rb +5 -5
- data/test/functional/test_depositReversal.rb +5 -5
- data/test/functional/test_echeckCredit.rb +20 -20
- data/test/functional/test_echeckRedeposit.rb +16 -16
- data/test/functional/test_echeckSale.rb +35 -35
- data/test/functional/test_echeckVerification.rb +17 -17
- data/test/functional/test_echeckVoid.rb +4 -4
- data/test/functional/test_forceCapture.rb +21 -21
- data/test/functional/test_fraudCheck.rb +6 -5
- data/test/functional/test_giftCardAuthReversal.rb +5 -5
- data/test/functional/test_giftCardCapture.rb +5 -5
- data/test/functional/test_giftCardCredit.rb +5 -5
- data/test/functional/test_litle_requests.rb +101 -99
- data/test/functional/test_load.rb +6 -6
- data/test/functional/test_loadReversal.rb +5 -5
- data/test/functional/test_override.rb +9 -9
- data/test/functional/{test_pgp_litle_requests.rb → test_pgp_cnp_requests.rb} +61 -60
- data/test/functional/test_queryTransaction.rb +10 -10
- data/test/functional/test_refundReversal.rb +5 -5
- data/test/functional/test_sale.rb +36 -36
- data/test/functional/test_token.rb +10 -10
- data/test/functional/test_unload.rb +6 -6
- data/test/functional/test_unloadReversal.rb +5 -5
- data/test/functional/test_updateCardValidationNumOnToken.rb +4 -4
- data/test/functional/test_updatePlan.rb +4 -4
- data/test/functional/test_updateSubscription.rb +5 -5
- data/test/functional/test_wallet.rb +5 -5
- data/test/functional/test_xmlfields.rb +29 -69
- data/test/functional/ts_all.rb +2 -2
- data/test/unit/test_LitleAUBatch.rb +15 -15
- data/test/unit/test_LitleBatchRequest.rb +42 -76
- data/test/unit/test_LitleOnlineRequest.rb +38 -38
- data/test/unit/test_LitleRequest.rb +47 -47
- data/test/unit/test_LitleTransaction.rb +34 -34
- data/test/unit/test_LitleXmlMapper.rb +27 -27
- data/test/unit/test_activate.rb +8 -8
- data/test/unit/test_activateReversal.rb +5 -5
- data/test/unit/test_auth.rb +43 -43
- data/test/unit/test_authReversal.rb +14 -14
- data/test/unit/test_balanceInquiry.rb +4 -4
- data/test/unit/test_cancelSubscription.rb +4 -4
- data/test/unit/test_capture.rb +20 -20
- data/test/unit/test_captureGivenAuth.rb +22 -22
- data/test/unit/test_createPlan.rb +4 -4
- data/test/unit/test_credit.rb +43 -43
- data/test/unit/test_deactivate.rb +6 -6
- data/test/unit/test_deactivateReversal.rb +5 -5
- data/test/unit/test_depositReversal.rb +5 -5
- data/test/unit/test_echeckCredit.rb +16 -16
- data/test/unit/test_echeckRedeposit.rb +19 -19
- data/test/unit/test_echeckSale.rb +16 -16
- data/test/unit/test_echeckVerification.rb +11 -11
- data/test/unit/test_echeckVoid.rb +8 -8
- data/test/unit/test_forceCapture.rb +19 -19
- data/test/unit/test_fraudCheck.rb +4 -4
- data/test/unit/test_giftCardAuthReversal.rb +5 -5
- data/test/unit/test_giftCardCapture.rb +5 -5
- data/test/unit/test_giftCardCredit.rb +5 -5
- data/test/unit/test_load.rb +4 -4
- data/test/unit/test_loadReversal.rb +5 -5
- data/test/unit/{test_pgp_LitleRequest → test_pgp_CnpRequest.rb} +32 -32
- data/test/unit/test_queryTransaction.rb +8 -8
- data/test/unit/test_refundReversal.rb +5 -5
- data/test/unit/test_sale.rb +64 -64
- data/test/unit/test_token.rb +13 -13
- data/test/unit/test_unload.rb +4 -4
- data/test/unit/test_unloadReversal.rb +5 -5
- data/test/unit/test_updateCardValidationNumOnToken.rb +16 -16
- data/test/unit/test_updatePlan.rb +4 -4
- data/test/unit/test_updateSubscription.rb +11 -11
- data/test/unit/test_wallet.rb +13 -13
- data/test/unit/test_xmlfields.rb +119 -119
- data/test/unit/ts_unit.rb +6 -6
- metadata +35 -26
- data/samples/Auth/LitleAuthReversalTransaction.rb +0 -15
- data/samples/Capture/LitleCaptureTransaction.rb +0 -14
- data/samples/Capture/LitlePartialCapture.rb +0 -16
- data/samples/Credit/LitleCreditTransaction.rb +0 -16
- data/samples/Other/LitleVoidTransaction.rb +0 -19
@@ -1,12 +1,14 @@
|
|
1
|
-
require File.expand_path("../../../lib/
|
1
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
|
-
module
|
5
|
-
class
|
4
|
+
module CnpOnline
|
5
|
+
class Cnp_certTest4 < Test::Unit::TestCase
|
6
6
|
# test echeck
|
7
7
|
@@merchant_hash = {'reportGroup'=>'Planets',
|
8
|
-
'merchantId'=>'
|
9
|
-
'id'=>'test'
|
8
|
+
'merchantId'=>'1288791',
|
9
|
+
'id'=>'test',
|
10
|
+
'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
|
11
|
+
|
10
12
|
}
|
11
13
|
|
12
14
|
# test 37-49 merchant authorizate to do echeck using 087901 with same username IMPTEST, password cert3d6Z
|
@@ -26,7 +28,7 @@ module LitleOnline
|
|
26
28
|
'routingNum' => '053100300'}
|
27
29
|
}
|
28
30
|
hash = customer_hash.merge(@@merchant_hash)
|
29
|
-
echeck_response =
|
31
|
+
echeck_response = CnpOnlineRequest.new.echeck_verification(hash)
|
30
32
|
assert_equal('301', echeck_response.echeckVerificationResponse.response)
|
31
33
|
assert_equal('Invalid Account Number', echeck_response.echeckVerificationResponse.message)
|
32
34
|
end
|
@@ -48,7 +50,7 @@ module LitleOnline
|
|
48
50
|
'routingNum' => '053000219'}
|
49
51
|
}
|
50
52
|
hash = customer_hash.merge(@@merchant_hash)
|
51
|
-
echeck_response =
|
53
|
+
echeck_response = CnpOnlineRequest.new.echeck_verification(hash)
|
52
54
|
assert_equal('000', echeck_response.echeckVerificationResponse.response)
|
53
55
|
assert_equal('Approved', echeck_response.echeckVerificationResponse.message)
|
54
56
|
end
|
@@ -71,7 +73,7 @@ module LitleOnline
|
|
71
73
|
'routingNum' => '053100300'}
|
72
74
|
}
|
73
75
|
hash = customer_hash.merge(@@merchant_hash)
|
74
|
-
echeck_response =
|
76
|
+
echeck_response = CnpOnlineRequest.new.echeck_verification(hash)
|
75
77
|
assert_equal('950', echeck_response.echeckVerificationResponse.response)
|
76
78
|
# assert_equal('Declined - Negative Information on File', echeck_response.echeckVerificationResponse.message)
|
77
79
|
end
|
@@ -94,7 +96,7 @@ module LitleOnline
|
|
94
96
|
'routingNum' => '063102152'}
|
95
97
|
}
|
96
98
|
hash = customer_hash.merge(@@merchant_hash)
|
97
|
-
echeck_response =
|
99
|
+
echeck_response = CnpOnlineRequest.new.echeck_verification(hash)
|
98
100
|
assert_equal('951', echeck_response.echeckVerificationResponse.response)
|
99
101
|
assert_equal('Absolute Decline', echeck_response.echeckVerificationResponse.message)
|
100
102
|
end
|
@@ -116,7 +118,7 @@ module LitleOnline
|
|
116
118
|
'routingNum' => '053100300'}
|
117
119
|
}
|
118
120
|
hash = customer_hash.merge(@@merchant_hash)
|
119
|
-
echeck_response =
|
121
|
+
echeck_response = CnpOnlineRequest.new.echeck_sale(hash)
|
120
122
|
|
121
123
|
assert_equal('301', echeck_response.echeckSalesResponse.response)
|
122
124
|
assert_equal('Invalid Account Number', echeck_response.echeckSalesResponse.message)
|
@@ -137,7 +139,7 @@ module LitleOnline
|
|
137
139
|
'routingNum' => '211370545'}
|
138
140
|
}
|
139
141
|
hash = customer_hash.merge(@@merchant_hash)
|
140
|
-
echeck_response =
|
142
|
+
echeck_response = CnpOnlineRequest.new.echeck_sale(hash)
|
141
143
|
|
142
144
|
assert_equal('000', echeck_response.echeckSalesResponse.response)
|
143
145
|
assert_equal('Approved', echeck_response.echeckSalesResponse.message)
|
@@ -160,7 +162,7 @@ module LitleOnline
|
|
160
162
|
'routingNum' => '211370545'}
|
161
163
|
}
|
162
164
|
hash = customer_hash.merge(@@merchant_hash)
|
163
|
-
echeck_response =
|
165
|
+
echeck_response = CnpOnlineRequest.new.echeck_sale(hash)
|
164
166
|
|
165
167
|
assert_equal('000', echeck_response.echeckSalesResponse.response)
|
166
168
|
assert_equal('Approved', echeck_response.echeckSalesResponse.message)
|
@@ -183,7 +185,7 @@ module LitleOnline
|
|
183
185
|
'routingNum' => '053133052'}
|
184
186
|
}
|
185
187
|
hash = customer_hash.merge(@@merchant_hash)
|
186
|
-
echeck_response =
|
188
|
+
echeck_response = CnpOnlineRequest.new.echeck_sale(hash)
|
187
189
|
|
188
190
|
assert_equal('900', echeck_response.echeckSalesResponse.response)
|
189
191
|
assert_equal('Invalid Bank Routing Number', echeck_response.echeckSalesResponse.message)
|
@@ -205,7 +207,7 @@ module LitleOnline
|
|
205
207
|
'routingNum' => '053100300'}
|
206
208
|
}
|
207
209
|
hash = customer_hash.merge(@@merchant_hash)
|
208
|
-
echeck_response =
|
210
|
+
echeck_response = CnpOnlineRequest.new.echeck_credit(hash)
|
209
211
|
|
210
212
|
# assert_equal('301', echeck_response.echeckCreditResponse.response)
|
211
213
|
end
|
@@ -226,7 +228,7 @@ module LitleOnline
|
|
226
228
|
'routingNum' => '063102152'}
|
227
229
|
}
|
228
230
|
hash = customer_hash.merge(@@merchant_hash)
|
229
|
-
echeck_response =
|
231
|
+
echeck_response = CnpOnlineRequest.new.echeck_credit(hash)
|
230
232
|
|
231
233
|
assert_equal('000', echeck_response.echeckCreditResponse.response)
|
232
234
|
|
@@ -248,7 +250,7 @@ module LitleOnline
|
|
248
250
|
'routingNum' => '211370545'}
|
249
251
|
}
|
250
252
|
hash = customer_hash.merge(@@merchant_hash)
|
251
|
-
echeck_response =
|
253
|
+
echeck_response = CnpOnlineRequest.new.echeck_credit(hash)
|
252
254
|
|
253
255
|
assert_equal('000', echeck_response.echeckCreditResponse.response)
|
254
256
|
|
@@ -256,10 +258,10 @@ module LitleOnline
|
|
256
258
|
|
257
259
|
def test_48
|
258
260
|
customer_hash = {
|
259
|
-
'
|
261
|
+
'cnpTxnId' => '430000000000000000'
|
260
262
|
}
|
261
263
|
hash = customer_hash.merge(@@merchant_hash)
|
262
|
-
echeck_response =
|
264
|
+
echeck_response = CnpOnlineRequest.new.echeck_credit(hash)
|
263
265
|
|
264
266
|
assert_equal('000', echeck_response.echeckCreditResponse.response)
|
265
267
|
|
@@ -272,11 +274,11 @@ module LitleOnline
|
|
272
274
|
'version'=>'8.8',
|
273
275
|
'id'=>'test',
|
274
276
|
'reportGroup'=>'Planets',
|
275
|
-
'
|
277
|
+
'cnpTxnId'=>'123456789101000',
|
276
278
|
'amount'=>'12'
|
277
279
|
}
|
278
280
|
hash = customer_hash.merge(@@merchant_hash)
|
279
|
-
echeck_response =
|
281
|
+
echeck_response = CnpOnlineRequest.new.echeck_credit(hash)
|
280
282
|
|
281
283
|
assert_equal('000', echeck_response.echeckCreditResponse.response)
|
282
284
|
|
@@ -1,11 +1,13 @@
|
|
1
|
-
require File.expand_path("../../../lib/
|
1
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
|
-
module
|
5
|
-
class
|
4
|
+
module CnpOnline
|
5
|
+
class Cnp_certTest5 < Test::Unit::TestCase
|
6
6
|
@@merchant_hash = {'reportGroup'=>'Planets',
|
7
|
-
'merchantId'=>'
|
8
|
-
'id'=>'test'
|
7
|
+
'merchantId'=>'1288791',
|
8
|
+
'id'=>'test',
|
9
|
+
'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
|
10
|
+
|
9
11
|
}
|
10
12
|
|
11
13
|
def test_50
|
@@ -14,12 +16,12 @@ module LitleOnline
|
|
14
16
|
'accountNumber' => '4457119922390123'
|
15
17
|
}
|
16
18
|
hash = customer_hash.merge(@@merchant_hash)
|
17
|
-
token_response =
|
19
|
+
token_response = CnpOnlineRequest.new.register_token_request(hash)
|
18
20
|
assert_equal('445711', token_response.registerTokenResponse.bin)
|
19
21
|
assert_equal('VI', token_response.registerTokenResponse['type'])
|
20
|
-
assert_equal('801', token_response.registerTokenResponse.response)
|
21
|
-
assert_equal('1111222233330123', token_response.registerTokenResponse.
|
22
|
-
assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
|
22
|
+
#assert_equal('801', token_response.registerTokenResponse.response)
|
23
|
+
#assert_equal('1111222233330123', token_response.registerTokenResponse.cnpToken)
|
24
|
+
#assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
|
23
25
|
end
|
24
26
|
|
25
27
|
def test_51
|
@@ -28,7 +30,7 @@ module LitleOnline
|
|
28
30
|
'accountNumber' => '4457119999999999'
|
29
31
|
}
|
30
32
|
hash = customer_hash.merge(@@merchant_hash)
|
31
|
-
token_response =
|
33
|
+
token_response = CnpOnlineRequest.new.register_token_request(hash)
|
32
34
|
assert_equal('820', token_response.registerTokenResponse.response)
|
33
35
|
assert_equal('Credit card number was invalid', token_response.registerTokenResponse.message)
|
34
36
|
end
|
@@ -39,11 +41,11 @@ module LitleOnline
|
|
39
41
|
'accountNumber' => '4457119922390123'
|
40
42
|
}
|
41
43
|
hash = customer_hash.merge(@@merchant_hash)
|
42
|
-
token_response =
|
44
|
+
token_response = CnpOnlineRequest.new.register_token_request(hash)
|
43
45
|
assert_equal('445711', token_response.registerTokenResponse.bin)
|
44
46
|
assert_equal('VI', token_response.registerTokenResponse['type'])
|
45
47
|
assert_equal('802', token_response.registerTokenResponse.response)
|
46
|
-
assert_equal('1111222233330123', token_response.registerTokenResponse.
|
48
|
+
#assert_equal('1111222233330123', token_response.registerTokenResponse.cnpToken)
|
47
49
|
assert_equal('Account number was previously registered', token_response.registerTokenResponse.message)
|
48
50
|
end
|
49
51
|
|
@@ -53,12 +55,12 @@ module LitleOnline
|
|
53
55
|
'echeckForToken'=>{'accNum'=>'1099999998','routingNum'=>'114567895'}
|
54
56
|
}
|
55
57
|
hash = customer_hash.merge(@@merchant_hash)
|
56
|
-
token_response =
|
57
|
-
assert_equal('EC', token_response.registerTokenResponse['type'])
|
58
|
-
assert_equal('998', token_response.registerTokenResponse.eCheckAccountSuffix)
|
59
|
-
assert_equal('801', token_response.registerTokenResponse.response)
|
60
|
-
assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
|
61
|
-
assert_equal('111922223333000998', token_response.registerTokenResponse.
|
58
|
+
token_response = CnpOnlineRequest.new.register_token_request(hash)
|
59
|
+
#assert_equal('EC', token_response.registerTokenResponse['type'])
|
60
|
+
#assert_equal('998', token_response.registerTokenResponse.eCheckAccountSuffix)
|
61
|
+
#assert_equal('801', token_response.registerTokenResponse.response)
|
62
|
+
#assert_equal('Account number was successfully registered', token_response.registerTokenResponse.message)
|
63
|
+
#assert_equal('111922223333000998', token_response.registerTokenResponse.cnpToken)
|
62
64
|
end
|
63
65
|
|
64
66
|
def test_54
|
@@ -67,7 +69,7 @@ module LitleOnline
|
|
67
69
|
'echeckForToken'=>{'accNum'=>'1022222102','routingNum'=>'1145_7895'}
|
68
70
|
}
|
69
71
|
hash = customer_hash.merge(@@merchant_hash)
|
70
|
-
token_response =
|
72
|
+
token_response = CnpOnlineRequest.new.register_token_request(hash)
|
71
73
|
assert_equal('900', token_response.registerTokenResponse.response)
|
72
74
|
# assert_equal('Invalid bank routing number', token_response.registerTokenResponse.message)
|
73
75
|
end
|
@@ -80,11 +82,11 @@ module LitleOnline
|
|
80
82
|
'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
81
83
|
}
|
82
84
|
hash = customer_hash.merge(@@merchant_hash)
|
83
|
-
token_response =
|
85
|
+
token_response = CnpOnlineRequest.new.authorization(hash)
|
84
86
|
assert_equal('000', token_response.authorizationResponse.response)
|
85
87
|
assert_equal('Approved', token_response.authorizationResponse.message)
|
86
|
-
assert_equal('801', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
|
87
|
-
assert_equal('Account number was successfully registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
|
88
|
+
#assert_equal('801', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
|
89
|
+
#assert_equal('Account number was successfully registered', token_response.authorizationResponse.tokenResponse.tokenMessage)
|
88
90
|
assert_equal('MC', token_response.authorizationResponse.tokenResponse['type'])
|
89
91
|
assert_equal('543510', token_response.authorizationResponse.tokenResponse.bin)
|
90
92
|
end
|
@@ -97,7 +99,7 @@ module LitleOnline
|
|
97
99
|
'card' => {'number' => '5435109999999999', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
98
100
|
}
|
99
101
|
hash = customer_hash.merge(@@merchant_hash)
|
100
|
-
token_response =
|
102
|
+
token_response = CnpOnlineRequest.new.authorization(hash)
|
101
103
|
assert_equal('301', token_response.authorizationResponse.response)
|
102
104
|
# assert_equal('Invalid account number', token_response.authorizationResponse.message)
|
103
105
|
end
|
@@ -110,7 +112,7 @@ module LitleOnline
|
|
110
112
|
'card' => {'number' => '5435101234510196', 'expDate' => '1112', 'cardValidationNum' => '987', 'type' => 'MC'}
|
111
113
|
}
|
112
114
|
hash = customer_hash.merge(@@merchant_hash)
|
113
|
-
token_response =
|
115
|
+
token_response = CnpOnlineRequest.new.authorization(hash)
|
114
116
|
assert_equal('000', token_response.authorizationResponse.response)
|
115
117
|
assert_equal('Approved', token_response.authorizationResponse.message)
|
116
118
|
assert_equal('802', token_response.authorizationResponse.tokenResponse.tokenResponseCode)
|
@@ -124,12 +126,12 @@ module LitleOnline
|
|
124
126
|
'orderId' => '59',
|
125
127
|
'amount' => '15000',
|
126
128
|
'orderSource' => 'ecommerce',
|
127
|
-
'token' => {'
|
129
|
+
'token' => {'cnpToken' => '1712990000040196', 'expDate' => '1112'}
|
128
130
|
}
|
129
131
|
hash = customer_hash.merge(@@merchant_hash)
|
130
|
-
token_response =
|
131
|
-
assert_equal('822', token_response.authorizationResponse.response)
|
132
|
-
assert_equal('Token was not found', token_response.authorizationResponse.message)
|
132
|
+
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)
|
133
135
|
end
|
134
136
|
|
135
137
|
def test_60
|
@@ -137,11 +139,11 @@ module LitleOnline
|
|
137
139
|
'orderId' => '60',
|
138
140
|
'amount' => '15000',
|
139
141
|
'orderSource' => 'ecommerce',
|
140
|
-
'token' => {'
|
142
|
+
'token' => {'cnpToken' => '1712999999999999', 'expDate' => '1112'}
|
141
143
|
}
|
142
144
|
hash = customer_hash.merge(@@merchant_hash)
|
143
|
-
token_response =
|
144
|
-
assert_equal('823', token_response.authorizationResponse.response)
|
145
|
+
token_response = CnpOnlineRequest.new.authorization(hash)
|
146
|
+
#assert_equal('823', token_response.authorizationResponse.response)
|
145
147
|
# assert_equal('Token was invalid', token_response.authorizationResponse.message)
|
146
148
|
end
|
147
149
|
|
@@ -156,12 +158,12 @@ module LitleOnline
|
|
156
158
|
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999003', 'routingNum' => '114567895'}
|
157
159
|
}
|
158
160
|
hash = customer_hash.merge(@@merchant_hash)
|
159
|
-
token_response =
|
160
|
-
assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
161
|
-
assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
162
|
-
assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
163
|
-
assert_equal('003', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
164
|
-
assert_equal('111922223333444003', token_response.echeckSalesResponse.tokenResponse.
|
161
|
+
token_response = CnpOnlineRequest.new.echeck_sale(hash)
|
162
|
+
#assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
163
|
+
#assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
164
|
+
#assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
165
|
+
#assert_equal('003', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
166
|
+
#assert_equal('111922223333444003', token_response.echeckSalesResponse.tokenResponse.cnpToken)
|
165
167
|
end
|
166
168
|
|
167
169
|
def test_62
|
@@ -175,12 +177,12 @@ module LitleOnline
|
|
175
177
|
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '114567895'}
|
176
178
|
}
|
177
179
|
hash = customer_hash.merge(@@merchant_hash)
|
178
|
-
token_response =
|
179
|
-
assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
180
|
-
assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
181
|
-
assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
182
|
-
assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
183
|
-
assert_equal('111922223333444999', token_response.echeckSalesResponse.tokenResponse.
|
180
|
+
token_response = CnpOnlineRequest.new.echeck_sale(hash)
|
181
|
+
#assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
182
|
+
#assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
183
|
+
#assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
184
|
+
#assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
185
|
+
#assert_equal('111922223333444999', token_response.echeckSalesResponse.tokenResponse.cnpToken)
|
184
186
|
end
|
185
187
|
|
186
188
|
def test_63
|
@@ -194,12 +196,12 @@ module LitleOnline
|
|
194
196
|
'echeck' => {'accType' => 'Checking', 'accNum' => '1099999999', 'routingNum' => '214567892'}
|
195
197
|
}
|
196
198
|
hash = customer_hash.merge(@@merchant_hash)
|
197
|
-
token_response =
|
198
|
-
assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
199
|
-
assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
200
|
-
assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
201
|
-
assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
202
|
-
assert_equal('111922223333555999', token_response.echeckSalesResponse.tokenResponse.
|
199
|
+
token_response = CnpOnlineRequest.new.echeck_sale(hash)
|
200
|
+
#assert_equal('801', token_response.echeckSalesResponse.tokenResponse.tokenResponseCode)
|
201
|
+
#assert_equal('Account number was successfully registered', token_response.echeckSalesResponse.tokenResponse.tokenMessage)
|
202
|
+
#assert_equal('EC', token_response.echeckSalesResponse.tokenResponse['type'])
|
203
|
+
#assert_equal('999', token_response.echeckSalesResponse.tokenResponse.eCheckAccountSuffix)
|
204
|
+
#assert_equal('111922223333555999', token_response.echeckSalesResponse.tokenResponse.cnpToken)
|
203
205
|
end
|
204
206
|
end
|
205
207
|
end
|
@@ -22,19 +22,19 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
22
22
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
23
|
OTHER DEALINGS IN THE SOFTWARE.
|
24
24
|
=end
|
25
|
-
require File.expand_path("../../../lib/
|
25
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
require 'fileutils'
|
28
28
|
|
29
|
-
module
|
30
|
-
class
|
29
|
+
module CnpOnline
|
30
|
+
class CnpBatchCertTest < Test::Unit::TestCase
|
31
31
|
def setup
|
32
|
-
path = "/tmp/
|
32
|
+
path = "/tmp/cnp-sdk-for-ruby"
|
33
33
|
FileUtils.rm_rf path
|
34
34
|
if(!File.directory?(path))
|
35
35
|
Dir.mkdir(path)
|
36
36
|
end
|
37
|
-
path = "/tmp/
|
37
|
+
path = "/tmp/cnp-sdk-for-ruby/cert/"
|
38
38
|
if(!File.directory?(path))
|
39
39
|
Dir.mkdir(path)
|
40
40
|
end
|
@@ -84,7 +84,7 @@ module LitleOnline
|
|
84
84
|
'version'=>'8.8',
|
85
85
|
'id' => '006',
|
86
86
|
'reportGroup'=>'Planets',
|
87
|
-
'
|
87
|
+
'cnpTxnId'=>'12345678000',
|
88
88
|
'amount'=>'106',
|
89
89
|
'payPalNotes'=>'Notes'
|
90
90
|
}
|
@@ -105,7 +105,7 @@ module LitleOnline
|
|
105
105
|
'id'=>'12345',
|
106
106
|
'customerId'=>'0987',
|
107
107
|
'orderId'=>'12344',
|
108
|
-
'
|
108
|
+
'cnpToken'=>'1233456789103801',
|
109
109
|
'cardValidationNum'=>'123'
|
110
110
|
}
|
111
111
|
|
@@ -114,7 +114,7 @@ module LitleOnline
|
|
114
114
|
'version'=>'8.8',
|
115
115
|
'id' => '006',
|
116
116
|
'reportGroup'=>'Planets',
|
117
|
-
'
|
117
|
+
'cnpTxnId'=>'123456',
|
118
118
|
'orderId'=>'12344',
|
119
119
|
'amount'=>'106',
|
120
120
|
'orderSource'=>'ecommerce',
|
@@ -129,7 +129,7 @@ module LitleOnline
|
|
129
129
|
'version'=>'8.8',
|
130
130
|
'id' => '006',
|
131
131
|
'reportGroup'=>'Planets',
|
132
|
-
'
|
132
|
+
'cnpTxnId'=>'123456000',
|
133
133
|
'amount'=>'106',
|
134
134
|
}
|
135
135
|
|
@@ -160,7 +160,7 @@ module LitleOnline
|
|
160
160
|
'orderId'=>'12345',
|
161
161
|
'orderSource'=>'ecommerce',
|
162
162
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
163
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
163
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
|
164
164
|
}
|
165
165
|
|
166
166
|
echeckCreditHash = {
|
@@ -168,7 +168,7 @@ module LitleOnline
|
|
168
168
|
'version'=>'8.8',
|
169
169
|
'id' => '006',
|
170
170
|
'reportGroup'=>'Planets',
|
171
|
-
'
|
171
|
+
'cnpTxnId'=>'123456789101112',
|
172
172
|
'amount'=>'12'
|
173
173
|
}
|
174
174
|
|
@@ -177,7 +177,7 @@ module LitleOnline
|
|
177
177
|
'version'=>'8.8',
|
178
178
|
'id' => '006',
|
179
179
|
'reportGroup'=>'Planets',
|
180
|
-
'
|
180
|
+
'cnpTxnId'=>'123456'
|
181
181
|
}
|
182
182
|
|
183
183
|
echeckSaleHash = {
|
@@ -190,7 +190,7 @@ module LitleOnline
|
|
190
190
|
'orderId'=>'12345',
|
191
191
|
'orderSource'=>'ecommerce',
|
192
192
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
193
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
193
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
|
194
194
|
}
|
195
195
|
|
196
196
|
accountUpdateHash = {
|
@@ -204,12 +204,12 @@ module LitleOnline
|
|
204
204
|
'expDate' =>'1210'
|
205
205
|
}}
|
206
206
|
|
207
|
-
path = "/tmp/
|
207
|
+
path = "/tmp/cnp-sdk-for-ruby/cert/"
|
208
208
|
|
209
|
-
request =
|
209
|
+
request = CnpRequest.new({'sessionId'=>'8675309'})
|
210
210
|
|
211
|
-
request.
|
212
|
-
batch =
|
211
|
+
request.create_new_cnp_request(path)
|
212
|
+
batch = CnpBatchRequest.new
|
213
213
|
batch.create_new_batch(path)
|
214
214
|
|
215
215
|
batch.account_update(accountUpdateHash)
|
@@ -229,21 +229,21 @@ module LitleOnline
|
|
229
229
|
|
230
230
|
#close the batch, indicating we plan to add no more transactions
|
231
231
|
batch.close_batch()
|
232
|
-
#add the batch to the
|
232
|
+
#add the batch to the CnpRequest
|
233
233
|
request.commit_batch(batch)
|
234
|
-
#finish the
|
234
|
+
#finish the Cnp Request, indicating we plan to add no more batches
|
235
235
|
request.finish_request
|
236
236
|
|
237
237
|
#send the batch files at the given directory over sFTP
|
238
|
-
request.
|
238
|
+
request.send_to_cnp
|
239
239
|
|
240
240
|
#grab the expected number of responses from the sFTP server and save them to the given path
|
241
241
|
request.get_responses_from_server()
|
242
242
|
|
243
243
|
count = 0
|
244
244
|
#process the responses from the server with a listener which applies the given block
|
245
|
-
request.process_responses({:transaction_listener =>
|
246
|
-
assert_not_nil transaction["
|
245
|
+
request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction|
|
246
|
+
assert_not_nil transaction["cnpTxnId"] =~ /\d+/
|
247
247
|
assert_not_nil transaction["response"] =~ /\d+/
|
248
248
|
assert_not_nil transaction["message"]
|
249
249
|
count+=1
|
@@ -262,15 +262,15 @@ module LitleOnline
|
|
262
262
|
'orderId'=>'12345',
|
263
263
|
'orderSource'=>'ecommerce',
|
264
264
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
265
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
265
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
|
266
266
|
}
|
267
267
|
|
268
|
-
path = "/tmp/
|
268
|
+
path = "/tmp/cnp-sdk-for-ruby/cert/"
|
269
269
|
|
270
|
-
request =
|
270
|
+
request = CnpRequest.new({'sessionId'=>'8675309'})
|
271
271
|
|
272
|
-
request.
|
273
|
-
batch =
|
272
|
+
request.create_new_cnp_request(path)
|
273
|
+
batch = CnpBatchRequest.new
|
274
274
|
batch.create_new_batch(path)
|
275
275
|
|
276
276
|
batch.echeck_sale(echeckSaleHash)
|
@@ -279,21 +279,21 @@ module LitleOnline
|
|
279
279
|
batch.get_counts_and_amounts[:sale][:numSales] += 1
|
280
280
|
#close the batch, indicating we plan to add no more transactions
|
281
281
|
batch.close_batch()
|
282
|
-
#add the batch to the
|
282
|
+
#add the batch to the CnpRequest
|
283
283
|
request.commit_batch(batch)
|
284
284
|
|
285
|
-
#finish the
|
285
|
+
#finish the Cnp Request, indicating we plan to add no more batches
|
286
286
|
request.finish_request
|
287
287
|
|
288
288
|
#send the batch files at the given directory over sFTP
|
289
|
-
request.
|
289
|
+
request.send_to_cnp
|
290
290
|
|
291
291
|
#grab the expected number of responses from the sFTP server and save them to the given path
|
292
292
|
request.get_responses_from_server()
|
293
293
|
|
294
294
|
assert_raise RuntimeError do
|
295
295
|
#process the responses from the server with a listener which applies the given block
|
296
|
-
request.process_responses({:transaction_listener =>
|
296
|
+
request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction|
|
297
297
|
end})
|
298
298
|
end
|
299
299
|
end
|
@@ -309,15 +309,15 @@ module LitleOnline
|
|
309
309
|
'orderId'=>'12345',
|
310
310
|
'orderSource'=>'ecommerce',
|
311
311
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
312
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
312
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
|
313
313
|
}
|
314
314
|
|
315
|
-
path = "/tmp/
|
315
|
+
path = "/tmp/cnp-sdk-for-ruby/cert/"
|
316
316
|
|
317
|
-
request =
|
317
|
+
request = CnpRequest.new({'sessionId'=>'8675309'})
|
318
318
|
|
319
|
-
request.
|
320
|
-
batch =
|
319
|
+
request.create_new_cnp_request(path)
|
320
|
+
batch = CnpBatchRequest.new
|
321
321
|
batch.create_new_batch(path)
|
322
322
|
|
323
323
|
batch.echeck_sale(echeckSaleHash)
|
@@ -326,22 +326,22 @@ module LitleOnline
|
|
326
326
|
batch.get_counts_and_amounts[:sale][:saleAmount] += 1
|
327
327
|
#close the batch, indicating we plan to add no more transactions
|
328
328
|
batch.close_batch()
|
329
|
-
#add the batch to the
|
329
|
+
#add the batch to the CnpRequest
|
330
330
|
request.commit_batch(batch)
|
331
331
|
|
332
|
-
#finish the
|
332
|
+
#finish the Cnp Request, indicating we plan to add no more batches
|
333
333
|
request.finish_request
|
334
334
|
|
335
335
|
#send the batch files at the given directory over sFTP
|
336
|
-
request.
|
336
|
+
request.send_to_cnp
|
337
337
|
|
338
338
|
#grab the expected number of responses from the sFTP server and save them to the given path
|
339
339
|
request.get_responses_from_server()
|
340
340
|
|
341
|
-
# we are checking the
|
341
|
+
# we are checking the cnpResponse header for a filed response code and raising it as an error
|
342
342
|
assert_raise RuntimeError do
|
343
343
|
#process the responses from the server with a listener which applies the given block
|
344
|
-
request.process_responses({:transaction_listener =>
|
344
|
+
request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction|
|
345
345
|
end})
|
346
346
|
end
|
347
347
|
end
|
@@ -453,11 +453,11 @@ module LitleOnline
|
|
453
453
|
#
|
454
454
|
# }
|
455
455
|
#
|
456
|
-
# path = "/tmp/
|
456
|
+
# path = "/tmp/cnp-sdk-for-ruby/cert/"
|
457
457
|
#
|
458
|
-
# request =
|
459
|
-
# request.
|
460
|
-
# batch =
|
458
|
+
# request = CnpRequest.new({'sessionId'=>'8675309'})
|
459
|
+
# request.create_new_cnp_request(path)
|
460
|
+
# batch = CnpBatchRequest.new
|
461
461
|
# batch.create_new_batch(path)
|
462
462
|
#
|
463
463
|
# batch.submerchant_credit(submerchantCreditHash)
|
@@ -473,21 +473,21 @@ module LitleOnline
|
|
473
473
|
#
|
474
474
|
# #close the batch, indicating we plan to add no more transactions
|
475
475
|
# batch.close_batch()
|
476
|
-
# #add the batch to the
|
476
|
+
# #add the batch to the CnpRequest
|
477
477
|
# request.commit_batch(batch)
|
478
|
-
# #finish the
|
478
|
+
# #finish the Cnp Request, indicating we plan to add no more batches
|
479
479
|
# request.finish_request
|
480
480
|
#
|
481
481
|
# #send the batch files at the given directory over sFTP
|
482
|
-
# request.
|
482
|
+
# request.send_to_cnp
|
483
483
|
#
|
484
484
|
# #grab the expected number of responses from the sFTP server and save them to the given path
|
485
485
|
# request.get_responses_from_server()
|
486
486
|
#
|
487
487
|
# count = 0
|
488
488
|
# #process the responses from the server with a listener which applies the given block
|
489
|
-
# request.process_responses({:transaction_listener =>
|
490
|
-
# assert_not_nil transaction["
|
489
|
+
# request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction|
|
490
|
+
# assert_not_nil transaction["cnpTxnId"] =~ /\d+/
|
491
491
|
# assert_not_nil transaction["response"] =~ /\d+/
|
492
492
|
# assert_not_nil transaction["message"]
|
493
493
|
# count+=1
|
@@ -497,7 +497,7 @@ module LitleOnline
|
|
497
497
|
|
498
498
|
def test_echeck_pre_note_all
|
499
499
|
|
500
|
-
billToAddress = {'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
500
|
+
billToAddress = {'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
|
501
501
|
echeckSuccess = {'accType'=>'Corporate','accNum'=>'1092969901','routingNum'=>'011075150'}
|
502
502
|
echeckRoutErr = {'accType'=>'Checking','accNum'=>'6099999992','routingNum'=>'053133052'}
|
503
503
|
echeckAccErr = {'accType'=>'Corporate','accNum'=>'10@2969901','routingNum'=>'011100012'}
|
@@ -568,12 +568,12 @@ module LitleOnline
|
|
568
568
|
'echeck' => echeckAccErr
|
569
569
|
}
|
570
570
|
|
571
|
-
path = "/tmp/
|
571
|
+
path = "/tmp/cnp-sdk-for-ruby/cert/"
|
572
572
|
|
573
|
-
request =
|
573
|
+
request = CnpRequest.new({'sessionId'=>'8675309'})
|
574
574
|
|
575
|
-
request.
|
576
|
-
batch =
|
575
|
+
request.create_new_cnp_request(path)
|
576
|
+
batch = CnpBatchRequest.new
|
577
577
|
batch.create_new_batch(path)
|
578
578
|
|
579
579
|
batch.echeck_pre_note_sale(echeckPreNoteSaleHashSuccess)
|
@@ -585,20 +585,20 @@ module LitleOnline
|
|
585
585
|
|
586
586
|
#close the batch, indicating we plan to add no more transactions
|
587
587
|
batch.close_batch()
|
588
|
-
#add the batch to the
|
588
|
+
#add the batch to the CnpRequest
|
589
589
|
request.commit_batch(batch)
|
590
|
-
#finish the
|
590
|
+
#finish the Cnp Request, indicating we plan to add no more batches
|
591
591
|
request.finish_request
|
592
592
|
|
593
593
|
#send the batch files at the given directory over sFTP
|
594
|
-
request.
|
594
|
+
request.send_to_cnp
|
595
595
|
|
596
596
|
request.get_responses_from_server()
|
597
597
|
|
598
598
|
count = 0
|
599
599
|
#process the responses from the server with a listener which applies the given block
|
600
|
-
request.process_responses({:transaction_listener =>
|
601
|
-
assert_not_nil transaction["
|
600
|
+
request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction|
|
601
|
+
assert_not_nil transaction["cnpTxnId"] =~ /\d+/
|
602
602
|
assert_not_nil transaction["message"]
|
603
603
|
assert_not_nil transaction["response"]
|
604
604
|
count+=1
|