LitleOnline 9.3.0 → 9.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1330,18 +1330,18 @@ module LitleOnline
1330
1330
  end
1331
1331
  end
1332
1332
  end
1333
- #
1334
- # class FraudCheckRequest
1335
- # include XML::Mapping
1336
- # root_element_name "fraudCheck"
1337
- # text_node :reportGroup, "@reportGroup", :default_value=>nil
1338
- # text_node :transactionId, "@id", :default_value=>nil
1339
- # text_node :customerId, "@customerId", :default_value=>nil
1340
- # object_node :advancedFraudChecks, "advancedFraudChecks", :default_value=>nil
1341
- # object_node :billToAddress, "billToAddress", :class=>Contact, :default_value=>nil
1342
- # object_node :shipToAddress, "shipToAddress", :class=>Contact, :default_value=>nil
1343
- # text_node :amount, "amount", :default_value=>nil
1344
- # end
1333
+ #
1334
+ # class FraudCheckRequest
1335
+ # include XML::Mapping
1336
+ # root_element_name "fraudCheck"
1337
+ # text_node :reportGroup, "@reportGroup", :default_value=>nil
1338
+ # text_node :transactionId, "@id", :default_value=>nil
1339
+ # text_node :customerId, "@customerId", :default_value=>nil
1340
+ # object_node :advancedFraudChecks, "advancedFraudChecks", :default_value=>nil
1341
+ # object_node :billToAddress, "billToAddress", :class=>Contact, :default_value=>nil
1342
+ # object_node :shipToAddress, "shipToAddress", :class=>Contact, :default_value=>nil
1343
+ # text_node :amount, "amount", :default_value=>nil
1344
+ # end
1345
1345
 
1346
1346
  class Authorization
1347
1347
  include XML::Mapping
@@ -1714,28 +1714,28 @@ module LitleOnline
1714
1714
  object_node :customBilling, "customBilling", :class=>CustomBilling, :default_value=>nil
1715
1715
  object_node :merchantData, "merchantData", :class=>MerchantData, :default_value=>nil
1716
1716
  end
1717
-
1717
+
1718
1718
  class EcheckPreNoteSale
1719
1719
  include XML::Mapping
1720
1720
  root_element_name "echeckPreNoteSale"
1721
1721
  text_node :reportGroup, "@reportGroup", :default_value=>nil
1722
1722
  text_node :transactionId, "@id", :default_value=>nil
1723
1723
  text_node :customerId, "@customerId", :default_value=>nil
1724
-
1724
+
1725
1725
  text_node :orderId, "orderId", :default_value=>nil
1726
1726
  text_node :orderSource, "orderSource", :default_value=>nil
1727
1727
  object_node :billToAddress, "billToAddress", :class=>Contact, :default_value=>nil
1728
1728
  object_node :echeck, "echeck", :class=>Echeck, :default_value=>nil
1729
1729
  object_node :merchantData, "merchantData", :class=>MerchantData, :default_value=>nil
1730
1730
  end
1731
-
1732
- class EcheckPreNoteCredit
1731
+
1732
+ class EcheckPreNoteCredit
1733
1733
  include XML::Mapping
1734
1734
  root_element_name "echeckPreNoteCredit"
1735
1735
  text_node :reportGroup, "@reportGroup", :default_value=>nil
1736
1736
  text_node :transactionId, "@id", :default_value=>nil
1737
1737
  text_node :customerId, "@customerId", :default_value=>nil
1738
-
1738
+
1739
1739
  text_node :orderId, "orderId", :default_value=>nil
1740
1740
  text_node :orderSource, "orderSource", :default_value=>nil
1741
1741
  object_node :billToAddress, "billToAddress", :class=>Contact, :default_value=>nil
@@ -1743,6 +1743,134 @@ module LitleOnline
1743
1743
  object_node :merchantData, "merchantData", :class=>MerchantData, :default_value=>nil
1744
1744
  end
1745
1745
 
