CnpOnline 11.4.0 → 12.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG +4 -164
  3. data/CHANGELOG~ +0 -0
  4. data/CONTRIBUTORS +0 -2
  5. data/DESCRIPTION +1 -1
  6. data/LICENSE +0 -0
  7. data/README.md +13 -15
  8. data/Rakefile +3 -2
  9. data/Rakefile~ +4 -3
  10. data/SETUP.md +13 -10
  11. data/bin/Setup.rb +26 -22
  12. data/bin/sample_batch_driver.rb +15 -15
  13. data/bin/sample_driver.rb +5 -5
  14. data/lib/{LitleBatchRequest.rb → CnpBatchRequest.rb} +68 -66
  15. data/lib/{LitleListeners.rb → CnpListeners.rb} +48 -40
  16. data/lib/{LitleOnline.rb → CnpOnline.rb} +8 -7
  17. data/lib/{LitleOnlineRequest.rb → CnpOnlineRequest.rb} +53 -53
  18. data/lib/{LitleRequest.rb → CnpRequest.rb} +186 -192
  19. data/lib/{LitleTransaction.rb → CnpTransaction.rb} +53 -52
  20. data/lib/{LitleXmlMapper.rb → CnpXmlMapper.rb} +7 -7
  21. data/lib/Communications.rb +8 -7
  22. data/lib/Configuration.rb +7 -6
  23. data/lib/EnvironmentVariables.rb +2 -2
  24. data/lib/XMLFields.rb +98 -108
  25. data/lib/cacert.pem +0 -0
  26. data/samples/Auth/CnpAuthReversalTransaction.rb +15 -0
  27. data/samples/Auth/{LitleAuthorizationTransaction.rb → CnpAuthorizationTransaction.rb} +4 -4
  28. data/samples/Auth/{LitlePaymentFullLifeCycle.rb → CnpPaymentFullLifeCycle.rb} +11 -11
  29. data/samples/Batch/AccountUpdate.rb +11 -11
  30. data/samples/Batch/SampleBatchDriver.rb +16 -16
  31. data/samples/Capture/{LitleCaptureGivenAuthTransaction.rb → CnpCaptureGivenAuthTransaction.rb} +4 -4
  32. data/samples/Capture/CnpCaptureTransaction.rb +14 -0
  33. data/samples/Capture/{LitleForceCaptureTransaction.rb → CnpForceCaptureTransaction.rb} +5 -5
  34. data/samples/Capture/CnpPartialCapture.rb +16 -0
  35. data/samples/Credit/CnpCreditTransaction.rb +16 -0
  36. data/samples/Credit/{LitleRefundTransaction.rb → CnpRefundTransaction.rb} +4 -4
  37. data/samples/Other/{LitleAvsTransaction.rb → CnpAvsTransaction.rb} +4 -4
  38. data/samples/Other/CnpVoidTransaction.rb +19 -0
  39. data/samples/Paypage/FullPaypageLifeCycle.rb +16 -16
  40. data/samples/Run_all.rb +12 -12
  41. data/samples/Sale/{LitleSaleTransaction.rb → CnpSaleTransaction.rb} +4 -4
  42. data/samples/Sale/SampleSaleTransaction.rb +5 -5
  43. data/test/certification/certTest1_base.rb +104 -103
  44. data/test/certification/certTest2_authenhanced.rb +90 -88
  45. data/test/certification/certTest3_authreversal.rb +29 -28
  46. data/test/certification/certTest4_echeck.rb +22 -20
  47. data/test/certification/certTest5_token.rb +51 -49
  48. data/test/certification/certTest_batchAll.rb +60 -60
  49. data/test/certification/ts_all.rb +1 -1
  50. data/test/functional/test_activate.rb +9 -8
  51. data/test/functional/test_activateReversal.rb +5 -5
  52. data/test/functional/test_auth.rb +31 -30
  53. data/test/functional/test_authReversal.rb +8 -8
  54. data/test/functional/test_balanceInquiry.rb +6 -6
  55. data/test/functional/test_batch.rb +32 -32
  56. data/test/functional/test_batchStream.rb +14 -14
  57. data/test/functional/test_cancelSubscription.rb +4 -4
  58. data/test/functional/test_capture.rb +14 -14
  59. data/test/functional/test_captureGivenAuth.rb +16 -16
  60. data/test/functional/test_configuration.rb +26 -26
  61. data/test/functional/test_createPlan.rb +5 -5
  62. data/test/functional/test_credit.rb +13 -33
  63. data/test/functional/test_deactivate.rb +6 -6
  64. data/test/functional/test_deactivateReversal.rb +5 -5
  65. data/test/functional/test_depositReversal.rb +5 -5
  66. data/test/functional/test_echeckCredit.rb +20 -20
  67. data/test/functional/test_echeckRedeposit.rb +16 -16
  68. data/test/functional/test_echeckSale.rb +35 -35
  69. data/test/functional/test_echeckVerification.rb +17 -17
  70. data/test/functional/test_echeckVoid.rb +4 -4
  71. data/test/functional/test_forceCapture.rb +21 -21
  72. data/test/functional/test_fraudCheck.rb +6 -5
  73. data/test/functional/test_giftCardAuthReversal.rb +5 -5
  74. data/test/functional/test_giftCardCapture.rb +5 -5
  75. data/test/functional/test_giftCardCredit.rb +5 -5
  76. data/test/functional/test_litle_requests.rb +101 -99
  77. data/test/functional/test_load.rb +6 -6
  78. data/test/functional/test_loadReversal.rb +5 -5
  79. data/test/functional/test_override.rb +9 -9
  80. data/test/functional/{test_pgp_litle_requests.rb → test_pgp_cnp_requests.rb} +61 -60
  81. data/test/functional/test_queryTransaction.rb +10 -10
  82. data/test/functional/test_refundReversal.rb +5 -5
  83. data/test/functional/test_sale.rb +36 -36
  84. data/test/functional/test_token.rb +10 -10
  85. data/test/functional/test_unload.rb +6 -6
  86. data/test/functional/test_unloadReversal.rb +5 -5
  87. data/test/functional/test_updateCardValidationNumOnToken.rb +4 -4
  88. data/test/functional/test_updatePlan.rb +4 -4
  89. data/test/functional/test_updateSubscription.rb +5 -5
  90. data/test/functional/test_wallet.rb +5 -5
  91. data/test/functional/test_xmlfields.rb +29 -69
  92. data/test/functional/ts_all.rb +2 -2
  93. data/test/unit/test_LitleAUBatch.rb +15 -15
  94. data/test/unit/test_LitleBatchRequest.rb +42 -76
  95. data/test/unit/test_LitleOnlineRequest.rb +38 -38
  96. data/test/unit/test_LitleRequest.rb +47 -47
  97. data/test/unit/test_LitleTransaction.rb +34 -34
  98. data/test/unit/test_LitleXmlMapper.rb +27 -27
  99. data/test/unit/test_activate.rb +8 -8
  100. data/test/unit/test_activateReversal.rb +5 -5
  101. data/test/unit/test_auth.rb +43 -43
  102. data/test/unit/test_authReversal.rb +14 -14
  103. data/test/unit/test_balanceInquiry.rb +4 -4
  104. data/test/unit/test_cancelSubscription.rb +4 -4
  105. data/test/unit/test_capture.rb +20 -20
  106. data/test/unit/test_captureGivenAuth.rb +22 -22
  107. data/test/unit/test_createPlan.rb +4 -4
  108. data/test/unit/test_credit.rb +43 -43
  109. data/test/unit/test_deactivate.rb +6 -6
  110. data/test/unit/test_deactivateReversal.rb +5 -5
  111. data/test/unit/test_depositReversal.rb +5 -5
  112. data/test/unit/test_echeckCredit.rb +16 -16
  113. data/test/unit/test_echeckRedeposit.rb +19 -19
  114. data/test/unit/test_echeckSale.rb +16 -16
  115. data/test/unit/test_echeckVerification.rb +11 -11
  116. data/test/unit/test_echeckVoid.rb +8 -8
  117. data/test/unit/test_forceCapture.rb +19 -19
  118. data/test/unit/test_fraudCheck.rb +4 -4
  119. data/test/unit/test_giftCardAuthReversal.rb +5 -5
  120. data/test/unit/test_giftCardCapture.rb +5 -5
  121. data/test/unit/test_giftCardCredit.rb +5 -5
  122. data/test/unit/test_load.rb +4 -4
  123. data/test/unit/test_loadReversal.rb +5 -5
  124. data/test/unit/{test_pgp_LitleRequest → test_pgp_CnpRequest.rb} +32 -32
  125. data/test/unit/test_queryTransaction.rb +8 -8
  126. data/test/unit/test_refundReversal.rb +5 -5
  127. data/test/unit/test_sale.rb +64 -64
  128. data/test/unit/test_token.rb +13 -13
  129. data/test/unit/test_unload.rb +4 -4
  130. data/test/unit/test_unloadReversal.rb +5 -5
  131. data/test/unit/test_updateCardValidationNumOnToken.rb +16 -16
  132. data/test/unit/test_updatePlan.rb +4 -4
  133. data/test/unit/test_updateSubscription.rb +11 -11
  134. data/test/unit/test_wallet.rb +13 -13
  135. data/test/unit/test_xmlfields.rb +119 -119
  136. data/test/unit/ts_unit.rb +6 -6
  137. metadata +35 -26
  138. data/samples/Auth/LitleAuthReversalTransaction.rb +0 -15
  139. data/samples/Capture/LitleCaptureTransaction.rb +0 -14
  140. data/samples/Capture/LitlePartialCapture.rb +0 -16
  141. data/samples/Credit/LitleCreditTransaction.rb +0 -16
  142. data/samples/Other/LitleVoidTransaction.rb +0 -19
