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,33 @@
|
|
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
|
+
|
27
|
+
|
28
|
+
#test driver for running all tests
|
29
|
+
require_relative 'certTest1_base'
|
30
|
+
require_relative 'certTest2_authenhanced'
|
31
|
+
require_relative 'certTest3_authreversal'
|
32
|
+
require_relative 'certTest4_echeck'
|
33
|
+
require_relative 'certTest5_token'
|
@@ -0,0 +1,100 @@
|
|
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
|
+
|
28
|
+
#test Activate Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestActivate < Test::Unit::TestCase
|
31
|
+
|
32
|
+
def test_simple_card_happy
|
33
|
+
hash = {
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'reportGroup'=>'Planets',
|
37
|
+
'orderId' =>'1001',
|
38
|
+
'amount' =>'500',
|
39
|
+
'orderSource' =>'ecommerce',
|
40
|
+
'card'=>{
|
41
|
+
'type'=>'VI',
|
42
|
+
'number' =>'4100000000000001',
|
43
|
+
'expDate' =>'1210'
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
response= LitleOnlineRequest.new.activate(hash)
|
48
|
+
assert_equal('Valid Format', response.message)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_simple_virtualGiftCard_happy
|
52
|
+
hash = {
|
53
|
+
'merchantId' => '101',
|
54
|
+
'version'=>'8.8',
|
55
|
+
'reportGroup'=>'Planets',
|
56
|
+
'orderId' =>'1001',
|
57
|
+
'amount' =>'500',
|
58
|
+
'orderSource' =>'ecommerce',
|
59
|
+
'virtualGiftCard'=>{
|
60
|
+
'accountNumberLength'=>'13',
|
61
|
+
'giftCardBin'=>'giftCardBinString'
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
response= LitleOnlineRequest.new.activate(hash)
|
66
|
+
assert_equal('Valid Format', response.message)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_simple_out_of_order
|
70
|
+
hash = {
|
71
|
+
'merchantId' => '101',
|
72
|
+
'version'=>'8.8',
|
73
|
+
'reportGroup'=>'Planets',
|
74
|
+
'amount' =>'500',
|
75
|
+
'orderId' =>'1001',
|
76
|
+
'orderSource' =>'ecommerce',
|
77
|
+
'card'=>{
|
78
|
+
'type'=>'VI',
|
79
|
+
'number' =>'4100000000000001',
|
80
|
+
'expDate' =>'1210'
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
84
|
+
response= LitleOnlineRequest.new.activate(hash)
|
85
|
+
assert_equal('Valid Format', response.message)
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_simple_error
|
89
|
+
hash = {
|
90
|
+
'merchantId' => '101',
|
91
|
+
'version'=>'8.8',
|
92
|
+
'reportGroup'=>'Planets',
|
93
|
+
'amount' =>'500',
|
94
|
+
}
|
95
|
+
|
96
|
+
response= LitleOnlineRequest.new.activate(hash)
|
97
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,56 @@
|
|
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
|
+
|
28
|
+
#test ActivateReversal Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestActivateReversal < Test::Unit::TestCase
|
31
|
+
|
32
|
+
def test_simple
|
33
|
+
hash = {
|
34
|
+
'merchantId' => '101',
|
35
|
+
'version'=>'8.8',
|
36
|
+
'reportGroup'=>'Planets',
|
37
|
+
'litleTxnId' =>'5000'
|
38
|
+
}
|
39
|
+
|
40
|
+
response= LitleOnlineRequest.new.activate_reversal(hash)
|
41
|
+
assert_equal('Valid Format', response.message)
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def test_simple_error
|
46
|
+
hash = {
|
47
|
+
'merchantId' => '101',
|
48
|
+
'version'=>'8.8',
|
49
|
+
'reportGroup'=>'Planets',
|
50
|
+
}
|
51
|
+
|
52
|
+
response= LitleOnlineRequest.new.activate_reversal(hash)
|
53
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,298 @@
|
|
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
|
+
|
28
|
+
#test Authorization Transaction
|
29
|
+
module LitleOnline
|
30
|
+
class TestAuth < Test::Unit::TestCase
|
31
|
+
def test_simple_auth_with_card
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'orderId'=>'12344',
|
37
|
+
'amount'=>'106',
|
38
|
+
'orderSource'=>'ecommerce',
|
39
|
+
'card'=>{
|
40
|
+
'type'=>'VI',
|
41
|
+
'number' =>'4100000000000000',
|
42
|
+
'expDate' =>'1210'
|
43
|
+
}}
|
44
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
45
|
+
assert_equal('000', response.authorizationResponse.response)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_simple_auth_with_paypal
|
49
|
+
hash = {
|
50
|
+
'merchantId' => '101',
|
51
|
+
'version'=>'8.8',
|
52
|
+
'reportGroup'=>'Planets',
|
53
|
+
'amount'=>'106',
|
54
|
+
'orderId'=>'123456',
|
55
|
+
'orderSource'=>'ecommerce',
|
56
|
+
'paypal'=>{
|
57
|
+
'payerId'=>'1234',
|
58
|
+
'token'=>'1234',
|
59
|
+
'transactionId'=>'123456'
|
60
|
+
}}
|
61
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
62
|
+
assert_equal 'Valid Format', response.message
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_simple_auth_with_applepay_and_secondaryAmount
|
66
|
+
hash = {
|
67
|
+
'merchantId' => '101',
|
68
|
+
'version'=>'8.8',
|
69
|
+
'reportGroup'=>'Planets',
|
70
|
+
'orderId'=>'12344',
|
71
|
+
'amount'=>'110',
|
72
|
+
'secondaryAmount'=>'50',
|
73
|
+
'orderSource'=>'ecommerce',
|
74
|
+
'applepay'=>{
|
75
|
+
'data'=>'1234',
|
76
|
+
'header'=>{
|
77
|
+
'applicationData'=>'454657413164',
|
78
|
+
'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
79
|
+
'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
80
|
+
'transactionId'=>'1234'
|
81
|
+
},
|
82
|
+
'signature' =>'1',
|
83
|
+
'version'=>'12345'
|
84
|
+
}}
|
85
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
86
|
+
assert_equal('Insufficient Funds', response.authorizationResponse.message)
|
87
|
+
assert_equal('110', response.authorizationResponse.applepayResponse.transactionAmount)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_illegal_order_source
|
91
|
+
hash = {
|
92
|
+
'merchantId' => '101',
|
93
|
+
'version'=>'8.8',
|
94
|
+
'reportGroup'=>'Planets',
|
95
|
+
'orderId'=>'12344',
|
96
|
+
'amount'=>'106',
|
97
|
+
'orderSource'=>'ecomerce', #This order source is mispelled on purpose!
|
98
|
+
'card'=>{
|
99
|
+
'type'=>'VI',
|
100
|
+
'number' =>'4100000000000001',
|
101
|
+
'expDate' =>'1210'
|
102
|
+
}}
|
103
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
104
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_fields_out_of_order
|
108
|
+
hash = {
|
109
|
+
'merchantId' => '101',
|
110
|
+
'version'=>'8.8',
|
111
|
+
'reportGroup'=>'Planets',
|
112
|
+
'orderId'=>'12344',
|
113
|
+
'card'=>{
|
114
|
+
'type'=>'VI',
|
115
|
+
'number' =>'4100000000000000',
|
116
|
+
'expDate' =>'1210'
|
117
|
+
},
|
118
|
+
'orderSource'=>'ecommerce',
|
119
|
+
'amount'=>'106'
|
120
|
+
}
|
121
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
122
|
+
assert_equal('000', response.authorizationResponse.response)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_invalid_field
|
126
|
+
hash = {
|
127
|
+
'merchantId' => '101',
|
128
|
+
'version'=>'8.8',
|
129
|
+
'reportGroup'=>'Planets',
|
130
|
+
'orderId'=>'12344',
|
131
|
+
'amount'=>'106',
|
132
|
+
'orderSource'=>'ecommerce',
|
133
|
+
'card'=>{
|
134
|
+
'NOexistantField' => 'ShouldNotCauseError',
|
135
|
+
'type'=>'VI',
|
136
|
+
'number' =>'4100000000000000',
|
137
|
+
'expDate' =>'1210'
|
138
|
+
}}
|
139
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
140
|
+
assert_equal('000', response.authorizationResponse.response)
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_no_order_id
|
144
|
+
hash = {
|
145
|
+
'merchantId' => '101',
|
146
|
+
'version'=>'8.8',
|
147
|
+
'reportGroup'=>'Planets',
|
148
|
+
'amount'=>'106',
|
149
|
+
'orderSource'=>'ecommerce',
|
150
|
+
'card'=>{
|
151
|
+
'type'=>'VI',
|
152
|
+
'number' =>'4100000000000001',
|
153
|
+
'expDate' =>'1210'
|
154
|
+
}}
|
155
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
156
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_no_amount
|
160
|
+
hash = {
|
161
|
+
'merchantId' => '101',
|
162
|
+
'version'=>'8.8',
|
163
|
+
'reportGroup'=>'Planets',
|
164
|
+
'orderId'=>'12344',
|
165
|
+
'orderSource'=>'ecommerce',
|
166
|
+
'card'=>{
|
167
|
+
'type'=>'VI',
|
168
|
+
'number' =>'4100000000000001',
|
169
|
+
'expDate' =>'1210'
|
170
|
+
}}
|
171
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
172
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
173
|
+
end
|
174
|
+
|
175
|
+
def test_no_order_source
|
176
|
+
hash = {
|
177
|
+
'merchantId' => '101',
|
178
|
+
'version'=>'8.8',
|
179
|
+
'reportGroup'=>'Planets',
|
180
|
+
# 'litleTxnId'=>'123456',
|
181
|
+
'orderId'=>'12344',
|
182
|
+
'amount'=>'106',
|
183
|
+
'card'=>{
|
184
|
+
'type'=>'VI',
|
185
|
+
'number' =>'4100000000000001',
|
186
|
+
'expDate' =>'1210'
|
187
|
+
}}
|
188
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
189
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
190
|
+
end
|
191
|
+
|
192
|
+
def test_authorization_missing_attributes
|
193
|
+
hash={
|
194
|
+
'reportGroup'=>'Planets',
|
195
|
+
'amount'=>'106',
|
196
|
+
|
197
|
+
'orderSource'=>'ecommerce',
|
198
|
+
'card'=>{
|
199
|
+
'type'=>'VI',
|
200
|
+
'number' =>'4100000000000001',
|
201
|
+
'expDate' =>'1210'
|
202
|
+
}}
|
203
|
+
|
204
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
205
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
206
|
+
end
|
207
|
+
|
208
|
+
def test_orderId_required
|
209
|
+
start_hash = {
|
210
|
+
'merchantId'=>'101',
|
211
|
+
'reportGroup'=>'Planets',
|
212
|
+
'amount'=>'101',
|
213
|
+
'orderSource'=>'ecommerce',
|
214
|
+
'card' => {
|
215
|
+
'type' => 'VI',
|
216
|
+
'number' => '1111222233334444'
|
217
|
+
}
|
218
|
+
}
|
219
|
+
response= LitleOnlineRequest.new.authorization(start_hash)
|
220
|
+
assert(response.message =~ /Error validating xml data against the schema/)
|
221
|
+
|
222
|
+
response = LitleOnlineRequest.new.authorization(start_hash.merge({'orderId'=>'1234'}))
|
223
|
+
assert_equal('000', response.authorizationResponse.response)
|
224
|
+
end
|
225
|
+
|
226
|
+
def test_ssn_optional
|
227
|
+
start_hash = {
|
228
|
+
'orderId'=>'12344',
|
229
|
+
'merchantId'=>'101',
|
230
|
+
'reportGroup'=>'Planets',
|
231
|
+
'amount'=>'101',
|
232
|
+
'orderSource'=>'ecommerce',
|
233
|
+
'card' => {
|
234
|
+
'type' => 'VI',
|
235
|
+
'number' => '1111222233334444'
|
236
|
+
},
|
237
|
+
}
|
238
|
+
response = LitleOnlineRequest.new.authorization(start_hash)
|
239
|
+
assert_equal('000', response.authorizationResponse.response)
|
240
|
+
|
241
|
+
response = LitleOnlineRequest.new.authorization(start_hash.merge({'customerInfo'=>{'ssn'=>'000112222'} }))
|
242
|
+
assert_equal('000', response.authorizationResponse.response)
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_simple_auth_with_paypage
|
246
|
+
hash = {
|
247
|
+
'orderId'=>'12344',
|
248
|
+
'amount'=>'106',
|
249
|
+
'orderSource'=>'ecommerce',
|
250
|
+
'paypage'=>{
|
251
|
+
'type'=>'VI',
|
252
|
+
'paypageRegistrationId' =>'QU1pTFZnV2NGQWZrZzRKeTNVR0lzejB1K2Q5VDdWMTVqb2J5WFJ2Snh4U0U4eTBxaFg2cEVWaDBWSlhtMVZTTw==',
|
253
|
+
'expDate' =>'1210',
|
254
|
+
'cardValidationNum' => '123'
|
255
|
+
}
|
256
|
+
}
|
257
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
258
|
+
assert_equal('000', response.authorizationResponse.response)
|
259
|
+
end
|
260
|
+
|
261
|
+
def test_simple_auth_with_advanced_fraud_checks
|
262
|
+
hash = {
|
263
|
+
'merchantId' => '101',
|
264
|
+
'version'=>'8.8',
|
265
|
+
'reportGroup'=>'Planets',
|
266
|
+
'orderId'=>'12355',
|
267
|
+
'amount'=>'106',
|
268
|
+
'orderSource'=>'ecommerce',
|
269
|
+
'card'=>{
|
270
|
+
'type'=>'VI',
|
271
|
+
'number' =>'4100000000000000',
|
272
|
+
'expDate' =>'1210'
|
273
|
+
},
|
274
|
+
'advancedFraudChecks' => {'threatMetrixSessionId'=>'1234'}
|
275
|
+
}
|
276
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
277
|
+
assert_equal('000', response.authorizationResponse.response)
|
278
|
+
end
|
279
|
+
|
280
|
+
def test_simple_auth_with_mpos
|
281
|
+
hash = {
|
282
|
+
'orderId'=>'12344',
|
283
|
+
'amount'=>'106',
|
284
|
+
'orderSource'=>'ecommerce',
|
285
|
+
'mpos'=>
|
286
|
+
{
|
287
|
+
'ksn'=>'ksnString',
|
288
|
+
'formatId'=>'30',
|
289
|
+
'encryptedTrack'=>'encryptedTrackString',
|
290
|
+
'track1Status'=>'0',
|
291
|
+
'track2Status'=>'0'
|
292
|
+
}
|
293
|
+
}
|
294
|
+
response= LitleOnlineRequest.new.authorization(hash)
|
295
|
+
assert_equal('000', response.authorizationResponse.response)
|
296
|
+
end
|
297
|
+
end
|
298
|
+
end
|