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,11 +22,11 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
22
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
23
  OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
25
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
26
26
  require 'test/unit'
27
27
 
28
28
  #test FraudCheck Transaction
29
- module LitleOnline
29
+ module CnpOnline
30
30
  class TestFraudCheck < Test::Unit::TestCase
31
31
  def test_fraud_check_happy_path
32
32
  hash = {
@@ -40,10 +40,11 @@ module LitleOnline
40
40
  'customAttribute2' => '55',
41
41
  'customAttribute3' => '5'}
42
42
  }
43
- response = LitleOnlineRequest.new.fraud_check_request(hash)
43
+ response = CnpOnlineRequest.new.fraud_check_request(hash)
44
44
  assert_equal('0', response.response)
45
45
  assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
46
- assert_equal('55', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
46
+ #sandbox is being updated to handle this correctly
47
+ #assert_equal('55', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
47
48
  assert_equal('triggered_rule_1', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
48
49
  assert_equal(5, response.fraudCheckResponse.advancedFraudResults.triggeredRule.size())
49
50
  end
@@ -58,7 +59,7 @@ module LitleOnline
58
59
  'threatMetrixSessionId' => 'test2-BXXXXXX003'
59
60
  }
60
61
  }
61
- response = LitleOnlineRequest.new.fraud_check_request(hash)
62
+ response = CnpOnlineRequest.new.fraud_check_request(hash)
62
63
  assert_equal('0', response.response)
63
64
  assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
64
65
  assert_equal('42', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
@@ -22,11 +22,11 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
22
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
23
  OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
25
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
26
26
  require 'test/unit'
27
27
 
28
28
  #test GiftCardAuthReversal Transaction
29
- module LitleOnline
29
+ module CnpOnline
30
30
  class TestGiftCardAuthReversal < Test::Unit::TestCase
31
31
  def test_giftCardAuthReversal
32
32
  hash = {
@@ -34,7 +34,7 @@ module LitleOnline
34
34
  'version'=>'8.8',
35
35
  'id'=>'test',
36
36
  'reportGroup'=>'Planets',
37
- 'litleTxnId' =>'5000',
37
+ 'cnpTxnId' =>'5000',
38
38
  'card'=>{
39
39
  'type'=>'GC',
40
40
  'number' =>'400000000000000',
@@ -49,7 +49,7 @@ module LitleOnline
49
49
  'originalSequenceNumber' => '111111',
50
50
  }
51
51
 
52
- response= LitleOnlineRequest.new.giftCardAuth_reversal(hash)
52
+ response= CnpOnlineRequest.new.giftCardAuth_reversal(hash)
53
53
  assert_equal('000', response.giftCardAuthReversalResponse.response)
54
54
  assert_equal('0', response.giftCardAuthReversalResponse.giftCardResponse.systemTraceId)
55
55
  end
@@ -63,7 +63,7 @@ module LitleOnline
63
63
  }
64
64
 
65
65
  #Get exceptions
66
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.giftCardAuth_reversal(hash)}
66
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.giftCardAuth_reversal(hash)}
67
67
  #Test
68
68
  assert(exception.message =~ /Error validating xml data against the schema/)
69
69
  end
@@ -22,11 +22,11 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
22
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
23
  OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
25
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
26
26
  require 'test/unit'
27
27
 
28
28
  #test GiftCardCapture Transaction
29
- module LitleOnline
29
+ module CnpOnline
30
30
  class TestGiftCardCapture < Test::Unit::TestCase
31
31
  def test_giftCardCapture
32
32
  hash = {
@@ -35,7 +35,7 @@ module LitleOnline
35
35
  'version'=>'8.8',
36
36
  'id'=>'test',
37
37
  'reportGroup'=>'Planets',
38
- 'litleTxnId' =>'5000',
38
+ 'cnpTxnId' =>'5000',
39
39
  'card'=>{
40
40
  'type'=>'GC',
41
41
  'number' =>'400000000000000',
@@ -49,7 +49,7 @@ module LitleOnline
49
49
 
50
50
  }
51
51
 
52
- response= LitleOnlineRequest.new.giftCardCapture(hash)
52
+ response= CnpOnlineRequest.new.giftCardCapture(hash)
53
53
  assert_equal('000', response.giftCardCaptureResponse.response)
54
54
  assert_equal('0', response.giftCardCaptureResponse.giftCardResponse.systemTraceId)
55
55
  end
@@ -63,7 +63,7 @@ module LitleOnline
63
63
  }
