CnpOnline 9.14.0 → 11.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +7 -7
  2. data/CHANGELOG +23 -17
  3. data/CONTRIBUTORS +0 -0
  4. data/DESCRIPTION +1 -1
  5. data/LICENSE +1 -1
  6. data/README.md +5 -3
  7. data/Rakefile +5 -5
  8. data/Rakefile~ +5 -5
  9. data/SETUP.md +3 -3
  10. data/bin/Setup.rb +59 -41
  11. data/lib/Communications.rb +3 -3
  12. data/lib/Configuration.rb +52 -45
  13. data/lib/EnvironmentVariables.rb +5 -1
  14. data/lib/LitleBatchRequest.rb +72 -7
  15. data/lib/LitleListeners.rb +17 -1
  16. data/lib/LitleOnline.rb +3 -4
  17. data/lib/LitleOnlineRequest.rb +37 -7
  18. data/lib/LitleRequest.rb +315 -186
  19. data/lib/LitleTransaction.rb +212 -85
  20. data/lib/LitleXmlMapper.rb +4 -2
  21. data/lib/XMLFields.rb +384 -171
  22. data/lib/cacert.pem +0 -0
  23. data/samples/Auth/LitleAuthReversalTransaction.rb +2 -2
  24. data/samples/Auth/LitleAuthorizationTransaction.rb +1 -0
  25. data/samples/Auth/LitlePaymentFullLifeCycle.rb +12 -6
  26. data/samples/Batch/AccountUpdate.rb +1 -0
  27. data/samples/Batch/SampleBatchDriver.rb +2 -1
  28. data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +2 -1
  29. data/samples/Capture/LitleCaptureTransaction.rb +2 -2
  30. data/samples/Capture/LitleForceCaptureTransaction.rb +2 -1
  31. data/samples/Capture/LitlePartialCapture.rb +3 -3
  32. data/samples/Credit/LitleCreditTransaction.rb +2 -2
  33. data/samples/Credit/LitleRefundTransaction.rb +2 -1
  34. data/samples/Other/LitleAvsTransaction.rb +2 -1
  35. data/samples/Other/LitleVoidTransaction.rb +2 -1
  36. data/samples/Paypage/FullPaypageLifeCycle.rb +7 -2
  37. data/samples/Run_all.rb +0 -0
  38. data/samples/Sale/LitleSaleTransaction.rb +2 -1
  39. data/samples/Sale/SampleSaleTransaction.rb +2 -1
  40. data/test/certification/certTest1_base.rb +52 -53
  41. data/test/certification/certTest2_authenhanced.rb +24 -25
  42. data/test/certification/certTest3_authreversal.rb +23 -26
  43. data/test/certification/certTest4_echeck.rb +18 -32
  44. data/test/certification/certTest5_token.rb +105 -106
  45. data/test/certification/certTest_batchAll.rb +47 -15
  46. data/test/functional/test_activate.rb +32 -4
  47. data/test/functional/test_activateReversal.rb +18 -5
  48. data/test/functional/test_auth.rb +94 -48
  49. data/test/functional/test_authReversal.rb +4 -1
  50. data/test/functional/test_balanceInquiry.rb +28 -3
  51. data/test/functional/test_batchStream.rb +2 -4
  52. data/test/functional/test_cancelSubscription.rb +2 -2
  53. data/test/functional/test_capture.rb +21 -14
  54. data/test/functional/test_captureGivenAuth.rb +15 -6
  55. data/test/functional/test_createPlan.rb +1 -1
  56. data/test/functional/test_credit.rb +14 -5
  57. data/test/functional/test_deactivate.rb +26 -3
  58. data/test/functional/test_deactivateReversal.rb +18 -5
  59. data/test/functional/test_depositReversal.rb +31 -19
  60. data/test/functional/test_echeckCredit.rb +34 -6
  61. data/test/functional/test_echeckRedeposit.rb +29 -2
  62. data/test/functional/test_echeckSale.rb +68 -11
  63. data/test/functional/test_echeckVerification.rb +32 -7
  64. data/test/functional/test_echeckVoid.rb +2 -1
  65. data/test/functional/test_forceCapture.rb +20 -6
  66. data/test/functional/test_fraudCheck.rb +3 -5
  67. data/test/functional/test_giftCardAuthReversal.rb +72 -0
  68. data/test/functional/test_giftCardCapture.rb +72 -0
  69. data/test/functional/test_giftCardCredit.rb +69 -0
  70. data/test/functional/test_litle_requests.rb +3 -6
  71. data/test/functional/test_load.rb +27 -3
  72. data/test/functional/test_loadReversal.rb +18 -5
  73. data/test/functional/test_override.rb +7 -3
  74. data/test/functional/test_pgp_litle_requests.rb +294 -0
  75. data/test/functional/test_queryTransaction.rb +152 -0
  76. data/test/functional/test_refundReversal.rb +18 -5
  77. data/test/functional/test_sale.rb +122 -159
  78. data/test/functional/test_token.rb +17 -11
  79. data/test/functional/test_unload.rb +27 -3
  80. data/test/functional/test_unloadReversal.rb +18 -5
  81. data/test/functional/test_updateCardValidationNumOnToken.rb +1 -0
  82. data/test/functional/test_updatePlan.rb +2 -1
  83. data/test/functional/test_updateSubscription.rb +3 -1
  84. data/test/functional/test_wallet.rb +74 -0
  85. data/test/functional/test_xmlfields.rb +22 -3
  86. data/test/functional/ts_all.rb +2 -0
  87. data/test/unit/test_LitleBatchRequest.rb +53 -5
  88. data/test/unit/test_LitleOnlineRequest.rb +5 -30
  89. data/test/unit/test_LitleRequest.rb +7 -6
  90. data/test/unit/test_LitleTransaction.rb +34 -5
  91. data/test/unit/test_LitleXmlMapper.rb +3 -0
  92. data/test/unit/test_activate.rb +22 -2
  93. data/test/unit/test_activateReversal.rb +15 -3
  94. data/test/unit/test_auth.rb +11 -9
  95. data/test/unit/test_balanceInquiry.rb +2 -2
  96. data/test/unit/test_capture.rb +2 -2
  97. data/test/unit/test_captureGivenAuth.rb +21 -1
  98. data/test/unit/test_credit.rb +1 -1
  99. data/test/unit/test_deactivate.rb +19 -0
  100. data/test/unit/test_deactivateReversal.rb +15 -3
  101. data/test/unit/test_depositReversal.rb +17 -5
  102. data/test/unit/test_echeckCredit.rb +19 -0
  103. data/test/unit/test_echeckRedeposit.rb +15 -0
  104. data/test/unit/test_echeckSale.rb +20 -1
  105. data/test/unit/test_echeckVerification.rb +6 -3
  106. data/test/unit/test_forceCapture.rb +1 -1
  107. data/test/unit/test_giftCardAuthReversal.rb +58 -0
  108. data/test/{functional/test_utf8.rb → unit/test_giftCardCapture.rb} +25 -12
  109. data/test/unit/test_giftCardCredit.rb +57 -0
  110. data/test/unit/test_load.rb +2 -2
  111. data/test/unit/test_loadReversal.rb +15 -3
  112. data/test/unit/test_pgp_LitleRequest +139 -0
  113. data/test/unit/test_queryTransaction.rb +105 -0
  114. data/test/unit/test_refundReversal.rb +15 -3
  115. data/test/unit/test_sale.rb +23 -3
  116. data/test/unit/test_token.rb +24 -20
  117. data/test/unit/test_unload.rb +2 -2
  118. data/test/unit/test_unloadReversal.rb +15 -3
  119. data/test/unit/test_wallet.rb +262 -0
  120. data/test/unit/ts_unit.rb +2 -1
  121. metadata +81 -100
@@ -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'=>'vantiv.com'}
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'=>'vantiv.com'}
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'=>'vantiv.com'}
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(12)
641
- File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'wb').at_most(10)
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
- def test_set_merchant_sdk
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'=>'9.14'})
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. Game over :(" ,test
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
- Dir.expects(:foreach).with("fake/path/")
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).twice.with("reddit.com", "periwinkle", :password=>"password")
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'=>'vantiv.com'}
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 'vantiv.com', result.billToAddress.email
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'=>'vantiv.com'}
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 'vantiv.com', result.billToAddress.email
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
@@ -38,13 +38,33 @@ module LitleOnline
38
38
  'orderSource'=>'ecommerce',
39
39
  'card'=>
40
40
  {
41
- 'type'=>'VI',
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>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/activate>.*/m), is_a(Hash))
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(/.*<activateReversal reportGroup="Planets"><litleTxnId>5000<\/litleTxnId><\/activateReversal>.*/m), is_a(Hash))
40
- LitleOnlineRequest.new.activate_reversal(hash)
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