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 Load Transaction
29
- module LitleOnline
29
+ module CnpOnline
30
30
  class TestLoad < Test::Unit::TestCase
31
31
 
32
32
  def test_simple_happy
@@ -45,7 +45,7 @@ def test_simple_happy
45
45
  }
46
46
  }
47
47
 
48
- response= LitleOnlineRequest.new.load_request(hash)
48
+ response= CnpOnlineRequest.new.load_request(hash)
49
49
  assert_equal('Valid Format', response.message)
50
50
  end
51
51
 
@@ -65,7 +65,7 @@ def test_simple_happy
65
65
  }
66
66
  }
67
67
 
68
- response= LitleOnlineRequest.new.load_request(hash)
68
+ response= CnpOnlineRequest.new.load_request(hash)
69
69
  assert_equal('Valid Format', response.message)
70
70
  end
71
71
 
@@ -78,7 +78,7 @@ def test_simple_happy
78
78
  }
79
79
 
80
80
  #Get exceptions
81
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.load_request(hash)}
81
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.load_request(hash)}
82
82
  #Test
83
83
  assert(exception.message =~ /Error validating xml data against the schema/)
84
84
  end
@@ -100,7 +100,7 @@ def test_simple_happy
100
100
  }
101
101
 
102
102
  #Get exceptions
103
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.load_request(hash)}
103
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.load_request(hash)}
104
104
  #Test
105
105
  assert(exception.message =~ /Error validating xml data against the schema/)
106
106
  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 loadReversal Transaction
29
- module LitleOnline
29
+ module CnpOnline
30
30
  class TestLoadReversal < Test::Unit::TestCase
31
31
 
32
32
  def test_simple
@@ -35,7 +35,7 @@ def test_simple
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' =>'400000000000001',
@@ -50,7 +50,7 @@ def test_simple
50
50
  'originalSequenceNumber' => '111111',
51
51
  }
52
52
 
53
- response= LitleOnlineRequest.new.deposit_reversal(hash)
53
+ response= CnpOnlineRequest.new.deposit_reversal(hash)
54
54
  assert_equal('000', response.depositReversalResponse.response)
55
55
  end
56
56
 
@@ -63,7 +63,7 @@ def test_simple
63
63
  }
64
64
 
65
65
  #Get exceptions
66
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.load_reversal(hash)}
66
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.load_reversal(hash)}
67
67
  #Test
68
68
  assert(exception.message =~ /Error validating xml data against the schema/)
69
69
  end
@@ -1,8 +1,8 @@
1
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
1
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
2
2
  require 'test/unit'
3
3
 
4
4
  #test Activate Transaction
5
- module LitleOnline
5
+ module CnpOnline
6
6
  class TestOverride < Test::Unit::TestCase
7
7
  def test_override_withoutLocalAndEnv
8
8
  hash = {
@@ -18,7 +18,7 @@ module LitleOnline
18
18
  'expDate' =>'1210'
19
19
  }
20
20
  }
21
- response= LitleOnlineRequest.new.activate(hash)
21
+ response= CnpOnlineRequest.new.activate(hash)
22
22
  assert_equal('Default Report Group', response.activateResponse.reportGroup)
23
23
  end
24
24
 
@@ -36,10 +36,10 @@ module LitleOnline
36
36
  'expDate' =>'1210'
37
37
  }
38
38
  }
39
- ENV['litle_default_report_group']='380'
40
- response= LitleOnlineRequest.new.activate(hash)
39
+ ENV['cnp_default_report_group']='380'
40
+ response= CnpOnlineRequest.new.activate(hash)
41
41
  assert_equal('380', response.activateResponse.reportGroup)
42
- ENV['litle_default_report_group']=nil
42
+ ENV['cnp_default_report_group']=nil
43
43
 
44
44
  end
45
45
  def test_override
@@ -57,10 +57,10 @@ module LitleOnline
57
57
  'expDate' =>'1210'
58
58
  }
59
59
  }