@@ -22,20 +22,20 @@ 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/LitleOnline",__FILE__)
25
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
26
26
  require 'test/unit'
27
27
  require 'mocha/setup'
28
28
 
29
- module LitleOnline
29
+ module CnpOnline
30
30
 
31
- class TestLitleAUBatch < Test::Unit::TestCase
31
+ class TestCnpAUBatch < Test::Unit::TestCase
32
32
  def test_create_new_batch
33
33
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
34
34
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').twice
35
35
  Dir.expects(:mkdir).with('/usr/local/Batches/').once
36
36
  File.expects(:directory?).returns(false).once
37
37
 
38
- batch = LitleAUBatch.new
38
+ batch = CnpAUBatch.new
39
39
  batch.create_new_batch('/usr/local/Batches/')
40
40
  end
41
41
 
@@ -56,7 +56,7 @@ module LitleOnline
56
56
  'expDate' =>'1210'
57
57
  }}
58
58
 
59
- batch = LitleAUBatch.new
59
+ batch = CnpAUBatch.new
60
60
  batch.create_new_batch('D:\Batches\\')
61
61
  batch.account_update(accountUpdateHash)
62
62
 
@@ -74,7 +74,7 @@ module LitleOnline
74
74
  File.expects(:delete).once
75
75
  File.expects(:directory?).returns(true).once
