CnpOnline 11.4.0 → 12.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +4 -164
- data/CHANGELOG~ +0 -0
- data/CONTRIBUTORS +0 -2
- data/DESCRIPTION +1 -1
- data/LICENSE +0 -0
- data/README.md +13 -15
- data/Rakefile +3 -2
- data/Rakefile~ +4 -3
- data/SETUP.md +13 -10
- data/bin/Setup.rb +26 -22
- data/bin/sample_batch_driver.rb +15 -15
- data/bin/sample_driver.rb +5 -5
- data/lib/{LitleBatchRequest.rb → CnpBatchRequest.rb} +68 -66
- data/lib/{LitleListeners.rb → CnpListeners.rb} +48 -40
- data/lib/{LitleOnline.rb → CnpOnline.rb} +8 -7
- data/lib/{LitleOnlineRequest.rb → CnpOnlineRequest.rb} +53 -53
- data/lib/{LitleRequest.rb → CnpRequest.rb} +186 -192
- data/lib/{LitleTransaction.rb → CnpTransaction.rb} +53 -52
- data/lib/{LitleXmlMapper.rb → CnpXmlMapper.rb} +7 -7
- data/lib/Communications.rb +8 -7
- data/lib/Configuration.rb +7 -6
- data/lib/EnvironmentVariables.rb +2 -2
- data/lib/XMLFields.rb +98 -108
- data/lib/cacert.pem +0 -0
- data/samples/Auth/CnpAuthReversalTransaction.rb +15 -0
- data/samples/Auth/{LitleAuthorizationTransaction.rb → CnpAuthorizationTransaction.rb} +4 -4
- data/samples/Auth/{LitlePaymentFullLifeCycle.rb → CnpPaymentFullLifeCycle.rb} +11 -11
- data/samples/Batch/AccountUpdate.rb +11 -11
- data/samples/Batch/SampleBatchDriver.rb +16 -16
- data/samples/Capture/{LitleCaptureGivenAuthTransaction.rb → CnpCaptureGivenAuthTransaction.rb} +4 -4
- data/samples/Capture/CnpCaptureTransaction.rb +14 -0
- data/samples/Capture/{LitleForceCaptureTransaction.rb → CnpForceCaptureTransaction.rb} +5 -5
- data/samples/Capture/CnpPartialCapture.rb +16 -0
- data/samples/Credit/CnpCreditTransaction.rb +16 -0
- data/samples/Credit/{LitleRefundTransaction.rb → CnpRefundTransaction.rb} +4 -4
- data/samples/Other/{LitleAvsTransaction.rb → CnpAvsTransaction.rb} +4 -4
- data/samples/Other/CnpVoidTransaction.rb +19 -0
- data/samples/Paypage/FullPaypageLifeCycle.rb +16 -16
- data/samples/Run_all.rb +12 -12
- data/samples/Sale/{LitleSaleTransaction.rb → CnpSaleTransaction.rb} +4 -4
- data/samples/Sale/SampleSaleTransaction.rb +5 -5
- data/test/certification/certTest1_base.rb +104 -103
- data/test/certification/certTest2_authenhanced.rb +90 -88
- data/test/certification/certTest3_authreversal.rb +29 -28
- data/test/certification/certTest4_echeck.rb +22 -20
- data/test/certification/certTest5_token.rb +51 -49
- data/test/certification/certTest_batchAll.rb +60 -60
- data/test/certification/ts_all.rb +1 -1
- data/test/functional/test_activate.rb +9 -8
- data/test/functional/test_activateReversal.rb +5 -5
- data/test/functional/test_auth.rb +31 -30
- data/test/functional/test_authReversal.rb +8 -8
- data/test/functional/test_balanceInquiry.rb +6 -6
- data/test/functional/test_batch.rb +32 -32
- data/test/functional/test_batchStream.rb +14 -14
- data/test/functional/test_cancelSubscription.rb +4 -4
- data/test/functional/test_capture.rb +14 -14
- data/test/functional/test_captureGivenAuth.rb +16 -16
- data/test/functional/test_configuration.rb +26 -26
- data/test/functional/test_createPlan.rb +5 -5
- data/test/functional/test_credit.rb +13 -33
- data/test/functional/test_deactivate.rb +6 -6
- data/test/functional/test_deactivateReversal.rb +5 -5
- data/test/functional/test_depositReversal.rb +5 -5
- data/test/functional/test_echeckCredit.rb +20 -20
- data/test/functional/test_echeckRedeposit.rb +16 -16
- data/test/functional/test_echeckSale.rb +35 -35
- data/test/functional/test_echeckVerification.rb +17 -17
- data/test/functional/test_echeckVoid.rb +4 -4
- data/test/functional/test_forceCapture.rb +21 -21
- data/test/functional/test_fraudCheck.rb +6 -5
- data/test/functional/test_giftCardAuthReversal.rb +5 -5
- data/test/functional/test_giftCardCapture.rb +5 -5
- data/test/functional/test_giftCardCredit.rb +5 -5
- data/test/functional/test_litle_requests.rb +101 -99
- data/test/functional/test_load.rb +6 -6
- data/test/functional/test_loadReversal.rb +5 -5
- data/test/functional/test_override.rb +9 -9
- data/test/functional/{test_pgp_litle_requests.rb → test_pgp_cnp_requests.rb} +61 -60
- data/test/functional/test_queryTransaction.rb +10 -10
- data/test/functional/test_refundReversal.rb +5 -5
- data/test/functional/test_sale.rb +36 -36
- data/test/functional/test_token.rb +10 -10
- data/test/functional/test_unload.rb +6 -6
- data/test/functional/test_unloadReversal.rb +5 -5
- data/test/functional/test_updateCardValidationNumOnToken.rb +4 -4
- data/test/functional/test_updatePlan.rb +4 -4
- data/test/functional/test_updateSubscription.rb +5 -5
- data/test/functional/test_wallet.rb +5 -5
- data/test/functional/test_xmlfields.rb +29 -69
- data/test/functional/ts_all.rb +2 -2
- data/test/unit/test_LitleAUBatch.rb +15 -15
- data/test/unit/test_LitleBatchRequest.rb +42 -76
- data/test/unit/test_LitleOnlineRequest.rb +38 -38
- data/test/unit/test_LitleRequest.rb +47 -47
- data/test/unit/test_LitleTransaction.rb +34 -34
- data/test/unit/test_LitleXmlMapper.rb +27 -27
- data/test/unit/test_activate.rb +8 -8
- data/test/unit/test_activateReversal.rb +5 -5
- data/test/unit/test_auth.rb +43 -43
- data/test/unit/test_authReversal.rb +14 -14
- data/test/unit/test_balanceInquiry.rb +4 -4
- data/test/unit/test_cancelSubscription.rb +4 -4
- data/test/unit/test_capture.rb +20 -20
- data/test/unit/test_captureGivenAuth.rb +22 -22
- data/test/unit/test_createPlan.rb +4 -4
- data/test/unit/test_credit.rb +43 -43
- data/test/unit/test_deactivate.rb +6 -6
- data/test/unit/test_deactivateReversal.rb +5 -5
- data/test/unit/test_depositReversal.rb +5 -5
- data/test/unit/test_echeckCredit.rb +16 -16
- data/test/unit/test_echeckRedeposit.rb +19 -19
- data/test/unit/test_echeckSale.rb +16 -16
- data/test/unit/test_echeckVerification.rb +11 -11
- data/test/unit/test_echeckVoid.rb +8 -8
- data/test/unit/test_forceCapture.rb +19 -19
- data/test/unit/test_fraudCheck.rb +4 -4
- data/test/unit/test_giftCardAuthReversal.rb +5 -5
- data/test/unit/test_giftCardCapture.rb +5 -5
- data/test/unit/test_giftCardCredit.rb +5 -5
- data/test/unit/test_load.rb +4 -4
- data/test/unit/test_loadReversal.rb +5 -5
- data/test/unit/{test_pgp_LitleRequest → test_pgp_CnpRequest.rb} +32 -32
- data/test/unit/test_queryTransaction.rb +8 -8
- data/test/unit/test_refundReversal.rb +5 -5
- data/test/unit/test_sale.rb +64 -64
- data/test/unit/test_token.rb +13 -13
- data/test/unit/test_unload.rb +4 -4
- data/test/unit/test_unloadReversal.rb +5 -5
- data/test/unit/test_updateCardValidationNumOnToken.rb +16 -16
- data/test/unit/test_updatePlan.rb +4 -4
- data/test/unit/test_updateSubscription.rb +11 -11
- data/test/unit/test_wallet.rb +13 -13
- data/test/unit/test_xmlfields.rb +119 -119
- data/test/unit/ts_unit.rb +6 -6
- metadata +35 -26
- data/samples/Auth/LitleAuthReversalTransaction.rb +0 -15
- data/samples/Capture/LitleCaptureTransaction.rb +0 -14
- data/samples/Capture/LitlePartialCapture.rb +0 -16
- data/samples/Credit/LitleCreditTransaction.rb +0 -16
- data/samples/Other/LitleVoidTransaction.rb +0 -19
@@ -19,15 +19,15 @@ 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/
|
22
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
23
23
|
require 'test/unit'
|
24
24
|
require 'fileutils'
|
25
25
|
|
26
|
-
module
|
27
|
-
class
|
26
|
+
module CnpOnline
|
27
|
+
class TestCnpBatchStream < Test::Unit::TestCase
|
28
28
|
|
29
29
|
def setup
|
30
|
-
dir = '/tmp/
|
30
|
+
dir = '/tmp/cnp-sdk-for-ruby-test'
|
31
31
|
FileUtils.rm_rf dir
|
32
32
|
Dir.mkdir dir
|
33
33
|
end
|
@@ -47,10 +47,10 @@ module LitleOnline
|
|
47
47
|
|
48
48
|
dir = '/tmp'
|
49
49
|
|
50
|
-
request =
|
51
|
-
request.
|
50
|
+
request = CnpRequest.new()
|
51
|
+
request.create_new_cnp_request(dir + '/cnp-sdk-for-ruby-test')
|
52
52
|
|
53
|
-
entries = Dir.entries(dir + '/
|
53
|
+
entries = Dir.entries(dir + '/cnp-sdk-for-ruby-test')
|
54
54
|
entries.sort!
|
55
55
|
|
56
56
|
assert_equal 4,entries.size
|
@@ -59,8 +59,8 @@ module LitleOnline
|
|
59
59
|
|
60
60
|
#create five batches, each with 10 sales
|
61
61
|
|
62
|
-
batch =
|
63
|
-
batch.create_new_batch(dir + '/
|
62
|
+
batch = CnpBatchRequest.new
|
63
|
+
batch.create_new_batch(dir + '/cnp-sdk-for-ruby-test')
|
64
64
|
|
65
65
|
cancelSubscriptionHash =
|
66
66
|
{
|
@@ -105,12 +105,12 @@ module LitleOnline
|
|
105
105
|
batch.close_batch()
|
106
106
|
|
107
107
|
|
108
|
-
#add the batch to the
|
108
|
+
#add the batch to the CnpRequest
|
109
109
|
request.commit_batch(batch)
|
110
110
|
|
111
|
-
#finish the
|
111
|
+
#finish the Cnp Request, indicating we plan to add no more batches
|
112
112
|
request.finish_request
|
113
|
-
entries = Dir.entries(dir + '/
|
113
|
+
entries = Dir.entries(dir + '/cnp-sdk-for-ruby-test')
|
114
114
|
assert_equal 3, entries.length
|
115
115
|
entries.sort!
|
116
116
|
assert_not_nil entries[2] =~ /request_\d+.complete\z/
|
@@ -118,7 +118,7 @@ module LitleOnline
|
|
118
118
|
#send the batch files at the given directory over sFTP
|
119
119
|
count = 1
|
120
120
|
begin
|
121
|
-
request.
|
121
|
+
request.send_to_cnp_stream
|
122
122
|
rescue
|
123
123
|
if (count < 3) then
|
124
124
|
count = count + 1
|
@@ -127,7 +127,7 @@ module LitleOnline
|
|
127
127
|
raise
|
128
128
|
end
|
129
129
|
end
|
130
|
-
request.process_responses({:transaction_listener =>
|
130
|
+
request.process_responses({:transaction_listener => CnpOnline::DefaultCnpListener.new do |transaction|
|
131
131
|
type = transaction["type"]
|
132
132
|
|
133
133
|
if(type == "cancelSubscriptionResponse") then
|
@@ -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/
|
25
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
|
28
28
|
#test Authorization Transaction
|
29
|
-
module
|
29
|
+
module CnpOnline
|
30
30
|
class TestCancelSubscription < Test::Unit::TestCase
|
31
31
|
def test_simple_happy
|
32
32
|
hash = {
|
@@ -36,7 +36,7 @@ module LitleOnline
|
|
36
36
|
'subscriptionId' =>'1001'
|
37
37
|
}
|
38
38
|
|
39
|
-
response=
|
39
|
+
response= CnpOnlineRequest.new.cancel_subscription(hash)
|
40
40
|
assert_equal('Valid Format', response.message)
|
41
41
|
end
|
42
42
|
|
@@ -48,7 +48,7 @@ module LitleOnline
|
|
48
48
|
}
|
49
49
|
|
50
50
|
#Get exceptions
|
51
|
-
exception = assert_raise(RuntimeError){
|
51
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.cancel_subscription(hash)}
|
52
52
|
#Test
|
53
53
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
54
54
|
end
|
@@ -22,10 +22,10 @@ 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/
|
25
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
|
28
|
-
module
|
28
|
+
module CnpOnline
|
29
29
|
class Test_capture < Test::Unit::TestCase
|
30
30
|
def test_simple_capture
|
31
31
|
hash = {
|
@@ -33,10 +33,10 @@ module LitleOnline
|
|
33
33
|
'version'=>'8.8',
|
34
34
|
'id'=>'test',
|
35
35
|
'reportGroup'=>'Planets',
|
36
|
-
'
|
36
|
+
'cnpTxnId'=>'123456000',
|
37
37
|
'amount'=>'106',
|
38
38
|
}
|
39
|
-
response=
|
39
|
+
response= CnpOnlineRequest.new.capture(hash)
|
40
40
|
assert_equal('Valid Format', response.message)
|
41
41
|
end
|
42
42
|
|
@@ -47,10 +47,10 @@ module LitleOnline
|
|
47
47
|
'id'=>'test',
|
48
48
|
'reportGroup'=>'Planets',
|
49
49
|
'partial'=>'true',
|
50
|
-
'
|
50
|
+
'cnpTxnId'=>'123456000',
|
51
51
|
'amount'=>'106',
|
52
52
|
}
|
53
|
-
response=
|
53
|
+
response= CnpOnlineRequest.new.capture(hash)
|
54
54
|
assert_equal('Valid Format', response.message)
|
55
55
|
end
|
56
56
|
|
@@ -60,15 +60,15 @@ module LitleOnline
|
|
60
60
|
'version'=>'8.8',
|
61
61
|
'id'=>'test',
|
62
62
|
'reportGroup'=>'Planets',
|
63
|
-
'
|
63
|
+
'cnpTxnId'=>'123456000',
|
64
64
|
'amount'=>'106',
|
65
65
|
'enhancedData'=>{
|
66
|
-
'customerReference'=>'
|
66
|
+
'customerReference'=>'Cnp',
|
67
67
|
'salesTax'=>'50',
|
68
68
|
'deliveryType'=>'TBD'},
|
69
69
|
'payPalOrderComplete'=>'true'
|
70
70
|
}
|
71
|
-
response=
|
71
|
+
response= CnpOnlineRequest.new.capture(hash)
|
72
72
|
assert_equal('Valid Format', response.message)
|
73
73
|
end
|
74
74
|
|
@@ -81,7 +81,7 @@ module LitleOnline
|
|
81
81
|
'pin'=>'3333'
|
82
82
|
}
|
83
83
|
#Get exceptions
|
84
|
-
exception = assert_raise(RuntimeError){
|
84
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.capture(hash)}
|
85
85
|
#Test
|
86
86
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
87
87
|
end
|
@@ -93,12 +93,12 @@ module LitleOnline
|
|
93
93
|
'reportGroup'=>'Planets',
|
94
94
|
'amount'=>'106',
|
95
95
|
'secondaryAmount'=>'20',
|
96
|
-
'
|
96
|
+
'cnpTxnId'=>'1234',
|
97
97
|
'customBilling'=>{
|
98
98
|
'city' =>'boston',
|
99
99
|
'descriptor' => 'card was present',
|
100
100
|
}}
|
101
|
-
response=
|
101
|
+
response= CnpOnlineRequest.new.capture(hash)
|
102
102
|
assert_equal('Valid Format', response.message)
|
103
103
|
end
|
104
104
|
|
@@ -109,10 +109,10 @@ module LitleOnline
|
|
109
109
|
'reportGroup'=>'Planets',
|
110
110
|
'amount'=>'106',
|
111
111
|
'secondaryAmount'=>'20',
|
112
|
-
'
|
112
|
+
'cnpTxnId'=>'123456000',
|
113
113
|
'pin'=>'1234'
|
114
114
|
}
|
115
|
-
response=
|
115
|
+
response= CnpOnlineRequest.new.capture(hash)
|
116
116
|
assert_equal('Valid Format', response.message)
|
117
117
|
end
|
118
118
|
|
@@ -22,10 +22,10 @@ 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/
|
25
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
|
28
|
-
module
|
28
|
+
module CnpOnline
|
29
29
|
class TestcaptureGivenAuth < Test::Unit::TestCase
|
30
30
|
def test_simple_capture_given_auth_with_card
|
31
31
|
hash = {
|
@@ -45,7 +45,7 @@ module LitleOnline
|
|
45
45
|
'number' =>'4100000000000000',
|
46
46
|
'expDate' =>'1210'
|
47
47
|
}}
|
48
|
-
response=
|
48
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
49
49
|
assert_equal('Valid Format', response.message)
|
50
50
|
end
|
51
51
|
|
@@ -63,12 +63,12 @@ module LitleOnline
|
|
63
63
|
'amount'=>'106',
|
64
64
|
'orderSource'=>'ecommerce',
|
65
65
|
'token'=> {
|
66
|
-
'
|
66
|
+
'cnpToken'=>'123456789101112',
|
67
67
|
'expDate'=>'1210',
|
68
68
|
'cardValidationNum'=>'555',
|
69
69
|
'type'=>'VI'
|
70
70
|
}}
|
71
|
-
response=
|
71
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
72
72
|
assert_equal('Valid Format', response.message)
|
73
73
|
end
|
74
74
|
|
@@ -91,7 +91,7 @@ module LitleOnline
|
|
91
91
|
'reportGroup'=>'Planets',
|
92
92
|
'orderId'=>'12344'
|
93
93
|
}
|
94
|
-
response=
|
94
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
95
95
|
assert_equal('Valid Format', response.message)
|
96
96
|
end
|
97
97
|
|
@@ -114,7 +114,7 @@ module LitleOnline
|
|
114
114
|
'number' =>'4100000000000000',
|
115
115
|
'expDate' =>'1210'
|
116
116
|
}}
|
117
|
-
response=
|
117
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
118
118
|
assert_equal('Valid Format', response.message)
|
119
119
|
end
|
120
120
|
|
@@ -130,7 +130,7 @@ module LitleOnline
|
|
130
130
|
'authDate'=>'2002-10-09','authCode'=>'543216',
|
131
131
|
'authAmount'=>'12345'
|
132
132
|
},
|
133
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
133
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'},
|
134
134
|
'processingInstructions'=>{'bypassVelocityCheck'=>'true'},
|
135
135
|
'orderSource'=>'ecommerce',
|
136
136
|
'card'=>{
|
@@ -138,7 +138,7 @@ module LitleOnline
|
|
138
138
|
'number' =>'4100000000000000',
|
139
139
|
'expDate' =>'1210'
|
140
140
|
}}
|
141
|
-
response=
|
141
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
142
142
|
assert_equal('Valid Format', response.message)
|
143
143
|
end
|
144
144
|
|
@@ -166,7 +166,7 @@ module LitleOnline
|
|
166
166
|
'number' =>'4100000000000000',
|
167
167
|
'expDate' =>'1210'
|
168
168
|
}}
|
169
|
-
response=
|
169
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
170
170
|
assert_equal('Valid Format', response.message)
|
171
171
|
end
|
172
172
|
|
@@ -188,7 +188,7 @@ module LitleOnline
|
|
188
188
|
'expDate' =>'1210'
|
189
189
|
}}
|
190
190
|
#Get exceptions
|
191
|
-
exception = assert_raise(RuntimeError){
|
191
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.capture_given_auth(hash)}
|
192
192
|
#Test
|
193
193
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
194
194
|
end
|
@@ -215,7 +215,7 @@ module LitleOnline
|
|
215
215
|
'track2Status'=>'0'
|
216
216
|
}
|
217
217
|
}
|
218
|
-
response=
|
218
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
219
219
|
assert_equal('Valid Format', response.message)
|
220
220
|
end
|
221
221
|
|
@@ -234,12 +234,12 @@ module LitleOnline
|
|
234
234
|
'secondaryAmount'=>'50',
|
235
235
|
'orderSource'=>'ecommerce',
|
236
236
|
'token'=> {
|
237
|
-
'
|
237
|
+
'cnpToken'=>'123456789101112',
|
238
238
|
'expDate'=>'1210',
|
239
239
|
'cardValidationNum'=>'555',
|
240
240
|
'type'=>'VI'
|
241
241
|
}}
|
242
|
-
response=
|
242
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
243
243
|
assert_equal('Valid Format', response.message)
|
244
244
|
end
|
245
245
|
|
@@ -262,7 +262,7 @@ module LitleOnline
|
|
262
262
|
'number' =>'4100000000000001',
|
263
263
|
'expDate' =>'1210'
|
264
264
|
}}
|
265
|
-
response=
|
265
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
266
266
|
assert_equal('Valid Format', response.message)
|
267
267
|
end
|
268
268
|
|
@@ -287,7 +287,7 @@ module LitleOnline
|
|
287
287
|
'originalNetworkTransactionId'=>'987654321098765432109876543210',
|
288
288
|
'originalTransactionAmount'=>'10661'
|
289
289
|
}
|
290
|
-
response=
|
290
|
+
response= CnpOnlineRequest.new.capture_given_auth(hash)
|
291
291
|
assert_equal('Valid Format', response.message)
|
292
292
|
end
|
293
293
|
|
@@ -20,11 +20,11 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
20
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
21
21
|
OTHER DEALINGS IN THE SOFTWARE.
|
22
22
|
=end
|
23
|
-
require File.expand_path("../../../lib/
|
23
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
24
24
|
require 'test/unit'
|
25
25
|
|
26
26
|
|
27
|
-
module
|
27
|
+
module CnpOnline
|
28
28
|
class TestConfiguration < Test::Unit::TestCase
|
29
29
|
#the flag is to judge the data in config file exist or not
|
30
30
|
@@flag=false
|
@@ -42,47 +42,47 @@ module LitleOnline
|
|
42
42
|
|
43
43
|
def test_configuration_mix_file_env
|
44
44
|
#check the env variable override
|
45
|
-
ENV['
|
45
|
+
ENV['cnp_timeout']='80'
|
46
46
|
@config_hash = Configuration.new.config
|
47
47
|
assert_equal('80',@config_hash['timeout'])
|
48
|
-
ENV['
|
48
|
+
ENV['cnp_timeout']=nil
|
49
49
|
end
|
50
50
|
|
51
51
|
|
52
52
|
|
53
53
|
def test_configuration_without_file
|
54
54
|
#set up Env variable
|
55
|
-
ENV['
|
56
|
-
ENV['
|
57
|
-
ENV['
|
58
|
-
ENV['
|
59
|
-
ENV['
|
60
|
-
ENV['
|
61
|
-
ENV['
|
62
|
-
ENV['
|
63
|
-
ENV['
|
64
|
-
ENV['
|
55
|
+
ENV['cnp_user']='isola'
|
56
|
+
ENV['cnp_password']='vinicius'
|
57
|
+
ENV['cnp_currency_merchant_map']='0180'
|
58
|
+
ENV['cnp_url']='basketball@gmail.com'
|
59
|
+
ENV['cnp_proxy_addr']='iwp1.lowell.cnp.com'
|
60
|
+
ENV['cnp_proxy_port']='8080'
|
61
|
+
ENV['cnp_sftp_username']='sdkFire'
|
62
|
+
ENV['cnp_sftp_password']='fire is comming'
|
63
|
+
ENV['cnp_fast_url']='prelive.cnp.com'
|
64
|
+
ENV['cnp_fast_port']='15000'
|
65
65
|
@config_hash = Configuration.new.config
|
66
66
|
assert_equal('isola',@config_hash['user'])
|
67
67
|
assert_equal('vinicius',@config_hash['password'])
|
68
68
|
assert_equal('0180',@config_hash['currency_merchant_map'])
|
69
69
|
assert_equal('basketball@gmail.com',@config_hash['url'])
|
70
|
-
assert_equal('iwp1.lowell.
|
70
|
+
assert_equal('iwp1.lowell.cnp.com',@config_hash['proxy_addr'])
|
71
71
|
assert_equal('8080',@config_hash['proxy_port'])
|
72
72
|
assert_equal('sdkFire',@config_hash['sftp_username'])
|
73
73
|
assert_equal('fire is comming',@config_hash['sftp_password'])
|
74
|
-
assert_equal('prelive.
|
74
|
+
assert_equal('prelive.cnp.com',@config_hash['fast_url'])
|
75
75
|
assert_equal('15000',@config_hash['fast_port'])
|
76
|
-
ENV['
|
77
|
-
ENV['
|
78
|
-
ENV['
|
79
|
-
ENV['
|
80
|
-
ENV['
|
81
|
-
ENV['
|
82
|
-
ENV['
|
83
|
-
ENV['
|
84
|
-
ENV['
|
85
|
-
ENV['
|
76
|
+
ENV['cnp_user']=nil
|
77
|
+
ENV['cnp_password']=nil
|
78
|
+
ENV['cnp_currency_merchant_map']=nil
|
79
|
+
ENV['cnp_url']=nil
|
80
|
+
ENV['cnp_proxy_addr']=nil
|
81
|
+
ENV['cnp_proxy_port']=nil
|
82
|
+
ENV['cnp_sftp_username']=nil
|
83
|
+
ENV['cnp_sftp_password']=nil
|
84
|
+
ENV['cnp_fast_url']=nil
|
85
|
+
ENV['cnp_fast_port']=nil
|
86
86
|
end
|
87
87
|
|
88
88
|
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/
|
25
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
26
26
|
require 'test/unit'
|
27
27
|
|
28
28
|
#test Activate Transaction
|
29
|
-
module
|
29
|
+
module CnpOnline
|
30
30
|
class TestCreatePlan < Test::Unit::TestCase
|
31
31
|
|
32
32
|
def test_simple_happy
|
@@ -45,7 +45,7 @@ def test_simple_happy
|
|
45
45
|
'active'=>'true'
|
46
46
|
}
|
47
47
|
|
48
|
-
response=
|
48
|
+
response= CnpOnlineRequest.new.create_plan(hash)
|
49
49
|
assert_equal('Valid Format', response.message)
|
50
50
|
end
|
51
51
|
|
@@ -65,7 +65,7 @@ def test_simple_happy
|
|
65
65
|
'active'=>'true'
|
66
66
|
}
|
67
67
|
|
68
|
-
response=
|
68
|
+
response= CnpOnlineRequest.new.create_plan(hash)
|
69
69
|
assert_equal('Valid Format', response.message)
|
70
70
|
end
|
71
71
|
|
@@ -79,7 +79,7 @@ def test_simple_happy
|
|
79
79
|
}
|
80
80
|
|
81
81
|
#Get exceptions
|
82
|
-
exception = assert_raise(RuntimeError){
|
82
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.create_plan(hash)}
|
83
83
|
#Test
|
84
84
|
assert(exception.message =~ /Error validating xml data against the schema/)
|
85
85
|
end
|