1746
+ class SubmerchantCredit
1747
+ include XML::Mapping
1748
+ root_element_name "submerchantCredit"
1749
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1750
+ text_node :transactionId, "@id", :default_value=>nil
1751
+ text_node :customerId, "@customerId", :default_value=>nil
1752
+
1753
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1754
+ text_node :submerchantName, "submerchantName", :default_value=>nil
1755
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1756
+ text_node :amount, "amount", :default_value=>nil
1757
+ object_node :accountInfo, "accountInfo", :class=>Echeck, :default_value=>nil
1758
+ end
1759
+
1760
+ class PayFacCredit
1761
+ include XML::Mapping
1762
+ root_element_name "payFacCredit"
1763
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1764
+ text_node :transactionId, "@id", :default_value=>nil
1765
+ text_node :customerId, "@customerId", :default_value=>nil
1766
+
1767
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1768
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1769
+ text_node :amount, "amount", :default_value=>nil
1770
+ end
1771
+
1772
+ class ReserveCredit
1773
+ include XML::Mapping
1774
+ root_element_name "reserveCredit"
1775
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1776
+ text_node :transactionId, "@id", :default_value=>nil
1777
+ text_node :customerId, "@customerId", :default_value=>nil
1778
+
1779
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1780
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1781
+ text_node :amount, "amount", :default_value=>nil
1782
+ end
1783
+
1784
+ class VendorCredit
1785
+ include XML::Mapping
1786
+ root_element_name "vendorCredit"
1787
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1788
+ text_node :transactionId, "@id", :default_value=>nil
1789
+ text_node :customerId, "@customerId", :default_value=>nil
1790
+
1791
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1792
+ text_node :vendorName, "vendorName", :default_value=>nil
1793
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1794
+ text_node :amount, "amount", :default_value=>nil
1795
+ object_node :accountInfo, "accountInfo", :class=>Echeck, :default_value=>nil
1796
+ end
1797
+
1798
+ class PhysicalCheckCredit
1799
+ include XML::Mapping
1800
+ root_element_name "physicalCheckCredit"
1801
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1802
+ text_node :transactionId, "@id", :default_value=>nil
1803
+ text_node :customerId, "@customerId", :default_value=>nil
1804
+
1805
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1806
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1807
+ text_node :amount, "amount", :default_value=>nil
1808
+ end
1809
+
1810
+ class SubmerchantDebit
1811
+ include XML::Mapping
1812
+ root_element_name "submerchantDebit"
1813
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1814
+ text_node :transactionId, "@id", :default_value=>nil
1815
+ text_node :customerId, "@customerId", :default_value=>nil
1816
+
1817
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1818
+ text_node :submerchantName, "submerchantName", :default_value=>nil
1819
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1820
+ text_node :amount, "amount", :default_value=>nil
1821
+ object_node :accountInfo, "accountInfo", :class=>Echeck, :default_value=>nil
1822
+ end
1823
+
1824
+ class PayFacDebit
1825
+ include XML::Mapping
1826
+ root_element_name "payFacDebit"
1827
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1828
+ text_node :transactionId, "@id", :default_value=>nil
1829
+ text_node :customerId, "@customerId", :default_value=>nil
1830
+
1831
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1832
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1833
+ text_node :amount, "amount", :default_value=>nil
1834
+ end
1835
+
1836
+ class ReserveDebit
1837
+ include XML::Mapping
1838
+ root_element_name "reserveDebit"
1839
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1840
+ text_node :transactionId, "@id", :default_value=>nil
1841
+ text_node :customerId, "@customerId", :default_value=>nil
1842
+
1843
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1844
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1845
+ text_node :amount, "amount", :default_value=>nil
1846
+ end
1847
+
1848
+ class VendorDebit
1849
+ include XML::Mapping
1850
+ root_element_name "vendorDebit"
1851
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1852
+ text_node :transactionId, "@id", :default_value=>nil
1853
+ text_node :customerId, "@customerId", :default_value=>nil
1854
+
1855
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1856
+ text_node :vendorName, "vendorName", :default_value=>nil
1857
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1858
+ text_node :amount, "amount", :default_value=>nil
1859
+ object_node :accountInfo, "accountInfo", :class=>Echeck, :default_value=>nil
1860
+ end
1861
+
1862
+ class PhysicalCheckDebit
1863
+ include XML::Mapping
1864
+ root_element_name "physicalCheckDebit"
1865
+ text_node :reportGroup, "@reportGroup", :default_value=>nil
1866
+ text_node :transactionId, "@id", :default_value=>nil
1867
+ text_node :customerId, "@customerId", :default_value=>nil
1868
+
1869
+ text_node :fundingSubmerchantId, "fundingSubmerchantId", :default_value=>nil
1870
+ text_node :fundsTransferId, "fundsTransferId", :default_value=>nil
1871
+ text_node :amount, "amount", :default_value=>nil
1872
+ end
1873
+
1746
1874
  class UpdateCardValidationNumOnToken