76
76
 
77
- batch = LitleAUBatch.new
77
+ batch = CnpAUBatch.new
78
78
  batch.create_new_batch('D:\Batches\\')
79
79
 
80
80
  batch.close_batch()
@@ -97,8 +97,8 @@ module LitleOnline
97
97
  File.expects(:rename).once.in_sequence(open)
98
98
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.closed.*/), 'w').once.in_sequence(open)
99
99
  File.expects(:delete).with(regexp_matches(/.*batch_.*\d_txns.*/)).once.in_sequence(open)
100
- batch1 = LitleAUBatch.new
101
- batch2 = LitleAUBatch.new
100
+ batch1 = CnpAUBatch.new
101
+ batch2 = CnpAUBatch.new
102
102
  batch1.create_new_batch('/usr/local/Batches/')
103
103
 
104
104
  batch2.open_existing_batch(batch1.get_batch_name)
@@ -114,7 +114,7 @@ module LitleOnline
114
114
  File.expects(:delete).once
115
115
  File.expects(:directory?).returns(true).once
116
116
 
117
- batch = LitleAUBatch.new
117
+ batch = CnpAUBatch.new
118
118
  batch.get_counts_and_amounts.expects(:[]).returns(hash = Hash.new).at_least(5)
119
119
 
120
120
  batch.create_new_batch('/usr/local/batches')
@@ -126,7 +126,7 @@ module LitleOnline
126
126
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').once
127
127
  File.expects(:open).with(regexp_matches(/.*batch_.*\d_txns.*/), 'a+').once
128
128
 
129
- batch = LitleAUBatch.new
129
+ batch = CnpAUBatch.new
130
130
  batch.create_new_batch('/usr/local')
131
131
 
132
132
  assert batch.get_batch_name.include?('/usr/local/')
@@ -144,14 +144,14 @@ module LitleOnline
144
144
  File.expects(:open).with(regexp_matches(/.*batch_.*\d_txns.*/), 'a+').in_sequence(fileExists)
145
145
 
146
146
 
147
- batch = LitleAUBatch.new
147
+ batch = CnpAUBatch.new
148
148
  batch.create_new_batch('/usr/local/')
149
149
  end
150
150
 
151
151
  def test_create_new_batch_when_full
152
152
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
153
153
 
154
- batch = LitleAUBatch.new
154
+ batch = CnpAUBatch.new
155
155
  addTxn = sequence('addTxn')
156
156
 
157
157
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').in_sequence(addTxn)
@@ -190,7 +190,7 @@ module LitleOnline
190
190
  Dir.expects(:mkdir).with('/usr/local/Batches/').once
191
191
  File.expects(:directory?).returns(false).once
192
192
 
