CnpOnline 9.14.0 → 11.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/CHANGELOG +23 -17
- data/CONTRIBUTORS +0 -0
- data/DESCRIPTION +1 -1
- data/LICENSE +1 -1
- data/README.md +5 -3
- data/Rakefile +5 -5
- data/Rakefile~ +5 -5
- data/SETUP.md +3 -3
- data/bin/Setup.rb +59 -41
- data/lib/Communications.rb +3 -3
- data/lib/Configuration.rb +52 -45
- data/lib/EnvironmentVariables.rb +5 -1
- data/lib/LitleBatchRequest.rb +72 -7
- data/lib/LitleListeners.rb +17 -1
- data/lib/LitleOnline.rb +3 -4
- data/lib/LitleOnlineRequest.rb +37 -7
- data/lib/LitleRequest.rb +315 -186
- data/lib/LitleTransaction.rb +212 -85
- data/lib/LitleXmlMapper.rb +4 -2
- data/lib/XMLFields.rb +384 -171
- data/lib/cacert.pem +0 -0
- data/samples/Auth/LitleAuthReversalTransaction.rb +2 -2
- data/samples/Auth/LitleAuthorizationTransaction.rb +1 -0
- data/samples/Auth/LitlePaymentFullLifeCycle.rb +12 -6
- data/samples/Batch/AccountUpdate.rb +1 -0
- data/samples/Batch/SampleBatchDriver.rb +2 -1
- data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +2 -1
- data/samples/Capture/LitleCaptureTransaction.rb +2 -2
- data/samples/Capture/LitleForceCaptureTransaction.rb +2 -1
- data/samples/Capture/LitlePartialCapture.rb +3 -3
- data/samples/Credit/LitleCreditTransaction.rb +2 -2
- data/samples/Credit/LitleRefundTransaction.rb +2 -1
- data/samples/Other/LitleAvsTransaction.rb +2 -1
- data/samples/Other/LitleVoidTransaction.rb +2 -1
- data/samples/Paypage/FullPaypageLifeCycle.rb +7 -2
- data/samples/Run_all.rb +0 -0
- data/samples/Sale/LitleSaleTransaction.rb +2 -1
- data/samples/Sale/SampleSaleTransaction.rb +2 -1
- data/test/certification/certTest1_base.rb +52 -53
- data/test/certification/certTest2_authenhanced.rb +24 -25
- data/test/certification/certTest3_authreversal.rb +23 -26
- data/test/certification/certTest4_echeck.rb +18 -32
- data/test/certification/certTest5_token.rb +105 -106
- data/test/certification/certTest_batchAll.rb +47 -15
- data/test/functional/test_activate.rb +32 -4
- data/test/functional/test_activateReversal.rb +18 -5
- data/test/functional/test_auth.rb +94 -48
- data/test/functional/test_authReversal.rb +4 -1
- data/test/functional/test_balanceInquiry.rb +28 -3
- data/test/functional/test_batchStream.rb +2 -4
- data/test/functional/test_cancelSubscription.rb +2 -2
- data/test/functional/test_capture.rb +21 -14
- data/test/functional/test_captureGivenAuth.rb +15 -6
- data/test/functional/test_createPlan.rb +1 -1
- data/test/functional/test_credit.rb +14 -5
- data/test/functional/test_deactivate.rb +26 -3
- data/test/functional/test_deactivateReversal.rb +18 -5
- data/test/functional/test_depositReversal.rb +31 -19
- data/test/functional/test_echeckCredit.rb +34 -6
- data/test/functional/test_echeckRedeposit.rb +29 -2
- data/test/functional/test_echeckSale.rb +68 -11
- data/test/functional/test_echeckVerification.rb +32 -7
- data/test/functional/test_echeckVoid.rb +2 -1
- data/test/functional/test_forceCapture.rb +20 -6
- data/test/functional/test_fraudCheck.rb +3 -5
- data/test/functional/test_giftCardAuthReversal.rb +72 -0
- data/test/functional/test_giftCardCapture.rb +72 -0
- data/test/functional/test_giftCardCredit.rb +69 -0
- data/test/functional/test_litle_requests.rb +3 -6
- data/test/functional/test_load.rb +27 -3
- data/test/functional/test_loadReversal.rb +18 -5
- data/test/functional/test_override.rb +7 -3
- data/test/functional/test_pgp_litle_requests.rb +294 -0
- data/test/functional/test_queryTransaction.rb +152 -0
- data/test/functional/test_refundReversal.rb +18 -5
- data/test/functional/test_sale.rb +122 -159
- data/test/functional/test_token.rb +17 -11
- data/test/functional/test_unload.rb +27 -3
- data/test/functional/test_unloadReversal.rb +18 -5
- data/test/functional/test_updateCardValidationNumOnToken.rb +1 -0
- data/test/functional/test_updatePlan.rb +2 -1
- data/test/functional/test_updateSubscription.rb +3 -1
- data/test/functional/test_wallet.rb +74 -0
- data/test/functional/test_xmlfields.rb +22 -3
- data/test/functional/ts_all.rb +2 -0
- data/test/unit/test_LitleBatchRequest.rb +53 -5
- data/test/unit/test_LitleOnlineRequest.rb +5 -30
- data/test/unit/test_LitleRequest.rb +7 -6
- data/test/unit/test_LitleTransaction.rb +34 -5
- data/test/unit/test_LitleXmlMapper.rb +3 -0
- data/test/unit/test_activate.rb +22 -2
- data/test/unit/test_activateReversal.rb +15 -3
- data/test/unit/test_auth.rb +11 -9
- data/test/unit/test_balanceInquiry.rb +2 -2
- data/test/unit/test_capture.rb +2 -2
- data/test/unit/test_captureGivenAuth.rb +21 -1
- data/test/unit/test_credit.rb +1 -1
- data/test/unit/test_deactivate.rb +19 -0
- data/test/unit/test_deactivateReversal.rb +15 -3
- data/test/unit/test_depositReversal.rb +17 -5
- data/test/unit/test_echeckCredit.rb +19 -0
- data/test/unit/test_echeckRedeposit.rb +15 -0
- data/test/unit/test_echeckSale.rb +20 -1
- data/test/unit/test_echeckVerification.rb +6 -3
- data/test/unit/test_forceCapture.rb +1 -1
- data/test/unit/test_giftCardAuthReversal.rb +58 -0
- data/test/{functional/test_utf8.rb → unit/test_giftCardCapture.rb} +25 -12
- data/test/unit/test_giftCardCredit.rb +57 -0
- data/test/unit/test_load.rb +2 -2
- data/test/unit/test_loadReversal.rb +15 -3
- data/test/unit/test_pgp_LitleRequest +139 -0
- data/test/unit/test_queryTransaction.rb +105 -0
- data/test/unit/test_refundReversal.rb +15 -3
- data/test/unit/test_sale.rb +23 -3
- data/test/unit/test_token.rb +24 -20
- data/test/unit/test_unload.rb +2 -2
- data/test/unit/test_unloadReversal.rb +15 -3
- data/test/unit/test_wallet.rb +262 -0
- data/test/unit/ts_unit.rb +2 -1
- metadata +81 -100
data/test/functional/ts_all.rb
CHANGED
@@ -44,6 +44,8 @@ require_relative 'test_echeckCredit'
|
|
44
44
|
require_relative 'test_echeckVerification'
|
45
45
|
require_relative 'test_echeckVoid'
|
46
46
|
require_relative 'test_updateCardValidationNumOnToken'
|
47
|
+
require_relative 'test_wallet'
|
48
|
+
require_relative 'test_queryTransaction'
|
47
49
|
require_relative 'test_litle_requests'
|
48
50
|
require_relative 'test_batch'
|
49
51
|
require_relative 'test_cancelSubscription'
|
@@ -206,7 +206,7 @@ module LitleOnline
|
|
206
206
|
'reportGroup'=>'Planets',
|
207
207
|
'subscriptionId'=>'100',
|
208
208
|
'planCode'=>'planCodeString',
|
209
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
209
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
210
210
|
}
|
211
211
|
|
212
212
|
batch = LitleBatchRequest.new
|
@@ -343,7 +343,7 @@ module LitleOnline
|
|
343
343
|
'orderId'=>'12345',
|
344
344
|
'orderSource'=>'ecommerce',
|
345
345
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
346
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
346
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
347
347
|
}
|
348
348
|
|
349
349
|
batch = LitleBatchRequest.new
|
@@ -417,7 +417,7 @@ module LitleOnline
|
|
417
417
|
'orderId'=>'12345',
|
418
418
|
'orderSource'=>'ecommerce',
|
419
419
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
420
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
420
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
421
421
|
}
|
422
422
|
|
423
423
|
batch = LitleBatchRequest.new
|
@@ -429,6 +429,36 @@ module LitleOnline
|
|
429
429
|
assert_equal 123456, counts[:echeckSale][:echeckSalesAmount]
|
430
430
|
end
|
431
431
|
|
432
|
+
def test_add_fast_access_funding
|
433
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
|
434
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').once
|
435
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d_txns.*/), 'a+').twice
|
436
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'wb').once
|
437
|
+
File.expects(:directory?).returns(true).once
|
438
|
+
|
439
|
+
fastAccessFundingHash = {
|
440
|
+
'reportGroup'=>'Planets',
|
441
|
+
'orderId'=>'12344',
|
442
|
+
'fundingSubmerchantId'=>'123456',
|
443
|
+
'submerhcantName'=>'submerchant',
|
444
|
+
'fundsTransferId'=>'1234567',
|
445
|
+
'amount'=>'123',
|
446
|
+
'card'=>{
|
447
|
+
'type'=>'VI',
|
448
|
+
'number' =>'4100000000000001',
|
449
|
+
'expDate' =>'1210'
|
450
|
+
}
|
451
|
+
}
|
452
|
+
|
453
|
+
batch = LitleBatchRequest.new
|
454
|
+
batch.create_new_batch('D:\Batches\\')
|
455
|
+
batch.fast_access_funding(fastAccessFundingHash)
|
456
|
+
|
457
|
+
counts = batch.get_counts_and_amounts
|
458
|
+
assert_equal 1, counts[:fastAccessFunding][:numFastAccessFunding]
|
459
|
+
assert_equal 123, counts[:fastAccessFunding][:fastAccessFundingAmount]
|
460
|
+
end
|
461
|
+
|
432
462
|
def test_close_batch
|
433
463
|
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
|
434
464
|
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').once
|
@@ -637,8 +667,8 @@ module LitleOnline
|
|
637
667
|
|
638
668
|
def test_PFIF_instruction_txn
|
639
669
|
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'9.3'}).once
|
640
|
-
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').at_most(
|
641
|
-
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'wb').at_most(
|
670
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').at_most(13)
|
671
|
+
File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'wb').at_most(11)
|
642
672
|
File.expects(:rename).once
|
643
673
|
File.expects(:open).with(regexp_matches(/.*batch_.*\d.closed.*/), 'w').once
|
644
674
|
File.expects(:delete).with(regexp_matches(/.*batch_.*\d_txns.*/)).once
|
@@ -732,6 +762,20 @@ module LitleOnline
|
|
732
762
|
'fundsTransferId'=>'1234567',
|
733
763
|
'amount'=>'110',
|
734
764
|
}
|
765
|
+
|
766
|
+
fastAccessFundingHash = {
|
767
|
+
'reportGroup'=>'Planets',
|
768
|
+
'orderId'=>'12344',
|
769
|
+
'fundingSubmerchantId'=>'123456',
|
770
|
+
'submerhcantName'=>'submerchant',
|
771
|
+
'fundsTransferId'=>'1234567',
|
772
|
+
'amount'=>'111',
|
773
|
+
'card'=>{
|
774
|
+
'type'=>'VI',
|
775
|
+
'number' =>'4100000000000001',
|
776
|
+
'expDate' =>'1210'
|
777
|
+
}
|
778
|
+
}
|
735
779
|
batch = LitleBatchRequest.new
|
736
780
|
batch.create_new_batch('/usr/local/Batches/')
|
737
781
|
|
@@ -745,6 +789,7 @@ module LitleOnline
|
|
745
789
|
batch.vendor_debit(vendorDebitHash)
|
746
790
|
batch.reserve_debit(reserveDebitHash)
|
747
791
|
batch.physical_check_debit(physicalCheckDebitHash)
|
792
|
+
batch.fast_access_funding(fastAccessFundingHash)
|
748
793
|
|
749
794
|
#pid, size = `ps ax -o pid,rss | grep -E "^[[:space:]]*#{$$}"`.strip.split.map(&:to_i)
|
750
795
|
#puts "PID: " + pid.to_s + " size: " + size.to_s
|
@@ -772,6 +817,9 @@ module LitleOnline
|
|
772
817
|
assert_equal 109, counts[:reserveDebit ][:reserveDebitAmount ]
|
773
818
|
assert_equal 107, counts[:vendorDebit ][:vendorDebitAmount ]
|
774
819
|
assert_equal 110, counts[:physicalCheckDebit ][:physicalCheckDebitAmount ]
|
820
|
+
|
821
|
+
# assert_equal 1, counts[:fastAccessFunding ][:numFastAccessFunding ]
|
822
|
+
# assert_equal 111, counts[:fastAccessFunding ][:fastAccessFundingAmount ]
|
775
823
|
end
|
776
824
|
end
|
777
825
|
end
|
@@ -84,6 +84,7 @@ module LitleOnline
|
|
84
84
|
'number' =>'4100000000000001',
|
85
85
|
'expDate' =>'1210'
|
86
86
|
}}
|
87
|
+
|
87
88
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*<orderId>12344.*<amount>106.*<orderSource>ecommerce.*/m), is_a(Hash))
|
88
89
|
response = LitleOnlineRequest.new.authorization(hash)
|
89
90
|
end
|
@@ -102,8 +103,6 @@ module LitleOnline
|
|
102
103
|
'expDate' =>'1210'
|
103
104
|
}}
|
104
105
|
|
105
|
-
#Communications.expects(:http_post).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
106
|
-
#XMLObject.expects(:new)
|
107
106
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m), is_a(Hash))
|
108
107
|
response = LitleOnlineRequest.new.authorization(hash)
|
109
108
|
end
|
@@ -122,8 +121,6 @@ module LitleOnline
|
|
122
121
|
'expDate' =>'1210'
|
123
122
|
}}
|
124
123
|
|
125
|
-
#Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m),kind_of(Hash))
|
126
|
-
#XMLObject.expects(:new)
|
127
124
|
LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m), is_a(Hash))
|
128
125
|
response = LitleOnlineRequest.new.sale(hash)
|
129
126
|
end
|
@@ -136,8 +133,6 @@ module LitleOnline
|
|
136
133
|
'litleTxnId'=>'123456789012345678'
|
137
134
|
}
|
138
135
|
|
139
|
-
#Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
140
|
-
#XMLObject.expects(:new)
|
141
136
|
LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
|
142
137
|
response = LitleOnlineRequest.new.capture(hash)
|
143
138
|
end
|
@@ -152,8 +147,6 @@ module LitleOnline
|
|
152
147
|
'litleTxnId'=>'123456789012345678'
|
153
148
|
}
|
154
149
|
|
155
|
-
#Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
156
|
-
#XMLObject.expects(:new)
|
157
150
|
LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
|
158
151
|
response = LitleOnlineRequest.new.force_capture(hash)
|
159
152
|
end
|
@@ -168,9 +161,8 @@ module LitleOnline
|
|
168
161
|
'litleTxnId'=>'123456789012345678',
|
169
162
|
}
|
170
163
|
|
171
|
-
#Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
172
|
-
#XMLObject.expects(:new)
|
173
164
|
LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
|
165
|
+
|
174
166
|
response = LitleOnlineRequest.new.echeck_credit(hash)
|
175
167
|
end
|
176
168
|
|
@@ -184,8 +176,6 @@ module LitleOnline
|
|
184
176
|
'litleTxnId'=>'123456789012345678',
|
185
177
|
}
|
186
178
|
|
187
|
-
#Communications.expects(:http_post).with(Not(regexp_matches(/.*amount.*/m)),kind_of(Hash))
|
188
|
-
#XMLObject.expects(:new)
|
189
179
|
LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
|
190
180
|
response = LitleOnlineRequest.new.echeck_sale(hash)
|
191
181
|
end
|
@@ -206,8 +196,6 @@ module LitleOnline
|
|
206
196
|
}
|
207
197
|
}
|
208
198
|
|
209
|
-
#XMLObject.expects(:new)
|
210
|
-
#Communications.expects(:http_post).with(regexp_matches(/.*card.*/m),kind_of(Hash))
|
211
199
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*card.*/m), is_a(Hash))
|
212
200
|
LitleOnlineRequest.new.authorization(start_hash.merge(card_only))
|
213
201
|
end
|
@@ -227,19 +215,11 @@ module LitleOnline
|
|
227
215
|
}
|
228
216
|
}
|
229
217
|
|
230
|
-
#XMLObject.expects(:new)
|
231
|
-
#Communications.expects(:http_post).with(regexp_matches(/.*token.*/m),kind_of(Hash))
|
232
218
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*token.*/m), is_a(Hash))
|
233
219
|
LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
|
234
220
|
end
|
235
221
|
|
236
|
-
|
237
|
-
litle = LitleOnlineRequest.new
|
238
|
-
#Explicit - used for integrations
|
239
|
-
assert_equal 'ActiveMerchant;10.0', litle.send(:get_merchant_sdk, {'merchantSdk'=>'ActiveMerchant;10.0'})
|
240
|
-
#Implicit - used raw when nothing is specified
|
241
|
-
assert_equal 'Ruby;9.14.0', litle.send(:get_merchant_sdk, {'NotMerchantSdk'=>'ActiveMerchant;10.0'})
|
242
|
-
end
|
222
|
+
|
243
223
|
|
244
224
|
def test_sale_paypal_order_complete_typo
|
245
225
|
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
@@ -256,21 +236,16 @@ module LitleOnline
|
|
256
236
|
'expDate' =>'1210'
|
257
237
|
}}
|
258
238
|
|
259
|
-
#Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m),kind_of(Hash))
|
260
|
-
#XMLObject.expects(:new)
|
261
239
|
LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m), is_a(Hash))
|
262
240
|
response = LitleOnlineRequest.new.sale(hash)
|
263
241
|
end
|
264
242
|
|
265
243
|
def test_version_matches_sdk_major_and_minor_version_ignoring_config
|
266
|
-
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'
|
244
|
+
Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
|
267
245
|
hash={
|
268
246
|
'litleTxnId' => '006'
|
269
247
|
}
|
270
|
-
|
271
|
-
#Communications.expects(:http_post).with(regexp_matches(/<litleOnlineRequest.*version="9\.12".*/m),kind_of(Hash))
|
272
|
-
#XMLObject.expects(:new)
|
273
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*version="9\.14".*/m), is_a(Hash))
|
248
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*version="11\.4".*/m), is_a(Hash))
|
274
249
|
response = LitleOnlineRequest.new.void(hash)
|
275
250
|
end
|
276
251
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
=begin
|
2
2
|
Copyright (c) 2017 Vantiv eCommerce
|
3
|
-
|
4
3
|
Permission is hereby granted, free of charge, to any person
|
5
4
|
obtaining a copy of this software and associated documentation
|
6
5
|
files (the "Software"), to deal in the Software without
|
@@ -9,10 +8,8 @@ copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
8
|
copies of the Software, and to permit persons to whom the
|
10
9
|
Software is furnished to do so, subject to the following
|
11
10
|
conditions:
|
12
|
-
|
13
11
|
The above copyright notice and this permission notice shall be
|
14
12
|
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
13
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
14
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
15
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -94,7 +91,9 @@ module LitleOnline
|
|
94
91
|
request = LitleRequest.new({'sessionId'=>'8675309',
|
95
92
|
'user'=>'john',
|
96
93
|
'password'=>'tinkleberry'})
|
94
|
+
|
97
95
|
request.add_rfr_request({'litleSessionId' => '137813712'}, '/usr/srv')
|
96
|
+
|
98
97
|
end
|
99
98
|
|
100
99
|
def test_commit_batch_with_batch
|
@@ -148,7 +147,7 @@ module LitleOnline
|
|
148
147
|
test = ""
|
149
148
|
rescue RuntimeError => e
|
150
149
|
test = e.message
|
151
|
-
assert_equal "You entered neither a path nor a batch.
|
150
|
+
assert_equal "You entered neither a path nor a batch." ,test
|
152
151
|
end
|
153
152
|
|
154
153
|
def test_add_open_batch
|
@@ -238,7 +237,9 @@ module LitleOnline
|
|
238
237
|
args.expects(:[]).with(:transaction_listener)
|
239
238
|
args.expects(:[]).with(:batch_listener).returns(nil)
|
240
239
|
args.expects(:[]).with(:path_to_responses).returns("fake/path/")
|
241
|
-
|
240
|
+
args.expects(:[]).twice.with(:deleteBatchFiles)
|
241
|
+
args.expects(:[]).with("deleteBatchFiles")
|
242
|
+
Dir.expects(:foreach).with("fake/path/")
|
242
243
|
|
243
244
|
request.process_responses(args)
|
244
245
|
end
|
@@ -250,7 +251,7 @@ module LitleOnline
|
|
250
251
|
|
251
252
|
File.expects(:directory?).with("new/path/").returns(false).once.in_sequence(resp_seq)
|
252
253
|
Dir.expects(:mkdir).with("new/path/").once.in_sequence(resp_seq)
|
253
|
-
Net::SFTP.expects(:start).
|
254
|
+
Net::SFTP.expects(:start).with("reddit.com", "periwinkle", :password=>"password")
|
254
255
|
|
255
256
|
request.get_responses_from_server(args)
|
256
257
|
end
|
@@ -30,6 +30,8 @@ require 'mocha/setup'
|
|
30
30
|
module LitleOnline
|
31
31
|
|
32
32
|
class TestLitleTransaction < Test::Unit::TestCase
|
33
|
+
|
34
|
+
|
33
35
|
def test_authorization
|
34
36
|
ltlTxn = LitleTransaction.new
|
35
37
|
authHash = {
|
@@ -281,7 +283,7 @@ module LitleOnline
|
|
281
283
|
'billToAddress'=>{'name'=>'Bob',
|
282
284
|
'city'=>'lowell',
|
283
285
|
'state'=>'MA',
|
284
|
-
'email'=>'
|
286
|
+
'email'=>'litle.com'}
|
285
287
|
}
|
286
288
|
|
287
289
|
result = ltlTxn.echeck_verification(echeckVerificationHash)
|
@@ -298,7 +300,7 @@ module LitleOnline
|
|
298
300
|
assert_equal 'Bob', result.billToAddress.name
|
299
301
|
assert_equal 'lowell', result.billToAddress.city
|
300
302
|
assert_equal 'MA', result.billToAddress.state
|
301
|
-
assert_equal '
|
303
|
+
assert_equal 'litle.com', result.billToAddress.email
|
302
304
|
end
|
303
305
|
|
304
306
|
def test_echeck_credit
|
@@ -352,7 +354,7 @@ module LitleOnline
|
|
352
354
|
'orderId'=>'12345',
|
353
355
|
'orderSource'=>'ecommerce',
|
354
356
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
355
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
357
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
356
358
|
}
|
357
359
|
|
358
360
|
result = ltlTxn.echeck_sale(echeckSaleHash)
|
@@ -370,7 +372,7 @@ module LitleOnline
|
|
370
372
|
assert_equal 'Bob', result.billToAddress.name
|
371
373
|
assert_equal 'lowell', result.billToAddress.city
|
372
374
|
assert_equal 'MA', result.billToAddress.state
|
373
|
-
assert_equal '
|
375
|
+
assert_equal 'litle.com', result.billToAddress.email
|
374
376
|
end
|
375
377
|
|
376
378
|
def test_account_update
|
@@ -392,6 +394,33 @@ module LitleOnline
|
|
392
394
|
assert_equal "4100000000000001", result.card.number
|
393
395
|
assert_equal "VI", result.card.mop
|
394
396
|
assert_equal "1210", result.card.expDate
|
395
|
-
end
|
397
|
+
end
|
398
|
+
|
399
|
+
|
400
|
+
def test_queryTransaction
|
401
|
+
ltlTxn = LitleTransaction.new
|
402
|
+
queryTransactionHash = {
|
403
|
+
'merchantId' => '101',
|
404
|
+
'version'=>'8.8',
|
405
|
+
'reportGroup'=>'Planets',
|
406
|
+
'id'=>'12345',
|
407
|
+
'customerId'=>'0987',
|
408
|
+
'origId'=>'834262',
|
409
|
+
'origActionType'=>'A',
|
410
|
+
'origLitleTxnId'=>'123456',
|
411
|
+
'origOrderId' => '65347567',
|
412
|
+
'origAccountNumber'=>'4000000000000001'
|
413
|
+
}
|
414
|
+
|
415
|
+
result = ltlTxn.query_Transaction(queryTransactionHash)
|
416
|
+
assert_equal 'Planets', result.reportGroup
|
417
|
+
assert_equal '12345', result.transactionId
|
418
|
+
assert_equal '0987', result.customerId
|
419
|
+
assert_equal '834262', result.origId
|
420
|
+
assert_equal 'A', result.origActionType
|
421
|
+
assert_equal '123456', result.origLitleTxnId
|
422
|
+
#assert_equal '65347567', result.origOrderId
|
423
|
+
#assert_equal '4000000000000001', result.origAccountNumber
|
424
|
+
end
|
396
425
|
end
|
397
426
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
=begin
|
2
2
|
Copyright (c) 2017 Vantiv eCommerce
|
3
|
+
|
3
4
|
Permission is hereby granted, free of charge, to any person
|
4
5
|
obtaining a copy of this software and associated documentation
|
5
6
|
files (the "Software"), to deal in the Software without
|
@@ -8,8 +9,10 @@ copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
9
|
copies of the Software, and to permit persons to whom the
|
9
10
|
Software is furnished to do so, subject to the following
|
10
11
|
conditions:
|
12
|
+
|
11
13
|
The above copyright notice and this permission notice shall be
|
12
14
|
included in all copies or substantial portions of the Software.
|
15
|
+
|
13
16
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
14
17
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
15
18
|
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
data/test/unit/test_activate.rb
CHANGED
@@ -38,13 +38,33 @@ module LitleOnline
|
|
38
38
|
'orderSource'=>'ecommerce',
|
39
39
|
'card'=>
|
40
40
|
{
|
41
|
-
'type'=>'
|
41
|
+
'type'=>'GC',
|
42
42
|
'number' =>'4100000000000001',
|
43
43
|
'expDate' =>'1210'
|
44
44
|
}
|
45
45
|
}
|
46
46
|
|
47
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>
|
47
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>GC<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
|
48
|
+
LitleOnlineRequest.new.activate(hash)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_simple_card1
|
52
|
+
hash = {
|
53
|
+
'merchantId' => '101',
|
54
|
+
'version'=>'8.8',
|
55
|
+
'reportGroup'=>'Planets',
|
56
|
+
'orderId' => '11',
|
57
|
+
'amount' => '500',
|
58
|
+
'orderSource'=>'ecommerce',
|
59
|
+
'card'=>
|
60
|
+
{
|
61
|
+
'type'=>'GC',
|
62
|
+
'number' =>'4100000000000001',
|
63
|
+
'expDate' =>'1210'
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<activate reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>GC<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
|
48
68
|
LitleOnlineRequest.new.activate(hash)
|
49
69
|
end
|
50
70
|
|
@@ -33,11 +33,23 @@ module LitleOnline
|
|
33
33
|
'merchantId' => '101',
|
34
34
|
'version'=>'8.8',
|
35
35
|
'reportGroup'=>'Planets',
|
36
|
-
'litleTxnId' => '5000'
|
36
|
+
'litleTxnId' => '5000',
|
37
|
+
'card'=>{
|
38
|
+
'type'=>'GC',
|
39
|
+
'number' =>'400000000000001',
|
40
|
+
'expDate' =>'0150',
|
41
|
+
'pin' => '1234',
|
42
|
+
'cardValidationNum' => '411'
|
43
|
+
},
|
44
|
+
'originalRefCode' => '101',
|
45
|
+
'originalAmount' => '34561',
|
46
|
+
'originalTxnTime' => '2017-01-24T09:00:00',
|
47
|
+
'originalSystemTraceId' => '33',
|
48
|
+
'originalSequenceNumber' => '111111',
|
37
49
|
}
|
38
50
|
|
39
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<
|
40
|
-
LitleOnlineRequest.new.
|
51
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>5000<\/litleTxnId><card><type>GC<\/type><number>400000000000001<\/number><expDate>0150<\/expDate><cardValidationNum>411<\/cardValidationNum><pin>1234<\/pin><\/card>.*/m), is_a(Hash))
|
52
|
+
LitleOnlineRequest.new.deposit_reversal(hash)
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|