64
64
 
65
65
  #Get exceptions
66
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.giftCardCapture(hash)}
66
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.giftCardCapture(hash)}
67
67
  #Test
68
68
  assert(exception.message =~ /Error validating xml data against the schema/)
69
69
  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
 
28
28
  #test GiftCardCapture Transaction
29
- module LitleOnline
29
+ module CnpOnline
30
30
  class TestGiftCardCredit < Test::Unit::TestCase
31
31
  def test_giftCardCredit
32
32
  hash = {
33
33
  'id'=>'test',
34
34
  'merchantId' => '101',
35
35
  'version'=>'8.8',
36
- 'litleTxnId' => '5000',
36
+ 'cnpTxnId' => '5000',
37
37
  'creditAmount' =>'1000',
38
38
  #'orderId' =>'1230',
39
39
  'card'=>{
@@ -46,7 +46,7 @@ module LitleOnline
46
46
  'reportGroup'=>'Planets',
47
47
  }
48
48
 
49
- response= LitleOnlineRequest.new.giftCardCredit(hash)
49
+ response= CnpOnlineRequest.new.giftCardCredit(hash)
50
50
  assert_equal('000', response.giftCardCreditResponse.response)
51
51
  assert_equal('0', response.giftCardCreditResponse.giftCardResponse.systemTraceId)
52
52
  end
@@ -60,7 +60,7 @@ module LitleOnline
60
60
  }
61
61
 
62
62
  #Get exceptions
63
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.giftCardCredit(hash)}
63
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.giftCardCredit(hash)}
64
64
  #Test
65
65
  assert(exception.message =~ /Error validating xml data against the schema/)
66
66
  end
@@ -19,15 +19,17 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
19
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
20
  OTHER DEALINGS IN THE SOFTWARE.
21
21
  =end
22
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
22
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
23
23
  require 'test/unit'
24
24
  require 'fileutils'
25
25
 
26
- module LitleOnline
27
- class TestLitleRequest < Test::Unit::TestCase
26
+ CNP_SDK_TEST_FOLDER = '/cnp-sdk-for-ruby-test'
27
+
28
+ module CnpOnline
29
+ class TestCnpRequest < Test::Unit::TestCase
28
30
 
29
31
  def setup
30
- dir = '/tmp/litle-sdk-for-ruby-test'
32
+ dir = '/tmp' + CNP_SDK_TEST_FOLDER
31
33
  FileUtils.rm_rf dir
32
34
  Dir.mkdir dir
33
35
  end
@@ -35,79 +37,79 @@ module LitleOnline
35
37
  def test_request_creation
36
38
  dir = '/tmp'
37
39
 
38
- request = LitleRequest.new()
39
- request.create_new_litle_request(dir + '/litle-sdk-for-ruby-test')
40
+ request = CnpRequest.new()
41
+ request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
40
42
 
41
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
43
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
42
44
  entries.sort!
43
45
 
44
46
  assert_equal 4, entries.size
45
- assert_not_nil entries[2] =~ /request_\d+\z/
46
- assert_not_nil entries[3] =~ /request_\d+_batches\z/
47
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
48
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
47
49
  end
48
50
 
49
51
  def test_commit_batch_with_path
50
52
  dir = '/tmp'
51
53
 
52
- batch = LitleBatchRequest.new
53
- batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
54
+ batch = CnpBatchRequest.new
55
+ batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
54
56
  batch.close_batch
55
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
57
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
56
58
 
57
59
  assert_equal 3, entries.length
58
60
  entries.sort!
59
61
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
60
62
 
61
- request = LitleRequest.new
62
- request.create_new_litle_request(dir+ '/litle-sdk-for-ruby-test')
63
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
63
+ request = CnpRequest.new
64
+ request.create_new_cnp_request(dir+ CNP_SDK_TEST_FOLDER)
65
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
64
66
  entries.sort!
