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,56 @@
|
|
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
|
+
require 'mocha/setup'
|
28
|
+
module CnpOnline
|
29
|
+
class TestDeactivateReversal < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_simple
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'cnpTxnId' => '5000',
|
37
|
+
'card'=>{
|
38
|
+
'type'=>'GC',
|
39
|
+
'number' =>'400000000000001',
|
40
|
+
'expDate' =>'0150',
|
41
|
+
'pin' => '1234',
|
42
|
+
'cardValidationNum' => '411'
|
43
|
+
},
|
44
|
+
'originalRefCode' => '101',
|
45
|
+
'originalAmount' => '34561',
|
46
|
+
'originalTxnTime' => '2017-01-24T09:00:00',
|
47
|
+
'originalSystemTraceId' => '33',
|
48
|
+
'originalSequenceNumber' => '111111',
|
49
|
+
}
|
50
|
+
|
51
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<cnpTxnId>5000<\/cnpTxnId><card><type>GC<\/type><number>400000000000001<\/number><expDate>0150<\/expDate><cardValidationNum>411<\/cardValidationNum><pin>1234<\/pin><\/card>.*/m), is_a(Hash))
|
52
|
+
CnpOnlineRequest.new.deposit_reversal(hash)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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
|
+
require 'mocha/setup'
|
28
|
+
|
29
|
+
module CnpOnline
|
30
|
+
class TestDepositReversal < Test::Unit::TestCase
|
31
|
+
def test_simple
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'cnpTxnId' => '5000',
|
37
|
+
'card'=>{
|
38
|
+
'type'=>'GC',
|
39
|
+
'number' =>'400000000000001',
|
40
|
+
'expDate' =>'0150',
|
41
|
+
'pin' => '1234',
|
42
|
+
'cardValidationNum' => '411'
|
43
|
+
},
|
44
|
+
'originalRefCode' => '101',
|
45
|
+
'originalAmount' => '34561',
|
46
|
+
'originalTxnTime' => '2017-01-24T09:00:00',
|
47
|
+
'originalSystemTraceId' => '33',
|
48
|
+
'originalSequenceNumber' => '111111',
|
49
|
+
}
|
50
|
+
|
51
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<cnpTxnId>5000<\/cnpTxnId><card><type>GC<\/type><number>400000000000001<\/number><expDate>0150<\/expDate><cardValidationNum>411<\/cardValidationNum><pin>1234<\/pin><\/card>.*/m), is_a(Hash))
|
52
|
+
CnpOnlineRequest.new.deposit_reversal(hash)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,103 @@
|
|
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
|
+
require 'mocha/setup'
|
28
|
+
|
29
|
+
module CnpOnline
|
30
|
+
class Test_echeckCredit < Test::Unit::TestCase
|
31
|
+
def test_echeck_credit_with_both
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'cnpTxnId'=>'123456',
|
37
|
+
'echeckToken' => {'accType'=>'Checking','cnpToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
38
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
39
|
+
}
|
40
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.echeck_credit(hash)}
|
41
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_logged_in_user
|
45
|
+
hash = {
|
46
|
+
'loggedInUser' => 'gdake',
|
47
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets',
|
51
|
+
'cnpTxnId'=>'123456',
|
52
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
53
|
+
}
|
54
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
55
|
+
CnpOnlineRequest.new.echeck_credit(hash)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_echeck_credit_with_orderId_secondary_amount
|
59
|
+
hash = {
|
60
|
+
'orderId' => '12344',
|
61
|
+
'amount' => '2',
|
62
|
+
'secondaryAmount' => '1',
|
63
|
+
'orderSource' => 'ecommerce',
|
64
|
+
'reportGroup' => 'Planets'
|
65
|
+
}
|
66
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
67
|
+
CnpOnlineRequest.new.echeck_credit(hash)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_echeck_credit_with_txnId_secondaryAmount
|
71
|
+
hash = {
|
72
|
+
'merchantId' => '101',
|
73
|
+
'version'=>'8.8',
|
74
|
+
'reportGroup'=>'Planets',
|
75
|
+
'cnpTxnId'=>'123456789101112',
|
76
|
+
'amount'=>'12',
|
77
|
+
'secondaryAmount'=>'1'
|
78
|
+
}
|
79
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<cnpTxnId>123456789101112<\/cnpTxnId>.*?<amount>12<\/amount><secondaryAmount>1<\/secondaryAmount>.*/m), is_a(Hash))
|
80
|
+
CnpOnlineRequest.new.echeck_credit(hash)
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_echeck_credit_with_customIdentifier
|
84
|
+
hash = {
|
85
|
+
'merchantId' => '101',
|
86
|
+
'version'=>'8.8',
|
87
|
+
'reportGroup'=>'Planets',
|
88
|
+
'amount'=>'123',
|
89
|
+
'secondaryAmount'=>'1',
|
90
|
+
'verify'=>'true',
|
91
|
+
'orderId'=>'12345',
|
92
|
+
'orderSource'=>'ecommerce',
|
93
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455','ccdPaymentInformation'=>'12345678901234567890123456789012345678901234567890123456789012345678901234567890'},
|
94
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'},
|
95
|
+
'merchantData'=>{'campaign'=>'camping'},
|
96
|
+
'customIdentifier' =>'identifier',
|
97
|
+
}
|
98
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<customIdentifier>identifier<\/customIdentifier>.*/m), is_a(Hash))
|
99
|
+
CnpOnlineRequest.new.echeck_credit(hash)
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,109 @@
|
|
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
|
+
require 'mocha/setup'
|
28
|
+
module CnpOnline
|
29
|
+
class Test_echeckRedeposit < Test::Unit::TestCase
|
30
|
+
def test_echeck_redeposit_with_both
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'cnpTxnId'=>'123456',
|
36
|
+
'echeckToken' => {'accType'=>'Checking','cnpToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
37
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
38
|
+
}
|
39
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.echeck_redeposit(hash)}
|
40
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_echeck_redeposit_withecheckmissingfield
|
44
|
+
hash = {
|
45
|
+
'merchantId' => '101',
|
46
|
+
'version'=>'8.8',
|
47
|
+
'reportGroup'=>'Planets',
|
48
|
+
'cnpTxnId'=>'123456',
|
49
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','checkNum'=>'123455'}
|
50
|
+
}
|
51
|
+
exception = assert_raise(RuntimeError) {CnpOnlineRequest.new.echeck_redeposit(hash)}
|
52
|
+
assert_match /If echeck is specified, it must have a routingNum/, exception.message
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_echeck_redeposit_with_echeck_token_missing_field
|
56
|
+
hash = {
|
57
|
+
'merchantId' => '101',
|
58
|
+
'version'=>'8.8',
|
59
|
+
'reportGroup'=>'Planets',
|
60
|
+
'cnpTxnId'=>'123456',
|
61
|
+
'echeckToken' => {'accType'=>'Checking','cnpToken'=>'1234565789012','checkNum'=>'123455'}
|
62
|
+
}
|
63
|
+
exception = assert_raise(RuntimeError) {CnpOnlineRequest.new.echeck_redeposit(hash)}
|
64
|
+
assert_match /If echeckToken is specified, it must have a routingNum/, exception.message
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_logged_in_user
|
68
|
+
hash = {
|
69
|
+
'loggedInUser' => 'gdake',
|
70
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
71
|
+
'merchantId' => '101',
|
72
|
+
'version'=>'8.8',
|
73
|
+
'reportGroup'=>'Planets',
|
74
|
+
'cnpTxnId'=>'123456',
|
75
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
76
|
+
}
|
77
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
78
|
+
CnpOnlineRequest.new.echeck_redeposit(hash)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_merchant_data
|
82
|
+
hash = {
|
83
|
+
'merchantData' => {'campaign'=>'camping'},
|
84
|
+
'merchantId' => '101',
|
85
|
+
'version'=>'8.8',
|
86
|
+
'reportGroup'=>'Planets',
|
87
|
+
'cnpTxnId'=>'123456',
|
88
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
89
|
+
}
|
90
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<\/echeck>.*<merchantData>.*<campaign>camping<\/campaign>.*<\/merchantData>/m), is_a(Hash))
|
91
|
+
CnpOnlineRequest.new.echeck_redeposit(hash)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_customIdentifier
|
95
|
+
hash = {
|
96
|
+
'merchantData' => {'campaign'=>'camping'},
|
97
|
+
'customIdentifier' =>'identifier',
|
98
|
+
'merchantId' => '101',
|
99
|
+
'version'=>'8.8',
|
100
|
+
'reportGroup'=>'Planets',
|
101
|
+
'cnpTxnId'=>'123456',
|
102
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
103
|
+
}
|
104
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<customIdentifier>identifier<\/customIdentifier>.*/m), is_a(Hash))
|
105
|
+
CnpOnlineRequest.new.echeck_redeposit(hash)
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,107 @@
|
|
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
|
+
require 'mocha/setup'
|
28
|
+
module CnpOnline
|
29
|
+
class Test_echeckSale < Test::Unit::TestCase
|
30
|
+
|
31
|
+
def test_echeck_sale_with_both
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'cnpTxnId'=>'123456',
|
37
|
+
'echeckToken' => {'accType'=>'Checking','cnpToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
38
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
39
|
+
}
|
40
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.echeck_sale(hash)}
|
41
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_logged_in_user
|
45
|
+
hash = {
|
46
|
+
'loggedInUser' => 'gdake',
|
47
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets',
|
51
|
+
'cnpTxnId'=>'123456',
|
52
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
53
|
+
}
|
54
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
55
|
+
CnpOnlineRequest.new.echeck_sale(hash)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_secondary_amount
|
59
|
+
hash = {
|
60
|
+
'orderId' => '12344',
|
61
|
+
'amount' => '2',
|
62
|
+
'secondaryAmount' => '1',
|
63
|
+
'orderSource' => 'ecommerce',
|
64
|
+
'reportGroup' => 'Planets'
|
65
|
+
}
|
66
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
67
|
+
CnpOnlineRequest.new.echeck_sale(hash)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_echeck_sale_with_secondaryAmount_ccd
|
71
|
+
hash = {
|
72
|
+
'merchantId' => '101',
|
73
|
+
'version'=>'8.8',
|
74
|
+
'reportGroup'=>'Planets',
|
75
|
+
'amount'=>'123',
|
76
|
+
'secondaryAmount'=>'1',
|
77
|
+
'verify'=>'true',
|
78
|
+
'orderId'=>'12345',
|
79
|
+
'orderSource'=>'ecommerce',
|
80
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455','ccdPaymentInformation'=>'12345678901234567890123456789012345678901234567890123456789012345678901234567890'},
|
81
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'}
|
82
|
+
}
|
83
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<amount>123<\/amount><secondaryAmount>1<\/secondaryAmount>.*?<echeck>.*?<ccdPaymentInformation>.*<\/ccdPaymentInformation><\/echeck>.*/m), is_a(Hash))
|
84
|
+
CnpOnlineRequest.new.echeck_sale(hash)
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_echeck_sale_with_customIdentifier
|
88
|
+
hash = {
|
89
|
+
'merchantId' => '101',
|
90
|
+
'version'=>'8.8',
|
91
|
+
'reportGroup'=>'Planets',
|
92
|
+
'amount'=>'123',
|
93
|
+
'secondaryAmount'=>'1',
|
94
|
+
'verify'=>'true',
|
95
|
+
'orderId'=>'12345',
|
96
|
+
'orderSource'=>'ecommerce',
|
97
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455','ccdPaymentInformation'=>'12345678901234567890123456789012345678901234567890123456789012345678901234567890'},
|
98
|
+
'billToAddress'=>{'name'=>'Bob','city'=>'lowell','state'=>'MA','email'=>'cnp.com'},
|
99
|
+
'merchantData'=>{'campaign'=>'camping'},
|
100
|
+
'customIdentifier' =>'identifier',
|
101
|
+
}
|
102
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<customIdentifier>identifier<\/customIdentifier>.*/m), is_a(Hash))
|
103
|
+
CnpOnlineRequest.new.echeck_sale(hash)
|
104
|
+
end
|
105
|
+
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,74 @@
|
|
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
|
+
require 'mocha/setup'
|
28
|
+
module CnpOnline
|
29
|
+
class Test_echeckVerification < Test::Unit::TestCase
|
30
|
+
def test_echeck_verification_with_both
|
31
|
+
hash = {
|
32
|
+
'merchantId' => '101',
|
33
|
+
'version'=>'8.8',
|
34
|
+
'reportGroup'=>'Planets',
|
35
|
+
'id'=>'12345',
|
36
|
+
#'cnpTxnId'=>'123456',
|
37
|
+
'echeckToken' => {'accType'=>'Checking','cnpToken'=>'1234565789012','routingNum'=>'123456789','checkNum'=>'123455'},
|
38
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
39
|
+
}
|
40
|
+
exception = assert_raise(RuntimeError){CnpOnlineRequest.new.echeck_verification(hash)}
|
41
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_logged_in_user
|
45
|
+
hash = {
|
46
|
+
'loggedInUser' => 'gdake',
|
47
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
48
|
+
'merchantId' => '101',
|
49
|
+
'version'=>'8.8',
|
50
|
+
'reportGroup'=>'Planets',
|
51
|
+
'id'=>'12345',
|
52
|
+
#'cnpTxnId'=>'123456',
|
53
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
54
|
+
}
|
55
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
56
|
+
CnpOnlineRequest.new.echeck_verification(hash)
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_merchant_data
|
60
|
+
hash = {
|
61
|
+
'merchantData' => {'campaign'=>'camping'},
|
62
|
+
'merchantId' => '101',
|
63
|
+
'version'=>'8.8',
|
64
|
+
'reportGroup'=>'Planets',
|
65
|
+
'id'=>'12345',
|
66
|
+
#'cnpTxnId'=>'123456',
|
67
|
+
'echeck' => {'accType'=>'Checking','accNum'=>'12345657890','routingNum'=>'123456789','checkNum'=>'123455'}
|
68
|
+
}
|
69
|
+
CnpXmlMapper.expects(:request).with(regexp_matches(/.*<\/echeck>.*<merchantData>.*<campaign>camping<\/campaign>.*<\/merchantData>/m), is_a(Hash))
|
70
|
+
CnpOnlineRequest.new.echeck_verification(hash)
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|