1747
1875
  include XML::Mapping
1748
1876
  root_element_name "updateCardValidationNumOnToken"
@@ -1764,7 +1892,7 @@ module LitleOnline
1764
1892
 
1765
1893
  text_node :orderId, "orderId", :default_value=>nil
1766
1894
  optional_choice_node :if, 'card', :then, (object_node :card, "card", :class=>Card),
1767
- :else, (object_node :token, "token", :class=>CardToken)
1895
+ :elsif, 'token', :then, (object_node :token, "token", :class=>CardToken)
1768
1896
  end
1769
1897
 
1770
1898
  class OnlineRequest
@@ -1842,6 +1970,26 @@ module LitleOnline
1842
1970
  text_node :numEcheckRedeposit, "@numEcheckRedeposit", :default_value=>"0"
1843
1971
  text_node :numEcheckPreNoteSale, "@numEcheckPreNoteSale", :default_value=>"0"
1844
1972
  text_node :numEcheckPreNoteCredit, "@numEcheckPreNoteCredit", :default_value=>"0"
1973
+ text_node :numSubmerchantCredit , "@numSubmerchantCredit", :default_value=>"0"
1974
+ text_node :numPayFacCredit , "@numPayFacCredit", :default_value=>"0"
1975
+ text_node :numReserveCredit , "@numReserveCredit", :default_value=>"0"
1976
+ text_node :numVendorCredit , "@numVendorCredit", :default_value=>"0"
1977
+ text_node :numPhysicalCheckCredit , "@numPhysicalCheckCredit", :default_value=>"0"
1978
+ text_node :submerchantCreditAmount , "@submerchantCreditAmount", :default_value=>"0"
1979
+ text_node :payFacCreditAmount , "@payFacCreditAmount", :default_value=>"0"
1980
+ text_node :reserveCreditAmount , "@reserveCreditAmount", :default_value=>"0"
1981
+ text_node :vendorCreditAmount , "@vendorCreditAmount", :default_value=>"0"
1982
+ text_node :physicalCheckCreditAmount , "@physicalCheckCreditAmount", :default_value=>"0"
1983
+ text_node :numSubmerchantDebit , "@numSubmerchantDebit", :default_value=>"0"
1984
+ text_node :numPayFacDebit , "@numPayFacDebit", :default_value=>"0"
1985
+ text_node :numReserveDebit , "@numReserveDebit", :default_value=>"0"
1986
+ text_node :numVendorDebit , "@numVendorDebit", :default_value=>"0"
1987
+ text_node :numPhysicalCheckDebit , "@numPhysicalCheckDebit", :default_value=>"0"
1988
+ text_node :submerchantDebitAmount , "@submerchantDebitAmount", :default_value=>"0"
1989
+ text_node :payFacDebitAmount , "@payFacDebitAmount", :default_value=>"0"
1990
+ text_node :reserveDebitAmount , "@reserveDebitAmount", :default_value=>"0"
1991
+ text_node :vendorDebitAmount , "@vendorDebitAmount", :default_value=>"0"
1992
+ text_node :physicalCheckDebitAmount , "@physicalCheckDebitAmount", :default_value=>"0"
1845
1993
  text_node :numEcheckCredit, "@numEcheckCredit", :default_value=>"0"