193
- batch = LitleAUBatch.new
193
+ batch = CnpAUBatch.new
194
194
  batch.create_new_batch('/usr/local/Batches/')
195
195
 
196
196
  accountUpdateHash = {
@@ -223,14 +223,14 @@ module LitleOnline
223
223
  Dir.expects(:mkdir).with('/usr/local/Batches/').once
224
224
  File.expects(:directory?).returns(false).once
225
225
 
226
- batch = LitleAUBatch.new
226
+ batch = CnpAUBatch.new
227
227
  batch.create_new_batch('/usr/local/Batches/')
228
228
 
229
229
  accountUpdateHash = {
230
230
  'reportGroup'=>'Planets',
231
231
  'id'=>'12345',
232
232
  'customerId'=>'0987',
233
- 'token'=>{'litleToken'=>'1234567890123'
233
+ 'token'=>{'cnpToken'=>'1234567890123'
234
234
  }}
235
235
 
236
236
  5.times(){ batch.account_update(accountUpdateHash ) }
@@ -22,19 +22,19 @@ 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/LitleOnline",__FILE__)
25
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
26
26
  require 'test/unit'
27
27
  require 'mocha/setup'
28
28
 
29
- module LitleOnline
30
- class TestLitleBatchRequest < Test::Unit::TestCase
29
+ module CnpOnline
30
+ class TestCnpBatchRequest < Test::Unit::TestCase
31
31
  def test_create_new_batch
32
32
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
33
33
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').twice
34
34
  Dir.expects(:mkdir).with('/usr/local/Batches/').once
35
35
  File.expects(:directory?).returns(false).once
36
36
 
37
- batch = LitleBatchRequest.new
37
+ batch = CnpBatchRequest.new
38
38
  batch.create_new_batch('/usr/local/Batches/')
39
39
  end
40
40
 
@@ -56,7 +56,7 @@ module LitleOnline
56
56
  'expDate' =>'1210'
57
57
  }}
58
58
 
59
- batch = LitleBatchRequest.new
59
+ batch = CnpBatchRequest.new
60
60
  batch.create_new_batch('/usr/local/Batches/')
61
61
 
62
62
  2.times(){ batch.authorization(authHash) }
@@ -85,7 +85,7 @@ module LitleOnline
85
85
  'expDate' =>'1210'
86
86
  }}
87
87
 
88
- batch = LitleBatchRequest.new
88
+ batch = CnpBatchRequest.new
89
89
  batch.create_new_batch('D:\Batches\\')
90
90
  batch.sale(saleHash)
91
91
 
@@ -114,7 +114,7 @@ module LitleOnline
114
114
  'expDate' =>'1210'
115
115
  }}
116
116
 
117
- batch = LitleBatchRequest.new
117
+ batch = CnpBatchRequest.new
118
118
  batch.create_new_batch('D:\Batches\\')
119
119
  batch.credit(creditHash)
120
120
 
@@ -134,12 +134,12 @@ module LitleOnline
134
134
  'merchantId' => '101',
135
135
  'version'=>'8.8',
136
136
  'reportGroup'=>'Planets',
137
- 'litleTxnId'=>'12345678000',
137
+ 'cnpTxnId'=>'12345678000',
138
138
  'amount'=>'106',
139
139
  'payPalNotes'=>'Notes'
140
140
  }
141
141
 
142
- batch = LitleBatchRequest.new
142
+ batch = CnpBatchRequest.new
143
143
  batch.create_new_batch('D:\Batches\\')
144
144
  batch.auth_reversal(authReversalHash)
145
145
 
@@ -163,7 +163,7 @@ module LitleOnline
163
163
  'accountNumber'=>'1233456789103801'
164
164
  }
165
165
 
166
- batch = LitleBatchRequest.new
166
+ batch = CnpBatchRequest.new
167
167
  batch.create_new_batch('D:\Batches\\')
168
168
  batch.register_token_request(registerTokenHash)
169
169
 
@@ -185,7 +185,7 @@ module LitleOnline
185
185
  'subscriptionId'=>'100'
186
186
  }
187
187
 
188
- batch = LitleBatchRequest.new
188
+ batch = CnpBatchRequest.new
189
189
  batch.create_new_batch('D:\Batches\\')
190
190
  batch.cancel_subscription(hash)
191
191
 
@@ -206,10 +206,10 @@ module LitleOnline
206
206
  'reportGroup'=>'Planets',
207
207
  'subscriptionId'=>'100',
208
208
  'planCode'=>'planCodeString',
209
- 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
209
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
210
210
  }
211
211
 
212
- batch = LitleBatchRequest.new
212
+ batch = CnpBatchRequest.new
213
213
  batch.create_new_batch('D:\Batches\\')
