CnpOnline 12.3.0 → 12.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +12 -0
- data/Rakefile +1 -1
- data/lib/CnpBatchRequest.rb +17 -8
- data/lib/CnpOnline.rb +2 -0
- data/lib/CnpOnlineRequest.rb +30 -2
- data/lib/CnpRequest.rb +24 -4
- data/lib/CnpTransaction.rb +70 -7
- data/lib/CommManager.rb +185 -0
- data/lib/Communications.rb +7 -3
- data/lib/EnvironmentVariables.rb +8 -0
- data/lib/RequestTarget.rb +10 -0
- data/lib/XMLFields.rb +148 -11
- data/out/production/cnp-sdk-for-ruby/CnpBatchRequest.rb +787 -0
- data/out/production/cnp-sdk-for-ruby/CnpListeners.rb +265 -0
- data/out/production/cnp-sdk-for-ruby/CnpOnline.rb +65 -0
- data/out/production/cnp-sdk-for-ruby/CnpOnlineRequest.rb +370 -0
- data/out/production/cnp-sdk-for-ruby/CnpRequest.rb +670 -0
- data/out/production/cnp-sdk-for-ruby/CnpTransaction.rb +831 -0
- data/out/production/cnp-sdk-for-ruby/CnpXmlMapper.rb +71 -0
- data/out/production/cnp-sdk-for-ruby/CommManager.rb +185 -0
- data/out/production/cnp-sdk-for-ruby/Communications.rb +90 -0
- data/out/production/cnp-sdk-for-ruby/Configuration.rb +75 -0
- data/out/production/cnp-sdk-for-ruby/EnvironmentVariables.rb +33 -0
- data/out/production/cnp-sdk-for-ruby/RequestTarget.rb +10 -0
- data/out/production/cnp-sdk-for-ruby/Setup.rb +147 -0
- data/out/production/cnp-sdk-for-ruby/XMLFields.rb +2638 -0
- data/out/production/cnp-sdk-for-ruby/cacert.pem +3331 -0
- data/out/production/cnp-sdk-for-ruby/sample_batch_driver.rb +123 -0
- data/out/production/cnp-sdk-for-ruby/sample_driver.rb +49 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest1_base.rb +948 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest2_authenhanced.rb +577 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest3_authreversal.rb +190 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest4_echeck.rb +288 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest5_token.rb +209 -0
- data/out/test/cnp-sdk-for-ruby/certification/certTest_batchAll.rb +610 -0
- data/out/test/cnp-sdk-for-ruby/certification/ts_all.rb +33 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_activate.rb +133 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_activateReversal.rb +73 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_auth.rb +478 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_authReversal.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_balanceInquiry.rb +107 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_batch.rb +264 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_batchStream.rb +154 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_cancelSubscription.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_capture.rb +147 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_captureGivenAuth.rb +352 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_commManager.rb +302 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_configuration.rb +89 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_createPlan.rb +87 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_credit.rb +222 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_ctx.rb +124 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_deactivate.rb +105 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_deactivateReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_depositReversal.rb +70 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckCredit.rb +179 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckRedeposit.rb +117 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckSale.rb +255 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckVerification.rb +160 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_echeckVoid.rb +42 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_fastAccessFunding.rb +177 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_forceCapture.rb +272 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_fraudCheck.rb +76 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardAuthReversal.rb +72 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardCapture.rb +72 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_giftCardCredit.rb +69 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_litle_requests.rb +355 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_load.rb +108 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_loadReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_override.rb +68 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_pgp_cnp_requests.rb +295 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_queryTransaction.rb +154 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_refundReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_sale.rb +459 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_token.rb +137 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_translateToken.rb +203 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_unload.rb +108 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_unloadReversal.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updateCardValidationNumOnToken.rb +44 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updatePlan.rb +61 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_updateSubscription.rb +80 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_wallet.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/functional/test_xmlfields.rb +429 -0
- data/out/test/cnp-sdk-for-ruby/functional/ts_all.rb +69 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleAUBatch.rb +244 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleBatchRequest.rb +791 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleOnlineRequest.rb +253 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleRequest.rb +317 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleTransaction.rb +426 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_LitleXmlMapper.rb +139 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_activate.rb +92 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_activateReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_auth.rb +463 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_authReversal.rb +82 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_balanceInquiry.rb +52 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_cancelSubscription.rb +43 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_capture.rb +99 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_captureGivenAuth.rb +234 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_createPlan.rb +52 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_credit.rb +355 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_deactivate.rb +71 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_deactivateReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_depositReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckCredit.rb +103 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckRedeposit.rb +109 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckSale.rb +107 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckVerification.rb +74 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_echeckVoid.rb +54 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_forceCapture.rb +163 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_fraudCheck.rb +45 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardAuthReversal.rb +58 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardCapture.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_giftCardCredit.rb +57 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_load.rb +53 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_loadReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_pgp_CnpRequest.rb +139 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_queryTransaction.rb +106 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_refundReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_sale.rb +551 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_token.rb +159 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_unload.rb +53 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_unloadReversal.rb +56 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updateCardValidationNumOnToken.rb +80 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updatePlan.rb +45 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_updateSubscription.rb +172 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_wallet.rb +262 -0
- data/out/test/cnp-sdk-for-ruby/unit/test_xmlfields.rb +2930 -0
- data/out/test/cnp-sdk-for-ruby/unit/ts_unit.rb +67 -0
- data/test/certification/certTest2_authenhanced.rb +28 -27
- data/test/functional/test_batch.rb +106 -1
- data/test/functional/test_batchStream.rb +3 -2
- data/test/functional/test_captureGivenAuth.rb +24 -0
- data/test/functional/test_commManager.rb +302 -0
- data/test/functional/test_ctx.rb +124 -0
- data/test/functional/test_fastAccessFunding.rb +21 -0
- data/test/functional/test_forceCapture.rb +21 -0
- data/test/functional/test_xmlfields.rb +20 -1
- metadata +122 -4
@@ -0,0 +1,222 @@
|
|
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/CnpOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
module CnpOnline
|
29
|
+
class TestCredit < Test::Unit::TestCase
|
30
|
+
def test_simple_credit_with_card
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'id' => 'test',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'orderId'=>'12344',
|
37
|
+
'amount'=>'106',
|
38
|
+
'orderSource'=>'ecommerce',
|
39
|
+
'card'=>{
|
40
|
+
'type'=>'VI',
|
41
|
+
'number' =>'4100000000000001',
|
42
|
+
'expDate' =>'1210'
|
43
|
+
}}
|
44
|
+
response= CnpOnlineRequest.new.credit(hash)
|
45
|
+
assert_equal('Valid Format', response.message)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_simple_credit_with_paypal
|
49
|
+
hash = {
|
50
|
+
'merchantId' => '101',
|
51
|
+
'id' => 'test',
|
52
|
+
'version'=>'8.8',
|
53
|
+
'reportGroup'=>'Planets',
|
54
|
+
'amount'=>'106',
|
55
|
+
'orderId'=>'123456',
|
56
|
+
'orderSource'=>'ecommerce',
|
57
|
+
'paypal'=>{
|
58
|
+
'payerId'=>'1234',
|
59
|
+
'transactionId'=>'1234',
|
60
|
+
}}
|
61
|
+
response= CnpOnlineRequest.new.credit(hash)
|
62
|
+
assert_equal('Valid Format', response.message)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_simple_credit_with_secondaryAmount
|
66
|
+
hash = {
|
67
|
+
'merchantId' => '101',
|
68
|
+
'id' => 'test',
|
69
|
+
'version'=>'8.8',
|
70
|
+
'reportGroup'=>'Planets',
|
71
|
+
'amount'=>'106',
|
72
|
+
'secondaryAmount'=>'50',
|
73
|
+
'orderId'=>'123456',
|
74
|
+
'orderSource'=>'ecommerce',
|
75
|
+
'paypal'=>{
|
76
|
+
'payerId'=>'1234',
|
77
|
+
'transactionId'=>'1234',
|
78
|
+
}}
|
79
|
+
response= CnpOnlineRequest.new.credit(hash)
|
80
|
+
assert_equal('Valid Format', response.message)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_credit_with_TxnID_secondaryAmount
|
84
|
+
hash = {
|
85
|
+
'merchantId' => '101',
|
86
|
+
'id' => '102',
|
87
|
+
'version'=>'8.8',
|
88
|
+
'reportGroup'=>'Planets',
|
89
|
+
'amount'=>'106',
|
90
|
+
'secondaryAmount'=>'50',
|
91
|
+
'cnpTxnId'=>'123456'
|
92
|
+
}
|
93
|
+
response= CnpOnlineRequest.new.credit(hash)
|
94
|
+
assert_equal('Valid Format', response.message)
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_fields_out_of_order
|
98
|
+
hash = {
|
99
|
+
'merchantId' => '101',
|
100
|
+
'id' => '102',
|
101
|
+
'version'=>'8.8',
|
102
|
+
'reportGroup'=>'Planets',
|
103
|
+
'orderId'=>'12344',
|
104
|
+
'card'=>{
|
105
|
+
'type'=>'VI',
|
106
|
+
'number' =>'4100000000000001',
|
107
|
+
'expDate' =>'1210'
|
108
|
+
},
|
109
|
+
'orderSource'=>'ecommerce',
|
110
|
+
'amount'=>'106'
|
111
|
+
}
|
112
|
+
response= CnpOnlineRequest.new.credit(hash)
|
113
|
+
assert_equal('Valid Format', response.message)
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_invalid_field
|
117
|
+
hash = {
|
118
|
+
'merchantId' => '101',
|
119
|
+
'id' => '102',
|
120
|
+
'version'=>'8.8',
|
121
|
+
'reportGroup'=>'Planets',
|
122
|
+
'orderId'=>'12344',
|
123
|
+
'amount'=>'106',
|
124
|
+
'orderSource'=>'ecommerce',
|
125
|
+
'card'=>{
|
126
|
+
'NOexistantField' => 'ShouldNotCauseError',
|
127
|
+
'type'=>'VI',
|
128
|
+
'number' =>'4100000000000001',
|
129
|
+
'expDate' =>'1210'
|
130
|
+
}}
|
131
|
+
response= CnpOnlineRequest.new.credit(hash)
|
132
|
+
assert_equal('Valid Format', response.message)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_pay_pal_notes
|
136
|
+
hash = {
|
137
|
+
'merchantId' => '101',
|
138
|
+
'id' => '102',
|
139
|
+
'version'=>'8.8',
|
140
|
+
'reportGroup'=>'Planets',
|
141
|
+
'orderId'=>'12344',
|
142
|
+
'amount'=>'106',
|
143
|
+
'payPalNotes'=>'Hello',
|
144
|
+
'orderSource'=>'ecommerce',
|
145
|
+
'card'=>{
|
146
|
+
'type'=>'VI',
|
147
|
+
'number' =>'4100000000000001',
|
148
|
+
'expDate' =>'1210'
|
149
|
+
}}
|
150
|
+
response= CnpOnlineRequest.new.credit(hash)
|
151
|
+
assert_equal('Valid Format', response.message)
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_simple_credit_with_mpos
|
155
|
+
hash = {
|
156
|
+
'merchantId' => '101',
|
157
|
+
'id' => '102',
|
158
|
+
'version'=>'8.8',
|
159
|
+
'reportGroup'=>'Planets',
|
160
|
+
'orderId'=>'12344',
|
161
|
+
'amount'=>'106',
|
162
|
+
'orderSource'=>'ecommerce',
|
163
|
+
'mpos'=>
|
164
|
+
{
|
165
|
+
'ksn'=>'ksnString',
|
166
|
+
'formatId'=>'30',
|
167
|
+
'encryptedTrack'=>'encryptedTrackString',
|
168
|
+
'track1Status'=>'0',
|
169
|
+
'track2Status'=>'0'
|
170
|
+
}
|
171
|
+
}
|
172
|
+
response= CnpOnlineRequest.new.credit(hash)
|
173
|
+
assert_equal('Valid Format', response.message)
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_simple_credit_with_pin
|
177
|
+
hash = {
|
178
|
+
'merchantId' => '101',
|
179
|
+
'id' => '102',
|
180
|
+
'reportGroup'=>'Planets',
|
181
|
+
'amount'=>'106',
|
182
|
+
'secondaryAmount'=>'20',
|
183
|
+
'cnpTxnId'=>'123456000',
|
184
|
+
'pin'=>'1234'
|
185
|
+
}
|
186
|
+
response= CnpOnlineRequest.new.credit(hash)
|
187
|
+
assert_equal('Valid Format', response.message)
|
188
|
+
assert_equal('000', response.creditResponse.response)
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_simple_credit_with_lodging_info
|
192
|
+
hash = {
|
193
|
+
'merchantId' => '101',
|
194
|
+
'id' => 'test',
|
195
|
+
'version'=>'8.8',
|
196
|
+
'reportGroup'=>'Planets',
|
197
|
+
'orderId'=>'12344',
|
198
|
+
'amount'=>'106',
|
199
|
+
'orderSource'=>'ecommerce',
|
200
|
+
'card'=>{
|
201
|
+
'type'=>'VI',
|
202
|
+
'number' =>'4100000000000001',
|
203
|
+
'expDate' =>'1210'
|
204
|
+
},
|
205
|
+
'lodgingInfo' => {
|
206
|
+
'hotelFolioNumber ' => 'testFolio',
|
207
|
+
'duration' => '111',
|
208
|
+
'customerServicePhone' => 'testPhone1',
|
209
|
+
'programCode' => 'LODGING',
|
210
|
+
'roomRate' => '112233445566',
|
211
|
+
'numAdults' => '11',
|
212
|
+
'propertyLocalPhone' => 'testPhone2',
|
213
|
+
'fireSafetyIndicator' => 'true',
|
214
|
+
'lodgingCharge' => {'name' => 'RESTAURANT'}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
response= CnpOnlineRequest.new.credit(hash)
|
218
|
+
assert_equal('Valid Format', response.message)
|
219
|
+
end
|
220
|
+
|
221
|
+
end
|
222
|
+
end
|
@@ -0,0 +1,124 @@
|
|
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/CnpOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
module CnpOnline
|
29
|
+
class TestCtx < Test::Unit::TestCase
|
30
|
+
|
31
|
+
|
32
|
+
def test_simple_vendor_debit_online
|
33
|
+
hash = {
|
34
|
+
'merchantId' => '101',
|
35
|
+
'id' => 'test',
|
36
|
+
'version'=>'8.8',
|
37
|
+
'reportGroup'=>'Planets',
|
38
|
+
'fundingSubmerchantId' => 'hello',
|
39
|
+
'vendorName' => 'me',
|
40
|
+
'fundsTransferId' => '1234567',
|
41
|
+
'amount'=>'106',
|
42
|
+
'accountInfo' => {
|
43
|
+
"accType" => "Savings",
|
44
|
+
"accNum" => "123",
|
45
|
+
"routingNum" => "888888888",
|
46
|
+
"ccdPaymentInformation" => "asbdccc"
|
47
|
+
}}
|
48
|
+
|
49
|
+
response = CnpOnlineRequest.new.vendor_debit(hash)
|
50
|
+
assert_equal 'Valid Format', response.message
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_simple_vendor_credit_online
|
54
|
+
hash = {
|
55
|
+
'merchantId' => '101',
|
56
|
+
'id' => 'test',
|
57
|
+
'version'=>'8.8',
|
58
|
+
'reportGroup'=>'Planets',
|
59
|
+
'fundingSubmerchantId' => 'hello',
|
60
|
+
'vendorName' => 'me',
|
61
|
+
'fundsTransferId' => '1234567',
|
62
|
+
'amount'=>'106',
|
63
|
+
'accountInfo' => {
|
64
|
+
"accType" => "Savings",
|
65
|
+
"accNum" => "123",
|
66
|
+
"routingNum" => "888888888",
|
67
|
+
"ccdPaymentInformation" => "asbdccc"
|
68
|
+
}}
|
69
|
+
|
70
|
+
response = CnpOnlineRequest.new.vendor_credit(hash)
|
71
|
+
assert_equal 'Valid Format', response.message
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_simple_submerchant_debit_online
|
75
|
+
hash = {
|
76
|
+
'merchantId' => '101',
|
77
|
+
'id' => 'test',
|
78
|
+
'version'=>'8.8',
|
79
|
+
'reportGroup'=>'Planets',
|
80
|
+
'fundingSubmerchantId' => 'hello',
|
81
|
+
'submerchantName' => 'me',
|
82
|
+
'fundsTransferId' => '1234567',
|
83
|
+
'amount'=>'106',
|
84
|
+
'accountInfo' => {
|
85
|
+
"accType" => "Savings",
|
86
|
+
"accNum" => "123",
|
87
|
+
"routingNum" => "888888888",
|
88
|
+
"ccdPaymentInformation" => "asbdccc"
|
89
|
+
},
|
90
|
+
'customerIdentifier' => 'yessum'
|
91
|
+
}
|
92
|
+
|
93
|
+
response = CnpOnlineRequest.new.submerchant_debit(hash)
|
94
|
+
assert_equal 'Valid Format', response.message
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_simple_subermchant_credit_online
|
98
|
+
hash = {
|
99
|
+
'merchantId' => '101',
|
100
|
+
'id' => 'test',
|
101
|
+
'version'=>'8.8',
|
102
|
+
'reportGroup'=>'Planets',
|
103
|
+
'fundingSubmerchantId' => 'hello',
|
104
|
+
'submerchantName' => 'me',
|
105
|
+
'fundsTransferId' => '1234567',
|
106
|
+
'amount'=>'106',
|
107
|
+
'accountInfo' => {
|
108
|
+
"accType" => "Savings",
|
109
|
+
"accNum" => "123",
|
110
|
+
"routingNum" => "888888888",
|
111
|
+
"ccdPaymentInformation" => "asbdccc"
|
112
|
+
},
|
113
|
+
'customerIdentifier' => 'yessum'
|
114
|
+
}
|
115
|
+
|
116
|
+
response = CnpOnlineRequest.new.submerchant_credit(hash)
|
117
|
+
assert_equal 'Valid Format', response.message
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_hello
|
121
|
+
Net::SFTP.start("nufloprftp01.litle.com", "sdkv12txn", :password => "f4Vt2T4A", :non_interactive => true)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -0,0 +1,105 @@
|
|
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/CnpOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
|
28
|
+
#test Deactivate Transaction
|
29
|
+
module CnpOnline
|
30
|
+
class TestDeactivate < Test::Unit::TestCase
|
31
|
+
|
32
|
+
def test_simple_happy
|
33
|
+
hash = {
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'id'=>'test',
|
37
|
+
'reportGroup'=>'Planets',
|
38
|
+
'orderId' =>'1001',
|
39
|
+
'orderSource' =>'ecommerce',
|
40
|
+
'card'=>{
|
41
|
+
'type'=>'GC',
|
42
|
+
'number' =>'4100000000000001',
|
43
|
+
'expDate' =>'1210'
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
response= CnpOnlineRequest.new.deactivate(hash)
|
48
|
+
assert_equal('Valid Format', response.message)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_simple_out_of_order
|
52
|
+
hash = {
|
53
|
+
'merchantId' => '101',
|
54
|
+
'version'=>'8.8',
|
55
|
+
'id'=>'test',
|
56
|
+
'reportGroup'=>'Planets',
|
57
|
+
'orderSource' =>'ecommerce',
|
58
|
+
'orderId' =>'1001',
|
59
|
+
'card'=>{
|
60
|
+
'type'=>'GC',
|
61
|
+
'number' =>'4100000000000001',
|
62
|
+
'expDate' =>'1210'
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
response= CnpOnlineRequest.new.deactivate(hash)
|
67
|
+
assert_equal('Valid Format', response.message)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_simple_error
|
71
|
+
hash = {
|
72
|
+
'merchantId' => '101',
|
73
|
+
'version'=>'8.8',
|
74
|
+
'reportGroup'=>'Planets',
|
75
|
+
'amount' =>'500',
|
76
|
+
}
|
77
|
+
|
78
|
+
#Get exceptions
|
79
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.deactivate(hash)}
|
80
|
+
#Test
|
81
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_CardType_NotGiftCard
|
85
|
+
hash = {
|
86
|
+
'merchantId' => '101',
|
87
|
+
'version'=>'8.8',
|
88
|
+
'id'=>'test',
|
89
|
+
'reportGroup'=>'Planets',
|
90
|
+
'orderId' =>'1001',
|
91
|
+
'orderSource' =>'ecommerce',
|
92
|
+
'card'=>{
|
93
|
+
'type'=>'VI',
|
94
|
+
'number' =>'4100000000000001',
|
95
|
+
'expDate' =>'1210'
|
96
|
+
}
|
97
|
+
}
|
98
|
+
#Get exceptions
|
99
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.deactivate(hash)}
|
100
|
+
#Test
|
101
|
+
assert(exception.message =~ /Error validating xml data against the schema/)
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
end
|