1846
1994
  text_node :echeckCreditAmount, "@echeckCreditAmount", :default_value=>"0"
1847
1995
  text_node :numEcheckVerification, "@numEcheckVerification", :default_value=>"0"
@@ -22,8 +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
-
26
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
25
+ require File.expand_path("../../../lib/LitleOnline",__FILE__)
27
26
  require 'test/unit'
28
27
  require 'fileutils'
29
28
 
@@ -40,7 +39,7 @@ module LitleOnline
40
39
  Dir.mkdir(path)
41
40
  end
42
41
  end
43
-
42
+
44
43
  def test_MEGA_batch
45
44
  authHash = {
46
45
  'reportGroup'=>'Planets',
@@ -48,9 +47,9 @@ module LitleOnline
48
47
  'amount'=>'106',
49
48
  'orderSource'=>'ecommerce',
50
49
  'card'=>{
51
- 'type'=>'VI',
52
- 'number' =>'4100000000000001',
53
- 'expDate' =>'1210'
50
+ 'type'=>'VI',
51
+ 'number' =>'4100000000000001',
52
+ 'expDate' =>'1210'
54
53
  }}
55
54
 
56
55
  saleHash = {
@@ -60,9 +59,9 @@ module LitleOnline
60
59
  'amount'=>'6000',
61
60
  'orderSource'=>'ecommerce',
62
61
  'card'=>{
63
- 'type'=>'VI',
64
- 'number' =>'4100000000000001',
65
- 'expDate' =>'1210'
62
+ 'type'=>'VI',
63
+ 'number' =>'4100000000000001',
64
+ 'expDate' =>'1210'
66
65
  }}
67
66
 
68
67
  creditHash = {
@@ -73,9 +72,9 @@ module LitleOnline
73
72
  'amount'=>'106',
74
73
  'orderSource'=>'ecommerce',
75
74
  'card'=>{
76
- 'type'=>'VI',
77
- 'number' =>'4100000000000001',
78
- 'expDate' =>'1210'
75
+ 'type'=>'VI',
76
+ 'number' =>'4100000000000001',
77
+ 'expDate' =>'1210'
79
78
  }}
80
79
 
81
80
  authReversalHash = {
@@ -105,7 +104,7 @@ module LitleOnline
105
104
  'litleToken'=>'1233456789103801',
106
105
  'cardValidationNum'=>'123'
107
106
  }
108
-
107
+
109
108
  forceCaptHash = {
110
109
  'merchantId' => '101',
111
110
  'version'=>'8.8',
@@ -115,9 +114,9 @@ module LitleOnline
115
114
  'amount'=>'106',
116
115
  'orderSource'=>'ecommerce',
117
116
  'card'=>{
118
- 'type'=>'VI',
119
- 'number' =>'4100000000000001',
120
- 'expDate' =>'1210'
117
+ 'type'=>'VI',
118
+ 'number' =>'4100000000000001',
119
+ 'expDate' =>'1210'
121
120
  }}
122
121
 
123
122
  captHash = {
@@ -135,14 +134,14 @@ module LitleOnline
135
134
  'orderId'=>'12344',
136
135
  'amount'=>'106',
137
136
  'authInformation' => {
138
- 'authDate'=>'2002-10-09','authCode'=>'543216',
139
- 'authAmount'=>'12345'
137
+ 'authDate'=>'2002-10-09','authCode'=>'543216',
138
+ 'authAmount'=>'12345'
140
139
  },
141
140
  'orderSource'=>'ecommerce',
142
141
  'card'=>{
143
- 'type'=>'VI',
144
- 'number' =>'4100000000000000',
145
- 'expDate' =>'1210'
142
+ 'type'=>'VI',
143
+ 'number' =>'4100000000000000',
144
+ 'expDate' =>'1210'
146
145
  }}
147
146
 