65
67
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
66
- assert_not_nil entries[3] =~ /request_\d+\z/
67
- assert_not_nil entries[4] =~ /request_\d+_batches\z/
68
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
69
+ assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
68
70
 
69
71
  request.commit_batch(batch.get_batch_name)
70
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
72
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
71
73
  entries.sort!
72
74
  assert_equal 4,entries.length
73
- assert_not_nil entries[2] =~ /request_\d+\z/
74
- assert_not_nil entries[3] =~ /request_\d+_batches\z/
75
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
76
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
75
77
  end
76
78
 
77
79
  def test_commit_batch_with_batch
78
80
  dir = '/tmp'
79
81
 
80
- batch = LitleBatchRequest.new
81
- batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
82
+ batch = CnpBatchRequest.new
83
+ batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
82
84
  batch.close_batch
83
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
85
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
84
86
 
85
87
  assert_equal 3, entries.length
86
88
  entries.sort!
87
89
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
88
90
 
89
- request = LitleRequest.new
90
- request.create_new_litle_request(dir+ '/litle-sdk-for-ruby-test')
91
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
91
+ request = CnpRequest.new
92
+ request.create_new_cnp_request(dir+ CNP_SDK_TEST_FOLDER)
93
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
92
94
  entries.sort!
93
95
  assert_equal 5, entries.length
94
96
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
95
- assert_not_nil entries[3] =~ /request_\d+\z/
96
- assert_not_nil entries[4] =~ /request_\d+_batches\z/
97
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
98
+ assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
97
99
 
98
100
  request.commit_batch(batch)
99
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
101
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
100
102
  entries.sort!
101
103
  assert_equal 4, entries.length
102
- assert_not_nil entries[2] =~ /request_\d+\z/
103
- assert_not_nil entries[3] =~ /request_\d+_batches\z/
104
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
105
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
104
106
  end
105
107
 
106
108
  def test_commit_batch_with_batch_and_au
107
109
  dir = '/tmp'
108
110
 
109
- batch = LitleBatchRequest.new
110
- batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
111
+ batch = CnpBatchRequest.new
112
+ batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
111
113
  accountUpdateHash = {
112
114
  'reportGroup'=>'Planets',
113
115
  'id'=>'12345',
@@ -120,84 +122,84 @@ module LitleOnline
120
122
  batch.account_update(accountUpdateHash)
121
123
  batch.close_batch
122
124
 
123
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
125
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
124
126
 
125
127
  assert_equal 4, entries.length
126
128
  entries.sort!
127
129
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
128
130
  assert_not_nil entries[3] =~ /batch_\d+.closed-1\z/
129
131
 
130
- request = LitleRequest.new
131
- request.create_new_litle_request(dir+ '/litle-sdk-for-ruby-test')
132
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
132
+ request = CnpRequest.new
133
+ request.create_new_cnp_request(dir+ CNP_SDK_TEST_FOLDER)
134
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
133
135
  entries.sort!
134
136
  assert_equal 6, entries.length
135
137
  assert_not_nil entries[2] =~ /batch_\d+.closed-0\z/
136
138
  assert_not_nil entries[3] =~ /batch_\d+.closed-1\z/
137
- assert_not_nil entries[4] =~ /request_\d+\z/
138
- assert_not_nil entries[5] =~ /request_\d+_batches\z/
139
+ assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
140
+ assert_not_nil entries[5] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
139
141
 
140
142
  request.commit_batch(batch)
141
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
143
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
142
144
  entries.sort!
143
145
  assert_equal 4, entries.length
144
- assert_not_nil entries[2] =~ /request_\d+\z/
145
- assert_not_nil entries[3] =~ /request_\d+_batches\z/
146
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
147
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
146
148
  end
147
149
 
148
150
  def test_finish_request
149
151
  dir = '/tmp'
150
152
 
151
- request = LitleRequest.new()
152
- request.create_new_litle_request(dir + '/litle-sdk-for-ruby-test')
153
+ request = CnpRequest.new()
154
+ request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
153
155
 
154
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
156
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
155
157
  entries.sort!
156
158
 
157
159
  assert_equal 4, entries.size
158
- assert_not_nil entries[2] =~ /request_\d+\z/
159
- assert_not_nil entries[3] =~ /request_\d+_batches\z/
160
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
161
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
160
162
 
161
163
  request.finish_request
162
164
 
163
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
165
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
164
166
  entries.sort!
165
167
 
166
168
  assert_equal 3, entries.size
167
- assert_not_nil entries[2] =~ /request_\d+.complete\z/
169
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}\z/
168
170
  end
