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
@@ -22,10 +22,10 @@ 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 'mocha/setup'
|
28
|
-
module
|
28
|
+
module CnpOnline
|
29
29
|
class TestRefundReversal < Test::Unit::TestCase
|
30
30
|
|
31
31
|
def test_simple
|
@@ -33,7 +33,7 @@ module LitleOnline
|
|
33
33
|
'merchantId' => '101',
|
34
34
|
'version'=>'8.8',
|
35
35
|
'reportGroup'=>'Planets',
|
36
|
-
'
|
36
|
+
'cnpTxnId' => '5000',
|
37
37
|
'card'=>{
|
38
38
|
'type'=>'GC',
|
39
39
|
'number' =>'400000000000001',
|
@@ -48,8 +48,8 @@ module LitleOnline
|
|
48
48
|
'originalSequenceNumber' => '111111',
|
49
49
|
}
|
50
50
|
|
51
|
-
|
52
|
-
|
51
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<cnpTxnId>5000<\/cnpTxnId><card><type>GC<\/type><number>400000000000001<\/number><expDate>0150<\/expDate><cardValidationNum>411<\/cardValidationNum><pin>1234<\/pin><\/card>.*/m), is_a(Hash))
|
52
|
+
CnpOnlineRequest.new.deposit_reversal(hash)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
data/test/unit/test_sale.rb
CHANGED
@@ -22,18 +22,18 @@ 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 'mocha/setup'
|
28
28
|
|
29
|
-
module
|
29
|
+
module CnpOnline
|
30
30
|
class TestSale < Test::Unit::TestCase
|
31
31
|
def test_both_choices_fraud_check_and_card_holder
|
32
32
|
hash = {
|
33
33
|
'merchantId' => '101',
|
34
34
|
'version'=>'8.8',
|
35
35
|
'reportGroup'=>'Planets',
|
36
|
-
'
|
36
|
+
'cnpTxnId'=>'123456',
|
37
37
|
'orderId'=>'12344',
|
38
38
|
'amount'=>'106',
|
39
39
|
'orderSource'=>'ecommerce',
|
@@ -45,7 +45,7 @@ module LitleOnline
|
|
45
45
|
'expDate' =>'1210'
|
46
46
|
}}
|
47
47
|
|
48
|
-
exception = assert_raise(RuntimeError){
|
48
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.sale(hash)}
|
49
49
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
50
50
|
end
|
51
51
|
|
@@ -54,7 +54,7 @@ module LitleOnline
|
|
54
54
|
'merchantId' => '101',
|
55
55
|
'version'=>'8.8',
|
56
56
|
'reportGroup'=>'Planets',
|
57
|
-
'
|
57
|
+
'cnpTxnId'=>'123456',
|
58
58
|
'orderId'=>'12344',
|
59
59
|
'amount'=>'106',
|
60
60
|
'orderSource'=>'ecommerce',
|
@@ -73,8 +73,8 @@ module LitleOnline
|
|
73
73
|
}
|
74
74
|
}
|
75
75
|
|
76
|
-
|
77
|
-
|
76
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*?<cnpOnlineRequest.*?<sale.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/sale>.*?/m), is_a(Hash))
|
77
|
+
CnpOnlineRequest.new.sale(hash)
|
78
78
|
end
|
79
79
|
|
80
80
|
# for test the choice functionality
|
@@ -83,7 +83,7 @@ module LitleOnline
|
|
83
83
|
'merchantId' => '101',
|
84
84
|
'version'=>'8.8',
|
85
85
|
'reportGroup'=>'Planets',
|
86
|
-
'
|
86
|
+
'cnpTxnId'=>'123456',
|
87
87
|
'orderId'=>'12344',
|
88
88
|
'amount'=>'106',
|
89
89
|
'orderSource'=>'ecommerce',
|
@@ -94,8 +94,8 @@ module LitleOnline
|
|
94
94
|
'expDate' =>'1210'
|
95
95
|
}
|
96
96
|
}
|
97
|
-
|
98
|
-
|
97
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*?<cnpOnlineRequest.*?<sale.*?<card>.*?<type>VI<\/type>.*?<\/card>.*?<\/sale>.*?/m), is_a(Hash))
|
98
|
+
CnpOnlineRequest.new.sale(hash)
|
99
99
|
end
|
100
100
|
|
101
101
|
def test_both_choices_card_and_paypal
|
@@ -103,7 +103,7 @@ module LitleOnline
|
|
103
103
|
'merchantId' => '101',
|
104
104
|
'version'=>'8.8',
|
105
105
|
'reportGroup'=>'Planets',
|
106
|
-
'
|
106
|
+
'cnpTxnId'=>'123456',
|
107
107
|
'orderId'=>'12344',
|
108
108
|
'amount'=>'106',
|
109
109
|
'orderSource'=>'ecommerce',
|
@@ -119,7 +119,7 @@ module LitleOnline
|
|
119
119
|
'transactionId'=>'123456'
|
120
120
|
}}
|
121
121
|
|
122
|
-
exception = assert_raise(RuntimeError){
|
122
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.sale(hash)}
|
123
123
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
124
124
|
end
|
125
125
|
|
@@ -128,7 +128,7 @@ module LitleOnline
|
|
128
128
|
'merchantId' => '101',
|
129
129
|
'version'=>'8.8',
|
130
130
|
'reportGroup'=>'Planets',
|
131
|
-
'
|
131
|
+
'cnpTxnId'=>'123456',
|
132
132
|
'orderId'=>'12344',
|
133
133
|
'amount'=>'106',
|
134
134
|
'orderSource'=>'ecommerce',
|
@@ -140,13 +140,13 @@ module LitleOnline
|
|
140
140
|
'expDate' =>'1210'
|
141
141
|
},
|
142
142
|
'token'=> {
|
143
|
-
'
|
143
|
+
'cnpToken'=>'1234567890123',
|
144
144
|
'expDate'=>'1210',
|
145
145
|
'cardValidationNum'=>'555',
|
146
146
|
'type'=>'VI'
|
147
147
|
}}
|
148
148
|
|
149
|
-
exception = assert_raise(RuntimeError){
|
149
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.sale(hash)}
|
150
150
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
151
151
|
end
|
152
152
|
|
@@ -155,7 +155,7 @@ module LitleOnline
|
|
155
155
|
'merchantId' => '101',
|
156
156
|
'version'=>'8.8',
|
157
157
|
'reportGroup'=>'Planets',
|
158
|
-
'
|
158
|
+
'cnpTxnId'=>'123456',
|
159
159
|
'orderId'=>'12344',
|
160
160
|
'amount'=>'106',
|
161
161
|
'orderSource'=>'ecommerce',
|
@@ -173,7 +173,7 @@ module LitleOnline
|
|
173
173
|
'type'=>'VI'
|
174
174
|
}}
|
175
175
|
|
176
|
-
exception = assert_raise(RuntimeError){
|
176
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.sale(hash)}
|
177
177
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
178
178
|
end
|
179
179
|
|
@@ -182,7 +182,7 @@ module LitleOnline
|
|
182
182
|
'merchantId' => '101',
|
183
183
|
'version'=>'8.8',
|
184
184
|
'reportGroup'=>'Planets',
|
185
|
-
'
|
185
|
+
'cnpTxnId'=>'123456',
|
186
186
|
'orderId'=>'12344',
|
187
187
|
'amount'=>'106',
|
188
188
|
'orderSource'=>'ecommerce',
|
@@ -204,7 +204,7 @@ module LitleOnline
|
|
204
204
|
'transactionId'=>'123456'
|
205
205
|
}}
|
206
206
|
|
207
|
-
exception = assert_raise(RuntimeError){
|
207
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.sale(hash)}
|
208
208
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
209
209
|
end
|
210
210
|
|
@@ -213,7 +213,7 @@ module LitleOnline
|
|
213
213
|
'merchantId' => '101',
|
214
214
|
'version'=>'8.8',
|
215
215
|
'reportGroup'=>'Planets',
|
216
|
-
'
|
216
|
+
'cnpTxnId'=>'123456',
|
217
217
|
'orderId'=>'12344',
|
218
218
|
'amount'=>'106',
|
219
219
|
'orderSource'=>'ecommerce',
|
@@ -234,12 +234,12 @@ module LitleOnline
|
|
234
234
|
'token'=>'1234',
|
235
235
|
'transactionId'=>'123456'},
|
236
236
|
'token'=> {
|
237
|
-
'
|
237
|
+
'cnpToken'=>'1234567890123',
|
238
238
|
'expDate'=>'1210',
|
239
239
|
'cardValidationNum'=>'555',
|
240
240
|
'type'=>'VI'
|
241
241
|
}}
|
242
|
-
exception = assert_raise(RuntimeError){
|
242
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.sale(hash)}
|
243
243
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
244
244
|
end
|
245
245
|
|
@@ -256,8 +256,8 @@ module LitleOnline
|
|
256
256
|
}
|
257
257
|
}
|
258
258
|
|
259
|
-
|
260
|
-
|
259
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<merchantData>.*?<affiliate>bar<\/affiliate>.*?<\/merchantData>.*/m), is_a(Hash))
|
260
|
+
CnpOnlineRequest.new.sale(hash)
|
261
261
|
end
|
262
262
|
|
263
263
|
def test_invalid_embedded_field_values
|
@@ -266,7 +266,7 @@ module LitleOnline
|
|
266
266
|
'merchantId' => '101',
|
267
267
|
'version'=>'8.8',
|
268
268
|
'reportGroup'=>'Planets',
|
269
|
-
'
|
269
|
+
'cnpTxnId'=>'123456',
|
270
270
|
'orderId'=>'12344',
|
271
271
|
'amount'=>'106',
|
272
272
|
'orderSource'=>'ecommerce',
|
@@ -276,7 +276,7 @@ module LitleOnline
|
|
276
276
|
'type'=>'VI',
|
277
277
|
'number' =>'4100000000000000',
|
278
278
|
}}
|
279
|
-
exception = assert_raise(RuntimeError){
|
279
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.sale(hash)}
|
280
280
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
281
281
|
end
|
282
282
|
|
@@ -291,8 +291,8 @@ module LitleOnline
|
|
291
291
|
'fraudFilterOverride'=> 'false'
|
292
292
|
}
|
293
293
|
|
294
|
-
|
295
|
-
|
294
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<sale.*?<fraudFilterOverride>false<\/fraudFilterOverride>.*?<\/sale>.*/m), is_a(Hash))
|
295
|
+
CnpOnlineRequest.new.sale(hash)
|
296
296
|
end
|
297
297
|
|
298
298
|
def test_illegal_card_type
|
@@ -300,7 +300,7 @@ module LitleOnline
|
|
300
300
|
'merchantId' => '101',
|
301
301
|
'version'=>'8.8',
|
302
302
|
'reportGroup'=>'Planets',
|
303
|
-
'
|
303
|
+
'cnpTxnId'=>'123456',
|
304
304
|
'orderId'=>'12344',
|
305
305
|
'amount'=>'106',
|
306
306
|
'orderSource'=>'ecommerce',
|
@@ -309,7 +309,7 @@ module LitleOnline
|
|
309
309
|
'number' =>'4100000000000002',
|
310
310
|
'expDate' =>'1210'
|
311
311
|
}}
|
312
|
-
exception = assert_raise(RuntimeError){
|
312
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.sale(hash)}
|
313
313
|
assert_match /If card type is specified, it must be in /, exception.message
|
314
314
|
end
|
315
315
|
|
@@ -320,7 +320,7 @@ module LitleOnline
|
|
320
320
|
'merchantId' => '101',
|
321
321
|
'version'=>'8.8',
|
322
322
|
'reportGroup'=>'Planets',
|
323
|
-
'
|
323
|
+
'cnpTxnId'=>'123456',
|
324
324
|
'orderId'=>'12344',
|
325
325
|
'amount'=>'106',
|
326
326
|
'orderSource'=>'ecommerce',
|
@@ -330,8 +330,8 @@ module LitleOnline
|
|
330
330
|
'expDate' =>'1210'
|
331
331
|
}}
|
332
332
|
|
333
|
-
|
334
|
-
|
333
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
334
|
+
CnpOnlineRequest.new.sale(hash)
|
335
335
|
end
|
336
336
|
|
337
337
|
def test_surcharge_amount
|
@@ -342,8 +342,8 @@ module LitleOnline
|
|
342
342
|
'orderSource' => 'ecommerce',
|
343
343
|
'reportGroup' => 'Planets'
|
344
344
|
}
|
345
|
-
|
346
|
-
|
345
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
346
|
+
CnpOnlineRequest.new.sale(hash)
|
347
347
|
end
|
348
348
|
|
349
349
|
def test_secondary_amount
|
@@ -354,8 +354,8 @@ module LitleOnline
|
|
354
354
|
'orderSource' => 'ecommerce',
|
355
355
|
'reportGroup' => 'Planets'
|
356
356
|
}
|
357
|
-
|
358
|
-
|
357
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
358
|
+
CnpOnlineRequest.new.sale(hash)
|
359
359
|
end
|
360
360
|
|
361
361
|
def test_surcharge_amount_optional
|
@@ -365,8 +365,8 @@ module LitleOnline
|
|
365
365
|
'orderSource' => 'ecommerce',
|
366
366
|
'reportGroup' => 'Planets'
|
367
367
|
}
|
368
|
-
|
369
|
-
|
368
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
369
|
+
CnpOnlineRequest.new.sale(hash)
|
370
370
|
end
|
371
371
|
|
372
372
|
def test_recurringRequest
|
@@ -387,8 +387,8 @@ module LitleOnline
|
|
387
387
|
}
|
388
388
|
}
|
389
389
|
}
|
390
|
-
|
391
|
-
|
390
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><recurringRequest><subscription><planCode>abc123<\/planCode><numberOfPayments>12<\/numberOfPayments><\/subscription><\/recurringRequest>.*/m), is_a(Hash))
|
391
|
+
CnpOnlineRequest.new.sale(hash)
|
392
392
|
end
|
393
393
|
|
394
394
|
def test_recurringRequest_optional
|
@@ -403,11 +403,11 @@ module LitleOnline
|
|
403
403
|
'orderSource'=>'ecommerce',
|
404
404
|
'fraudFilterOverride'=>'true',
|
405
405
|
}
|
406
|
-
|
407
|
-
|
406
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><\/sale>.*/m), is_a(Hash))
|
407
|
+
CnpOnlineRequest.new.sale(hash)
|
408
408
|
end
|
409
409
|
|
410
|
-
def
|
410
|
+
def test_cnpInternalRecurringRequest
|
411
411
|
hash = {
|
412
412
|
'card'=>{
|
413
413
|
'type'=>'VI',
|
@@ -418,17 +418,17 @@ module LitleOnline
|
|
418
418
|
'amount'=>'2',
|
419
419
|
'orderSource'=>'ecommerce',
|
420
420
|
'fraudFilterOverride'=>'true',
|
421
|
-
'
|
421
|
+
'cnpInternalRecurringRequest'=>{
|
422
422
|
'subscriptionId'=>'1234567890123456789',
|
423
423
|
'recurringTxnId'=>'1234567890123456789',
|
424
424
|
'finalPayment'=>'false'
|
425
425
|
},
|
426
426
|
}
|
427
|
-
|
428
|
-
|
427
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><cnpInternalRecurringRequest><subscriptionId>1234567890123456789<\/subscriptionId><recurringTxnId>1234567890123456789<\/recurringTxnId><finalPayment>false<\/finalPayment><\/cnpInternalRecurringRequest>.*/m), is_a(Hash))
|
428
|
+
CnpOnlineRequest.new.sale(hash)
|
429
429
|
end
|
430
430
|
|
431
|
-
def
|
431
|
+
def test_cnpInternalRecurringRequest_optional
|
432
432
|
hash = {
|
433
433
|
'card'=>{
|
434
434
|
'type'=>'VI',
|
@@ -440,8 +440,8 @@ module LitleOnline
|
|
440
440
|
'orderSource'=>'ecommerce',
|
441
441
|
'fraudFilterOverride'=>'true',
|
442
442
|
}
|
443
|
-
|
444
|
-
|
443
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><\/sale>.*/m), is_a(Hash))
|
444
|
+
CnpOnlineRequest.new.sale(hash)
|
445
445
|
end
|
446
446
|
|
447
447
|
def test_advanced_fraud_check
|
@@ -456,8 +456,8 @@ module LitleOnline
|
|
456
456
|
} ,
|
457
457
|
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
458
458
|
}
|
459
|
-
|
460
|
-
|
459
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudChecks><threatMetrixSessionId>1234<\/threatMetrixSessionId><\/advancedFraudChecks>.*/m), is_a(Hash))
|
460
|
+
CnpOnlineRequest.new.sale(hash)
|
461
461
|
end
|
462
462
|
|
463
463
|
def test_processingType
|
@@ -465,7 +465,7 @@ module LitleOnline
|
|
465
465
|
'merchantId' => '101',
|
466
466
|
'version'=>'8.8',
|
467
467
|
'reportGroup'=>'Planets',
|
468
|
-
'
|
468
|
+
'cnpTxnId'=>'123456',
|
469
469
|
'orderId'=>'12344',
|
470
470
|
'amount'=>'106',
|
471
471
|
'orderSource'=>'ecommerce',
|
@@ -477,8 +477,8 @@ module LitleOnline
|
|
477
477
|
},
|
478
478
|
'processingType'=>'initialInstallment'
|
479
479
|
}
|
480
|
-
|
481
|
-
|
480
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<processingType>initialInstallment<\/processingType>.*/m), is_a(Hash))
|
481
|
+
CnpOnlineRequest.new.sale(hash)
|
482
482
|
end
|
483
483
|
|
484
484
|
def test_originalNetworkTransactionId_originalTransactionAmount_pin
|
@@ -486,7 +486,7 @@ module LitleOnline
|
|
486
486
|
'merchantId' => '101',
|
487
487
|
'version'=>'8.8',
|
488
488
|
'reportGroup'=>'Planets',
|
489
|
-
'
|
489
|
+
'cnpTxnId'=>'123456',
|
490
490
|
'orderId'=>'12344',
|
491
491
|
'amount'=>'106',
|
492
492
|
'orderSource'=>'ecommerce',
|
@@ -500,8 +500,8 @@ module LitleOnline
|
|
500
500
|
'originalNetworkTransactionId'=>'98765432109876543210',
|
501
501
|
'originalTransactionAmount'=>'7001'
|
502
502
|
}
|
503
|
-
|
504
|
-
|
503
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<originalNetworkTransactionId>98765432109876543210<\/originalNetworkTransactionId><originalTransactionAmount>7001<\/originalTransactionAmount>.*/m), is_a(Hash))
|
504
|
+
CnpOnlineRequest.new.sale(hash)
|
505
505
|
end
|
506
506
|
|
507
507
|
def test_wallet
|
@@ -509,7 +509,7 @@ module LitleOnline
|
|
509
509
|
'merchantId' => '101',
|
510
510
|
'version'=>'8.8',
|
511
511
|
'reportGroup'=>'Planets',
|
512
|
-
'
|
512
|
+
'cnpTxnId'=>'123456',
|
513
513
|
'orderId'=>'12344',
|
514
514
|
'amount'=>'106',
|
515
515
|
'orderSource'=>'ecommerce',
|
@@ -524,8 +524,8 @@ module LitleOnline
|
|
524
524
|
'walletSourceTypeId'=>'VCIND'
|
525
525
|
}
|
526
526
|
}
|
527
|
-
|
528
|
-
|
527
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<wallet><walletSourceType>VisaCheckout<\/walletSourceType><walletSourceTypeId>VCIND<\/walletSourceTypeId><\/wallet>.*/m), is_a(Hash))
|
528
|
+
CnpOnlineRequest.new.sale(hash)
|
529
529
|
end
|
530
530
|
|
531
531
|
|
@@ -534,7 +534,7 @@ module LitleOnline
|
|
534
534
|
'merchantId' => '101',
|
535
535
|
'version'=>'8.8',
|
536
536
|
'reportGroup'=>'Planets',
|
537
|
-
'
|
537
|
+
'cnpTxnId'=>'123456',
|
538
538
|
'orderId'=>'12344',
|
539
539
|
'amount'=>'106',
|
540
540
|
'orderSource'=>'ecommerce',
|
@@ -543,8 +543,8 @@ module LitleOnline
|
|
543
543
|
'sequenceType'=>'OneTime',
|
544
544
|
'iban'=>'123456789123456789',
|
545
545
|
}}
|
546
|
-
|
547
|
-
|
546
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<sepaDirectDebit><mandateProvider>Merchant<\/mandateProvider><sequenceType>OneTime<\/sequenceType><iban>123456789123456789<\/iban><\/sepaDirectDebit>.*/m), is_a(Hash))
|
547
|
+
CnpOnlineRequest.new.sale(hash)
|
548
548
|
end
|
549
549
|
|
550
550
|
end
|
data/test/unit/test_token.rb
CHANGED
@@ -22,11 +22,11 @@ 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 'mocha/setup'
|
28
28
|
|
29
|
-
module
|
29
|
+
module CnpOnline
|
30
30
|
class TestToken < Test::Unit::TestCase
|
31
31
|
def test_success_applepay
|
32
32
|
hash = {
|
@@ -48,8 +48,8 @@ module LitleOnline
|
|
48
48
|
'version' =>'10000'
|
49
49
|
}
|
50
50
|
}
|
51
|
-
|
52
|
-
|
51
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*?<cnpOnlineRequest.*?<registerTokenRequest.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/registerTokenRequest>.*?/m), is_a(Hash))
|
52
|
+
CnpOnlineRequest.new.register_token_request(hash)
|
53
53
|
end
|
54
54
|
|
55
55
|
def test_account_num_and_applepay
|
@@ -73,7 +73,7 @@ module LitleOnline
|
|
73
73
|
'version' =>'10000'
|
74
74
|
}
|
75
75
|
}
|
76
|
-
exception = assert_raise(RuntimeError){
|
76
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.register_token_request(hash)}
|
77
77
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
78
78
|
end
|
79
79
|
|
@@ -86,7 +86,7 @@ module LitleOnline
|
|
86
86
|
'accountNumber'=>'1233456789101112',
|
87
87
|
'paypageRegistrationId'=>'1233456789101112'
|
88
88
|
}
|
89
|
-
exception = assert_raise(RuntimeError){
|
89
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.register_token_request(hash)}
|
90
90
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
91
91
|
end
|
92
92
|
|
@@ -99,7 +99,7 @@ module LitleOnline
|
|
99
99
|
'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'},
|
100
100
|
'paypageRegistrationId'=>'1233456789101112'
|
101
101
|
}
|
102
|
-
exception = assert_raise(RuntimeError){
|
102
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.register_token_request(hash)}
|
103
103
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
104
104
|
end
|
105
105
|
|
@@ -113,7 +113,7 @@ module LitleOnline
|
|
113
113
|
'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'},
|
114
114
|
'paypageRegistrationId'=>'1233456789101112'
|
115
115
|
}
|
116
|
-
exception = assert_raise(RuntimeError){
|
116
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.register_token_request(hash)}
|
117
117
|
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
118
118
|
end
|
119
119
|
|
@@ -125,7 +125,7 @@ module LitleOnline
|
|
125
125
|
'orderId'=>'12344',
|
126
126
|
'echeckForToken'=>{'routingNum'=>'132344565'}
|
127
127
|
}
|
128
|
-
exception = assert_raise(RuntimeError){
|
128
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.register_token_request(hash)}
|
129
129
|
assert_match /If echeckForToken is specified, it must have a accNum/, exception.message
|
130
130
|
end
|
131
131
|
|
@@ -139,8 +139,8 @@ module LitleOnline
|
|
139
139
|
'orderId'=>'12344',
|
140
140
|
'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'}
|
141
141
|
}
|
142
|
-
|
143
|
-
|
142
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
143
|
+
CnpOnlineRequest.new.register_token_request(hash)
|
144
144
|
end
|
145
145
|
|
146
146
|
def test_androidpay
|
@@ -152,8 +152,8 @@ module LitleOnline
|
|
152
152
|
'orderId'=>'androidpay',
|
153
153
|
'accountNumber'=>'1233456789103801'
|
154
154
|
}
|
155
|
-
|
156
|
-
|
155
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<orderId>androidpay<\/orderId>.*<accountNumber>1233456789103801<\/accountNumber>.*/m), is_a(Hash))
|
156
|
+
CnpOnlineRequest.new.register_token_request(hash)
|
157
157
|
end
|
158
158
|
end
|
159
159
|
end
|