214
214
  batch.update_subscription(hash)
215
215
 
@@ -229,11 +229,11 @@ module LitleOnline
229
229
  'version'=>'8.8',
230
230
  'reportGroup'=>'Planets',
231
231
  'orderId'=>'12344',
232
- 'litleToken'=>'1233456789103801',
232
+ 'cnpToken'=>'1233456789103801',
233
233
  'cardValidationNum'=>'123'
234
234
  }
235
235
 
236
- batch = LitleBatchRequest.new
236
+ batch = CnpBatchRequest.new
237
237
  batch.create_new_batch('D:\Batches\\')
238
238
  batch.update_card_validation_num_on_token(updateCardHash)
239
239
 
@@ -252,7 +252,7 @@ module LitleOnline
252
252
  'merchantId' => '101',
253
253
  'version'=>'8.8',
254
254
  'reportGroup'=>'Planets',
255
- 'litleTxnId'=>'123456',
255
+ 'cnpTxnId'=>'123456',
256
256
  'orderId'=>'12344',
257
257
  'amount'=>'106',
258
258
  'orderSource'=>'ecommerce',
@@ -262,7 +262,7 @@ module LitleOnline
262
262
  'expDate' =>'1210'
263
263
  }}
264
264
 
265
- batch = LitleBatchRequest.new
265
+ batch = CnpBatchRequest.new
266
266
  batch.create_new_batch('D:\Batches\\')
267
267
  batch.force_capture(forceCaptHash)
268
268
 
@@ -282,11 +282,11 @@ module LitleOnline
282
282
  'merchantId' => '101',
283
283
  'version'=>'8.8',
284
284
  'reportGroup'=>'Planets',
285
- 'litleTxnId'=>'123456000',
285
+ 'cnpTxnId'=>'123456000',
286
286
  'amount'=>'106',
287
287
  }
288
288
 
289
- batch = LitleBatchRequest.new
289
+ batch = CnpBatchRequest.new
290
290
  batch.create_new_batch('D:\Batches\\')
291
291
  batch.capture(captHash)
292
292
 
@@ -319,7 +319,7 @@ module LitleOnline
319
319
  'expDate' =>'1210'
320
320
  }}
321
321
 
322
- batch = LitleBatchRequest.new
322
+ batch = CnpBatchRequest.new
323
323
  batch.create_new_batch('D:\Batches\\')
324
324
  batch.capture_given_auth(captGivenAuthHash)
325
325
 
@@ -343,10 +343,10 @@ 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'=>'litle.com'}
346
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
347
347
  }
348
348
 
349
- batch = LitleBatchRequest.new
349
+ batch = CnpBatchRequest.new
350
350
  batch.create_new_batch('D:\Batches\\')
351
351
  batch.echeck_verification(echeckVerificationHash)
352
352
 
@@ -366,11 +366,11 @@ module LitleOnline
366
366
  'merchantId' => '101',
367
367
  'version'=>'8.8',
368
368
  'reportGroup'=>'Planets',
369
- 'litleTxnId'=>'123456789101112',
369
+ 'cnpTxnId'=>'123456789101112',
370
370
  'amount'=>'12'
371
371
  }
372
372
 
373
- batch = LitleBatchRequest.new
373
+ batch = CnpBatchRequest.new
374
374
  batch.create_new_batch('D:\Batches\\')
375
375
  batch.echeck_credit(echeckCreditHash)
376
376
 
@@ -390,10 +390,10 @@ module LitleOnline
390
390
  'merchantId' => '101',
391
391
  'version'=>'8.8',
392
392
  'reportGroup'=>'Planets',
393
- 'litleTxnId'=>'123456'
393
+ 'cnpTxnId'=>'123456'
394
394
  }
395
395
 
396
- batch = LitleBatchRequest.new
396
+ batch = CnpBatchRequest.new
397
397
  batch.create_new_batch('D:\Batches\\')
398
398
  batch.echeck_redeposit(echeckRedeopsitHash)
399
399
 
@@ -417,10 +417,10 @@ 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'=>'litle.com'}
420
+ 'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
421
421
  }
422
422
 
423
- batch = LitleBatchRequest.new
423
+ batch = CnpBatchRequest.new
424
424
  batch.create_new_batch('D:\Batches\\')
425
425
  batch.echeck_sale(echeckSaleHash)
426
426
 
@@ -429,36 +429,6 @@ 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
-
462
432
  def test_close_batch
463
433
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
464
434
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').once
@@ -481,7 +451,7 @@ module LitleOnline
481
451
  'expDate' =>'1210'
482
452
  }}
483
453
 