169
171
 
170
172
  def test_add_rfr
171
173
  @config_hash = Configuration.new.config
172
174
 
173
175
  dir = '/tmp'
174
- temp = dir + '/litle-sdk-for-ruby-test/'
176
+ temp = dir + CNP_SDK_TEST_FOLDER + '/'
175
177
 
176
- request = LitleRequest.new()
177
- request.add_rfr_request({'litleSessionId' => '137813712'}, temp)
178
+ request = CnpRequest.new()
179
+ request.add_rfr_request({'cnpSessionId' => '137813712'}, temp)
178
180
 
179
181
  entries = Dir.entries(temp)
180
182
  entries.sort!
181
183
 
182
184
  assert_equal 3, entries.size
183
- assert_not_nil entries[2] =~ /request_\d+.complete\z/
185
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}\z/
184
186
  end
185
187
 
186
- def test_send_to_litle
188
+ def test_send_to_cnp
187
189
  @config_hash = Configuration.new.config
188
190
 
189
191
  dir = '/tmp'
190
192
 
191
- request = LitleRequest.new()
192
- request.create_new_litle_request(dir + '/litle-sdk-for-ruby-test')
193
+ request = CnpRequest.new()
194
+ request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
193
195
  request.finish_request
194
- request.send_to_litle
196
+ request.send_to_cnp
195
197
 
196
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
198
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
197
199
  entries.sort!
198
200
  assert_equal 3, entries.size
199
201
  puts entries[2]
200
- assert_not_nil entries[2] =~ /request_\d+.complete.sent\z/
202
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
201
203
 
202
204
  uploaded_file = entries[2]
203
205
 
@@ -217,33 +219,33 @@ module LitleOnline
217
219
  }
218
220
  assert_equal 3,ents.size
219
221
  ents.sort!
220
- assert_equal ents[2], uploaded_file.gsub('sent', 'asc')
222
+ assert_equal ents[2], uploaded_file.gsub(SENT_FILE_SUFFIX, '.asc')
221
223
  sftp.remove('/inbound/' + ents[2])
222
224
  end
223
225
  end
224
226
 
225
- def test_send_to_litle_stream
227
+ def test_send_to_cnp_stream
226
228
  @config_hash = Configuration.new.config
227
229
 
228
230
  dir = '/tmp'
229
231
 
230
- request = LitleRequest.new()
231
- request.create_new_litle_request(dir + '/litle-sdk-for-ruby-test')
232
+ request = CnpRequest.new()
233
+ request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
232
234
  request.finish_request
233
- request.send_to_litle_stream
235
+ request.send_to_cnp_stream
234
236
 
235
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
237
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
236
238
  entries.sort!
237
239
 
238
240
  assert_equal 4, entries.size
239
- assert_not_nil entries[2] =~ /request_\d+.complete.sent\z/
240
- File.delete(dir + '/litle-sdk-for-ruby-test/' + entries[2])
241
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
242
+ File.delete(dir + CNP_SDK_TEST_FOLDER + '/' + entries[2])
241
243
 
242
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test/responses')
244
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + RESPONSE_PATH_DIR)
243
245
  entries.sort!
244
246
 
245
247
  assert_equal 3, entries.size
246
- assert_not_nil entries[2] =~ /response_\d+.complete.asc.received\z/
248
+ assert_not_nil entries[2] =~ /#{RESPONSE_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}.asc#{RECEIVED_FILE_SUFFIX}\z/
247
249
 
248
250
  end
249
251
 
@@ -262,29 +264,29 @@ module LitleOnline
262
264
 
263
265
  dir = '/tmp'
264
266
 
265
- request = LitleRequest.new()
266
- request.create_new_litle_request(dir + '/litle-sdk-for-ruby-test')
267
+ request = CnpRequest.new()
268
+ request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
267
269
 