148
147
  echeckVerificationHash = {
@@ -189,31 +188,11 @@ module LitleOnline
189
188
  'customerId'=>'0987',
190
189
  'orderId'=>'1234',
191
190
  'card'=>{
192
- 'type'=>'VI',
193
- 'number' =>'4100000000000001',
194
- 'expDate' =>'1210'
191
+ 'type'=>'VI',
192
+ 'number' =>'4100000000000001',
193
+ 'expDate' =>'1210'
195
194
  }}
196
-
197
- echeckPreNoteSaleHash = {
198
- 'merchantId' => '101',
199
- 'version'=>'8.8',
200
- 'reportGroup'=>'Planets',
201
- 'orderId'=>'123456',
202
- 'orderSource'=>'ecommerce',
203
- 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
204
- 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
205
- }
206
-
207
- echeckPreNoteCreditHash = {
208
- 'merchantId' => '101',
209
- 'version'=>'8.8',
210
- 'reportGroup'=>'Planets',
211
- 'orderId'=>'123457',
212
- 'orderSource'=>'ecommerce',
213
- 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
214
- 'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
215
- }
216
-
195
+
217
196
  path = "/tmp/litle-sdk-for-ruby/cert/"
218
197
 
219
198
  request = LitleRequest.new({'sessionId'=>'8675309'})
@@ -221,7 +200,7 @@ module LitleOnline
221
200
  request.create_new_litle_request(path)
222
201
  batch = LitleBatchRequest.new
223
202
  batch.create_new_batch(path)
224
-
203
+
225
204
  batch.account_update(accountUpdateHash)
226
205
  batch.auth_reversal(authReversalHash)
227
206
  batch.authorization(authHash)
@@ -236,9 +215,7 @@ module LitleOnline
236
215
  batch.register_token_request(registerTokenHash)
237
216
  batch.sale(saleHash)
238
217
  batch.update_card_validation_num_on_token(updateCardHash)
239
- batch.echeck_pre_note_sale(echeckPreNoteSaleHash)
240
- batch.echeck_pre_note_credit(echeckPreNoteCreditHash)
241
-
218
+
242
219
  #close the batch, indicating we plan to add no more transactions
243
220
  batch.close_batch()
244
221
  #add the batch to the LitleRequest
@@ -251,18 +228,18 @@ module LitleOnline
251
228
 
252
229
  #grab the expected number of responses from the sFTP server and save them to the given path
253
230
  request.get_responses_from_server()
254
-
231
+
255
232
  count = 0
256
233
  #process the responses from the server with a listener which applies the given block
257
234
  request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
258
- assert_not_nil transaction["litleTxnId"] =~ /\d+/
259
- assert_not_nil transaction["response"] =~ /\d+/
260
- assert_not_nil transaction["message"]
261
- count+=1
262
- end})
263
- assert_equal count, 16
235
+ assert_not_nil transaction["litleTxnId"] =~ /\d+/
236
+ assert_not_nil transaction["response"] =~ /\d+/
237
+ assert_not_nil transaction["message"]
238
+ count+=1
239
+ end})
240
+ assert_equal count, 14
264
241
  end
265
-
242
+
266
243
  def test_mini_batch_borked_counts
267
244
  echeckSaleHash = {
268
245
  'merchantId' => '101',
@@ -275,7 +252,7 @@ module LitleOnline
275
252
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
276
253
  'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
277
254
  }
278
-
255
+
279
256
  path = "/tmp/litle-sdk-for-ruby/cert/"
280
257
 
281
258
  request = LitleRequest.new({'sessionId'=>'8675309'})
@@ -283,11 +260,11 @@ module LitleOnline
283
260
  request.create_new_litle_request(path)
284
261
  batch = LitleBatchRequest.new
285
262
  batch.create_new_batch(path)
286
-
263
+
287
264
  batch.echeck_sale(echeckSaleHash)
288
-
265
+
289
266
  #make this a bad batch
290
- batch.get_counts_and_amounts[:sale][:numSales] += 1
267
+ batch.get_counts_and_amounts[:sale][:numSales] += 1
291
268
  #close the batch, indicating we plan to add no more transactions
292
269
  batch.close_batch()
293
270
  #add the batch to the LitleRequest
