CnpOnline 9.14.0 → 11.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/CHANGELOG +23 -17
- data/CONTRIBUTORS +0 -0
- data/DESCRIPTION +1 -1
- data/LICENSE +1 -1
- data/README.md +5 -3
- data/Rakefile +5 -5
- data/Rakefile~ +5 -5
- data/SETUP.md +3 -3
- data/bin/Setup.rb +59 -41
- data/lib/Communications.rb +3 -3
- data/lib/Configuration.rb +52 -45
- data/lib/EnvironmentVariables.rb +5 -1
- data/lib/LitleBatchRequest.rb +72 -7
- data/lib/LitleListeners.rb +17 -1
- data/lib/LitleOnline.rb +3 -4
- data/lib/LitleOnlineRequest.rb +37 -7
- data/lib/LitleRequest.rb +315 -186
- data/lib/LitleTransaction.rb +212 -85
- data/lib/LitleXmlMapper.rb +4 -2
- data/lib/XMLFields.rb +384 -171
- data/lib/cacert.pem +0 -0
- data/samples/Auth/LitleAuthReversalTransaction.rb +2 -2
- data/samples/Auth/LitleAuthorizationTransaction.rb +1 -0
- data/samples/Auth/LitlePaymentFullLifeCycle.rb +12 -6
- data/samples/Batch/AccountUpdate.rb +1 -0
- data/samples/Batch/SampleBatchDriver.rb +2 -1
- data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +2 -1
- data/samples/Capture/LitleCaptureTransaction.rb +2 -2
- data/samples/Capture/LitleForceCaptureTransaction.rb +2 -1
- data/samples/Capture/LitlePartialCapture.rb +3 -3
- data/samples/Credit/LitleCreditTransaction.rb +2 -2
- data/samples/Credit/LitleRefundTransaction.rb +2 -1
- data/samples/Other/LitleAvsTransaction.rb +2 -1
- data/samples/Other/LitleVoidTransaction.rb +2 -1
- data/samples/Paypage/FullPaypageLifeCycle.rb +7 -2
- data/samples/Run_all.rb +0 -0
- data/samples/Sale/LitleSaleTransaction.rb +2 -1
- data/samples/Sale/SampleSaleTransaction.rb +2 -1
- data/test/certification/certTest1_base.rb +52 -53
- data/test/certification/certTest2_authenhanced.rb +24 -25
- data/test/certification/certTest3_authreversal.rb +23 -26
- data/test/certification/certTest4_echeck.rb +18 -32
- data/test/certification/certTest5_token.rb +105 -106
- data/test/certification/certTest_batchAll.rb +47 -15
- data/test/functional/test_activate.rb +32 -4
- data/test/functional/test_activateReversal.rb +18 -5
- data/test/functional/test_auth.rb +94 -48
- data/test/functional/test_authReversal.rb +4 -1
- data/test/functional/test_balanceInquiry.rb +28 -3
- data/test/functional/test_batchStream.rb +2 -4
- data/test/functional/test_cancelSubscription.rb +2 -2
- data/test/functional/test_capture.rb +21 -14
- data/test/functional/test_captureGivenAuth.rb +15 -6
- data/test/functional/test_createPlan.rb +1 -1
- data/test/functional/test_credit.rb +14 -5
- data/test/functional/test_deactivate.rb +26 -3
- data/test/functional/test_deactivateReversal.rb +18 -5
- data/test/functional/test_depositReversal.rb +31 -19
- data/test/functional/test_echeckCredit.rb +34 -6
- data/test/functional/test_echeckRedeposit.rb +29 -2
- data/test/functional/test_echeckSale.rb +68 -11
- data/test/functional/test_echeckVerification.rb +32 -7
- data/test/functional/test_echeckVoid.rb +2 -1
- data/test/functional/test_forceCapture.rb +20 -6
- data/test/functional/test_fraudCheck.rb +3 -5
- data/test/functional/test_giftCardAuthReversal.rb +72 -0
- data/test/functional/test_giftCardCapture.rb +72 -0
- data/test/functional/test_giftCardCredit.rb +69 -0
- data/test/functional/test_litle_requests.rb +3 -6
- data/test/functional/test_load.rb +27 -3
- data/test/functional/test_loadReversal.rb +18 -5
- data/test/functional/test_override.rb +7 -3
- data/test/functional/test_pgp_litle_requests.rb +294 -0
- data/test/functional/test_queryTransaction.rb +152 -0
- data/test/functional/test_refundReversal.rb +18 -5
- data/test/functional/test_sale.rb +122 -159
- data/test/functional/test_token.rb +17 -11
- data/test/functional/test_unload.rb +27 -3
- data/test/functional/test_unloadReversal.rb +18 -5
- data/test/functional/test_updateCardValidationNumOnToken.rb +1 -0
- data/test/functional/test_updatePlan.rb +2 -1
- data/test/functional/test_updateSubscription.rb +3 -1
- data/test/functional/test_wallet.rb +74 -0
- data/test/functional/test_xmlfields.rb +22 -3
- data/test/functional/ts_all.rb +2 -0
- data/test/unit/test_LitleBatchRequest.rb +53 -5
- data/test/unit/test_LitleOnlineRequest.rb +5 -30
- data/test/unit/test_LitleRequest.rb +7 -6
- data/test/unit/test_LitleTransaction.rb +34 -5
- data/test/unit/test_LitleXmlMapper.rb +3 -0
- data/test/unit/test_activate.rb +22 -2
- data/test/unit/test_activateReversal.rb +15 -3
- data/test/unit/test_auth.rb +11 -9
- data/test/unit/test_balanceInquiry.rb +2 -2
- data/test/unit/test_capture.rb +2 -2
- data/test/unit/test_captureGivenAuth.rb +21 -1
- data/test/unit/test_credit.rb +1 -1
- data/test/unit/test_deactivate.rb +19 -0
- data/test/unit/test_deactivateReversal.rb +15 -3
- data/test/unit/test_depositReversal.rb +17 -5
- data/test/unit/test_echeckCredit.rb +19 -0
- data/test/unit/test_echeckRedeposit.rb +15 -0
- data/test/unit/test_echeckSale.rb +20 -1
- data/test/unit/test_echeckVerification.rb +6 -3
- data/test/unit/test_forceCapture.rb +1 -1
- data/test/unit/test_giftCardAuthReversal.rb +58 -0
- data/test/{functional/test_utf8.rb → unit/test_giftCardCapture.rb} +25 -12
- data/test/unit/test_giftCardCredit.rb +57 -0
- data/test/unit/test_load.rb +2 -2
- data/test/unit/test_loadReversal.rb +15 -3
- data/test/unit/test_pgp_LitleRequest +139 -0
- data/test/unit/test_queryTransaction.rb +105 -0
- data/test/unit/test_refundReversal.rb +15 -3
- data/test/unit/test_sale.rb +23 -3
- data/test/unit/test_token.rb +24 -20
- data/test/unit/test_unload.rb +2 -2
- data/test/unit/test_unloadReversal.rb +15 -3
- data/test/unit/test_wallet.rb +262 -0
- data/test/unit/ts_unit.rb +2 -1
- metadata +81 -100
@@ -32,12 +32,13 @@ module LitleOnline
|
|
32
32
|
hash = {
|
33
33
|
'merchantId' => '101',
|
34
34
|
'version'=>'8.8',
|
35
|
+
'id'=>'test',
|
35
36
|
'reportGroup'=>'Planets',
|
36
37
|
'amount'=>'123456',
|
37
38
|
'orderId'=>'12345',
|
38
39
|
'orderSource'=>'ecommerce',
|
39
40
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
40
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
41
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
41
42
|
}
|
42
43
|
response= LitleOnlineRequest.new.echeck_verification(hash)
|
43
44
|
assert_equal('Valid Format', response.message)
|
@@ -47,12 +48,13 @@ module LitleOnline
|
|
47
48
|
hash = {
|
48
49
|
'merchantId' => '101',
|
49
50
|
'version'=>'8.8',
|
51
|
+
'id'=>'test',
|
50
52
|
'reportGroup'=>'Planets',
|
51
53
|
'amount'=>'123456',
|
52
54
|
'orderId'=>'12345',
|
53
55
|
'orderSource'=>'ecommerce',
|
54
56
|
'echeckToken' => {'accType'=>'Checking','litleToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
55
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
57
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
56
58
|
}
|
57
59
|
response= LitleOnlineRequest.new.echeck_verification(hash)
|
58
60
|
assert_equal('Valid Format', response.message)
|
@@ -62,13 +64,14 @@ module LitleOnline
|
|
62
64
|
hash = {
|
63
65
|
'merchantId' => '101',
|
64
66
|
'version'=>'8.8',
|
67
|
+
'id'=>'test',
|
65
68
|
'reportGroup'=>'Planets',
|
66
69
|
'amount'=>'123',
|
67
70
|
'invalidfield'=>'nonexistant',
|
68
71
|
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
69
72
|
'orderId'=>'12345',
|
70
73
|
'orderSource'=>'ecommerce',
|
71
|
-
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'
|
74
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'}
|
72
75
|
}
|
73
76
|
response= LitleOnlineRequest.new.echeck_verification(hash)
|
74
77
|
assert_equal('Valid Format', response.message)
|
@@ -78,6 +81,7 @@ module LitleOnline
|
|
78
81
|
hash = {
|
79
82
|
'merchantId' => '101',
|
80
83
|
'version'=>'8.8',
|
84
|
+
'id'=>'test',
|
81
85
|
'reportGroup'=>'Planets',
|
82
86
|
'amount'=>'123',
|
83
87
|
'invalidfield'=>'nonexistant',
|
@@ -88,38 +92,41 @@ module LitleOnline
|
|
88
92
|
#Get exceptions
|
89
93
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
|
90
94
|
#Test
|
91
|
-
assert(exception.message =~ /Error validating xml data against the schema/)
|
95
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
92
96
|
end
|
93
97
|
|
94
98
|
def test_no_amount
|
95
99
|
hash = {
|
96
100
|
'merchantId' => '101',
|
97
101
|
'version'=>'8.8',
|
102
|
+
'id'=>'test',
|
98
103
|
'reportGroup'=>'Planets',
|
99
104
|
'orderId'=>'12345'
|
100
105
|
}
|
101
106
|
#Get exceptions
|
102
107
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
|
103
108
|
#Test
|
104
|
-
assert(exception.message =~ /Error validating xml data against the schema/)
|
109
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
105
110
|
end
|
106
111
|
|
107
112
|
def test_no_order_id
|
108
113
|
hash = {
|
109
114
|
'merchantId' => '101',
|
110
115
|
'version'=>'8.8',
|
116
|
+
'id'=>'test',
|
111
117
|
'reportGroup'=>'Planets',
|
112
118
|
}
|
113
119
|
#Get exceptions
|
114
120
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
|
115
121
|
#Test
|
116
|
-
assert(exception.message =~ /Error validating xml data against the schema/)
|
122
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
117
123
|
end
|
118
124
|
|
119
125
|
def test_no_order_source
|
120
126
|
hash = {
|
121
127
|
'merchantId' => '101',
|
122
128
|
'version'=>'8.8',
|
129
|
+
'id'=>'test',
|
123
130
|
'reportGroup'=>'Planets',
|
124
131
|
'amount'=>'123456',
|
125
132
|
'orderId'=>'12345'
|
@@ -127,7 +134,25 @@ module LitleOnline
|
|
127
134
|
#Get exceptions
|
128
135
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.echeck_verification(hash)}
|
129
136
|
#Test
|
130
|
-
assert(exception.message =~ /Error validating xml data against the schema/)
|
137
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_no_litleTxnId
|
141
|
+
hash = {
|
142
|
+
'merchantId' => '101',
|
143
|
+
'version'=>'8.8',
|
144
|
+
'id'=>'test',
|
145
|
+
'reportGroup'=>'Planets',
|
146
|
+
'amount'=>'123',
|
147
|
+
'invalidfield'=>'nonexistant',
|
148
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'litle.com'},
|
149
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'},
|
150
|
+
'orderId'=>'12345',
|
151
|
+
'orderSource'=>'ecommerce',
|
152
|
+
#'litleTxnId'=>'123456',
|
153
|
+
}
|
154
|
+
response= LitleOnlineRequest.new.echeck_verification(hash)
|
155
|
+
assert_equal('Valid Format', response.message)
|
131
156
|
end
|
132
157
|
|
133
158
|
end
|
@@ -30,12 +30,13 @@ module LitleOnline
|
|
30
30
|
def test_simple_echeck_void
|
31
31
|
hash = {
|
32
32
|
'merchantId' => '101',
|
33
|
+
'id' => 'test',
|
33
34
|
'version'=>'8.8',
|
34
35
|
'reportGroup'=>'Planets',
|
35
36
|
'litleTxnId'=>'12345678000',
|
36
37
|
}
|
37
38
|
response= LitleOnlineRequest.new.echeck_void(hash)
|
38
|
-
assert_equal('
|
39
|
+
assert_equal('0', response.response)
|
39
40
|
end
|
40
41
|
end
|
41
42
|
end
|
@@ -30,6 +30,7 @@ module LitleOnline
|
|
30
30
|
def test_simple_force_capture_with_card
|
31
31
|
hash = {
|
32
32
|
'merchantId' => '101',
|
33
|
+
'id' => 'test',
|
33
34
|
'version'=>'8.8',
|
34
35
|
'reportGroup'=>'Planets',
|
35
36
|
'litleTxnId'=>'123456',
|
@@ -42,12 +43,15 @@ module LitleOnline
|
|
42
43
|
'expDate' =>'1210'
|
43
44
|
}}
|
44
45
|
response= LitleOnlineRequest.new.force_capture(hash)
|
45
|
-
|
46
|
+
|
47
|
+
assert_equal('0', response.response)
|
48
|
+
|
46
49
|
end
|
47
50
|
|
48
51
|
def test_simple_force_capture_with_token
|
49
52
|
hash = {
|
50
53
|
'merchantId' => '101',
|
54
|
+
'id' => 'test',
|
51
55
|
'version'=>'8.8',
|
52
56
|
'reportGroup'=>'Planets',
|
53
57
|
'litleTxnId'=>'123456',
|
@@ -67,6 +71,7 @@ module LitleOnline
|
|
67
71
|
def test_fields_out_of_order
|
68
72
|
hash = {
|
69
73
|
'merchantId' => '101',
|
74
|
+
'id' => 'test',
|
70
75
|
'version'=>'8.8',
|
71
76
|
'orderSource'=>'ecommerce',
|
72
77
|
'litleTxnId'=>'123456',
|
@@ -86,6 +91,7 @@ module LitleOnline
|
|
86
91
|
def test_invalid_field
|
87
92
|
hash = {
|
88
93
|
'merchantId' => '101',
|
94
|
+
'id' => 'test',
|
89
95
|
'version'=>'8.8',
|
90
96
|
'reportGroup'=>'Planets',
|
91
97
|
'litleTxnId'=>'123456',
|
@@ -105,6 +111,7 @@ module LitleOnline
|
|
105
111
|
def test_no_order_id
|
106
112
|
hash = {
|
107
113
|
'merchantId' => '101',
|
114
|
+
'id' => 'test',
|
108
115
|
'version'=>'8.8',
|
109
116
|
'reportGroup'=>'Planets',
|
110
117
|
'litleTxnId'=>'123456',
|
@@ -119,12 +126,13 @@ module LitleOnline
|
|
119
126
|
#Get exceptions
|
120
127
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
|
121
128
|
#Test
|
122
|
-
assert(exception.message =~ /Error validating xml data against the schema/)
|
129
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
123
130
|
end
|
124
131
|
|
125
132
|
def test_no_order_source
|
126
133
|
hash = {
|
127
134
|
'merchantId' => '101',
|
135
|
+
'id' => 'test',
|
128
136
|
'version'=>'8.8',
|
129
137
|
'reportGroup'=>'Planets',
|
130
138
|
'litleTxnId'=>'123456',
|
@@ -138,12 +146,13 @@ module LitleOnline
|
|
138
146
|
#Get exceptions
|
139
147
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.force_capture(hash)}
|
140
148
|
#Test
|
141
|
-
assert(exception.message =~ /Error validating xml data against the schema/)
|
149
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
142
150
|
end
|
143
151
|
|
144
152
|
def test_simple_forceCapture_with_mpos
|
145
153
|
hash = {
|
146
154
|
'merchantId' => '101',
|
155
|
+
'id' => 'test',
|
147
156
|
'version'=>'8.8',
|
148
157
|
'reportGroup'=>'Planets',
|
149
158
|
'litleTxnId'=>'123456',
|
@@ -160,12 +169,14 @@ module LitleOnline
|
|
160
169
|
}
|
161
170
|
}
|
162
171
|
response= LitleOnlineRequest.new.force_capture(hash)
|
163
|
-
assert_equal('
|
172
|
+
assert_equal('0', response.response)
|
173
|
+
|
164
174
|
end
|
165
175
|
|
166
176
|
def test_simple_force_capture_with_secondaryAmount
|
167
177
|
hash = {
|
168
178
|
'merchantId' => '101',
|
179
|
+
'id' => 'test',
|
169
180
|
'version'=>'8.8',
|
170
181
|
'reportGroup'=>'Planets',
|
171
182
|
'litleTxnId'=>'123456',
|
@@ -181,10 +192,11 @@ module LitleOnline
|
|
181
192
|
response= LitleOnlineRequest.new.force_capture(hash)
|
182
193
|
assert_equal('000', response.forceCaptureResponse.response)
|
183
194
|
end
|
184
|
-
|
195
|
+
|
185
196
|
def test_simple_force_capture_with_processing_type
|
186
197
|
hash = {
|
187
198
|
'merchantId' => '101',
|
199
|
+
'id' => 'test',
|
188
200
|
'version'=>'8.8',
|
189
201
|
'reportGroup'=>'Planets',
|
190
202
|
'orderId'=>'12344',
|
@@ -197,7 +209,9 @@ module LitleOnline
|
|
197
209
|
'expDate' =>'1210'
|
198
210
|
}}
|
199
211
|
response= LitleOnlineRequest.new.force_capture(hash)
|
200
|
-
|
212
|
+
|
213
|
+
assert_equal('0', response.response)
|
214
|
+
|
201
215
|
end
|
202
216
|
|
203
217
|
end
|
@@ -41,10 +41,9 @@ module LitleOnline
|
|
41
41
|
'customAttribute3' => '5'}
|
42
42
|
}
|
43
43
|
response = LitleOnlineRequest.new.fraud_check_request(hash)
|
44
|
-
assert_equal('
|
45
|
-
assert_equal('Approved', response.fraudCheckResponse.message)
|
44
|
+
assert_equal('0', response.response)
|
46
45
|
assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
|
47
|
-
assert_equal('
|
46
|
+
assert_equal('55', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
|
48
47
|
assert_equal('triggered_rule_1', response.fraudCheckResponse.advancedFraudResults.triggeredRule[0])
|
49
48
|
assert_equal(5, response.fraudCheckResponse.advancedFraudResults.triggeredRule.size())
|
50
49
|
end
|
@@ -60,8 +59,7 @@ module LitleOnline
|
|
60
59
|
}
|
61
60
|
}
|
62
61
|
response = LitleOnlineRequest.new.fraud_check_request(hash)
|
63
|
-
assert_equal('
|
64
|
-
assert_equal('Approved', response.fraudCheckResponse.message)
|
62
|
+
assert_equal('0', response.response)
|
65
63
|
assert_equal('pass', response.fraudCheckResponse.advancedFraudResults.deviceReviewStatus)
|
66
64
|
assert_equal('42', response.fraudCheckResponse.advancedFraudResults.deviceReputationScore)
|
67
65
|
# kind of a hack to get around the variable # of triggered rule elements. ie. 1 element is added as a string not
|
@@ -0,0 +1,72 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person
|
5
|
+
obtaining a copy of this software and associated documentation
|
6
|
+
files (the "Software"), to deal in the Software without
|
7
|
+
restriction, including without limitation the rights to use,
|
8
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the
|
10
|
+
Software is furnished to do so, subject to the following
|
11
|
+
conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
=end
|
25
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test GiftCardAuthReversal Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestGiftCardAuthReversal < Test::Unit::TestCase
|
31
|
+
def test_giftCardAuthReversal
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'id'=>'test',
|
36
|
+
'reportGroup'=>'Planets',
|
37
|
+
'litleTxnId' =>'5000',
|
38
|
+
'card'=>{
|
39
|
+
'type'=>'GC',
|
40
|
+
'number' =>'400000000000000',
|
41
|
+
'expDate' =>'0150',
|
42
|
+
'pin' => '1234',
|
43
|
+
'cardValidationNum' => '411'
|
44
|
+
},
|
45
|
+
'originalRefCode' => '101',
|
46
|
+
'originalAmount' => '34561',
|
47
|
+
'originalTxnTime' => '2017-01-24T09:00:00',
|
48
|
+
'originalSystemTraceId' => '33',
|
49
|
+
'originalSequenceNumber' => '111111',
|
50
|
+
}
|
51
|
+
|
52
|
+
response= LitleOnlineRequest.new.giftCardAuth_reversal(hash)
|
53
|
+
assert_equal('000', response.giftCardAuthReversalResponse.response)
|
54
|
+
assert_equal('0', response.giftCardAuthReversalResponse.giftCardResponse.systemTraceId)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_simple_error
|
58
|
+
hash = {
|
59
|
+
'merchantId' => '101',
|
60
|
+
'version'=>'8.8',
|
61
|
+
'id'=>'test',
|
62
|
+
'reportGroup'=>'Planets',
|
63
|
+
}
|
64
|
+
|
65
|
+
#Get exceptions
|
66
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.giftCardAuth_reversal(hash)}
|
67
|
+
#Test
|
68
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person
|
5
|
+
obtaining a copy of this software and associated documentation
|
6
|
+
files (the "Software"), to deal in the Software without
|
7
|
+
restriction, including without limitation the rights to use,
|
8
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the
|
10
|
+
Software is furnished to do so, subject to the following
|
11
|
+
conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
=end
|
25
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test GiftCardCapture Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestGiftCardCapture < Test::Unit::TestCase
|
31
|
+
def test_giftCardCapture
|
32
|
+
hash = {
|
33
|
+
'captureAmount'=>'1000',
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'id'=>'test',
|
37
|
+
'reportGroup'=>'Planets',
|
38
|
+
'litleTxnId' =>'5000',
|
39
|
+
'card'=>{
|
40
|
+
'type'=>'GC',
|
41
|
+
'number' =>'400000000000000',
|
42
|
+
'expDate' =>'0150',
|
43
|
+
'pin' => '1234',
|
44
|
+
'cardValidationNum' => '411'
|
45
|
+
},
|
46
|
+
'originalRefCode' => '101',
|
47
|
+
'originalAmount' => '34561',
|
48
|
+
'originalTxnTime' => '2017-01-24T09:00:00',
|
49
|
+
|
50
|
+
}
|
51
|
+
|
52
|
+
response= LitleOnlineRequest.new.giftCardCapture(hash)
|
53
|
+
assert_equal('000', response.giftCardCaptureResponse.response)
|
54
|
+
assert_equal('0', response.giftCardCaptureResponse.giftCardResponse.systemTraceId)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_simple_error
|
58
|
+
hash = {
|
59
|
+
'merchantId' => '101',
|
60
|
+
'version'=>'8.8',
|
61
|
+
'id'=>'test',
|
62
|
+
'reportGroup'=>'Planets',
|
63
|
+
}
|
64
|
+
|
65
|
+
#Get exceptions
|
66
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.giftCardCapture(hash)}
|
67
|
+
#Test
|
68
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person
|
5
|
+
obtaining a copy of this software and associated documentation
|
6
|
+
files (the "Software"), to deal in the Software without
|
7
|
+
restriction, including without limitation the rights to use,
|
8
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the
|
10
|
+
Software is furnished to do so, subject to the following
|
11
|
+
conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
=end
|
25
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test GiftCardCapture Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestGiftCardCredit < Test::Unit::TestCase
|
31
|
+
def test_giftCardCredit
|
32
|
+
hash = {
|
33
|
+
'id'=>'test',
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'litleTxnId' => '5000',
|
37
|
+
'creditAmount' =>'1000',
|
38
|
+
#'orderId' =>'1230',
|
39
|
+
'card'=>{
|
40
|
+
'type'=>'GC',
|
41
|
+
'number' =>'400000000000000',
|
42
|
+
'expDate' =>'0150',
|
43
|
+
'pin' => '1234',
|
44
|
+
'cardValidationNum' => '411'
|
45
|
+
},
|
46
|
+
'reportGroup'=>'Planets',
|
47
|
+
}
|
48
|
+
|
49
|
+
response= LitleOnlineRequest.new.giftCardCredit(hash)
|
50
|
+
assert_equal('000', response.giftCardCreditResponse.response)
|
51
|
+
assert_equal('0', response.giftCardCreditResponse.giftCardResponse.systemTraceId)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_simple_error
|
55
|
+
hash = {
|
56
|
+
'merchantId' => '101',
|
57
|
+
'version'=>'8.8',
|
58
|
+
'id'=>'test',
|
59
|
+
'reportGroup'=>'Planets',
|
60
|
+
}
|
61
|
+
|
62
|
+
#Get exceptions
|
63
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.giftCardCredit(hash)}
|
64
|
+
#Test
|
65
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|