60
- ENV['litle_default_report_group']='380'
61
- response= LitleOnlineRequest.new.activate(hash)
60
+ ENV['cnp_default_report_group']='380'
61
+ response= CnpOnlineRequest.new.activate(hash)
62
62
  assert_equal('Planets', response.activateResponse.reportGroup)
63
- ENV['litle_default_report_group']=nil
63
+ ENV['cnp_default_report_group']=nil
64
64
 
65
65
  end
66
66
 
@@ -1,39 +1,40 @@
1
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
1
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
2
2
  require 'test/unit'
3
3
  require 'fileutils'
4
4
 
5
- LITLE_SDK_TEST_FOLDER = '/litle-sdk-for-ruby-test'
5
+ CNP_SDK_TEST_FOLDER = '/cnp-sdk-for-ruby-test'
6
6
 
7
- module LitleOnline
8
- class TestPgpLitleRequest < Test::Unit::TestCase
7
+
8
+ module CnpOnline
9
+ class TestPgpCnpRequest < Test::Unit::TestCase
9
10
 
10
11
  def setup
11
- dir = '/tmp/litle-sdk-for-ruby-test'
12
+ dir = '/tmp' + CNP_SDK_TEST_FOLDER
12
13
  FileUtils.rm_rf dir
13
14
  Dir.mkdir dir
14
15
 
15
16
  end
16
17
 
17
- def test_send_to_litle
18
- ENV['litle_deleteBatchFiles'] = 'false'
19
- config_dir = ENV['LITLE_CONFIG_DIR']
20
- ENV['LITLE_CONFIG_DIR'] = '/tmp/pgp_ruby'
18
+ def test_send_to_cnp
19
+ ENV['cnp_deleteBatchFiles'] = 'false'
20
+ config_dir = ENV['CNP_CONFIG_DIR']
21
+ ENV['CNP_CONFIG_DIR'] = '/tmp/pgp_ruby'
21
22
 
22
23
  @config_hash = Configuration.new.config
23
24
 
24
25
  dir = '/tmp'
25
26
 
26
- request = LitleRequest.new()
27
- ENV['LITLE_CONFIG_DIR'] = config_dir
28
- request.create_new_litle_request(dir + LITLE_SDK_TEST_FOLDER)
27
+ request = CnpRequest.new()
28
+ ENV['CNP_CONFIG_DIR'] = config_dir
29
+ request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
29
30
  request.finish_request
30
31
 
31
32
 
32
33
 
33
- request.send_to_litle()
34
+ request.send_to_cnp()
34
35
 
35
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
36
- encrypted_entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER + '/' + ENCRYPTED_PATH_DIR)
36
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
37
+ encrypted_entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + ENCRYPTED_PATH_DIR)
37
38
  entries.sort!
38
39
  assert_equal 4, entries.size
39
40
  assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
@@ -65,9 +66,9 @@ module LitleOnline
65
66
  end
66
67
 
67
68
  def test_full_flow
68
- ENV['litle_deleteBatchFiles'] = 'false'
69
- config_dir = ENV['LITLE_CONFIG_DIR']
70
- ENV['LITLE_CONFIG_DIR'] = '/tmp/pgp_ruby'
69
+ ENV['cnp_deleteBatchFiles'] = 'false'
70
+ config_dir = ENV['CNP_CONFIG_DIR']
71
+ ENV['CNP_CONFIG_DIR'] = '/tmp/pgp_ruby'
71
72
 