@@ -305,10 +282,10 @@ module LitleOnline
305
282
  assert_raise RuntimeError do
306
283
  #process the responses from the server with a listener which applies the given block
307
284
  request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
308
- end})
285
+ end})
309
286
  end
310
287
  end
311
-
288
+
312
289
  def test_mini_batch_borked_amounts
313
290
  echeckSaleHash = {
314
291
  'merchantId' => '101',
@@ -321,7 +298,7 @@ module LitleOnline
321
298
  'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
322
299
  'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
323
300
  }
324
-
301
+
325
302
  path = "/tmp/litle-sdk-for-ruby/cert/"
326
303
 
327
304
  request = LitleRequest.new({'sessionId'=>'8675309'})
@@ -329,11 +306,11 @@ module LitleOnline
329
306
  request.create_new_litle_request(path)
330
307
  batch = LitleBatchRequest.new
331
308
  batch.create_new_batch(path)
332
-
309
+
333
310
  batch.echeck_sale(echeckSaleHash)
334
-
311
+
335
312
  #make this a bad batch
336
- batch.get_counts_and_amounts[:sale][:saleAmount] += 1
313
+ batch.get_counts_and_amounts[:sale][:saleAmount] += 1
337
314
  #close the batch, indicating we plan to add no more transactions
338
315
  batch.close_batch()
339
316
  #add the batch to the LitleRequest
@@ -352,8 +329,245 @@ module LitleOnline
352
329
  assert_raise RuntimeError do
353
330
  #process the responses from the server with a listener which applies the given block
354
331
  request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
355
- end})
332
+ end})
356
333
  end
357
334
  end