484
- batch = LitleBatchRequest.new
454
+ batch = CnpBatchRequest.new
485
455
  batch.create_new_batch('D:\Batches\\')
486
456
 
487
457
  batch.sale(saleHash)
@@ -516,8 +486,8 @@ module LitleOnline
516
486
  File.expects(:rename).once.in_sequence(open)
517
487
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.closed.*/), 'w').once.in_sequence(open)
518
488
  File.expects(:delete).with(regexp_matches(/.*batch_.*\d_txns.*/)).once.in_sequence(open)
519
- batch1 = LitleBatchRequest.new
520
- batch2 = LitleBatchRequest.new
489
+ batch1 = CnpBatchRequest.new
490
+ batch2 = CnpBatchRequest.new
521
491
  batch2.expects(:build_batch_header).returns("foo")
522
492
  batch1.create_new_batch('/usr/local/Batches/')
523
493
  batch2.open_existing_batch(batch1.get_batch_name)
@@ -533,7 +503,7 @@ module LitleOnline
533
503
  File.expects(:delete).once
534
504
  File.expects(:directory?).returns(true).once
535
505
 
536
- batch = LitleBatchRequest.new
506
+ batch = CnpBatchRequest.new
537
507
  batch.get_counts_and_amounts.expects(:[]).returns(hash = Hash.new).at_least(25)
538
508
  hash.expects(:[]).returns('a').at_least(20)
539
509
 
@@ -546,7 +516,7 @@ module LitleOnline
546
516
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').once
547
517
  File.expects(:open).with(regexp_matches(/.*batch_.*\d_txns.*/), 'a+').once
548
518
 
549
- batch = LitleBatchRequest.new
519
+ batch = CnpBatchRequest.new
550
520
  batch.create_new_batch('/usr/local')
551
521
 
552
522
  assert batch.get_batch_name.include?('/usr/local/')
@@ -563,14 +533,14 @@ module LitleOnline
563
533
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').in_sequence(fileExists)
564
534
  File.expects(:open).with(regexp_matches(/.*batch_.*\d_txns.*/), 'a+').in_sequence(fileExists)
565
535
 
566
- batch = LitleBatchRequest.new
536
+ batch = CnpBatchRequest.new
567
537
  batch.create_new_batch('/usr/local/')
568
538
  end
569
539
 
570
540
  def test_create_new_batch_when_full
571
541
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'}).once
572
542
 
573
- batch = LitleBatchRequest.new
543
+ batch = CnpBatchRequest.new
574
544
  addTxn = sequence('addTxn')
575
545
 
576
546
  File.expects(:open).with(regexp_matches(/.*batch_.*\d.*/), 'a+').in_sequence(addTxn)
@@ -644,11 +614,11 @@ module LitleOnline
644
614
  'id'=>'12345',
645
615
  'customerId'=>'0987',
646
616
  'orderId'=>'12344',
647
- 'litleToken'=>'1233456789103801',
617
+ 'cnpToken'=>'1233456789103801',
648
618
  'cardValidationNum'=>'123'
649
619
  }
650
620
 
651
- batch = LitleBatchRequest.new
621
+ batch = CnpBatchRequest.new
652
622
  batch.create_new_batch('/usr/local/Batches/')
653
623
 
654
624
  5.times(){ batch.authorization(authHash) }
@@ -767,16 +737,12 @@ module LitleOnline
767
737
  'reportGroup'=>'Planets',
768
738
  'orderId'=>'12344',
769
739
  'fundingSubmerchantId'=>'123456',
770
- 'submerhcantName'=>'submerchant',
740
+ 'submerchantName' => 'Colin',
771
741
  'fundsTransferId'=>'1234567',
772
742
  'amount'=>'111',
773
- 'card'=>{
774
- 'type'=>'VI',
775
- 'number' =>'4100000000000001',
776
- 'expDate' =>'1210'
777
- }
778
743
  }
779
- batch = LitleBatchRequest.new
744
+
745
+ batch = CnpBatchRequest.new
780
746
  batch.create_new_batch('/usr/local/Batches/')
781
747
 
782
748
  batch.submerchant_credit(submerchantCreditHash)
@@ -818,8 +784,8 @@ module LitleOnline
818
784
  assert_equal 107, counts[:vendorDebit ][:vendorDebitAmount ]
819
785
  assert_equal 110, counts[:physicalCheckDebit ][:physicalCheckDebitAmount ]
820
786
 
821
- # assert_equal 1, counts[:fastAccessFunding ][:numFastAccessFunding ]
822
- # assert_equal 111, counts[:fastAccessFunding ][:fastAccessFundingAmount ]
787
+ assert_equal 111, counts[:fastAccessFunding ][:fastAccessFundingAmount ]
788
+ assert_equal 1, counts[:fastAccessFunding ][:numFastAccessFunding ]
823
789
  end