72
73
  saleHash = {
73
74
  'reportGroup'=>'Planets',
@@ -83,11 +84,11 @@ module LitleOnline
83
84
 
84
85
  dir = '/tmp'
85
86
 
86
- request = LitleRequest.new()
87
- ENV['LITLE_CONFIG_DIR'] = config_dir
88
- request.create_new_litle_request(dir + LITLE_SDK_TEST_FOLDER)
87
+ request = CnpRequest.new()
88
+ ENV['CNP_CONFIG_DIR'] = config_dir
89
+ request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
89
90
 
90
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
91
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
91
92
  entries.sort!
92
93
 
93
94
  assert_equal 4, entries.size
@@ -96,10 +97,10 @@ module LitleOnline
96
97
 
97
98
  #create five batches, each with 10 sales
98
99
  5.times{
99
- batch = LitleBatchRequest.new
100
- batch.create_new_batch(dir + LITLE_SDK_TEST_FOLDER)
100
+ batch = CnpBatchRequest.new
101
+ batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
101
102
 
102
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
103
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
103
104
 
104
105
  assert_equal 6, entries.length
105
106
  entries.sort!
@@ -116,7 +117,7 @@ module LitleOnline
116
117
 
117
118
  #close the batch, indicating we plan to add no more transactions
118
119
  batch.close_batch()
119
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
120
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
120
121
 
121
122
  assert_equal 5, entries.length
122
123
  entries.sort!
@@ -124,26 +125,26 @@ module LitleOnline
124
125
  assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
125
126
  assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
126
127
 
127
- #add the batch to the LitleRequest
128
+ #add the batch to the CnpRequest
128
129
  request.commit_batch(batch)
129
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
130
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
130
131
  assert_equal 4, entries.length
131
132
  entries.sort!
132
133
  assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
133
134
  assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
134
135
  }
135
- #finish the Litle Request, indicating we plan to add no more batches
136
+ #finish the Cnp Request, indicating we plan to add no more batches
136
137
  request.finish_request
137
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
138
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
138
139
  assert_equal 3, entries.length
139
140
  entries.sort!
140
141
  assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+.complete\z/
141
142
 
142
143
  #send the batch files at the given directory over sFTP
143
144
 
144
- request.send_to_litle()
145
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
146
- encrypted_entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER + '/' + ENCRYPTED_PATH_DIR)
145
+ request.send_to_cnp()
146
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
147
+ encrypted_entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + ENCRYPTED_PATH_DIR)
147
148
 
148
149
  assert_equal entries.length, 4
149
150
  entries.sort!
@@ -156,16 +157,16 @@ module LitleOnline
156
157
  #grab the expected number of responses from the sFTP server and save them to the given path
157
158
  request.get_responses_from_server()
158
159
  #process the responses from the server with a listener which applies the given block
159
- request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction| end})
160
+ request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction| end})
160
161
 
161
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
162
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
162
163
 
163
164
  assert_equal 5, entries.length
164
165
  entries.sort!
165
166
  assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{SENT_FILE_SUFFIX}\z/
166
- File.delete(dir + LITLE_SDK_TEST_FOLDER + '/' + entries[3])
167
+ File.delete(dir + CNP_SDK_TEST_FOLDER + '/' + entries[3])
167
168
 
168
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER + '/' + entries[4])
169
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + entries[4])
169
170
  entries.sort!
170
171
  assert_equal 4, entries.length
171
172
  assert_not_nil entries[3] =~ /#{RESPONSE_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}.asc#{RECEIVED_FILE_SUFFIX}.processed\z/
@@ -173,9 +174,9 @@ module LitleOnline
173
174
 
174
175
 
175
176
  def test_full_flow_with_deleteBatchFiles
176
- ENV['litle_deleteBatchFiles'] = 'true'
177
- config_dir = ENV['LITLE_CONFIG_DIR']
178
- ENV['LITLE_CONFIG_DIR'] = '/tmp/pgp_ruby'
177
+ ENV['cnp_deleteBatchFiles'] = 'true'
178
+ config_dir = ENV['CNP_CONFIG_DIR']
179
+ ENV['CNP_CONFIG_DIR'] = '/tmp/pgp_ruby'
179
180
 