268
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
270
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
269
271
  entries.sort!
270
272
 
271
273
  assert_equal 4, entries.size
272
- assert_not_nil entries[2] =~ /request_\d+\z/
273
- assert_not_nil entries[3] =~ /request_\d+_batches\z/
274
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
275
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
274
276
 
275
277
  #create five batches, each with 10 sales
276
278
  5.times{
277
- batch = LitleBatchRequest.new
278
- batch.create_new_batch(dir + '/litle-sdk-for-ruby-test')
279
+ batch = CnpBatchRequest.new
280
+ batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
279
281
 
280
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
282
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
281
283
 
282
284
  assert_equal 6, entries.length
283
285
  entries.sort!
284
286
  assert_not_nil entries[2] =~ /batch_\d+\z/
285
287
  assert_not_nil entries[3] =~ /batch_\d+_txns\z/
286
- assert_not_nil entries[4] =~ /request_\d+\z/
287
- assert_not_nil entries[5] =~ /request_\d+_batches\z/
288
+ assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
289
+ assert_not_nil entries[5] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
288
290
  #add the same sale ten times
289
291
  10.times{
290
292
  #batch.account_update(accountUpdateHash)
@@ -294,50 +296,50 @@ module LitleOnline
294
296
 
295
297
  #close the batch, indicating we plan to add no more transactions
296
298
  batch.close_batch()
297
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
299
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
298
300
 
299
301
  assert_equal 5, entries.length
300
302
  entries.sort!
301
303
  assert_not_nil entries[2] =~ /batch_\d+.closed-\d+\z/
302
- assert_not_nil entries[3] =~ /request_\d+\z/
303
- assert_not_nil entries[4] =~ /request_\d+_batches\z/
304
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
305
+ assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
304
306
 
305
- #add the batch to the LitleRequest
307
+ #add the batch to the CnpRequest
306
308
  request.commit_batch(batch)
307
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
309
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
308
310
  assert_equal 4, entries.length
309
311
  entries.sort!
310
- assert_not_nil entries[2] =~ /request_\d+\z/
311
- assert_not_nil entries[3] =~ /request_\d+_batches\z/
312
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
313
+ assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
312
314
  }
313
- #finish the Litle Request, indicating we plan to add no more batches
315
+ #finish the Cnp Request, indicating we plan to add no more batches
314
316
  request.finish_request
315
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
317
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
316
318
  assert_equal 3, entries.length
317
319
  entries.sort!
318
- assert_not_nil entries[2] =~ /request_\d+.complete\z/
320
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+.complete\z/
319
321
 
320
322
  #send the batch files at the given directory over sFTP
321
- request.send_to_litle
322
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
323
+ request.send_to_cnp
324
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
323
325
  assert_equal entries.length, 3
324
326
  entries.sort!
325
- assert_not_nil entries[2] =~ /request_\d+.complete.sent\z/
327
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
326
328
  #grab the expected number of responses from the sFTP server and save them to the given path
327
329
  request.get_responses_from_server()
328
330
  #process the responses from the server with a listener which applies the given block
329
- request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction| end})
331
+ request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction| end})
330
332
 
331
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test')
332
- assert_equal 4, entries.length
333
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
334
+ assert_equal 4, entries.length # 3 -> 4
333
335
  entries.sort!
334
- assert_not_nil entries[2] =~ /request_\d+.complete.sent\z/
335
- File.delete(dir + '/litle-sdk-for-ruby-test/' + entries[2])
336
+ assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
337
+ File.delete(dir + CNP_SDK_TEST_FOLDER + '/' + entries[2])
336
338
 
337
- entries = Dir.entries(dir + '/litle-sdk-for-ruby-test/' + entries[3])
339
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + entries[3])
338
340
  entries.sort!
339
341
  assert_equal 3, entries.length
340
- assert_not_nil entries[2] =~ /response_\d+.complete.asc.received.processed\z/
342
+ assert_not_nil entries[2] =~ /#{RESPONSE_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}.asc#{RECEIVED_FILE_SUFFIX}.processed\z/
341
343
  end
342
344
 
343
345
  def get_config(field, options)