824
790
  end
825
791
  end
@@ -22,18 +22,18 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
22
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
23
  OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
25
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
26
26
  require 'test/unit'
27
27
  require 'mocha/setup'
28
28
 
29
- module LitleOnline
29
+ module CnpOnline
30
30
 
31
- class TestLitleOnlineRequest < Test::Unit::TestCase
31
+ class TestCnpOnlineRequest < Test::Unit::TestCase
32
32
  def test_set_merchant_id
33
33
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}})
34
- litle = LitleOnlineRequest.new
35
- assert_equal '2', litle.send(:get_merchant_id, {'merchantId'=>'2'})
36
- assert_equal '1', litle.send(:get_merchant_id, {'NotMerchantId'=>'2'})
34
+ cnp = CnpOnlineRequest.new
35
+ assert_equal '2', cnp.send(:get_merchant_id, {'merchantId'=>'2'})
36
+ assert_equal '1', cnp.send(:get_merchant_id, {'NotMerchantId'=>'2'})
37
37
  end
38
38
 
39
39
  def test_simple
@@ -49,8 +49,8 @@ module LitleOnline
49
49
  'expDate' =>'1210'
50
50
  }}
51
51
 
52
- LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest .*/m), is_a(Hash))
53
- response = LitleOnlineRequest.new.authorization(hash)
52
+ CnpXmlMapper.expects(:request).with(regexp_matches(/<cnpOnlineRequest .*/m), is_a(Hash))
53
+ response = CnpOnlineRequest.new.authorization(hash)
54
54
  end
55
55
 
56
56
  def test_authorization_attributes
@@ -67,8 +67,8 @@ module LitleOnline
67
67
  'expDate' =>'1210'
68
68
  }}
69
69
 
70
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authorization ((reportGroup="Planets" id="003")|(id="003" reportGroup="Planets")).*/m), is_a(Hash))
71
- response = LitleOnlineRequest.new.authorization(hash)
70
+ CnpXmlMapper.expects(:request).with(regexp_matches(/.*<authorization ((reportGroup="Planets" id="003")|(id="003" reportGroup="Planets")).*/m), is_a(Hash))
71
+ response = CnpOnlineRequest.new.authorization(hash)
72
72
  end
73
73
 
74
74
  def test_authorization_elements
@@ -85,8 +85,8 @@ module LitleOnline
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))
89
- response = LitleOnlineRequest.new.authorization(hash)
88
+ CnpXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*<orderId>12344.*<amount>106.*<orderSource>ecommerce.*/m), is_a(Hash))
89
+ response = CnpOnlineRequest.new.authorization(hash)
90
90
  end
91
91
 
92
92
  def test_authorization_card_field
@@ -103,8 +103,8 @@ module LitleOnline
103
103
  'expDate' =>'1210'
104
104
  }}
105
105
 
106
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m), is_a(Hash))
107
- response = LitleOnlineRequest.new.authorization(hash)
106
+ CnpXmlMapper.expects(:request).with(regexp_matches(/.*<authorization.*<card>.*<number>4100000000000001.*<expDate>1210.*/m), is_a(Hash))
107
+ response = CnpOnlineRequest.new.authorization(hash)
108
108
  end
109
109
 
110
110
  def test_sale_card_field
@@ -121,8 +121,8 @@ module LitleOnline
121
121
  'expDate' =>'1210'
122
122
  }}
123
123
 
124
- LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m), is_a(Hash))
125
- response = LitleOnlineRequest.new.sale(hash)
124
+ CnpXmlMapper.expects(:request).with(regexp_matches(/<cnpOnlineRequest.*<sale.*<card>.*<number>4100000000000001.*<expDate>1210.*/m), is_a(Hash))
125
+ response = CnpOnlineRequest.new.sale(hash)
126
126
  end
127
127
 
128
128
  def test_capture_amount_unset_should_not_be_in_xml
@@ -130,11 +130,11 @@ module LitleOnline
130
130
  hash={
131
131
  'id' => '006',
132
132
  'reportGroup'=>'Planets',
133
- 'litleTxnId'=>'123456789012345678'
133
+ 'cnpTxnId'=>'123456789012345678'
134
134
  }
135
135
 
136
- LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
137
- response = LitleOnlineRequest.new.capture(hash)
136
+ CnpXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
137
+ response = CnpOnlineRequest.new.capture(hash)
138
138
  end
139
139
 
140
140
  def test_force_capture_amount_unset_should_not_be_in_xml
@@ -144,11 +144,11 @@ module LitleOnline
144
144
  'orderId'=>'12344',
