CnpOnline 8.31.0
Sign up to get free protection for your applications and to get access to all the features.
- 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/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 +255 -0
@@ -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 TestLoad < 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(/.*<load reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>VI<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/load>.*/m), is_a(Hash))
|
48
|
+
LitleOnlineRequest.new.load_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 TestLoadReversal < 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(/.*<loadReversal reportGroup="Planets"><litleTxnId>5000<\/litleTxnId><\/loadReversal>.*/m), is_a(Hash))
|
40
|
+
LitleOnlineRequest.new.load_reversal(hash)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
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 TestRefundReversal < 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(/.*<refundReversal reportGroup="Planets"><litleTxnId>5000<\/litleTxnId><\/refundReversal>.*/m), is_a(Hash))
|
40
|
+
LitleOnlineRequest.new.refund_reversal(hash)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,465 @@
|
|
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 TestSale < Test::Unit::TestCase
|
31
|
+
def test_both_choices_fraud_check_and_card_holder
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'litleTxnId'=>'123456',
|
37
|
+
'orderId'=>'12344',
|
38
|
+
'amount'=>'106',
|
39
|
+
'orderSource'=>'ecommerce',
|
40
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
41
|
+
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
42
|
+
'card'=>{
|
43
|
+
'type'=>'VI',
|
44
|
+
'number' =>'4100000000000002',
|
45
|
+
'expDate' =>'1210'
|
46
|
+
}}
|
47
|
+
|
48
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
49
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_success_applepay
|
53
|
+
hash = {
|
54
|
+
'merchantId' => '101',
|
55
|
+
'version'=>'8.8',
|
56
|
+
'reportGroup'=>'Planets',
|
57
|
+
'litleTxnId'=>'123456',
|
58
|
+
'orderId'=>'12344',
|
59
|
+
'amount'=>'106',
|
60
|
+
'orderSource'=>'ecommerce',
|
61
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
62
|
+
'applepay'=>{
|
63
|
+
'data'=>'user',
|
64
|
+
'header'=>{
|
65
|
+
'applicationData'=>'454657413164',
|
66
|
+
'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
67
|
+
'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
68
|
+
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
69
|
+
},
|
70
|
+
'signature' =>'sign',
|
71
|
+
'version' =>'1'
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<sale.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/sale>.*?/m), is_a(Hash))
|
76
|
+
LitleOnlineRequest.new.sale(hash)
|
77
|
+
end
|
78
|
+
|
79
|
+
# for test the choice functionality
|
80
|
+
def test_success_card
|
81
|
+
hash = {
|
82
|
+
'merchantId' => '101',
|
83
|
+
'version'=>'8.8',
|
84
|
+
'reportGroup'=>'Planets',
|
85
|
+
'litleTxnId'=>'123456',
|
86
|
+
'orderId'=>'12344',
|
87
|
+
'amount'=>'106',
|
88
|
+
'orderSource'=>'ecommerce',
|
89
|
+
# 'fraudCheck'=>{'authenticationTransactionId'=>'123'}, #for test
|
90
|
+
'card'=>{
|
91
|
+
'type'=>'VI',
|
92
|
+
'number' =>'4100000000000002',
|
93
|
+
'expDate' =>'1210'
|
94
|
+
}
|
95
|
+
}
|
96
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<sale.*?<card>.*?<type>VI<\/type>.*?<\/card>.*?<\/sale>.*?/m), is_a(Hash))
|
97
|
+
LitleOnlineRequest.new.sale(hash)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_both_choices_card_and_paypal
|
101
|
+
hash = {
|
102
|
+
'merchantId' => '101',
|
103
|
+
'version'=>'8.8',
|
104
|
+
'reportGroup'=>'Planets',
|
105
|
+
'litleTxnId'=>'123456',
|
106
|
+
'orderId'=>'12344',
|
107
|
+
'amount'=>'106',
|
108
|
+
'orderSource'=>'ecommerce',
|
109
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
110
|
+
'card'=>{
|
111
|
+
'type'=>'VI',
|
112
|
+
'number' =>'4100000000000002',
|
113
|
+
'expDate' =>'1210'
|
114
|
+
},
|
115
|
+
'paypal'=>{
|
116
|
+
'payerId'=>'1234',
|
117
|
+
'token'=>'1234',
|
118
|
+
'transactionId'=>'123456'
|
119
|
+
}}
|
120
|
+
|
121
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
122
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_both_choices_card_and_token
|
126
|
+
hash = {
|
127
|
+
'merchantId' => '101',
|
128
|
+
'version'=>'8.8',
|
129
|
+
'reportGroup'=>'Planets',
|
130
|
+
'litleTxnId'=>'123456',
|
131
|
+
'orderId'=>'12344',
|
132
|
+
'amount'=>'106',
|
133
|
+
'orderSource'=>'ecommerce',
|
134
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
135
|
+
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
136
|
+
'card'=>{
|
137
|
+
'type'=>'VI',
|
138
|
+
'number' =>'4100000000000002',
|
139
|
+
'expDate' =>'1210'
|
140
|
+
},
|
141
|
+
'token'=> {
|
142
|
+
'litleToken'=>'1234567890123',
|
143
|
+
'expDate'=>'1210',
|
144
|
+
'cardValidationNum'=>'555',
|
145
|
+
'type'=>'VI'
|
146
|
+
}}
|
147
|
+
|
148
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
149
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
150
|
+
end
|
151
|
+
|
152
|
+
def test_both_choices_card_and_paypage
|
153
|
+
hash = {
|
154
|
+
'merchantId' => '101',
|
155
|
+
'version'=>'8.8',
|
156
|
+
'reportGroup'=>'Planets',
|
157
|
+
'litleTxnId'=>'123456',
|
158
|
+
'orderId'=>'12344',
|
159
|
+
'amount'=>'106',
|
160
|
+
'orderSource'=>'ecommerce',
|
161
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
162
|
+
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
163
|
+
'card'=>{
|
164
|
+
'type'=>'VI',
|
165
|
+
'number' =>'4100000000000002',
|
166
|
+
'expDate' =>'1210'
|
167
|
+
},
|
168
|
+
'paypage'=> {
|
169
|
+
'paypageRegistrationId'=>'1234',
|
170
|
+
'expDate'=>'1210',
|
171
|
+
'cardValidationNum'=>'555',
|
172
|
+
'type'=>'VI'
|
173
|
+
}}
|
174
|
+
|
175
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
176
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_three_choices_card_and_paypage_and_paypal
|
180
|
+
hash = {
|
181
|
+
'merchantId' => '101',
|
182
|
+
'version'=>'8.8',
|
183
|
+
'reportGroup'=>'Planets',
|
184
|
+
'litleTxnId'=>'123456',
|
185
|
+
'orderId'=>'12344',
|
186
|
+
'amount'=>'106',
|
187
|
+
'orderSource'=>'ecommerce',
|
188
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
189
|
+
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
190
|
+
'card'=>{
|
191
|
+
'type'=>'VI',
|
192
|
+
'number' =>'4100000000000002',
|
193
|
+
'expDate' =>'1210'
|
194
|
+
},
|
195
|
+
'paypage'=> {
|
196
|
+
'paypageRegistrationId'=>'1234',
|
197
|
+
'expDate'=>'1210',
|
198
|
+
'cardValidationNum'=>'555',
|
199
|
+
'type'=>'VI'},
|
200
|
+
'paypal'=>{
|
201
|
+
'payerId'=>'1234',
|
202
|
+
'token'=>'1234',
|
203
|
+
'transactionId'=>'123456'
|
204
|
+
}}
|
205
|
+
|
206
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
207
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_all_choices_card_and_paypage_and_paypal_and_token
|
211
|
+
hash = {
|
212
|
+
'merchantId' => '101',
|
213
|
+
'version'=>'8.8',
|
214
|
+
'reportGroup'=>'Planets',
|
215
|
+
'litleTxnId'=>'123456',
|
216
|
+
'orderId'=>'12344',
|
217
|
+
'amount'=>'106',
|
218
|
+
'orderSource'=>'ecommerce',
|
219
|
+
'fraudCheck'=>{'authenticationTransactionId'=>'123'},
|
220
|
+
'cardholderAuthentication'=>{'authenticationTransactionId'=>'123'},
|
221
|
+
'card'=>{
|
222
|
+
'type'=>'VI',
|
223
|
+
'number' =>'4100000000000002',
|
224
|
+
'expDate' =>'1210'
|
225
|
+
},
|
226
|
+
'paypage'=> {
|
227
|
+
'paypageRegistrationId'=>'1234',
|
228
|
+
'expDate'=>'1210',
|
229
|
+
'cardValidationNum'=>'555',
|
230
|
+
'type'=>'VI'},
|
231
|
+
'paypal'=>{
|
232
|
+
'payerId'=>'1234',
|
233
|
+
'token'=>'1234',
|
234
|
+
'transactionId'=>'123456'},
|
235
|
+
'token'=> {
|
236
|
+
'litleToken'=>'1234567890123',
|
237
|
+
'expDate'=>'1210',
|
238
|
+
'cardValidationNum'=>'555',
|
239
|
+
'type'=>'VI'
|
240
|
+
}}
|
241
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
242
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_merchant_data_sale
|
246
|
+
hash = {
|
247
|
+
'merchantId' => '101',
|
248
|
+
'version'=>'8.12',
|
249
|
+
'orderId'=>'1',
|
250
|
+
'amount'=>'0',
|
251
|
+
'orderSource'=>'ecommerce',
|
252
|
+
'reportGroup'=>'Planets',
|
253
|
+
'merchantData'=> {
|
254
|
+
'affiliate'=>'bar'
|
255
|
+
}
|
256
|
+
}
|
257
|
+
|
258
|
+
XMLObject.expects(:new)
|
259
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<merchantData>.*?<affiliate>bar<\/affiliate>.*?<\/merchantData>.*/m),kind_of(Hash))
|
260
|
+
LitleOnlineRequest.new.sale(hash)
|
261
|
+
end
|
262
|
+
|
263
|
+
def test_invalid_embedded_field_values
|
264
|
+
#becasue there are sub fields under fraud check that are not specified
|
265
|
+
hash = {
|
266
|
+
'merchantId' => '101',
|
267
|
+
'version'=>'8.8',
|
268
|
+
'reportGroup'=>'Planets',
|
269
|
+
'litleTxnId'=>'123456',
|
270
|
+
'orderId'=>'12344',
|
271
|
+
'amount'=>'106',
|
272
|
+
'orderSource'=>'ecommerce',
|
273
|
+
'fraudCheck'=>'one',
|
274
|
+
'cardholderAuthentication'=>'two',
|
275
|
+
'card'=>{
|
276
|
+
'type'=>'VI',
|
277
|
+
'number' =>'4100000000000000',
|
278
|
+
}}
|
279
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
280
|
+
assert_match /Entered an Invalid Amount of Choices for a Field, please only fill out one Choice!!!!/, exception.message
|
281
|
+
end
|
282
|
+
|
283
|
+
def test_fraud_filter_override
|
284
|
+
hash = {
|
285
|
+
'merchantId' => '101',
|
286
|
+
'version'=>'8.12',
|
287
|
+
'orderId'=>'1',
|
288
|
+
'amount'=>'0',
|
289
|
+
'orderSource'=>'ecommerce',
|
290
|
+
'reportGroup'=>'Planets',
|
291
|
+
'fraudFilterOverride'=> 'false'
|
292
|
+
}
|
293
|
+
|
294
|
+
XMLObject.expects(:new)
|
295
|
+
Communications.expects(:http_post).with(regexp_matches(/.*<sale.*?<fraudFilterOverride>false<\/fraudFilterOverride>.*?<\/sale>.*/m),kind_of(Hash))
|
296
|
+
LitleOnlineRequest.new.sale(hash)
|
297
|
+
end
|
298
|
+
|
299
|
+
def test_illegal_card_type
|
300
|
+
hash = {
|
301
|
+
'merchantId' => '101',
|
302
|
+
'version'=>'8.8',
|
303
|
+
'reportGroup'=>'Planets',
|
304
|
+
'litleTxnId'=>'123456',
|
305
|
+
'orderId'=>'12344',
|
306
|
+
'amount'=>'106',
|
307
|
+
'orderSource'=>'ecommerce',
|
308
|
+
'card'=>{
|
309
|
+
'type'=>'NO',
|
310
|
+
'number' =>'4100000000000002',
|
311
|
+
'expDate' =>'1210'
|
312
|
+
}}
|
313
|
+
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.sale(hash)}
|
314
|
+
assert_match /If card type is specified, it must be in /, exception.message
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_logged_in_user
|
318
|
+
hash = {
|
319
|
+
'loggedInUser' => 'gdake',
|
320
|
+
'merchantSdk' => 'Ruby;8.14.0',
|
321
|
+
'merchantId' => '101',
|
322
|
+
'version'=>'8.8',
|
323
|
+
'reportGroup'=>'Planets',
|
324
|
+
'litleTxnId'=>'123456',
|
325
|
+
'orderId'=>'12344',
|
326
|
+
'amount'=>'106',
|
327
|
+
'orderSource'=>'ecommerce',
|
328
|
+
'card'=>{
|
329
|
+
'type'=>'VI',
|
330
|
+
'number' =>'4100000000000002',
|
331
|
+
'expDate' =>'1210'
|
332
|
+
}}
|
333
|
+
|
334
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*(loggedInUser="gdake".*merchantSdk="Ruby;8.14.0")|(merchantSdk="Ruby;8.14.0".*loggedInUser="gdake").*/m), is_a(Hash))
|
335
|
+
LitleOnlineRequest.new.sale(hash)
|
336
|
+
end
|
337
|
+
|
338
|
+
def test_surcharge_amount
|
339
|
+
hash = {
|
340
|
+
'orderId' => '12344',
|
341
|
+
'amount' => '2',
|
342
|
+
'surchargeAmount' => '1',
|
343
|
+
'orderSource' => 'ecommerce',
|
344
|
+
'reportGroup' => 'Planets'
|
345
|
+
}
|
346
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><surchargeAmount>1<\/surchargeAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
347
|
+
LitleOnlineRequest.new.sale(hash)
|
348
|
+
end
|
349
|
+
|
350
|
+
def test_secondary_amount
|
351
|
+
hash = {
|
352
|
+
'orderId' => '12344',
|
353
|
+
'amount' => '2',
|
354
|
+
'secondaryAmount' => '1',
|
355
|
+
'orderSource' => 'ecommerce',
|
356
|
+
'reportGroup' => 'Planets'
|
357
|
+
}
|
358
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><secondaryAmount>1<\/secondaryAmount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
359
|
+
LitleOnlineRequest.new.sale(hash)
|
360
|
+
end
|
361
|
+
|
362
|
+
def test_surcharge_amount_optional
|
363
|
+
hash = {
|
364
|
+
'orderId' => '12344',
|
365
|
+
'amount' => '2',
|
366
|
+
'orderSource' => 'ecommerce',
|
367
|
+
'reportGroup' => 'Planets'
|
368
|
+
}
|
369
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<amount>2<\/amount><orderSource>ecommerce<\/orderSource>.*/m), is_a(Hash))
|
370
|
+
LitleOnlineRequest.new.sale(hash)
|
371
|
+
end
|
372
|
+
|
373
|
+
def test_recurringRequest
|
374
|
+
hash = {
|
375
|
+
'card'=>{
|
376
|
+
'type'=>'VI',
|
377
|
+
'number'=>'4100000000000001',
|
378
|
+
'expDate'=>'1213',
|
379
|
+
},
|
380
|
+
'orderId'=>'12344',
|
381
|
+
'amount'=>'2',
|
382
|
+
'orderSource'=>'ecommerce',
|
383
|
+
'fraudFilterOverride'=>'true',
|
384
|
+
'recurringRequest'=>{
|
385
|
+
'subscription'=>{
|
386
|
+
'planCode'=>'abc123',
|
387
|
+
'numberOfPayments'=>'12'
|
388
|
+
}
|
389
|
+
}
|
390
|
+
}
|
391
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><recurringRequest><subscription><planCode>abc123<\/planCode><numberOfPayments>12<\/numberOfPayments><\/subscription><\/recurringRequest>.*/m), is_a(Hash))
|
392
|
+
LitleOnlineRequest.new.sale(hash)
|
393
|
+
end
|
394
|
+
|
395
|
+
def test_recurringRequest_optional
|
396
|
+
hash = {
|
397
|
+
'card'=>{
|
398
|
+
'type'=>'VI',
|
399
|
+
'number'=>'4100000000000001',
|
400
|
+
'expDate'=>'1213',
|
401
|
+
},
|
402
|
+
'orderId'=>'12344',
|
403
|
+
'amount'=>'2',
|
404
|
+
'orderSource'=>'ecommerce',
|
405
|
+
'fraudFilterOverride'=>'true',
|
406
|
+
}
|
407
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><\/sale>.*/m), is_a(Hash))
|
408
|
+
LitleOnlineRequest.new.sale(hash)
|
409
|
+
end
|
410
|
+
|
411
|
+
def test_litleInternalRecurringRequest
|
412
|
+
hash = {
|
413
|
+
'card'=>{
|
414
|
+
'type'=>'VI',
|
415
|
+
'number'=>'4100000000000001',
|
416
|
+
'expDate'=>'1213',
|
417
|
+
},
|
418
|
+
'orderId'=>'12344',
|
419
|
+
'amount'=>'2',
|
420
|
+
'orderSource'=>'ecommerce',
|
421
|
+
'fraudFilterOverride'=>'true',
|
422
|
+
'litleInternalRecurringRequest'=>{
|
423
|
+
'subscriptionId'=>'1234567890123456789',
|
424
|
+
'recurringTxnId'=>'1234567890123456789',
|
425
|
+
'finalPayment'=>'false'
|
426
|
+
},
|
427
|
+
}
|
428
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><litleInternalRecurringRequest><subscriptionId>1234567890123456789<\/subscriptionId><recurringTxnId>1234567890123456789<\/recurringTxnId><finalPayment>false<\/finalPayment><\/litleInternalRecurringRequest>.*/m), is_a(Hash))
|
429
|
+
LitleOnlineRequest.new.sale(hash)
|
430
|
+
end
|
431
|
+
|
432
|
+
def test_litleInternalRecurringRequest_optional
|
433
|
+
hash = {
|
434
|
+
'card'=>{
|
435
|
+
'type'=>'VI',
|
436
|
+
'number'=>'4100000000000001',
|
437
|
+
'expDate'=>'1213',
|
438
|
+
},
|
439
|
+
'orderId'=>'12344',
|
440
|
+
'amount'=>'2',
|
441
|
+
'orderSource'=>'ecommerce',
|
442
|
+
'fraudFilterOverride'=>'true',
|
443
|
+
}
|
444
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<fraudFilterOverride>true<\/fraudFilterOverride><\/sale>.*/m), is_a(Hash))
|
445
|
+
LitleOnlineRequest.new.sale(hash)
|
446
|
+
end
|
447
|
+
|
448
|
+
def test_advanced_fraud_check
|
449
|
+
hash = {
|
450
|
+
'orderId' => '12344',
|
451
|
+
'amount' => '2',
|
452
|
+
'orderSource' => 'ecommerce',
|
453
|
+
'card' => {
|
454
|
+
'number' => '4141000000000000',
|
455
|
+
'expDate' => '1210',
|
456
|
+
'type' => 'GC'
|
457
|
+
} ,
|
458
|
+
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
459
|
+
}
|
460
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudChecks><threatMetrixSessionId>1234<\/threatMetrixSessionId><\/advancedFraudChecks>.*/m), is_a(Hash))
|
461
|
+
LitleOnlineRequest.new.sale(hash)
|
462
|
+
end
|
463
|
+
|
464
|
+
end
|
465
|
+
end
|