180
181
  saleHash = {
181
182
  'reportGroup'=>'Planets',
@@ -191,12 +192,12 @@ module LitleOnline
191
192
 
192
193
  dir = '/tmp'
193
194
 
194
- request = LitleRequest.new()
195
- ENV['LITLE_CONFIG_DIR'] = config_dir
196
- ENV['litle_deleteBatchFiles'] = 'false'
197
- request.create_new_litle_request(dir + LITLE_SDK_TEST_FOLDER)
195
+ request = CnpRequest.new()
196
+ ENV['CNP_CONFIG_DIR'] = config_dir
197
+ ENV['cnp_deleteBatchFiles'] = 'false'
198
+ request.create_new_cnp_request(dir + CNP_SDK_TEST_FOLDER)
198
199
 
199
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
200
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
200
201
  entries.sort!
201
202
 
202
203
  assert_equal 4, entries.size
@@ -205,10 +206,10 @@ module LitleOnline
205
206
 
206
207
  #create five batches, each with 10 sales
207
208
  5.times{
208
- batch = LitleBatchRequest.new
209
- batch.create_new_batch(dir + LITLE_SDK_TEST_FOLDER)
209
+ batch = CnpBatchRequest.new
210
+ batch.create_new_batch(dir + CNP_SDK_TEST_FOLDER)
210
211
 
211
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
212
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
212
213
 
213
214
  assert_equal 6, entries.length
214
215
  entries.sort!
@@ -225,7 +226,7 @@ module LitleOnline
225
226
 
226
227
  #close the batch, indicating we plan to add no more transactions
227
228
  batch.close_batch()
228
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
229
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
229
230
 
230
231
  assert_equal 5, entries.length
231
232
  entries.sort!
@@ -233,26 +234,26 @@ module LitleOnline
233
234
  assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
234
235
  assert_not_nil entries[4] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
235
236
 
236
- #add the batch to the LitleRequest
237
+ #add the batch to the CnpRequest
237
238
  request.commit_batch(batch)
238
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
239
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
239
240
  assert_equal 4, entries.length
240
241
  entries.sort!
241
242
  assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+\z/
242
243
  assert_not_nil entries[3] =~ /#{REQUEST_FILE_PREFIX}\d+_batches\z/
243
244
  }
244
- #finish the Litle Request, indicating we plan to add no more batches
245
+ #finish the Cnp Request, indicating we plan to add no more batches
245
246
  request.finish_request
246
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
247
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
247
248
  assert_equal 3, entries.length
248
249
  entries.sort!
249
250
  assert_not_nil entries[2] =~ /#{REQUEST_FILE_PREFIX}\d+.complete\z/
250
251
 
251
252
  #send the batch files at the given directory over sFTP
252
253
 
253
- request.send_to_litle()
254
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER)
255
- encrypted_entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER + '/' + ENCRYPTED_PATH_DIR)
254
+ request.send_to_cnp()
255
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER)
256
+ encrypted_entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + ENCRYPTED_PATH_DIR)
256
257
 
257
258
  assert_equal 3, entries.length
258
259
  entries.sort!
@@ -264,17 +265,17 @@ module LitleOnline
264
265
  #grab the expected number of responses from the sFTP server and save them to the given path
265
266
  request.get_responses_from_server()
266
267
 
267
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER + '/' + RESPONSE_PATH_DIR)
268
- encrypted_entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER + '/' + RESPONSE_PATH_DIR + ENCRYPTED_PATH_DIR)
268
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + RESPONSE_PATH_DIR)
269
+ encrypted_entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + RESPONSE_PATH_DIR + ENCRYPTED_PATH_DIR)
269
270
  assert_equal 4, entries.length
270
271
  entries.sort!
271
272
  assert_not_nil entries[3] =~ /#{RESPONSE_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}.asc#{RECEIVED_FILE_SUFFIX}\z/
272
273
  assert_equal 2, encrypted_entries.length
273
274
 
274
275
  #process the responses from the server with a listener which applies the given block
275
- request.process_responses({:transaction_listener => LitleOnline::DefaultLitleListener.new do |transaction| end})
276
+ request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction| end})
276
277
 