335
+
336
+ def test_PFIF_instruction_txn
337
+ submerchantCreditHash = {
338
+ 'reportGroup'=>'Planets',
339
+ 'orderId'=>'12344',
340
+ 'fundingSubmerchantId'=>'123456',
341
+ 'submerchantName'=>'001',
342
+ 'fundsTransferId'=>'00003',
343
+ 'amount'=>'10000',
344
+ 'accountInfo' => {'accType'=>'Checking','accNum'=>'123456789012','routingNum'=>'114567895'}
345
+ }
346
+
347
+ vendorCreditHash = {
348
+ 'reportGroup'=>'Planets',
349
+ 'orderId'=>'12344',
350
+ 'fundingSubmerchantId'=>'123456',
351
+ 'vendorName'=>'001',
352
+ 'fundsTransferId'=>'00007',
353
+ 'amount'=>'7000',
354
+ 'accountInfo' => {'accType'=>'Checking','accNum'=>'123456789012','routingNum'=>'114567895'}
355
+ }
356
+
357
+ payFacCreditHash = {
358
+ 'reportGroup'=>'Planets',
359
+ 'orderId'=>'12344',
360
+ 'fundingSubmerchantId'=>'123456',
361
+ 'fundsTransferId'=>'00001',
362
+ 'amount'=>'1000',
363
+ }
364
+
365
+ reserveCreditHash = {
366
+ 'reportGroup'=>'Planets',
367
+ 'orderId'=>'12344',
368
+ 'fundingSubmerchantId'=>'123456',
369
+ 'fundsTransferId'=>'00005',
370
+ 'amount'=>'50000',
371
+ }
372
+
373
+ physicalCheckCreditHash = {
374
+ 'reportGroup'=>'Planets',
375
+ 'orderId'=>'12344',
376
+ 'fundingSubmerchantId'=>'123456',
377
+ 'fundsTransferId'=>'00009',
378
+ 'amount'=>'9000',
379
+ }
380
+
381
+ submerchantDebitHash = {
382
+ 'reportGroup'=>'Planets',
383
+ 'orderId'=>'12344',
384
+ 'fundingSubmerchantId'=>'123456',
385
+ 'submerchantName'=>'001',
386
+ 'fundsTransferId'=>'00003',
387
+ 'amount'=>'10000',
388
+ 'accountInfo' => {'accType'=>'Checking','accNum'=>'123456789012','routingNum'=>'114567895'}
389
+ }
390
+
391
+ vendorDebitHash = {
392
+ 'reportGroup'=>'Planets',
393
+ 'orderId'=>'12344',
394
+ 'fundingSubmerchantId'=>'123456',
395
+ 'vendorName'=>'001',
396
+ 'fundsTransferId'=>'00007',
397
+ 'amount'=>'7000',
398
+ 'accountInfo' => {'accType'=>'Checking','accNum'=>'123456789012','routingNum'=>'114567895'}
399
+ }
400
+
401
+ payFacDebitHash = {
402
+ 'reportGroup'=>'Planets',
403
+ 'orderId'=>'12344',
404
+ 'fundingSubmerchantId'=>'123456',
405
+ 'fundsTransferId'=>'00001',
406
+ 'amount'=>'1000',
407
+ }
408
+
409
+ reserveDebitHash = {
410
+ 'reportGroup'=>'Planets',
411
+ 'orderId'=>'12344',
412
+ 'fundingSubmerchantId'=>'123456',
413
+ 'fundsTransferId'=>'00005',
414
+ 'amount'=>'50000',
415
+ }
416
+
417
+ physicalCheckDebitHash = {
418
+ 'reportGroup'=>'Planets',
419
+ 'orderId'=>'12344',
420
+ 'fundingSubmerchantId'=>'123456',
421
+ 'fundsTransferId'=>'00009',
422
+ 'amount'=>'9000',
423
+ }
424
+
425
+ path = "/tmp/litle-sdk-for-ruby/cert/"
426
+
427
+ request = LitleRequest.new({'sessionId'=>'8675309'})
428
+ request.create_new_litle_request(path)
429
+ batch = LitleBatchRequest.new
430
+ batch.create_new_batch(path)
431
+
432
+ batch.submerchant_credit(submerchantCreditHash)
433
+ batch.payFac_credit(payFacCreditHash)
434
+ batch.vendor_credit(vendorCreditHash)
435
+ batch.reserve_credit(reserveCreditHash)
436
+ batch.physical_check_credit(physicalCheckCreditHash)
437
+ batch.submerchant_debit(submerchantDebitHash)
438
+ batch.payFac_debit(payFacDebitHash)
439
+ batch.vendor_debit(vendorDebitHash)
440
+ batch.reserve_debit(reserveDebitHash)
441
+ batch.physical_check_debit(physicalCheckDebitHash)
442
+
443
+ #close the batch, indicating we plan to add no more transactions
444
+ batch.close_batch()
445
+ #add the batch to the LitleRequest
446
+ request.commit_batch(batch)
447
+ #finish the Litle Request, indicating we plan to add no more batches
448
+ request.finish_request
449
+
450
+ #send the batch files at the given directory over sFTP
451
+ request.send_to_litle
452
+
453
+ #grab the expected number of responses from the sFTP server and save them to the given path
454
+ request.get_responses_from_server()
455
+
456
+ count = 0
457
+ #process the responses from the server with a listener which applies the given block
458
+ request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
459
+ assert_not_nil transaction["litleTxnId"] =~ /\d+/
460
+ assert_not_nil transaction["response"] =~ /\d+/
461
+ assert_not_nil transaction["message"]
462
+ count+=1
463
+ end})
464
+ assert_equal count, 10
465
+ end
466
+
467
+ def test_echeck_pre_note_all
468
+
469
+ billToAddress = {'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
470
+ echeckSuccess = {'accType'=>'Corporate','accNum'=>'1092969901','routingNum'=>'011075150'}
471
+ echeckRoutErr = {'accType'=>'Checking','accNum'=>'6099999992','routingNum'=>'053133052'}
472
+ echeckAccErr = {'accType'=>'Corporate','accNum'=>'10@2969901','routingNum'=>'011100012'}
473
+
474
+ echeckPreNoteSaleHashSuccess = {
475
+ 'merchantId' => '0180',
476
+ 'version'=>'9.3',
477
+ 'reportGroup'=>'Planets',
478
+ 'orderId'=>'000',
479
+ 'orderSource'=>'ecommerce',
480
+ 'billToAddress'=> billToAddress,
481
+ 'echeck' => echeckSuccess
482
+ }
483
+
484
+ echeckPreNoteSaleHashErrRout = {
485
+ 'merchantId' => '0180',
486
+ 'version'=>'9.3',
487
+ 'reportGroup'=>'Planets',
488
+ 'orderId'=>'900',
489
+ 'orderSource'=>'ecommerce',
490
+ 'billToAddress'=> billToAddress,
491
+ 'echeck' => echeckRoutErr
492
+ }
493
+
494
+ echeckPreNoteSaleHashErrAcc = {
495
+ 'merchantId' => '0180',
496
+ 'version'=>'9.3',
497
+ 'reportGroup'=>'Planets',
498
+ 'orderId'=>'301',
499
+ 'orderSource'=>'ecommerce',
500
+ 'billToAddress'=> billToAddress,
501
+ 'echeck' => echeckAccErr
502
+ }
503
+
504
+ echeckPreNoteCreditHashSuccess = {
505
+ 'merchantId' => '0180',
506
+ 'version'=>'9.3',
507
+ 'reportGroup'=>'Planets',
508
+ 'orderId'=>'000',
509
+ 'orderSource'=>'ecommerce',
510
+ 'billToAddress'=> billToAddress,
511
+ 'echeck' => echeckSuccess
512
+ }
513
+
514
+ echeckPreNoteCreditHashErrRout = {
515
+ 'merchantId' => '0180',
516
+ 'version'=>'9.3',
517
+ 'reportGroup'=>'Planets',
518
+ 'orderId'=>'900',
519
+ 'orderSource'=>'ecommerce',
520
+ 'billToAddress'=> billToAddress,
521
+ 'echeck' => echeckRoutErr
522
+ }
523
+
524
+ echeckPreNoteCreditHashErrAcc = {
525
+ 'merchantId' => '101',
526
+ 'version'=>'9.3',
527
+ 'reportGroup'=>'Planets',
528
+ 'orderId'=>'301',
529
+ 'orderSource'=>'ecommerce',
530
+ 'billToAddress'=> billToAddress,
531
+ 'echeck' => echeckAccErr
532
+ }
533
+
534
+ path = "/tmp/litle-sdk-for-ruby/cert/"
535
+
536
+ request = LitleRequest.new({'sessionId'=>'8675309'})
537
+
538
+ request.create_new_litle_request(path)
539
+ batch = LitleBatchRequest.new
540
+ batch.create_new_batch(path)
541
+
542
+ batch.echeck_pre_note_sale(echeckPreNoteSaleHashSuccess)
543
+ batch.echeck_pre_note_sale(echeckPreNoteSaleHashErrRout)
544
+ batch.echeck_pre_note_sale(echeckPreNoteSaleHashErrAcc)
545
+ batch.echeck_pre_note_credit(echeckPreNoteSaleHashSuccess)
546
+ batch.echeck_pre_note_credit(echeckPreNoteSaleHashErrRout)
547
+ batch.echeck_pre_note_credit(echeckPreNoteSaleHashErrAcc)
548
+
549
+ #close the batch, indicating we plan to add no more transactions
550
+ batch.close_batch()
551
+ #add the batch to the LitleRequest
552
+ request.commit_batch(batch)
553
+ #finish the Litle Request, indicating we plan to add no more batches
554
+ request.finish_request
555
+
556
+ #send the batch files at the given directory over sFTP
557
+ request.send_to_litle
558
+
559
+ request.get_responses_from_server()
560
+
561
+ count = 0
562
+ #process the responses from the server with a listener which applies the given block
563
+ request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction|
564
+ assert_not_nil transaction["litleTxnId"] =~ /\d+/
565
+ assert_not_nil transaction["message"]
566
+ assert_equal(transaction["orderId"],transaction["response"])
567
+ count+=1
568
+ end})
569
+ assert_equal count, 6
570
+ end
571
+
358
572
  end
359
573
  end