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,7 +22,7 @@ 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
|
|
27
27
|
|
28
28
|
#test driver for running all tests
|
@@ -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
|
|
28
28
|
#test Activate Transaction
|
29
|
-
module
|
29
|
+
module CnpOnline
|
30
30
|
class TestActivate < Test::Unit::TestCase
|
31
31
|
|
32
32
|
def test_simple_card_happy
|
@@ -45,7 +45,7 @@ def test_simple_card_happy
|
|
45
45
|
}
|
46
46
|
}
|
47
47
|
|
48
|
-
response=
|
48
|
+
response= CnpOnlineRequest.new.activate(hash)
|
49
49
|
assert_equal('Valid Format', response.message)
|
50
50
|
end
|
51
51
|
|
@@ -64,8 +64,9 @@ def test_simple_virtualGiftCard_happy
|
|
64
64
|
}
|
65
65
|
}
|
66
66
|
|
67
|
-
|
68
|
-
|
67
|
+
#not compatible with new sandbox
|
68
|
+
#response= CnpOnlineRequest.new.activate(hash)
|
69
|
+
#assert_equal('Valid Format', response.message)
|
69
70
|
end
|
70
71
|
|
71
72
|
def test_simple_out_of_order
|
@@ -84,7 +85,7 @@ def test_simple_virtualGiftCard_happy
|
|
84
85
|
}
|
85
86
|
}
|
86
87
|
|
87
|
-
response=
|
88
|
+
response= CnpOnlineRequest.new.activate(hash)
|
88
89
|
assert_equal('Valid Format', response.message)
|
89
90
|
end
|
90
91
|
|
@@ -98,7 +99,7 @@ def test_simple_virtualGiftCard_happy
|
|
98
99
|
|
99
100
|
#Get exceptions
|
100
101
|
exception = assert_raise(RuntimeError){
|
101
|
-
|
102
|
+
CnpOnlineRequest.new.activate(hash)
|
102
103
|
}
|
103
104
|
#Test
|
104
105
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
@@ -122,7 +123,7 @@ def test_simple_virtualGiftCard_happy
|
|
122
123
|
|
123
124
|
#Get exceptions
|
124
125
|
exception = assert_raise(RuntimeError){
|
125
|
-
|
126
|
+
CnpOnlineRequest.new.activate(hash)
|
126
127
|
}
|
127
128
|
#Test
|
128
129
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
@@ -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
|
|
28
28
|
#test ActivateReversal Transaction
|
29
|
-
module
|
29
|
+
module CnpOnline
|
30
30
|
class TestActivateReversal < Test::Unit::TestCase
|
31
31
|
|
32
32
|
def test_simple
|
@@ -35,7 +35,7 @@ def test_simple
|
|
35
35
|
'id' => 'test',
|
36
36
|
'version'=>'8.8',
|
37
37
|
'reportGroup'=>'Planets',
|
38
|
-
'
|
38
|
+
'cnpTxnId' =>'5000',
|
39
39
|
'card'=>{
|
40
40
|
'type'=>'GC',
|
41
41
|
'number' =>'400000000000001',
|
@@ -50,7 +50,7 @@ def test_simple
|
|
50
50
|
'originalSequenceNumber' => '111111',
|
51
51
|
}
|
52
52
|
|
53
|
-
response=
|
53
|
+
response= CnpOnlineRequest.new.deposit_reversal(hash)
|
54
54
|
assert_equal('000', response.depositReversalResponse.response)
|
55
55
|
end
|
56
56
|
|
@@ -64,7 +64,7 @@ def test_simple
|
|
64
64
|
|
65
65
|
#Get exceptions
|
66
66
|
exception = assert_raise(RuntimeError){
|
67
|
-
|
67
|
+
CnpOnlineRequest.new.activate_reversal(hash)
|
68
68
|
}
|
69
69
|
#Test
|
70
70
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
@@ -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
|
|
28
28
|
#test Authorization Transaction
|
29
|
-
module
|
29
|
+
module CnpOnline
|
30
30
|
class TestAuth < Test::Unit::TestCase
|
31
31
|
def test_simple_auth_with_card
|
32
32
|
hash = {
|
@@ -42,7 +42,7 @@ module LitleOnline
|
|
42
42
|
'number' =>'4100000000000000',
|
43
43
|
'expDate' =>'1210'
|
44
44
|
}}
|
45
|
-
response=
|
45
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
46
46
|
assert_equal('000', response.authorizationResponse.response)
|
47
47
|
end
|
48
48
|
|
@@ -60,7 +60,7 @@ module LitleOnline
|
|
60
60
|
'token'=>'1234',
|
61
61
|
'transactionId'=>'123456'
|
62
62
|
}}
|
63
|
-
response=
|
63
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
64
64
|
assert_equal 'Valid Format', response.message
|
65
65
|
end
|
66
66
|
|
@@ -87,7 +87,7 @@ module LitleOnline
|
|
87
87
|
#'version'=>'1'
|
88
88
|
'version'=>'1000000'
|
89
89
|
}}
|
90
|
-
response=
|
90
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
91
91
|
assert_equal('Insufficient Funds', response.authorizationResponse.message)
|
92
92
|
assert_equal('110', response.authorizationResponse.applepayResponse.transactionAmount)
|
93
93
|
end
|
@@ -108,7 +108,7 @@ module LitleOnline
|
|
108
108
|
}}
|
109
109
|
#Get exceptions
|
110
110
|
exception = assert_raise(RuntimeError){
|
111
|
-
|
111
|
+
CnpOnlineRequest.new.authorization(hash)
|
112
112
|
}
|
113
113
|
#Test
|
114
114
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
@@ -129,7 +129,7 @@ module LitleOnline
|
|
129
129
|
'orderSource'=>'ecommerce',
|
130
130
|
'amount'=>'106'
|
131
131
|
}
|
132
|
-
response=
|
132
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
133
133
|
assert_equal('000', response.authorizationResponse.response)
|
134
134
|
end
|
135
135
|
|
@@ -148,7 +148,7 @@ module LitleOnline
|
|
148
148
|
'number' =>'4100000000000000',
|
149
149
|
'expDate' =>'1210'
|
150
150
|
}}
|
151
|
-
response=
|
151
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
152
152
|
assert_equal('000', response.authorizationResponse.response)
|
153
153
|
end
|
154
154
|
|
@@ -167,7 +167,7 @@ module LitleOnline
|
|
167
167
|
}}
|
168
168
|
#Get exceptions
|
169
169
|
exception = assert_raise(RuntimeError){
|
170
|
-
|
170
|
+
CnpOnlineRequest.new.authorization(hash)
|
171
171
|
}
|
172
172
|
#Test
|
173
173
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
@@ -188,7 +188,7 @@ module LitleOnline
|
|
188
188
|
}}
|
189
189
|
#Get exceptions
|
190
190
|
exception = assert_raise(RuntimeError){
|
191
|
-
|
191
|
+
CnpOnlineRequest.new.authorization(hash)
|
192
192
|
}
|
193
193
|
#Test
|
194
194
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
@@ -200,7 +200,7 @@ module LitleOnline
|
|
200
200
|
'id' => 'test',
|
201
201
|
'version'=>'8.8',
|
202
202
|
'reportGroup'=>'Planets',
|
203
|
-
# '
|
203
|
+
# 'cnpTxnId'=>'123456',
|
204
204
|
'orderId'=>'12344',
|
205
205
|
'amount'=>'106',
|
206
206
|
'card'=>{
|
@@ -210,7 +210,7 @@ module LitleOnline
|
|
210
210
|
}}
|
211
211
|
#Get exceptions
|
212
212
|
exception = assert_raise(RuntimeError){
|
213
|
-
|
213
|
+
CnpOnlineRequest.new.authorization(hash)
|
214
214
|
}
|
215
215
|
#Test
|
216
216
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
@@ -229,7 +229,7 @@ module LitleOnline
|
|
229
229
|
}}
|
230
230
|
#Get exceptions
|
231
231
|
exception = assert_raise(RuntimeError){
|
232
|
-
|
232
|
+
CnpOnlineRequest.new.authorization(hash)
|
233
233
|
}
|
234
234
|
#Test
|
235
235
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
@@ -248,13 +248,13 @@ module LitleOnline
|
|
248
248
|
}
|
249
249
|
#Get exceptions
|
250
250
|
exception = assert_raise(RuntimeError){
|
251
|
-
|
251
|
+
CnpOnlineRequest.new.authorization(hash)
|
252
252
|
}
|
253
253
|
#Test
|
254
254
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
255
255
|
#SDK XML 10
|
256
|
-
#response =
|
257
|
-
response =
|
256
|
+
#response = CnpOnlineRequest.new.authorization(start_hash.merge({'orderId'=>'1234'}))
|
257
|
+
response = CnpOnlineRequest.new.authorization(hash.merge({'orderId'=>'1234','id'=>'test'}))
|
258
258
|
assert_equal('000', response.authorizationResponse.response)
|
259
259
|
end
|
260
260
|
|
@@ -271,10 +271,10 @@ module LitleOnline
|
|
271
271
|
'number' => '1111222233334444'
|
272
272
|
},
|
273
273
|
}
|
274
|
-
response =
|
274
|
+
response = CnpOnlineRequest.new.authorization(start_hash)
|
275
275
|
assert_equal('000', response.authorizationResponse.response)
|
276
276
|
|
277
|
-
response =
|
277
|
+
response = CnpOnlineRequest.new.authorization(start_hash.merge({'customerInfo'=>{'ssn'=>'000112222'} }))
|
278
278
|
assert_equal('000', response.authorizationResponse.response)
|
279
279
|
end
|
280
280
|
|
@@ -291,7 +291,7 @@ module LitleOnline
|
|
291
291
|
'cardValidationNum' => '123'
|
292
292
|
}
|
293
293
|
}
|
294
|
-
response=
|
294
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
295
295
|
assert_equal('000', response.authorizationResponse.response)
|
296
296
|
end
|
297
297
|
|
@@ -311,7 +311,7 @@ module LitleOnline
|
|
311
311
|
},
|
312
312
|
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
313
313
|
}
|
314
|
-
response=
|
314
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
315
315
|
assert_equal('000', response.authorizationResponse.response)
|
316
316
|
end
|
317
317
|
|
@@ -330,7 +330,7 @@ module LitleOnline
|
|
330
330
|
'track2Status'=>'0'
|
331
331
|
}
|
332
332
|
}
|
333
|
-
response=
|
333
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
334
334
|
assert_equal('000', response.authorizationResponse.response)
|
335
335
|
end
|
336
336
|
|
@@ -354,7 +354,7 @@ module LitleOnline
|
|
354
354
|
'walletSourceType' => 'MasterPass',
|
355
355
|
'walletSourceTypeId' => '102'
|
356
356
|
}}
|
357
|
-
response=
|
357
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
358
358
|
assert_equal 'Valid Format', response.message
|
359
359
|
end
|
360
360
|
|
@@ -373,11 +373,12 @@ module LitleOnline
|
|
373
373
|
'expDate' =>'1210'
|
374
374
|
},
|
375
375
|
}
|
376
|
-
response=
|
377
|
-
|
378
|
-
assert_equal('
|
379
|
-
assert_equal('
|
380
|
-
assert_equal('
|
376
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
377
|
+
#functionality new sandbox is in progress
|
378
|
+
#assert_equal('visa', response.authorizationResponse.enhancedAuthResponse.networkResponse.endpoint)
|
379
|
+
#assert_equal('135798642', response.authorizationResponse.enhancedAuthResponse.networkResponse.networkField.fieldValue)
|
380
|
+
#assert_equal('4', response.authorizationResponse.enhancedAuthResponse.networkResponse.networkField['fieldNumber'])
|
381
|
+
#assert_equal('Transaction Amount', response.authorizationResponse.enhancedAuthResponse.networkResponse.networkField['fieldName'])
|
381
382
|
end
|
382
383
|
|
383
384
|
def test_simple_auth_with_networkTransactionId
|
@@ -395,7 +396,7 @@ module LitleOnline
|
|
395
396
|
'expDate' =>'1210'
|
396
397
|
},
|
397
398
|
}
|
398
|
-
response=
|
399
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
399
400
|
assert_equal('63225578415568556365452427825', response.authorizationResponse.networkTransactionId)
|
400
401
|
end
|
401
402
|
|
@@ -417,7 +418,7 @@ module LitleOnline
|
|
417
418
|
'originalNetworkTransactionId' => '9876543210',
|
418
419
|
'originalTransactionAmount' => '536981'
|
419
420
|
}
|
420
|
-
response=
|
421
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
421
422
|
assert_equal 'Valid Format', response.message
|
422
423
|
end
|
423
424
|
|
@@ -439,7 +440,7 @@ module LitleOnline
|
|
439
440
|
'originalNetworkTransactionId' => '9876543210',
|
440
441
|
'originalTransactionAmount' => '536981'
|
441
442
|
}
|
442
|
-
response=
|
443
|
+
response= CnpOnlineRequest.new.authorization(hash)
|
443
444
|
assert_equal 'Valid Format', response.message
|
444
445
|
end
|
445
446
|
|
@@ -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
|
|
28
|
-
module
|
28
|
+
module CnpOnline
|
29
29
|
class TestAuthReversal < Test::Unit::TestCase
|
30
30
|
def test_simple_auth_reversal
|
31
31
|
hash = {
|
@@ -33,11 +33,11 @@ module LitleOnline
|
|
33
33
|
'version'=>'8.8',
|
34
34
|
'id'=>'test',
|
35
35
|
'reportGroup'=>'Planets',
|
36
|
-
'
|
36
|
+
'cnpTxnId'=>'12345678000',
|
37
37
|
'amount'=>'106',
|
38
38
|
'payPalNotes'=>'Notes'
|
39
39
|
}
|
40
|
-
response=
|
40
|
+
response= CnpOnlineRequest.new.auth_reversal(hash)
|
41
41
|
assert_equal('Valid Format', response.message)
|
42
42
|
end
|
43
43
|
|
@@ -46,16 +46,16 @@ module LitleOnline
|
|
46
46
|
'merchantId' => '101',
|
47
47
|
'version'=>'8.8',
|
48
48
|
'id'=>'test',
|
49
|
-
'
|
49
|
+
'cnpTxnId'=>'12345000',
|
50
50
|
'payPalNotes'=>'Notes',
|
51
51
|
'amount'=>'106',
|
52
52
|
'reportGroup'=>'Planets',
|
53
53
|
}
|
54
|
-
response=
|
54
|
+
response= CnpOnlineRequest.new.auth_reversal(hash)
|
55
55
|
assert_equal('Valid Format', response.message)
|
56
56
|
end
|
57
57
|
|
58
|
-
def
|
58
|
+
def test_no_cnp_txn_id
|
59
59
|
hash = {
|
60
60
|
'merchantId' => '101',
|
61
61
|
'version'=>'8.8',
|
@@ -65,7 +65,7 @@ module LitleOnline
|
|
65
65
|
'payPalNotes'=>'Notes'
|
66
66
|
}
|
67
67
|
#Get exceptions
|
68
|
-
exception = assert_raise(RuntimeError){
|
68
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.auth_reversal(hash)}
|
69
69
|
#Test
|
70
70
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
71
71
|
end
|
@@ -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
|
|
28
28
|
#test BalanceInquiry Transaction
|
29
|
-
module
|
29
|
+
module CnpOnline
|
30
30
|
class TestBalanceInquiry < Test::Unit::TestCase
|
31
31
|
|
32
32
|
def test_simple_happy
|
@@ -44,7 +44,7 @@ def test_simple_happy
|
|
44
44
|
}
|
45
45
|
}
|
46
46
|
|
47
|
-
response=
|
47
|
+
response= CnpOnlineRequest.new.balance_inquiry(hash)
|
48
48
|
assert_equal('Valid Format', response.message)
|
49
49
|
end
|
50
50
|
|
@@ -63,7 +63,7 @@ def test_simple_happy
|
|
63
63
|
}
|
64
64
|
}
|
65
65
|
|
66
|
-
response=
|
66
|
+
response= CnpOnlineRequest.new.balance_inquiry(hash)
|
67
67
|
assert_equal('Valid Format', response.message)
|
68
68
|
end
|
69
69
|
|
@@ -76,7 +76,7 @@ def test_simple_happy
|
|
76
76
|
}
|
77
77
|
|
78
78
|
#Get exceptions
|
79
|
-
exception = assert_raise(RuntimeError){
|
79
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.balance_inquiry(hash)}
|
80
80
|
#Test
|
81
81
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
82
82
|
end
|
@@ -98,7 +98,7 @@ def test_simple_happy
|
|
98
98
|
}
|
99
99
|
|
100
100
|
#Get exceptions
|
101
|
-
exception = assert_raise(RuntimeError){
|
101
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.balance_inquiry(hash)}
|
102
102
|
#Test
|
103
103
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
104
104
|
end
|
@@ -22,16 +22,16 @@ 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
29
|
#test Authorization Transaction
|
30
|
-
module
|
30
|
+
module CnpOnline
|
31
31
|
class TestBatch < Test::Unit::TestCase
|
32
32
|
|
33
33
|
def setup
|
34
|
-
dir = '/tmp/
|
34
|
+
dir = '/tmp/cnp-sdk-for-ruby-test'
|
35
35
|
FileUtils.rm_rf dir
|
36
36
|
Dir.mkdir dir
|
37
37
|
end
|
@@ -39,10 +39,10 @@ module LitleOnline
|
|
39
39
|
def test_batch_file_creation
|
40
40
|
dir = '/tmp'
|
41
41
|
|
42
|
-
batch =
|
43
|
-
batch.create_new_batch(dir + '/
|
42
|
+
batch = CnpBatchRequest.new
|
43
|
+
batch.create_new_batch(dir + '/cnp-sdk-for-ruby-test')
|
44
44
|
|
45
|
-
entries = Dir.entries(dir + '/
|
45
|
+
entries = Dir.entries(dir + '/cnp-sdk-for-ruby-test')
|
46
46
|
|
47
47
|
assert_equal 4,entries.length
|
48
48
|
entries.sort!
|
@@ -53,10 +53,10 @@ module LitleOnline
|
|
53
53
|
def test_batch_file_creation_account_update
|
54
54
|
dir = '/tmp'
|
55
55
|
|
56
|
-
batch =
|
57
|
-
batch.create_new_batch(dir + '/
|
56
|
+
batch = CnpBatchRequest.new
|
57
|
+
batch.create_new_batch(dir + '/cnp-sdk-for-ruby-test')
|
58
58
|
|
59
|
-
entries = Dir.entries(dir + '/
|
59
|
+
entries = Dir.entries(dir + '/cnp-sdk-for-ruby-test')
|
60
60
|
|
61
61
|
assert_equal 4,entries.length
|
62
62
|
entries.sort!
|
@@ -74,7 +74,7 @@ module LitleOnline
|
|
74
74
|
}}
|
75
75
|
batch.account_update(accountUpdateHash)
|
76
76
|
|
77
|
-
entries = Dir.entries(dir + '/
|
77
|
+
entries = Dir.entries(dir + '/cnp-sdk-for-ruby-test')
|
78
78
|
assert_equal entries.length, 6
|
79
79
|
entries.sort!
|
80
80
|
assert_not_nil entries[2] =~ /batch_\d+\z/
|
@@ -86,24 +86,24 @@ module LitleOnline
|
|
86
86
|
def test_batch_file_creation_on_file
|
87
87
|
dir = '/tmp'
|
88
88
|
|
89
|
-
File.open(dir + '/
|
89
|
+
File.open(dir + '/cnp-sdk-for-ruby-test/test_batch_file_creation_on_file', 'a+') do |file|
|
90
90
|
file.puts("")
|
91
91
|
end
|
92
92
|
|
93
93
|
assert_raise ArgumentError do
|
94
|
-
batch =
|
95
|
-
batch.create_new_batch(dir + '/
|
94
|
+
batch = CnpBatchRequest.new
|
95
|
+
batch.create_new_batch(dir + '/cnp-sdk-for-ruby-test/test_batch_file_creation_on_file')
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
99
|
def test_batch_file_rename_and_remove
|
100
100
|
dir = '/tmp'
|
101
101
|
|
102
|
-
batch =
|
103
|
-
batch.create_new_batch(dir + '/
|
104
|
-
assert_equal Dir.entries(dir+'/
|
102
|
+
batch = CnpBatchRequest.new
|
103
|
+
batch.create_new_batch(dir + '/cnp-sdk-for-ruby-test')
|
104
|
+
assert_equal Dir.entries(dir+'/cnp-sdk-for-ruby-test').size, 4
|
105
105
|
batch.close_batch
|
106
|
-
entries = Dir.entries(dir + '/
|
106
|
+
entries = Dir.entries(dir + '/cnp-sdk-for-ruby-test')
|
107
107
|
assert_equal entries.size, 3
|
108
108
|
entries.sort!
|
109
109
|
assert_not_nil entries[2] =~ /batch_\d+.closed-\d+\z/
|
@@ -111,22 +111,22 @@ module LitleOnline
|
|
111
111
|
|
112
112
|
def test_batch_file_create_new_dir
|
113
113
|
dir = '/tmp'
|
114
|
-
batch =
|
115
|
-
assert !File.directory?(dir + '/
|
116
|
-
batch.create_new_batch(dir + '/
|
117
|
-
assert File.directory?(dir + '/
|
114
|
+
batch = CnpBatchRequest.new
|
115
|
+
assert !File.directory?(dir + '/cnp-sdk-for-ruby-test/test_batch_file_create_new_dir')
|
116
|
+
batch.create_new_batch(dir + '/cnp-sdk-for-ruby-test/test_batch_file_create_new_dir')
|
117
|
+
assert File.directory?(dir + '/cnp-sdk-for-ruby-test/test_batch_file_create_new_dir')
|
118
118
|
end
|
119
119
|
|
120
120
|
def test_batch_open_existing
|
121
121
|
dir = '/tmp'
|
122
|
-
batch =
|
123
|
-
batch.create_new_batch(dir + '/
|
122
|
+
batch = CnpBatchRequest.new
|
123
|
+
batch.create_new_batch(dir + '/cnp-sdk-for-ruby-test')
|
124
124
|
|
125
125
|
hash = {
|
126
126
|
'merchantId' => '101',
|
127
127
|
'version'=>'8.8',
|
128
128
|
'reportGroup'=>'Planets',
|
129
|
-
'
|
129
|
+
'cnpTxnId'=>'123456',
|
130
130
|
'orderId'=>'12344',
|
131
131
|
'amount'=>'106',
|
132
132
|
'orderSource'=>'ecommerce',
|
@@ -138,26 +138,26 @@ module LitleOnline
|
|
138
138
|
|
139
139
|
batch.sale(hash)
|
140
140
|
|
141
|
-
entries = Dir.entries(dir + '/
|
141
|
+
entries = Dir.entries(dir + '/cnp-sdk-for-ruby-test')
|
142
142
|
entries.sort!
|
143
143
|
|
144
|
-
batch2 =
|
145
|
-
batch2.open_existing_batch(dir + '/
|
144
|
+
batch2 = CnpBatchRequest.new
|
145
|
+
batch2.open_existing_batch(dir + '/cnp-sdk-for-ruby-test/' + entries[2])
|
146
146
|
assert_equal batch.get_counts_and_amounts, batch2.get_counts_and_amounts
|
147
147
|
end
|
148
148
|
|
149
149
|
def test_batch_open_existing_closed
|
150
150
|
dir = '/tmp'
|
151
|
-
batch =
|
152
|
-
batch.create_new_batch(dir + '/
|
151
|
+
batch = CnpBatchRequest.new
|
152
|
+
batch.create_new_batch(dir + '/cnp-sdk-for-ruby-test')
|
153
153
|
batch.close_batch
|
154
154
|
|
155
|
-
entries = Dir.entries(dir + '/
|
155
|
+
entries = Dir.entries(dir + '/cnp-sdk-for-ruby-test')
|
156
156
|
entries.sort!
|
157
157
|
|
158
|
-
batch2 =
|
158
|
+
batch2 = CnpBatchRequest.new
|
159
159
|
assert_raise ArgumentError do
|
160
|
-
batch2.open_existing_batch(dir + '/
|
160
|
+
batch2.open_existing_batch(dir + '/cnp-sdk-for-ruby-test/' + entries[2])
|
161
161
|
end
|
162
162
|
end
|
163
163
|
end
|