277
- entries = Dir.entries(dir + LITLE_SDK_TEST_FOLDER + '/' + RESPONSE_PATH_DIR)
278
+ entries = Dir.entries(dir + CNP_SDK_TEST_FOLDER + '/' + RESPONSE_PATH_DIR)
278
279
  assert_equal 3, entries.length
279
280
  entries.sort!
280
281
  assert_not_nil entries[2] =~ /encrypted/
@@ -23,9 +23,9 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
23
  OTHER DEALINGS IN THE SOFTWARE.
24
24
  =end
25
25
 
26
- require File.expand_path("../../../lib/LitleOnline",__FILE__)
26
+ require File.expand_path("../../../lib/CnpOnline",__FILE__)
27
27
  require 'test/unit'
28
- module LitleOnline
28
+ module CnpOnline
29
29
  class TestqueryTransaction < Test::Unit::TestCase
30
30
  def test_queryTransaction
31
31
  hash = {
@@ -40,8 +40,8 @@ module LitleOnline
40
40
  'orderId'=>'65347567',
41
41
  #'origAccountNumber' => '4000000000000001'
42
42
  }
43
- response= LitleOnlineRequest.new.query_Transaction(hash)
44
- assert_equal('000', response.queryTransactionResponse.response)
43
+ response= CnpOnlineRequest.new.query_Transaction(hash)
44
+ assert_equal('150', response.queryTransactionResponse.response)
45
45
  end
46
46
 
47
47
  def test_queryTransaction_valid_enum
@@ -57,7 +57,7 @@ module LitleOnline
57
57
  'orderId'=>'65347567',
58
58
  #'origAccountNumber' => '4000000000000001'
59
59
  }
60
- response= LitleOnlineRequest.new.query_Transaction(hash)
60
+ response= CnpOnlineRequest.new.query_Transaction(hash)
61
61
  assert('000', response.queryTransactionResponse.response)
62
62
  end
63
63
 
@@ -74,7 +74,7 @@ module LitleOnline
74
74
  #'origAccountNumber' => '4000000000000001'
75
75
  }
76
76
  #Get exceptions
77
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.query_Transaction(hash)}
77
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.query_Transaction(hash)}
78
78
  #Test
79
79
  assert(exception.message =~ /Error validating xml data against the schema/)
80
80
  end
@@ -92,7 +92,7 @@ module LitleOnline
92
92
  #'origAccountNumber' => '4000000000000001'
93
93
  }
94
94
  #Get exceptions
95
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.query_Transaction(hash)}
95
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.query_Transaction(hash)}
96
96
  #Test
97
97
  assert(exception.message =~ /Error validating xml data against the schema/)
98
98
  end
@@ -111,7 +111,7 @@ module LitleOnline
111
111
  #'origAccountNumber' => '4000000000000001'
112
112
  }
113
113
  #Get exceptions
114
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.query_Transaction(hash)}
114
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.query_Transaction(hash)}
115
115
  #Test
116
116
  assert(exception.message =~ /Error validating xml data against the schema/)
117
117
  end
@@ -127,7 +127,7 @@ module LitleOnline
127
127
  #'origAccountNumber' => '4000000000000001'
128
128
  }
129
129
  #Get exceptions
130
- exception = assert_raise(RuntimeError){LitleOnlineRequest.new.query_Transaction(hash)}
130
+ exception = assert_raise(RuntimeError){CnpOnlineRequest.new.query_Transaction(hash)}
131
131
  #Test
132
132
  assert(exception.message =~ /Error validating xml data against the schema/)
133
133
  end
@@ -145,7 +145,7 @@ module LitleOnline
145
145
  'orderId'=>'65347567',
146
146
  #'origAccountNumber' => '4000000000000001'
147
147
  }
148
- response= LitleOnlineRequest.new.query_Transaction(hash)
148
+ response= CnpOnlineRequest.new.query_Transaction(hash)
149
149
  assert_equal('152', response.queryTransactionUnavailableResponse.response)
150
150
  end
151
151
  end