VantivCnp 8.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +139 -0
- data/CONTRIBUTORS +2 -0
- data/DESCRIPTION +5 -0
- data/LICENSE +22 -0
- data/README.md +72 -0
- data/Rakefile +89 -0
- data/SETUP.md +46 -0
- data/bin/Setup.rb +124 -0
- data/bin/sample_batch_driver.rb +123 -0
- data/bin/sample_driver.rb +49 -0
- data/lib/Communications.rb +85 -0
- data/lib/Configuration.rb +67 -0
- data/lib/EnvironmentVariables.rb +22 -0
- data/lib/LitleBatchRequest.rb +562 -0
- data/lib/LitleListeners.rb +142 -0
- data/lib/LitleOnline.rb +62 -0
- data/lib/LitleOnlineRequest.rb +297 -0
- data/lib/LitleRequest.rb +494 -0
- data/lib/LitleTransaction.rb +463 -0
- data/lib/LitleXmlMapper.rb +64 -0
- data/lib/XMLFields.rb +1869 -0
- data/lib/cacert.pem +3331 -0
- data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
- data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
- data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
- data/samples/Batch/AccountUpdate.rb +64 -0
- data/samples/Batch/SampleBatchDriver.rb +94 -0
- data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
- data/samples/Capture/LitleCaptureTransaction.rb +14 -0
- data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
- data/samples/Capture/LitlePartialCapture.rb +16 -0
- data/samples/Credit/LitleCreditTransaction.rb +16 -0
- data/samples/Credit/LitleRefundTransaction.rb +29 -0
- data/samples/Other/LitleAvsTransaction.rb +34 -0
- data/samples/Other/LitleVoidTransaction.rb +18 -0
- data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
- data/samples/Run_all.rb +17 -0
- data/samples/Sale/LitleSaleTransaction.rb +29 -0
- data/samples/Sale/SampleSaleTransaction.rb +24 -0
- data/test/certification/certTest1_base.rb +945 -0
- data/test/certification/certTest2_authenhanced.rb +573 -0
- data/test/certification/certTest3_authreversal.rb +185 -0
- data/test/certification/certTest4_echeck.rb +278 -0
- data/test/certification/certTest5_token.rb +204 -0
- data/test/certification/certTest_batchAll.rb +337 -0
- data/test/certification/ts_all.rb +33 -0
- data/test/functional/test_activate.rb +100 -0
- data/test/functional/test_activateReversal.rb +56 -0
- data/test/functional/test_auth.rb +298 -0
- data/test/functional/test_authReversal.rb +69 -0
- data/test/functional/test_balanceInquiry.rb +80 -0
- data/test/functional/test_batch.rb +164 -0
- data/test/functional/test_batchStream.rb +145 -0
- data/test/functional/test_cancelSubscription.rb +55 -0
- data/test/functional/test_capture.rb +84 -0
- data/test/functional/test_captureGivenAuth.rb +235 -0
- data/test/functional/test_configuration.rb +89 -0
- data/test/functional/test_createPlan.rb +85 -0
- data/test/functional/test_credit.rb +174 -0
- data/test/functional/test_deactivate.rb +80 -0
- data/test/functional/test_deactivateReversal.rb +56 -0
- data/test/functional/test_depositReversal.rb +56 -0
- data/test/functional/test_echeckCredit.rb +134 -0
- data/test/functional/test_echeckRedeposit.rb +88 -0
- data/test/functional/test_echeckSale.rb +177 -0
- data/test/functional/test_echeckVerification.rb +127 -0
- data/test/functional/test_echeckVoid.rb +41 -0
- data/test/functional/test_forceCapture.rb +183 -0
- data/test/functional/test_litle_requests.rb +356 -0
- data/test/functional/test_load.rb +82 -0
- data/test/functional/test_loadReversal.rb +56 -0
- data/test/functional/test_override.rb +64 -0
- data/test/functional/test_refundReversal.rb +56 -0
- data/test/functional/test_sale.rb +259 -0
- data/test/functional/test_token.rb +115 -0
- data/test/functional/test_unload.rb +82 -0
- data/test/functional/test_unloadReversal.rb +56 -0
- data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
- data/test/functional/test_updatePlan.rb +58 -0
- data/test/functional/test_updateSubscription.rb +76 -0
- data/test/functional/test_xmlfields.rb +427 -0
- data/test/functional/ts_all.rb +66 -0
- data/test/unit/test_LitleAUBatch.rb +216 -0
- data/test/unit/test_LitleBatchRequest.rb +643 -0
- data/test/unit/test_LitleOnlineRequest.rb +295 -0
- data/test/unit/test_LitleRequest.rb +316 -0
- data/test/unit/test_LitleTransaction.rb +397 -0
- data/test/unit/test_activate.rb +92 -0
- data/test/unit/test_activateReversal.rb +44 -0
- data/test/unit/test_auth.rb +421 -0
- data/test/unit/test_authReversal.rb +82 -0
- data/test/unit/test_balanceInquiry.rb +52 -0
- data/test/unit/test_cancelSubscription.rb +43 -0
- data/test/unit/test_capture.rb +73 -0
- data/test/unit/test_captureGivenAuth.rb +188 -0
- data/test/unit/test_createPlan.rb +52 -0
- data/test/unit/test_credit.rb +342 -0
- data/test/unit/test_deactivate.rb +52 -0
- data/test/unit/test_deactivateReversal.rb +44 -0
- data/test/unit/test_depositReversal.rb +44 -0
- data/test/unit/test_echeckCredit.rb +71 -0
- data/test/unit/test_echeckRedeposit.rb +94 -0
- data/test/unit/test_echeckSale.rb +71 -0
- data/test/unit/test_echeckVerification.rb +71 -0
- data/test/unit/test_echeckVoid.rb +54 -0
- data/test/unit/test_forceCapture.rb +145 -0
- data/test/unit/test_load.rb +53 -0
- data/test/unit/test_loadReversal.rb +44 -0
- data/test/unit/test_refundReversal.rb +44 -0
- data/test/unit/test_sale.rb +465 -0
- data/test/unit/test_token.rb +144 -0
- data/test/unit/test_unload.rb +53 -0
- data/test/unit/test_unloadReversal.rb +44 -0
- data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
- data/test/unit/test_updatePlan.rb +45 -0
- data/test/unit/test_updateSubscription.rb +172 -0
- data/test/unit/test_xmlfields.rb +2930 -0
- data/test/unit/ts_unit.rb +65 -0
- metadata +224 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (c) 2012 Litle & Co.
|
|
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
|
+
require 'mocha/setup'
|
|
28
|
+
|
|
29
|
+
module LitleOnline
|
|
30
|
+
class TestToken < Test::Unit::TestCase
|
|
31
|
+
def test_success_applepay
|
|
32
|
+
hash = {
|
|
33
|
+
'merchantId' => '101',
|
|
34
|
+
'version'=>'8.8',
|
|
35
|
+
'reportGroup'=>'Planets',
|
|
36
|
+
'orderId'=>'12344',
|
|
37
|
+
'applepay'=>{
|
|
38
|
+
'data'=>'user',
|
|
39
|
+
'header'=>{
|
|
40
|
+
'applicationData'=>'454657413164',
|
|
41
|
+
'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
42
|
+
'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
43
|
+
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
44
|
+
},
|
|
45
|
+
'signature' =>'sign',
|
|
46
|
+
'version' =>'12345'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<registerTokenRequest.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/registerTokenRequest>.*?/m), is_a(Hash))
|
|
50
|
+
LitleOnlineRequest.new.register_token_request(hash)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_account_num_and_applepay
|
|
54
|
+
hash = {
|
|
55
|
+
'merchantId' => '101',
|
|
56
|
+
'version'=>'8.8',
|
|
57
|
+
'reportGroup'=>'Planets',
|
|
58
|
+
'orderId'=>'12344',
|
|
59
|
+
'accountNumber'=>'1233456789101112',
|
|
60
|
+
'applepay'=>{
|
|
61
|
+
'data'=>'user',
|
|
62
|
+
'header'=>{
|
|
63
|
+
'applicationData'=>'454657413164',
|
|
64
|
+
'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
65
|
+
'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
|
66
|
+
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
|
67
|
+
},
|
|
68
|
+
'signature' =>'sign',
|
|
69
|
+
'version' =>'12345'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
|
|
73
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def test_account_num_and_paypage
|
|
77
|
+
hash = {
|
|
78
|
+
'merchantId' => '101',
|
|
79
|
+
'version'=>'8.8',
|
|
80
|
+
'reportGroup'=>'Planets',
|
|
81
|
+
'orderId'=>'12344',
|
|
82
|
+
'accountNumber'=>'1233456789101112',
|
|
83
|
+
'paypageRegistrationId'=>'1233456789101112'
|
|
84
|
+
}
|
|
85
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
|
|
86
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def test_echeck_and_Paypage
|
|
90
|
+
hash = {
|
|
91
|
+
'merchantId' => '101',
|
|
92
|
+
'version'=>'8.8',
|
|
93
|
+
'reportGroup'=>'Planets',
|
|
94
|
+
'orderId'=>'12344',
|
|
95
|
+
'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'},
|
|
96
|
+
'paypageRegistrationId'=>'1233456789101112'
|
|
97
|
+
}
|
|
98
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
|
|
99
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def test_echeck_and_Paypage_and_accountnum
|
|
103
|
+
hash = {
|
|
104
|
+
'merchantId' => '101',
|
|
105
|
+
'version'=>'8.8',
|
|
106
|
+
'reportGroup'=>'Planets',
|
|
107
|
+
'orderId'=>'12344',
|
|
108
|
+
'accountNumber'=>'1233456789101112',
|
|
109
|
+
'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'},
|
|
110
|
+
'paypageRegistrationId'=>'1233456789101112'
|
|
111
|
+
}
|
|
112
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
|
|
113
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
def test_token_echeck_missing_required
|
|
117
|
+
hash = {
|
|
118
|
+
'merchantId' => '101',
|
|
119
|
+
'version'=>'8.8',
|
|
120
|
+
'reportGroup'=>'Planets',
|
|
121
|
+
'orderId'=>'12344',
|
|
122
|
+
'echeckForToken'=>{'routingNum'=>'132344565'}
|
|
123
|
+
}
|
|
124
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
|
|
125
|
+
assert_match /If echeckForToken is specified, it must have a accNum/, exception.message
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def test_logged_in_user
|
|
129
|
+
hash = {
|
|
130
|
+
'loggedInUser'=>'gdake',
|
|
131
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
|
132
|
+
'merchantId' => '101',
|
|
133
|
+
'version'=>'8.8',
|
|
134
|
+
'reportGroup'=>'Planets',
|
|
135
|
+
'orderId'=>'12344',
|
|
136
|
+
'echeckForToken'=>{'accNum'=>'12344565','routingNum'=>'123476545'}
|
|
137
|
+
}
|
|
138
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
|
139
|
+
LitleOnlineRequest.new.register_token_request(hash)
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (c) 2012 Litle & Co.
|
|
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
|
+
require 'mocha/setup'
|
|
28
|
+
module LitleOnline
|
|
29
|
+
class TestUnload < Test::Unit::TestCase
|
|
30
|
+
|
|
31
|
+
def test_simple
|
|
32
|
+
hash = {
|
|
33
|
+
'merchantId' => '101',
|
|
34
|
+
'version'=>'8.8',
|
|
35
|
+
'reportGroup'=>'Planets',
|
|
36
|
+
'orderId' => '11',
|
|
37
|
+
'amount' => '500',
|
|
38
|
+
'orderSource'=>'ecommerce',
|
|
39
|
+
'card'=>
|
|
40
|
+
{
|
|
41
|
+
'type'=>'VI',
|
|
42
|
+
'number' =>'4100000000000001',
|
|
43
|
+
'expDate' =>'1210'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<unload reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/unload>.*/m), is_a(Hash))
|
|
48
|
+
LitleOnlineRequest.new.unload_request(hash)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (c) 2012 Litle & Co.
|
|
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
|
+
require 'mocha/setup'
|
|
28
|
+
module LitleOnline
|
|
29
|
+
class TestUnloadReversal < Test::Unit::TestCase
|
|
30
|
+
|
|
31
|
+
def test_simple
|
|
32
|
+
hash = {
|
|
33
|
+
'merchantId' => '101',
|
|
34
|
+
'version'=>'8.8',
|
|
35
|
+
'reportGroup'=>'Planets',
|
|
36
|
+
'litleTxnId' => '5000'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<unloadReversal reportGroup="Planets"><litleTxnId>5000<\/litleTxnId><\/unloadReversal>.*/m), is_a(Hash))
|
|
40
|
+
LitleOnlineRequest.new.unload_reversal(hash)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (c) 2012 Litle & Co.
|
|
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
|
+
require 'mocha/setup'
|
|
28
|
+
module LitleOnline
|
|
29
|
+
class TestUpdateCardValidationNumOnToken < Test::Unit::TestCase
|
|
30
|
+
def test_simple
|
|
31
|
+
hash = {
|
|
32
|
+
'orderId'=>'12344',
|
|
33
|
+
'litleToken'=>'1233456789101112',
|
|
34
|
+
'cardValidationNum'=>'123'
|
|
35
|
+
}
|
|
36
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<orderId>1.*<litleToken>1233456789101112.*<cardValidationNum>123.*/m), is_a(Hash))
|
|
37
|
+
LitleOnlineRequest.new.update_card_validation_num_on_token(hash)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_order_id_is_optional
|
|
41
|
+
hash = {
|
|
42
|
+
'litleToken'=>'1233456789101112',
|
|
43
|
+
'cardValidationNum'=>'123'
|
|
44
|
+
}
|
|
45
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleToken>1233456789101112.*<cardValidationNum>123.*/m), is_a(Hash))
|
|
46
|
+
LitleOnlineRequest.new.update_card_validation_num_on_token(hash)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def test_litle_token_is_required
|
|
50
|
+
hash = {
|
|
51
|
+
'orderId'=>'12344',
|
|
52
|
+
'cardValidationNum'=>'123'
|
|
53
|
+
}
|
|
54
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.update_card_validation_num_on_token(hash)}
|
|
55
|
+
assert_match /If updateCardValidationNumOnToken is specified, it must have a litleToken/, exception.message
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_card_validation_num_is_required
|
|
59
|
+
hash = {
|
|
60
|
+
'orderId'=>'12344',
|
|
61
|
+
'litleToken'=>'1233456789101112'
|
|
62
|
+
}
|
|
63
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.update_card_validation_num_on_token(hash)}
|
|
64
|
+
assert_match /If updateCardValidationNumOnToken is specified, it must have a cardValidationNum/, exception.message
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def test_logged_in_user
|
|
68
|
+
hash = {
|
|
69
|
+
'loggedInUser' => 'gdake',
|
|
70
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
|
71
|
+
'orderId'=>'12344',
|
|
72
|
+
'litleToken'=>'1233456789101112',
|
|
73
|
+
'cardValidationNum'=>'123'
|
|
74
|
+
}
|
|
75
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
|
76
|
+
LitleOnlineRequest.new.update_card_validation_num_on_token(hash)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (c) 2012 Litle & Co.
|
|
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
|
+
require 'mocha/setup'
|
|
28
|
+
module LitleOnline
|
|
29
|
+
class TestUpdatePlan < Test::Unit::TestCase
|
|
30
|
+
|
|
31
|
+
def test_simple
|
|
32
|
+
hash ={
|
|
33
|
+
'merchantId' => '101',
|
|
34
|
+
'version'=>'8.8',
|
|
35
|
+
'reportGroup'=>'Planets',
|
|
36
|
+
'planCode'=>'planCodeString',
|
|
37
|
+
'active'=>'true'
|
|
38
|
+
}
|
|
39
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<updatePlan><planCode>planCodeString<\/planCode><active>true<\/active><\/updatePlan>.*/m), is_a(Hash))
|
|
40
|
+
LitleOnlineRequest.new.update_plan(hash)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
end
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (c) 2012 Litle & Co.
|
|
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
|
+
require 'mocha/setup'
|
|
28
|
+
|
|
29
|
+
module LitleOnline
|
|
30
|
+
class TestUpdateSubscription < Test::Unit::TestCase
|
|
31
|
+
|
|
32
|
+
def test_simple
|
|
33
|
+
hash = {
|
|
34
|
+
'subscriptionId' =>'100',
|
|
35
|
+
'merchantId' => '101',
|
|
36
|
+
'version'=>'8.8',
|
|
37
|
+
}
|
|
38
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<updateSubscription><subscriptionId>100<\/subscriptionId><\/updateSubscription>.*/m), is_a(Hash))
|
|
39
|
+
LitleOnlineRequest.new.update_subscription(hash)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def test_allFields
|
|
43
|
+
hash = {
|
|
44
|
+
'subscriptionId' =>'100',
|
|
45
|
+
'merchantId' => '101',
|
|
46
|
+
'version'=>'8.8',
|
|
47
|
+
'reportGroup'=>'Planets',
|
|
48
|
+
'planCode' => 'planCodeString',
|
|
49
|
+
'billToAddress' =>
|
|
50
|
+
{
|
|
51
|
+
'name' =>'nameString'
|
|
52
|
+
},
|
|
53
|
+
'card'=>
|
|
54
|
+
{
|
|
55
|
+
'type'=>'VI',
|
|
56
|
+
'number' =>'4100000000000001',
|
|
57
|
+
'expDate' =>'1210'
|
|
58
|
+
},
|
|
59
|
+
'billingDate' =>'2014-03-11'
|
|
60
|
+
}
|
|
61
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<updateSubscription><subscriptionId>100<\/subscriptionId><planCode>planCodeString<\/planCode><billToAddress><name>nameString<\/name><\/billToAddress><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><billingDate>2014-03-11<\/billingDate><\/updateSubscription>.*/m), is_a(Hash))
|
|
62
|
+
LitleOnlineRequest.new.update_subscription(hash)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def test_update_subscription_token
|
|
66
|
+
hash = {
|
|
67
|
+
'merchantId' => '101',
|
|
68
|
+
'version'=>'8.8',
|
|
69
|
+
'reportGroup'=>'Planets',
|
|
70
|
+
'subscriptionId' => '1000',
|
|
71
|
+
'planCode' => 'planCodeString',
|
|
72
|
+
'billToAddress' =>
|
|
73
|
+
{
|
|
74
|
+
'name' =>'nameString'
|
|
75
|
+
},
|
|
76
|
+
'token'=>
|
|
77
|
+
{
|
|
78
|
+
'litleToken'=>'litleTokenString'
|
|
79
|
+
},
|
|
80
|
+
'billingDate' =>'2014-03-11',
|
|
81
|
+
'createDiscount'=>[
|
|
82
|
+
{
|
|
83
|
+
'discountCode'=>'discCode1',
|
|
84
|
+
'name'=>'name1',
|
|
85
|
+
'amount'=>'500',
|
|
86
|
+
'startDate'=>'2014-03-12',
|
|
87
|
+
'endDate'=>'2014-03-12',
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
'discountCode'=>'discCode11',
|
|
91
|
+
'name'=>'name11',
|
|
92
|
+
'amount'=>'5000',
|
|
93
|
+
'startDate'=>'2014-03-12',
|
|
94
|
+
'endDate'=>'2014-03-12',
|
|
95
|
+
}],
|
|
96
|
+
'updateDiscount'=>[
|
|
97
|
+
{
|
|
98
|
+
'discountCode'=>'discCode2',
|
|
99
|
+
}],
|
|
100
|
+
'createAddOn'=>[
|
|
101
|
+
{
|
|
102
|
+
'addOnCode'=>'addOnCode1',
|
|
103
|
+
'name'=>'name1',
|
|
104
|
+
'amount'=>'500',
|
|
105
|
+
'startDate'=>'2014-03-12',
|
|
106
|
+
'endDate'=>'2014-03-12',
|
|
107
|
+
}],
|
|
108
|
+
'updateAddOn'=>[
|
|
109
|
+
{
|
|
110
|
+
'addOnCode'=>'addOnCode2',
|
|
111
|
+
}],
|
|
112
|
+
'deleteAddOn'=>[{'addOnCode'=>'addOnCode3'}]
|
|
113
|
+
}
|
|
114
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<updateSubscription><subscriptionId>1000<\/subscriptionId><planCode>planCodeString<\/planCode><billToAddress><name>nameString<\/name><\/billToAddress><token><litleToken>litleTokenString<\/litleToken><\/token><billingDate>2014-03-11<\/billingDate><createDiscount><discountCode>discCode1<\/discountCode><name>name1<\/name><amount>500<\/amount><startDate>2014-03-12<\/startDate><endDate>2014-03-12<\/endDate><\/createDiscount><createDiscount><discountCode>discCode11<\/discountCode><name>name11<\/name><amount>5000<\/amount><startDate>2014-03-12<\/startDate><endDate>2014-03-12<\/endDate><\/createDiscount><updateDiscount><discountCode>discCode2<\/discountCode><\/updateDiscount><createAddOn><addOnCode>addOnCode1<\/addOnCode><name>name1<\/name><amount>500<\/amount><startDate>2014-03-12<\/startDate><endDate>2014-03-12<\/endDate><\/createAddOn><updateAddOn><addOnCode>addOnCode2<\/addOnCode><\/updateAddOn><deleteAddOn><addOnCode>addOnCode3<\/addOnCode><\/deleteAddOn><\/updateSubscription>.*/m), is_a(Hash))
|
|
115
|
+
LitleOnlineRequest.new.update_subscription(hash)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def test_update_subscription_paypage
|
|
119
|
+
hash = {
|
|
120
|
+
'merchantId' => '101',
|
|
121
|
+
'version'=>'8.8',
|
|
122
|
+
'reportGroup'=>'Planets',
|
|
123
|
+
'subscriptionId' => '1000',
|
|
124
|
+
'planCode' => 'planCodeString',
|
|
125
|
+
'billToAddress' =>
|
|
126
|
+
{
|
|
127
|
+
'name' =>'nameString'
|
|
128
|
+
},
|
|
129
|
+
'paypage'=>
|
|
130
|
+
{
|
|
131
|
+
'paypageRegistrationId'=>'paypageString'
|
|
132
|
+
},
|
|
133
|
+
'billingDate' =>'2014-03-11',
|
|
134
|
+
'createDiscount'=>[
|
|
135
|
+
{
|
|
136
|
+
'discountCode'=>'discCode1',
|
|
137
|
+
'name'=>'name1',
|
|
138
|
+
'amount'=>'500',
|
|
139
|
+
'startDate'=>'2014-03-12',
|
|
140
|
+
'endDate'=>'2014-03-12',
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
'discountCode'=>'discCode11',
|
|
144
|
+
'name'=>'name11',
|
|
145
|
+
'amount'=>'5000',
|
|
146
|
+
'startDate'=>'2014-03-12',
|
|
147
|
+
'endDate'=>'2014-03-12',
|
|
148
|
+
}],
|
|
149
|
+
'updateDiscount'=>[
|
|
150
|
+
{
|
|
151
|
+
'discountCode'=>'discCode2',
|
|
152
|
+
}],
|
|
153
|
+
'deleteDiscount'=>[{'discountCode'=>'discCode3'},{'discountCode'=>'discCode33'}],
|
|
154
|
+
'createAddOn'=>[
|
|
155
|
+
{
|
|
156
|
+
'addOnCode'=>'addOnCode1',
|
|
157
|
+
'name'=>'name1',
|
|
158
|
+
'amount'=>'500',
|
|
159
|
+
'startDate'=>'2014-03-12',
|
|
160
|
+
'endDate'=>'2014-03-12',
|
|
161
|
+
}],
|
|
162
|
+
'updateAddOn'=>[
|
|
163
|
+
{
|
|
164
|
+
'addOnCode'=>'addOnCode2',
|
|
165
|
+
}],
|
|
166
|
+
}
|
|
167
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<updateSubscription><subscriptionId>1000<\/subscriptionId><planCode>planCodeString<\/planCode><billToAddress><name>nameString<\/name><\/billToAddress><paypage><paypageRegistrationId>paypageString<\/paypageRegistrationId><\/paypage><billingDate>2014-03-11<\/billingDate><createDiscount><discountCode>discCode1<\/discountCode><name>name1<\/name><amount>500<\/amount><startDate>2014-03-12<\/startDate><endDate>2014-03-12<\/endDate><\/createDiscount><createDiscount><discountCode>discCode11<\/discountCode><name>name11<\/name><amount>5000<\/amount><startDate>2014-03-12<\/startDate><endDate>2014-03-12<\/endDate><\/createDiscount><updateDiscount><discountCode>discCode2<\/discountCode><\/updateDiscount><deleteDiscount><discountCode>discCode3<\/discountCode><\/deleteDiscount><deleteDiscount><discountCode>discCode33<\/discountCode><\/deleteDiscount><createAddOn><addOnCode>addOnCode1<\/addOnCode><name>name1<\/name><amount>500<\/amount><startDate>2014-03-12<\/startDate><endDate>2014-03-12<\/endDate><\/createAddOn><updateAddOn><addOnCode>addOnCode2<\/addOnCode><\/updateAddOn><\/updateSubscription>.*/m), is_a(Hash))
|
|
168
|
+
LitleOnlineRequest.new.update_subscription(hash)
|
|
169
|
+
end
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
end
|