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,577 @@
|
|
1
|
+
require File.expand_path("../../../lib/CnpOnline",__FILE__)
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
module CnpOnline
|
5
|
+
class Cnp_certTest2 < Test::Unit::TestCase
|
6
|
+
#test enhanced data on auth response
|
7
|
+
@@merchant_hash = {
|
8
|
+
'reportGroup'=>'Planets',
|
9
|
+
'merchantId'=>'1288791',
|
10
|
+
'id'=>'test',
|
11
|
+
'url'=> 'https://payments.vantivprelive.com/vap/communicator/online'
|
12
|
+
|
13
|
+
}
|
14
|
+
|
15
|
+
#test 14-31 enhanced data need merchant with smart authorization features.
|
16
|
+
def test_14
|
17
|
+
customer_hash = {
|
18
|
+
'orderId' => '14',
|
19
|
+
'amount' => '3000',
|
20
|
+
'orderSource'=>'ecommerce',
|
21
|
+
'card'=>{
|
22
|
+
'number' =>'4457010200000247',
|
23
|
+
'expDate' => '0812',
|
24
|
+
'type' => 'VI'
|
25
|
+
}
|
26
|
+
}
|
27
|
+
hash = customer_hash.merge(@@merchant_hash)
|
28
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
29
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
30
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
31
|
+
assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type']) #Ruby 1.8.7 has type as an attribute of Object
|
32
|
+
assert_equal('2000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
|
33
|
+
assert_equal('NO', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
|
34
|
+
assert_equal('GIFT', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_15
|
38
|
+
customer_hash = {
|
39
|
+
'orderId' => '15',
|
40
|
+
'amount' => '3000',
|
41
|
+
'orderSource'=>'ecommerce',
|
42
|
+
'card'=>{
|
43
|
+
'number' =>'5500000254444445',
|
44
|
+
'expDate' => '0312',
|
45
|
+
'type' => 'MC'
|
46
|
+
}
|
47
|
+
}
|
48
|
+
hash = customer_hash.merge(@@merchant_hash)
|
49
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
50
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
51
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
52
|
+
assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
|
53
|
+
assert_equal('2000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
|
54
|
+
assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
|
55
|
+
assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_16
|
59
|
+
customer_hash = {
|
60
|
+
'orderId' => '16',
|
61
|
+
'amount' => '3000',
|
62
|
+
'orderSource'=>'ecommerce',
|
63
|
+
'card'=>{
|
64
|
+
'number' =>'5592106621450897',
|
65
|
+
'expDate' => '0312',
|
66
|
+
'type' => 'MC'
|
67
|
+
}
|
68
|
+
}
|
69
|
+
hash = customer_hash.merge(@@merchant_hash)
|
70
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
71
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
72
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
73
|
+
assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
|
74
|
+
assert_equal('0', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
|
75
|
+
assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
|
76
|
+
assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_17
|
80
|
+
customer_hash = {
|
81
|
+
'orderId' => '17',
|
82
|
+
'amount' => '3000',
|
83
|
+
'orderSource'=>'ecommerce',
|
84
|
+
'card'=>{
|
85
|
+
'number' =>'5590409551104142',
|
86
|
+
'expDate' => '0312',
|
87
|
+
'type' => 'MC'
|
88
|
+
}
|
89
|
+
}
|
90
|
+
hash = customer_hash.merge(@@merchant_hash)
|
91
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
92
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
93
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
94
|
+
assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
|
95
|
+
assert_equal('6500', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
|
96
|
+
assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
|
97
|
+
assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_18
|
101
|
+
customer_hash = {
|
102
|
+
'orderId' => '18',
|
103
|
+
'amount' => '3000',
|
104
|
+
'orderSource'=>'ecommerce',
|
105
|
+
'card'=>{
|
106
|
+
'number' =>'5587755665222179',
|
107
|
+
'expDate' => '0312',
|
108
|
+
'type' => 'MC'
|
109
|
+
}
|
110
|
+
}
|
111
|
+
hash = customer_hash.merge(@@merchant_hash)
|
112
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
113
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
114
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
115
|
+
assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
|
116
|
+
assert_equal('12200', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
|
117
|
+
assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
|
118
|
+
assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_19
|
122
|
+
customer_hash = {
|
123
|
+
'orderId' => '19',
|
124
|
+
'amount' => '3000',
|
125
|
+
'orderSource'=>'ecommerce',
|
126
|
+
'card'=>{
|
127
|
+
'number' =>'5445840176552850',
|
128
|
+
'expDate' => '0312',
|
129
|
+
'type' => 'MC'
|
130
|
+
}
|
131
|
+
}
|
132
|
+
hash = customer_hash.merge(@@merchant_hash)
|
133
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
134
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
135
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
136
|
+
assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
|
137
|
+
assert_equal('20000', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
|
138
|
+
assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
|
139
|
+
assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_20
|
143
|
+
customer_hash = {
|
144
|
+
'orderId' => '20',
|
145
|
+
'amount' => '3000',
|
146
|
+
'orderSource'=>'ecommerce',
|
147
|
+
'card'=>{
|
148
|
+
'number' =>'5390016478904678',
|
149
|
+
'expDate' => '0312',
|
150
|
+
'type' => 'MC'
|
151
|
+
}
|
152
|
+
}
|
153
|
+
hash = customer_hash.merge(@@merchant_hash)
|
154
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
155
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
156
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
157
|
+
assert_equal('PREPAID', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource['type'])
|
158
|
+
assert_equal('10050', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.availableBalance)
|
159
|
+
assert_equal('YES', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.reloadable)
|
160
|
+
assert_equal('PAYROLL', auth_response.authorizationResponse.enhancedAuthResponse.fundingSource.prepaidCardType)
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_21
|
164
|
+
customer_hash = {
|
165
|
+
'orderId' => '21',
|
166
|
+
'amount' => '5000',
|
167
|
+
'orderSource'=>'ecommerce',
|
168
|
+
'card'=>{
|
169
|
+
'number' =>'4457010201000246',
|
170
|
+
'expDate' => '0912',
|
171
|
+
'type' => 'VI'
|
172
|
+
}
|
173
|
+
}
|
174
|
+
hash = customer_hash.merge(@@merchant_hash)
|
175
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
176
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
177
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
178
|
+
assert_equal('AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_22
|
182
|
+
customer_hash = {
|
183
|
+
'orderId' => '22',
|
184
|
+
'amount' => '5000',
|
185
|
+
'orderSource'=>'ecommerce',
|
186
|
+
'card'=>{
|
187
|
+
'number' =>'4457010202000245',
|
188
|
+
'expDate' => '1111',
|
189
|
+
'type' => 'VI'
|
190
|
+
}
|
191
|
+
}
|
192
|
+
hash = customer_hash.merge(@@merchant_hash)
|
193
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
194
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
195
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
196
|
+
assert_equal('MASS AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_23
|
200
|
+
customer_hash = {
|
201
|
+
'orderId' => '23',
|
202
|
+
'amount' => '5000',
|
203
|
+
'orderSource'=>'ecommerce',
|
204
|
+
'card'=>{
|
205
|
+
'number' =>'5112010201000109',
|
206
|
+
'expDate' => '0412',
|
207
|
+
'type' => 'MC'
|
208
|
+
}
|
209
|
+
}
|
210
|
+
hash = customer_hash.merge(@@merchant_hash)
|
211
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
212
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
213
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
214
|
+
assert_equal('AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
|
215
|
+
end
|
216
|
+
|
217
|
+
def test_24
|
218
|
+
customer_hash = {
|
219
|
+
'orderId' => '24',
|
220
|
+
'amount' => '5000',
|
221
|
+
'orderSource'=>'ecommerce',
|
222
|
+
'card'=>{
|
223
|
+
'number' =>'5112010202000108',
|
224
|
+
'expDate' => '0812',
|
225
|
+
'type' => 'MC'
|
226
|
+
}
|
227
|
+
}
|
228
|
+
hash = customer_hash.merge(@@merchant_hash)
|
229
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
230
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
231
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
232
|
+
assert_equal('MASS AFFLUENT', auth_response.authorizationResponse.enhancedAuthResponse.affluence)
|
233
|
+
end
|
234
|
+
|
235
|
+
def test_25
|
236
|
+
customer_hash = {
|
237
|
+
'orderId' => '25',
|
238
|
+
'amount' => '5000',
|
239
|
+
'orderSource'=>'ecommerce',
|
240
|
+
'card'=>{
|
241
|
+
'number' =>'4100204446270000',
|
242
|
+
'expDate' => '1112',
|
243
|
+
'type' => 'VI'}
|
244
|
+
}
|
245
|
+
hash = customer_hash.merge(@@merchant_hash)
|
246
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
247
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
248
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
249
|
+
assert_equal('BRA', auth_response.authorizationResponse.enhancedAuthResponse.issuerCountry)
|
250
|
+
end
|
251
|
+
|
252
|
+
# test 26-31 healthcare iias
|
253
|
+
def test_26
|
254
|
+
customer_hash = {
|
255
|
+
'orderId' => '26',
|
256
|
+
'amount' => '18698',
|
257
|
+
'orderSource'=>'ecommerce',
|
258
|
+
'card'=>{
|
259
|
+
'number' =>'5194560012341234',
|
260
|
+
'expDate' => '1212',
|
261
|
+
'type' => 'MC'},
|
262
|
+
'allowPartialAuth' => 'true',
|
263
|
+
'healthcareIIAS' => {
|
264
|
+
'healthcareAmounts' => {
|
265
|
+
'totalHealthcareAmount' =>'20000'
|
266
|
+
},
|
267
|
+
'IIASFlag' => 'Y'
|
268
|
+
}
|
269
|
+
}
|
270
|
+
hash = customer_hash.merge(@@merchant_hash)
|
271
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
272
|
+
assert_equal('341', auth_response.authorizationResponse.response)
|
273
|
+
assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
|
274
|
+
end
|
275
|
+
|
276
|
+
def test_27
|
277
|
+
customer_hash = {
|
278
|
+
'orderId' => '27',
|
279
|
+
'amount' => '18698',
|
280
|
+
'orderSource'=>'ecommerce',
|
281
|
+
'card'=>{
|
282
|
+
'number' =>'5194560012341234',
|
283
|
+
'expDate' => '1212',
|
284
|
+
'type' => 'MC'},
|
285
|
+
'allowPartialAuth' => 'true',
|
286
|
+
'healthcareIIAS' => {
|
287
|
+
'healthcareAmounts' => {
|
288
|
+
'totalHealthcareAmount' =>'15000',
|
289
|
+
'RxAmount' => '16000'
|
290
|
+
},
|
291
|
+
'IIASFlag' => 'Y'
|
292
|
+
}
|
293
|
+
}
|
294
|
+
hash = customer_hash.merge(@@merchant_hash)
|
295
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
296
|
+
assert_equal('341', auth_response.authorizationResponse.response)
|
297
|
+
assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
|
298
|
+
end
|
299
|
+
|
300
|
+
def test_28
|
301
|
+
customer_hash = {
|
302
|
+
'orderId' => '28',
|
303
|
+
'amount' => '15000',
|
304
|
+
'orderSource'=>'ecommerce',
|
305
|
+
'card'=>{
|
306
|
+
'number' =>'5194560012341234',
|
307
|
+
'expDate' => '1212',
|
308
|
+
'type' => 'MC'},
|
309
|
+
'allowPartialAuth' => 'true',
|
310
|
+
'healthcareIIAS' => {
|
311
|
+
'healthcareAmounts' => {
|
312
|
+
'totalHealthcareAmount' =>'15000',
|
313
|
+
'RxAmount' => '3698'
|
314
|
+
},
|
315
|
+
'IIASFlag' => 'Y'
|
316
|
+
}
|
317
|
+
}
|
318
|
+
hash = customer_hash.merge(@@merchant_hash)
|
319
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
320
|
+
assert_equal('000', auth_response.authorizationResponse.response)
|
321
|
+
assert_equal('Approved', auth_response.authorizationResponse.message)
|
322
|
+
end
|
323
|
+
|
324
|
+
def test_29
|
325
|
+
customer_hash = {
|
326
|
+
'orderId' => '29',
|
327
|
+
'amount' => '18699',
|
328
|
+
'orderSource'=>'ecommerce',
|
329
|
+
'card'=>{
|
330
|
+
'number' =>'4024720001231239',
|
331
|
+
'expDate' => '1212',
|
332
|
+
'type' => 'VI'},
|
333
|
+
'allowPartialAuth' => 'true',
|
334
|
+
'healthcareIIAS' => {
|
335
|
+
'healthcareAmounts' => {
|
336
|
+
'totalHealthcareAmount' =>'31000',
|
337
|
+
'RxAmount' => '1000',
|
338
|
+
'visionAmount' => '19901',
|
339
|
+
'clinicOtherAmount' => '9050',
|
340
|
+
'dentalAmount' => '1049'
|
341
|
+
},
|
342
|
+
'IIASFlag' => 'Y'
|
343
|
+
}
|
344
|
+
}
|
345
|
+
hash = customer_hash.merge(@@merchant_hash)
|
346
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
347
|
+
assert_equal('341', auth_response.authorizationResponse.response)
|
348
|
+
assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
|
349
|
+
end
|
350
|
+
|
351
|
+
def test_30
|
352
|
+
customer_hash = {
|
353
|
+
'orderId' => '30',
|
354
|
+
'amount' => '20000',
|
355
|
+
'orderSource'=>'ecommerce',
|
356
|
+
'card'=>{
|
357
|
+
'number' =>'4024720001231239',
|
358
|
+
'expDate' => '1212',
|
359
|
+
'type' => 'VI'},
|
360
|
+
'allowPartialAuth' => 'true',
|
361
|
+
'healthcareIIAS' => {
|
362
|
+
'healthcareAmounts' => {
|
363
|
+
'totalHealthcareAmount' =>'20000',
|
364
|
+
'RxAmount' => '1000',
|
365
|
+
'visionAmount' => '19901',
|
366
|
+
'clinicOtherAmount' => '9050',
|
367
|
+
'dentalAmount' => '1049'
|
368
|
+
},
|
369
|
+
'IIASFlag' => 'Y'
|
370
|
+
}
|
371
|
+
}
|
372
|
+
hash = customer_hash.merge(@@merchant_hash)
|
373
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
374
|
+
assert_equal('341', auth_response.authorizationResponse.response)
|
375
|
+
assert_equal('Invalid healthcare amounts', auth_response.authorizationResponse.message)
|
376
|
+
end
|
377
|
+
|
378
|
+
def test_31
|
379
|
+
customer_hash = {
|
380
|
+
'orderId' => '31',
|
381
|
+
'amount' => '25000',
|
382
|
+
'orderSource'=>'ecommerce',
|
383
|
+
'card'=>{
|
384
|
+
'number' =>'4024720001231239',
|
385
|
+
'expDate' => '1212',
|
386
|
+
'type' => 'VI'},
|
387
|
+
'allowPartialAuth' => 'true',
|
388
|
+
'healthcareIIAS' => {
|
389
|
+
'healthcareAmounts' => {
|
390
|
+
'totalHealthcareAmount' =>'18699',
|
391
|
+
'RxAmount' => '1000',
|
392
|
+
'visionAmount' => '15099'
|
393
|
+
},
|
394
|
+
'IIASFlag' => 'Y'
|
395
|
+
}
|
396
|
+
}
|
397
|
+
hash = customer_hash.merge(@@merchant_hash)
|
398
|
+
auth_response = CnpOnlineRequest.new.authorization(hash)
|
399
|
+
assert_equal('010', auth_response.authorizationResponse.response)
|
400
|
+
assert_equal('Partially Approved', auth_response.authorizationResponse.message)
|
401
|
+
assert_equal('18699', auth_response.authorizationResponse.approvedAmount)
|
402
|
+
end
|
403
|
+
|
404
|
+
def test_32
|
405
|
+
customer_hash = {
|
406
|
+
'orderId' => '32',
|
407
|
+
'amount' => '10010',
|
408
|
+
'orderSource'=>'ecommerce',
|
409
|
+
'billToAddress'=>{
|
410
|
+
'name' => 'John Smith',
|
411
|
+
'addressLine1' => '1 Main St.',
|
412
|
+
'city' => 'Burlington',
|
413
|
+
'state' => 'MA',
|
414
|
+
'zip' => '01803-3747',
|
415
|
+
'country' => 'US'},
|
416
|
+
'card'=>{
|
417
|
+
'number' =>'4457010000000009',
|
418
|
+
'expDate' => '0112',
|
419
|
+
'cardValidationNum' => '349',
|
420
|
+
'type' => 'VI'}
|
421
|
+
}
|
422
|
+
hash = customer_hash.merge(@@merchant_hash)
|
423
|
+
authorization_response = CnpOnlineRequest.new.authorization(hash)
|
424
|
+
assert_equal('000', authorization_response.authorizationResponse.response)
|
425
|
+
assert_equal('Approved', authorization_response.authorizationResponse.message)
|
426
|
+
assert_equal('01', authorization_response.authorizationResponse.fraudResult.avsResult)
|
427
|
+
assert_equal('M', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
|
428
|
+
|
429
|
+
#test 32A
|
430
|
+
capture_hash = {'cnpTxnId' => authorization_response.authorizationResponse.cnpTxnId, 'amount' => '5005'}
|
431
|
+
hash32a = capture_hash.merge(@@merchant_hash)
|
432
|
+
capture_response = CnpOnlineRequest.new.capture(hash32a)
|
433
|
+
assert_equal('000', capture_response.captureResponse.response)
|
434
|
+
|
435
|
+
|
436
|
+
#test 32B
|
437
|
+
authReversal_hash = {'cnpTxnId' => '123456789000'}
|
438
|
+
hash1b = authReversal_hash.merge(@@merchant_hash)
|
439
|
+
authReversal_response = CnpOnlineRequest.new.auth_reversal(hash1b)
|
440
|
+
assert_equal('000', authReversal_response.authReversalResponse.response)
|
441
|
+
|
442
|
+
end
|
443
|
+
|
444
|
+
def test_33
|
445
|
+
customer_hash = {
|
446
|
+
'orderId' => '33',
|
447
|
+
'amount' => '20020',
|
448
|
+
'orderSource'=>'ecommerce',
|
449
|
+
'billToAddress'=>{
|
450
|
+
'name' => 'Mike J. Hammer',
|
451
|
+
'addressLine1' => '2 Main St.',
|
452
|
+
'addressLine2' => 'Apt. 222',
|
453
|
+
'city' => 'Riverside',
|
454
|
+
'state' => 'RI',
|
455
|
+
'zip' => '02915',
|
456
|
+
'country' => 'US'},
|
457
|
+
'card'=>{
|
458
|
+
'number' =>'5112010000000003',
|
459
|
+
'expDate' => '0212',
|
460
|
+
'cardValidationNum' => '261',
|
461
|
+
'type' => 'MC'},
|
462
|
+
'cardholderAuthentication' => {'authenticationValue'=> 'BwABBJQ1AgAAAAAgJDUCAAAAAAA=' }
|
463
|
+
}
|
464
|
+
hash = customer_hash.merge(@@merchant_hash)
|
465
|
+
authorization_response = CnpOnlineRequest.new.authorization(hash)
|
466
|
+
assert_equal('000', authorization_response.authorizationResponse.response)
|
467
|
+
assert_equal('Approved', authorization_response.authorizationResponse.message)
|
468
|
+
assert_equal('22222 ', authorization_response.authorizationResponse.authCode)
|
469
|
+
assert_equal('10', authorization_response.authorizationResponse.fraudResult.avsResult)
|
470
|
+
assert_equal('M', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
|
471
|
+
|
472
|
+
#test 33A
|
473
|
+
authReversal_hash = {'cnpTxnId' => authorization_response.authorizationResponse.cnpTxnId}
|
474
|
+
hash1b = authReversal_hash.merge(@@merchant_hash)
|
475
|
+
authReversal_response = CnpOnlineRequest.new.auth_reversal(hash1b)
|
476
|
+
assert_equal('000', authReversal_response.authReversalResponse.response)
|
477
|
+
|
478
|
+
end
|
479
|
+
|
480
|
+
def test_34
|
481
|
+
customer_hash = {
|
482
|
+
'orderId' => '34',
|
483
|
+
'amount' => '30030',
|
484
|
+
'orderSource'=>'ecommerce',
|
485
|
+
'billToAddress'=>{
|
486
|
+
'name' => 'Eileen Jones',
|
487
|
+
'addressLine1' => '3 Main St.',
|
488
|
+
'city' => 'Bloomfield',
|
489
|
+
'state' => 'CT',
|
490
|
+
'zip' => '06002',
|
491
|
+
'country' => 'US'},
|
492
|
+
'card'=>{
|
493
|
+
'number' =>'6011010000000003',
|
494
|
+
'expDate' => '0312',
|
495
|
+
'cardValidationNum' => '758',
|
496
|
+
'type' => 'DI'},
|
497
|
+
}
|
498
|
+
hash = customer_hash.merge(@@merchant_hash)
|
499
|
+
authorization_response = CnpOnlineRequest.new.authorization(hash)
|
500
|
+
assert_equal('000', authorization_response.authorizationResponse.response)
|
501
|
+
assert_equal('Approved', authorization_response.authorizationResponse.message)
|
502
|
+
assert_equal('33333 ', authorization_response.authorizationResponse.authCode)
|
503
|
+
assert_equal('10', authorization_response.authorizationResponse.fraudResult.avsResult)
|
504
|
+
assert_equal('M', authorization_response.authorizationResponse.fraudResult.cardValidationResult)
|
505
|
+
|
506
|
+
#test 34A
|
507
|
+
authReversal_hash = {'cnpTxnId' => authorization_response.authorizationResponse.cnpTxnId}
|
508
|
+
hash1b = authReversal_hash.merge(@@merchant_hash)
|
509
|
+
authReversal_response = CnpOnlineRequest.new.auth_reversal(hash1b)
|
510
|
+
assert_equal('000', authReversal_response.authReversalResponse.response)
|
511
|
+
|
512
|
+
end
|
513
|
+
|
514
|
+
def test_35
|
515
|
+
customer_hash = {
|
516
|
+
'orderId' => '35',
|
517
|
+
'amount' => '40040',
|
518
|
+
'orderSource'=>'ecommerce',
|
519
|
+
'billToAddress'=>{
|
520
|
+
'name' => 'Bob Black',
|
521
|
+
'addressLine1' => '4 Main St.',
|
522
|
+
'city' => 'Laurel',
|
523
|
+
'state' => 'MD',
|
524
|
+
'zip' => '20708',
|
525
|
+
'country' => 'US'},
|
526
|
+
'card'=>{
|
527
|
+
'number' =>'375001000000005',
|
528
|
+
'expDate' => '0412',
|
529
|
+
'type' => 'AX'}
|
530
|
+
}
|
531
|
+
hash = customer_hash.merge(@@merchant_hash)
|
532
|
+
authorization_response = CnpOnlineRequest.new.authorization(hash)
|
533
|
+
assert_equal('000', authorization_response.authorizationResponse.response)
|
534
|
+
assert_equal('Approved', authorization_response.authorizationResponse.message)
|
535
|
+
assert_equal('44444 ', authorization_response.authorizationResponse.authCode)
|
536
|
+
assert_equal('13', authorization_response.authorizationResponse.fraudResult.avsResult)
|
537
|
+
|
538
|
+
#test 35A
|
539
|
+
capture_hash = {'cnpTxnId' => authorization_response.authorizationResponse.cnpTxnId, 'amount' => '20020'}
|
540
|
+
hash32a = capture_hash.merge(@@merchant_hash)
|
541
|
+
capture_response = CnpOnlineRequest.new.capture(hash32a)
|
542
|
+
assert_equal('000', capture_response.captureResponse.response)
|
543
|
+
|
544
|
+
|
545
|
+
#test 35B
|
546
|
+
authReversal_hash = {'cnpTxnId' => authorization_response.authorizationResponse.cnpTxnId, 'amount' => '20020'}
|
547
|
+
hash1b = authReversal_hash.merge(@@merchant_hash)
|
548
|
+
authReversal_response = CnpOnlineRequest.new.auth_reversal(hash1b)
|
549
|
+
assert_equal('000', authReversal_response.authReversalResponse.response)
|
550
|
+
|
551
|
+
end
|
552
|
+
|
553
|
+
def test_36
|
554
|
+
customer_hash = {
|
555
|
+
'orderId' => '36',
|
556
|
+
'amount' => '20500',
|
557
|
+
'orderSource'=>'ecommerce',
|
558
|
+
'card'=>{
|
559
|
+
'number' =>'375000026600004',
|
560
|
+
'expDate' => '0512',
|
561
|
+
'type' => 'AX'},
|
562
|
+
}
|
563
|
+
hash = customer_hash.merge(@@merchant_hash)
|
564
|
+
authorization_response = CnpOnlineRequest.new.authorization(hash)
|
565
|
+
assert_equal('000', authorization_response.authorizationResponse.response)
|
566
|
+
assert_equal('Approved', authorization_response.authorizationResponse.message)
|
567
|
+
|
568
|
+
#test 36A
|
569
|
+
authReversal_hash = {'cnpTxnId' => '123456789000', 'amount' => '10000'}
|
570
|
+
hash1b = authReversal_hash.merge(@@merchant_hash)
|
571
|
+
authReversal_response = CnpOnlineRequest.new.auth_reversal(hash1b)
|
572
|
+
assert_equal('000', authReversal_response.authReversalResponse.response)
|
573
|
+
|
574
|
+
end
|
575
|
+
|
576
|
+
end
|
577
|
+
end
|