145
145
  'reportGroup'=>'Planets',
146
146
  'orderSource'=>'ecommerce',
147
- 'litleTxnId'=>'123456789012345678'
147
+ 'cnpTxnId'=>'123456789012345678'
148
148
  }
149
149
 
150
- LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
151
- response = LitleOnlineRequest.new.force_capture(hash)
150
+ CnpXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
151
+ response = CnpOnlineRequest.new.force_capture(hash)
152
152
  end
153
153
 
154
154
  def test_amount_is_not_required_in_echeck_credit
@@ -158,12 +158,12 @@ module LitleOnline
158
158
  'orderId'=>'12344',
159
159
  'reportGroup'=>'Planets',
160
160
  'orderSource'=>'ecommerce',
161
- 'litleTxnId'=>'123456789012345678',
161
+ 'cnpTxnId'=>'123456789012345678',
162
162
  }
163
163
 
164
- LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
164
+ CnpXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
165
165
 
166
- response = LitleOnlineRequest.new.echeck_credit(hash)
166
+ response = CnpOnlineRequest.new.echeck_credit(hash)
167
167
  end
168
168
 
169
169
  def test_amount_is_not_required_in_echeck_sale
@@ -173,11 +173,11 @@ module LitleOnline
173
173
  'orderId'=>'12344',
174
174
  'reportGroup'=>'Planets',
175
175
  'orderSource'=>'ecommerce',
176
- 'litleTxnId'=>'123456789012345678',
176
+ 'cnpTxnId'=>'123456789012345678',
177
177
  }
178
178
 
179
- LitleXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
180
- response = LitleOnlineRequest.new.echeck_sale(hash)
179
+ CnpXmlMapper.expects(:request).with(Not(regexp_matches(/.*amount.*/m)), is_a(Hash))
180
+ response = CnpOnlineRequest.new.echeck_sale(hash)
181
181
  end
182
182
 
183
183
  def test_choice_between_card_token
@@ -196,8 +196,8 @@ module LitleOnline
196
196
  }
197
197
  }
198
198
 
199
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*card.*/m), is_a(Hash))
200
- LitleOnlineRequest.new.authorization(start_hash.merge(card_only))
199
+ CnpXmlMapper.expects(:request).with(regexp_matches(/.*card.*/m), is_a(Hash))
200
+ CnpOnlineRequest.new.authorization(start_hash.merge(card_only))
201
201
  end
202
202
 
203
203
  def test_choice_between_card_token2
@@ -211,12 +211,12 @@ module LitleOnline
211
211
 
212
212
  token_only = {
213
213
  'token'=> {
214
- 'litleToken' => '1111222233334444'
214
+ 'cnpToken' => '1111222233334444'
215
215
  }
216
216
  }
217
217
 
218
- LitleXmlMapper.expects(:request).with(regexp_matches(/.*token.*/m), is_a(Hash))
219
- LitleOnlineRequest.new.authorization(start_hash.merge(token_only))
218
+ CnpXmlMapper.expects(:request).with(regexp_matches(/.*token.*/m), is_a(Hash))
219
+ CnpOnlineRequest.new.authorization(start_hash.merge(token_only))
220
220
  end
221
221
 
222
222
 
@@ -236,17 +236,17 @@ module LitleOnline
236
236
  'expDate' =>'1210'
237
237
  }}
238
238
 
239
- LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m), is_a(Hash))
240
- response = LitleOnlineRequest.new.sale(hash)
239
+ CnpXmlMapper.expects(:request).with(regexp_matches(/<cnpOnlineRequest.*<sale.*<payPalOrderComplete>true<\/payPalOrderComplete>.*/m), is_a(Hash))
240
+ response = CnpOnlineRequest.new.sale(hash)
241
241
  end
242
242
 
243
243
  def test_version_matches_sdk_major_and_minor_version_ignoring_config
244
244
  Configuration.any_instance.stubs(:config).returns({'currency_merchant_map'=>{'DEFAULT'=>'1'}, 'user'=>'a','password'=>'b','version'=>'8.10'})
245
245
  hash={
246
- 'litleTxnId' => '006'
246
+ 'cnpTxnId' => '006'
247
247
  }
248
- LitleXmlMapper.expects(:request).with(regexp_matches(/<litleOnlineRequest.*version="11\.4".*/m), is_a(Hash))
249
- response = LitleOnlineRequest.new.void(hash)
248
+ CnpXmlMapper.expects(:request).with(regexp_matches(/<cnpOnlineRequest.*version="12\.1".*/m), is_a(Hash))
249
+ response = CnpOnlineRequest.new.void(hash)
250
250
  end
251
251
 
252
252
  end