CnpOnline 9.14.0 → 11.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -7
- data/CHANGELOG +23 -17
- data/CONTRIBUTORS +0 -0
- data/DESCRIPTION +1 -1
- data/LICENSE +1 -1
- data/README.md +5 -3
- data/Rakefile +5 -5
- data/Rakefile~ +5 -5
- data/SETUP.md +3 -3
- data/bin/Setup.rb +59 -41
- data/lib/Communications.rb +3 -3
- data/lib/Configuration.rb +52 -45
- data/lib/EnvironmentVariables.rb +5 -1
- data/lib/LitleBatchRequest.rb +72 -7
- data/lib/LitleListeners.rb +17 -1
- data/lib/LitleOnline.rb +3 -4
- data/lib/LitleOnlineRequest.rb +37 -7
- data/lib/LitleRequest.rb +315 -186
- data/lib/LitleTransaction.rb +212 -85
- data/lib/LitleXmlMapper.rb +4 -2
- data/lib/XMLFields.rb +384 -171
- data/lib/cacert.pem +0 -0
- data/samples/Auth/LitleAuthReversalTransaction.rb +2 -2
- data/samples/Auth/LitleAuthorizationTransaction.rb +1 -0
- data/samples/Auth/LitlePaymentFullLifeCycle.rb +12 -6
- data/samples/Batch/AccountUpdate.rb +1 -0
- data/samples/Batch/SampleBatchDriver.rb +2 -1
- data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +2 -1
- data/samples/Capture/LitleCaptureTransaction.rb +2 -2
- data/samples/Capture/LitleForceCaptureTransaction.rb +2 -1
- data/samples/Capture/LitlePartialCapture.rb +3 -3
- data/samples/Credit/LitleCreditTransaction.rb +2 -2
- data/samples/Credit/LitleRefundTransaction.rb +2 -1
- data/samples/Other/LitleAvsTransaction.rb +2 -1
- data/samples/Other/LitleVoidTransaction.rb +2 -1
- data/samples/Paypage/FullPaypageLifeCycle.rb +7 -2
- data/samples/Run_all.rb +0 -0
- data/samples/Sale/LitleSaleTransaction.rb +2 -1
- data/samples/Sale/SampleSaleTransaction.rb +2 -1
- data/test/certification/certTest1_base.rb +52 -53
- data/test/certification/certTest2_authenhanced.rb +24 -25
- data/test/certification/certTest3_authreversal.rb +23 -26
- data/test/certification/certTest4_echeck.rb +18 -32
- data/test/certification/certTest5_token.rb +105 -106
- data/test/certification/certTest_batchAll.rb +47 -15
- data/test/functional/test_activate.rb +32 -4
- data/test/functional/test_activateReversal.rb +18 -5
- data/test/functional/test_auth.rb +94 -48
- data/test/functional/test_authReversal.rb +4 -1
- data/test/functional/test_balanceInquiry.rb +28 -3
- data/test/functional/test_batchStream.rb +2 -4
- data/test/functional/test_cancelSubscription.rb +2 -2
- data/test/functional/test_capture.rb +21 -14
- data/test/functional/test_captureGivenAuth.rb +15 -6
- data/test/functional/test_createPlan.rb +1 -1
- data/test/functional/test_credit.rb +14 -5
- data/test/functional/test_deactivate.rb +26 -3
- data/test/functional/test_deactivateReversal.rb +18 -5
- data/test/functional/test_depositReversal.rb +31 -19
- data/test/functional/test_echeckCredit.rb +34 -6
- data/test/functional/test_echeckRedeposit.rb +29 -2
- data/test/functional/test_echeckSale.rb +68 -11
- data/test/functional/test_echeckVerification.rb +32 -7
- data/test/functional/test_echeckVoid.rb +2 -1
- data/test/functional/test_forceCapture.rb +20 -6
- data/test/functional/test_fraudCheck.rb +3 -5
- data/test/functional/test_giftCardAuthReversal.rb +72 -0
- data/test/functional/test_giftCardCapture.rb +72 -0
- data/test/functional/test_giftCardCredit.rb +69 -0
- data/test/functional/test_litle_requests.rb +3 -6
- data/test/functional/test_load.rb +27 -3
- data/test/functional/test_loadReversal.rb +18 -5
- data/test/functional/test_override.rb +7 -3
- data/test/functional/test_pgp_litle_requests.rb +294 -0
- data/test/functional/test_queryTransaction.rb +152 -0
- data/test/functional/test_refundReversal.rb +18 -5
- data/test/functional/test_sale.rb +122 -159
- data/test/functional/test_token.rb +17 -11
- data/test/functional/test_unload.rb +27 -3
- data/test/functional/test_unloadReversal.rb +18 -5
- data/test/functional/test_updateCardValidationNumOnToken.rb +1 -0
- data/test/functional/test_updatePlan.rb +2 -1
- data/test/functional/test_updateSubscription.rb +3 -1
- data/test/functional/test_wallet.rb +74 -0
- data/test/functional/test_xmlfields.rb +22 -3
- data/test/functional/ts_all.rb +2 -0
- data/test/unit/test_LitleBatchRequest.rb +53 -5
- data/test/unit/test_LitleOnlineRequest.rb +5 -30
- data/test/unit/test_LitleRequest.rb +7 -6
- data/test/unit/test_LitleTransaction.rb +34 -5
- data/test/unit/test_LitleXmlMapper.rb +3 -0
- data/test/unit/test_activate.rb +22 -2
- data/test/unit/test_activateReversal.rb +15 -3
- data/test/unit/test_auth.rb +11 -9
- data/test/unit/test_balanceInquiry.rb +2 -2
- data/test/unit/test_capture.rb +2 -2
- data/test/unit/test_captureGivenAuth.rb +21 -1
- data/test/unit/test_credit.rb +1 -1
- data/test/unit/test_deactivate.rb +19 -0
- data/test/unit/test_deactivateReversal.rb +15 -3
- data/test/unit/test_depositReversal.rb +17 -5
- data/test/unit/test_echeckCredit.rb +19 -0
- data/test/unit/test_echeckRedeposit.rb +15 -0
- data/test/unit/test_echeckSale.rb +20 -1
- data/test/unit/test_echeckVerification.rb +6 -3
- data/test/unit/test_forceCapture.rb +1 -1
- data/test/unit/test_giftCardAuthReversal.rb +58 -0
- data/test/{functional/test_utf8.rb → unit/test_giftCardCapture.rb} +25 -12
- data/test/unit/test_giftCardCredit.rb +57 -0
- data/test/unit/test_load.rb +2 -2
- data/test/unit/test_loadReversal.rb +15 -3
- data/test/unit/test_pgp_LitleRequest +139 -0
- data/test/unit/test_queryTransaction.rb +105 -0
- data/test/unit/test_refundReversal.rb +15 -3
- data/test/unit/test_sale.rb +23 -3
- data/test/unit/test_token.rb +24 -20
- data/test/unit/test_unload.rb +2 -2
- data/test/unit/test_unloadReversal.rb +15 -3
- data/test/unit/test_wallet.rb +262 -0
- data/test/unit/ts_unit.rb +2 -1
- metadata +81 -100
@@ -0,0 +1,57 @@
|
|
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/LitleOnline",__FILE__)
|
26
|
+
require 'test/unit'
|
27
|
+
require 'mocha/setup'
|
28
|
+
|
29
|
+
module LitleOnline
|
30
|
+
class TestGiftCardCredit < Test::Unit::TestCase
|
31
|
+
def test_simple
|
32
|
+
hash = {
|
33
|
+
'merchantId' => '101',
|
34
|
+
'version'=>'8.8',
|
35
|
+
'reportGroup'=>'Planets',
|
36
|
+
'originalRefCode' => '101',
|
37
|
+
'originalAmount' => '34561',
|
38
|
+
'originalTxnTime' => '2017-01-24T09:00:00',
|
39
|
+
'originalSystemTraceId' => '33',
|
40
|
+
'originalSequenceNumber' => '111111',
|
41
|
+
'litleTxnId' => '5000',
|
42
|
+
'creditAmount' =>'1000',
|
43
|
+
'card'=>{
|
44
|
+
'type'=>'GC',
|
45
|
+
'number' =>'400000000000001',
|
46
|
+
'expDate' =>'0150',
|
47
|
+
'pin' => '1234',
|
48
|
+
'cardValidationNum' => '411'
|
49
|
+
},
|
50
|
+
}
|
51
|
+
|
52
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<creditAmount>1000<\/creditAmount><card><type>GC<\/type><number>400000000000001<\/number><expDate>0150<\/expDate><cardValidationNum>411<\/cardValidationNum><pin>1234<\/pin><\/card>.*/m), is_a(Hash))
|
53
|
+
LitleOnlineRequest.new.giftCardCredit(hash)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
data/test/unit/test_load.rb
CHANGED
@@ -38,13 +38,13 @@ module LitleOnline
|
|
38
38
|
'orderSource'=>'ecommerce',
|
39
39
|
'card'=>
|
40
40
|
{
|
41
|
-
'type'=>'
|
41
|
+
'type'=>'GC',
|
42
42
|
'number' =>'4100000000000001',
|
43
43
|
'expDate' =>'1210'
|
44
44
|
}
|
45
45
|
}
|
46
46
|
|
47
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<load reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>
|
47
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<load reportGroup="Planets"><orderId>11<\/orderId><amount>500<\/amount><orderSource>ecommerce<\/orderSource><card><type>GC<\/type><number>4100000000000001<\/number><expDate>1210<\/expDate><\/card><\/load>.*/m), is_a(Hash))
|
48
48
|
LitleOnlineRequest.new.load_request(hash)
|
49
49
|
end
|
50
50
|
|
@@ -33,11 +33,23 @@ module LitleOnline
|
|
33
33
|
'merchantId' => '101',
|
34
34
|
'version'=>'8.8',
|
35
35
|
'reportGroup'=>'Planets',
|
36
|
-
'litleTxnId' => '5000'
|
36
|
+
'litleTxnId' => '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',
|
37
49
|
}
|
38
50
|
|
39
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<
|
40
|
-
LitleOnlineRequest.new.
|
51
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>5000<\/litleTxnId><card><type>GC<\/type><number>400000000000001<\/number><expDate>0150<\/expDate><cardValidationNum>411<\/cardValidationNum><pin>1234<\/pin><\/card>.*/m), is_a(Hash))
|
52
|
+
LitleOnlineRequest.new.deposit_reversal(hash)
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
@@ -0,0 +1,139 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2017 Vantiv eCommerce
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
14
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
15
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
16
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
17
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
18
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
19
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
20
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
=end
|
22
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
23
|
+
require 'test/unit'
|
24
|
+
require 'mocha/setup'
|
25
|
+
require 'fileutils'
|
26
|
+
|
27
|
+
LITLE_SDK_TEST_FOLDER = '/litle-sdk-for-ruby-test'
|
28
|
+
|
29
|
+
module LitleOnline
|
30
|
+
|
31
|
+
class TestPgpLitleRequest < Test::Unit::TestCase
|
32
|
+
|
33
|
+
def setup
|
34
|
+
dir = '/tmp' + LITLE_SDK_TEST_FOLDER
|
35
|
+
FileUtils.rm_rf dir
|
36
|
+
Dir.mkdir dir
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_noPublicKey
|
41
|
+
config_dir = ENV['LITLE_CONFIG_DIR']
|
42
|
+
ENV['LITLE_CONFIG_DIR'] = '/tmp/pgp_ruby'
|
43
|
+
dir = '/tmp'
|
44
|
+
|
45
|
+
test = ''
|
46
|
+
request = LitleRequest.new()
|
47
|
+
ENV['LITLE_CONFIG_DIR'] = config_dir
|
48
|
+
request.create_new_litle_request(dir + LITLE_SDK_TEST_FOLDER)
|
49
|
+
request.finish_request
|
50
|
+
request.send_to_litle(dir + LITLE_SDK_TEST_FOLDER, {'vantivPublicKeyID' => ''})
|
51
|
+
|
52
|
+
rescue RuntimeError => e
|
53
|
+
test = e.message
|
54
|
+
|
55
|
+
clear_outbound
|
56
|
+
assert_equal "The public key to encrypt batch file requests is missing from the config", test
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_incorrectPublicKey
|
60
|
+
config_dir = ENV['LITLE_CONFIG_DIR']
|
61
|
+
ENV['LITLE_CONFIG_DIR'] = '/tmp/pgp_ruby'
|
62
|
+
dir = '/tmp'
|
63
|
+
|
64
|
+
test = ''
|
65
|
+
request = LitleRequest.new()
|
66
|
+
ENV['LITLE_CONFIG_DIR'] = config_dir
|
67
|
+
request.create_new_litle_request(dir + LITLE_SDK_TEST_FOLDER)
|
68
|
+
request.finish_request
|
69
|
+
request.send_to_litle(dir + LITLE_SDK_TEST_FOLDER, {'vantivPublicKeyID' => '7E25EB2X'})
|
70
|
+
|
71
|
+
|
72
|
+
rescue ArgumentError => e
|
73
|
+
test = e.message
|
74
|
+
clear_outbound
|
75
|
+
assert_match(/Please check if you have entered correct vantivePublicKeyID to config and that vantiv's public key is added to your gpg keyring and is trusted/, test)
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_noPassphrase
|
79
|
+
config_dir = ENV['LITLE_CONFIG_DIR']
|
80
|
+
ENV['LITLE_CONFIG_DIR'] = '/tmp/pgp_ruby'
|
81
|
+
dir = '/tmp'
|
82
|
+
|
83
|
+
test = ''
|
84
|
+
request = LitleRequest.new()
|
85
|
+
ENV['LITLE_CONFIG_DIR'] = config_dir
|
86
|
+
request.create_new_litle_request(dir + LITLE_SDK_TEST_FOLDER)
|
87
|
+
request.finish_request
|
88
|
+
request.send_to_litle
|
89
|
+
request.get_responses_from_server({'passphrase' => ''})
|
90
|
+
|
91
|
+
rescue RuntimeError => e
|
92
|
+
test = e.message
|
93
|
+
clear_outbound
|
94
|
+
assert_equal "The passphrase to decrypt the batch file responses is missing from the config", test
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_incorrectPassphrase
|
99
|
+
config_dir = ENV['LITLE_CONFIG_DIR']
|
100
|
+
ENV['LITLE_CONFIG_DIR'] = '/tmp/pgp_ruby'
|
101
|
+
dir = '/tmp'
|
102
|
+
|
103
|
+
test = ''
|
104
|
+
request = LitleRequest.new()
|
105
|
+
ENV['LITLE_CONFIG_DIR'] = config_dir
|
106
|
+
request.create_new_litle_request(dir + LITLE_SDK_TEST_FOLDER)
|
107
|
+
request.finish_request
|
108
|
+
request.send_to_litle
|
109
|
+
request.get_responses_from_server({'passphrase' => 'gameover:('})
|
110
|
+
|
111
|
+
rescue ArgumentError => e
|
112
|
+
test = e.message
|
113
|
+
clear_outbound
|
114
|
+
assert_match(/Please check if you have entered correct passphrase to config and that your merchant private key is added to your gpg keyring and is trusted/, test)
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
def clear_outbound
|
119
|
+
config_dir = ENV['LITLE_CONFIG_DIR']
|
120
|
+
ENV['LITLE_CONFIG_DIR'] = '/tmp/pgp_ruby'
|
121
|
+
options = Configuration.new.config
|
122
|
+
sftp_username = options['sftp_username']
|
123
|
+
sftp_password = options['sftp_password']
|
124
|
+
sftp_url = options['sftp_url']
|
125
|
+
ENV['LITLE_CONFIG_DIR'] = config_dir
|
126
|
+
|
127
|
+
Net::SFTP.start(sftp_url, sftp_username, :password => sftp_password) do |sftp|
|
128
|
+
handle = sftp.opendir!('/outbound/')
|
129
|
+
files_on_srv = sftp.readdir!(handle)
|
130
|
+
files_on_srv.each {|file|
|
131
|
+
if (file.name =~ /#{REQUEST_FILE_PREFIX}\d+#{COMPLETE_FILE_SUFFIX}#{ENCRYPTED_FILE_SUFFIX}.asc\z/) != nil
|
132
|
+
sftp.remove('/outbound/' + file.name)
|
133
|
+
end
|
134
|
+
}
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,105 @@
|
|
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
|
+
|
26
|
+
|
27
|
+
require File.expand_path("../../../lib/LitleOnline",__FILE__)
|
28
|
+
require 'test/unit'
|
29
|
+
require 'mocha/setup'
|
30
|
+
|
31
|
+
# TESTING THE QUERY TRANSACTION FEATURE
|
32
|
+
|
33
|
+
|
34
|
+
module LitleOnline
|
35
|
+
=begin
|
36
|
+
Definition: Class Definition for the Testing Class TestQueryTransaction
|
37
|
+
Created on: 01-29-2016
|
38
|
+
Reason: To test the incorporation new features developed in Ruby SDK as per XML 10.1 schema.
|
39
|
+
=end
|
40
|
+
|
41
|
+
class TestQueryTransaction < Test::Unit::TestCase
|
42
|
+
|
43
|
+
=begin
|
44
|
+
Name - test_queryTransaction
|
45
|
+
Description - To validate request by providing valid query transaction fields
|
46
|
+
Expected Response - Success
|
47
|
+
=end
|
48
|
+
def test_queryTransaction
|
49
|
+
hash =
|
50
|
+
{
|
51
|
+
'merchantId' => '101',
|
52
|
+
'id' => 'test',
|
53
|
+
'version'=>'10.0',
|
54
|
+
'reportGroup'=>'Some RG',
|
55
|
+
'customerId' => '038945',
|
56
|
+
'origId' => '834262',
|
57
|
+
'origActionType' => 'A',
|
58
|
+
'transactionId'=>'123456',
|
59
|
+
'orderId'=>'65347567',
|
60
|
+
#'origAccountNumber' => '4000000000000001'
|
61
|
+
}
|
62
|
+
|
63
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<queryTransaction.*?<origId>834262<\/origId><origActionType>A<\/origActionType>.*?<\/queryTransaction>.*?/m), is_a(Hash))
|
64
|
+
LitleOnlineRequest.new.query_Transaction(hash)
|
65
|
+
end
|
66
|
+
|
67
|
+
=begin
|
68
|
+
Name - test_queryTransaction_no_optional_fields
|
69
|
+
Description - To validate request by providing valid query transaction without providing optional fields
|
70
|
+
Expected Response - Success
|
71
|
+
=end
|
72
|
+
def test_queryTransaction_no_optional_fields
|
73
|
+
hash =
|
74
|
+
{
|
75
|
+
'merchantId' => '101',
|
76
|
+
'id' => 'test',
|
77
|
+
'version'=>'10.0',
|
78
|
+
'reportGroup'=>'Some RG',
|
79
|
+
'customerId' => '038945',
|
80
|
+
'origId' => '834262',
|
81
|
+
'origActionType' => 'A',
|
82
|
+
'transactionId'=>'123456'
|
83
|
+
}
|
84
|
+
|
85
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<queryTransaction.*?<origId>834262<\/origId><origActionType>A<\/origActionType>.*?<\/queryTransaction>.*?/m), is_a(Hash))
|
86
|
+
LitleOnlineRequest.new.query_Transaction(hash)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_queryTransaction_no_origId1
|
90
|
+
hash =
|
91
|
+
{
|
92
|
+
'merchantId' => '101',
|
93
|
+
'id' => 'test',
|
94
|
+
'version'=>'10.0',
|
95
|
+
'reportGroup'=>'Some RG',
|
96
|
+
'customerId' => '038945',
|
97
|
+
'origActionType' => 'A',
|
98
|
+
'transactionId'=>'123456'
|
99
|
+
}
|
100
|
+
|
101
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<queryTransaction.*?<origActionType>A<\/origActionType>.*?<\/queryTransaction>.*?/m), is_a(Hash))
|
102
|
+
LitleOnlineRequest.new.query_Transaction(hash)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
@@ -33,11 +33,23 @@ module LitleOnline
|
|
33
33
|
'merchantId' => '101',
|
34
34
|
'version'=>'8.8',
|
35
35
|
'reportGroup'=>'Planets',
|
36
|
-
'litleTxnId' => '5000'
|
36
|
+
'litleTxnId' => '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',
|
37
49
|
}
|
38
50
|
|
39
|
-
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<
|
40
|
-
LitleOnlineRequest.new.
|
51
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<litleTxnId>5000<\/litleTxnId><card><type>GC<\/type><number>400000000000001<\/number><expDate>0150<\/expDate><cardValidationNum>411<\/cardValidationNum><pin>1234<\/pin><\/card>.*/m), is_a(Hash))
|
52
|
+
LitleOnlineRequest.new.deposit_reversal(hash)
|
41
53
|
end
|
42
54
|
end
|
43
55
|
|
data/test/unit/test_sale.rb
CHANGED
@@ -68,7 +68,8 @@ module LitleOnline
|
|
68
68
|
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
69
69
|
},
|
70
70
|
'signature' =>'sign',
|
71
|
-
|
71
|
+
# 'version' =>'1'
|
72
|
+
'version' =>'10000'
|
72
73
|
}
|
73
74
|
}
|
74
75
|
|
@@ -458,8 +459,8 @@ module LitleOnline
|
|
458
459
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<advancedFraudChecks><threatMetrixSessionId>1234<\/threatMetrixSessionId><\/advancedFraudChecks>.*/m), is_a(Hash))
|
459
460
|
LitleOnlineRequest.new.sale(hash)
|
460
461
|
end
|
461
|
-
|
462
|
-
|
462
|
+
|
463
|
+
def test_processingType
|
463
464
|
hash = {
|
464
465
|
'merchantId' => '101',
|
465
466
|
'version'=>'8.8',
|
@@ -527,5 +528,24 @@ module LitleOnline
|
|
527
528
|
LitleOnlineRequest.new.sale(hash)
|
528
529
|
end
|
529
530
|
|
531
|
+
|
532
|
+
def test_sepaDirectDebit
|
533
|
+
hash = {
|
534
|
+
'merchantId' => '101',
|
535
|
+
'version'=>'8.8',
|
536
|
+
'reportGroup'=>'Planets',
|
537
|
+
'litleTxnId'=>'123456',
|
538
|
+
'orderId'=>'12344',
|
539
|
+
'amount'=>'106',
|
540
|
+
'orderSource'=>'ecommerce',
|
541
|
+
'sepaDirectDebit'=> {
|
542
|
+
'mandateProvider'=>'Merchant',
|
543
|
+
'sequenceType'=>'OneTime',
|
544
|
+
'iban'=>'123456789123456789',
|
545
|
+
}}
|
546
|
+
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<sepaDirectDebit><mandateProvider>Merchant<\/mandateProvider><sequenceType>OneTime<\/sequenceType><iban>123456789123456789<\/iban><\/sepaDirectDebit>.*/m), is_a(Hash))
|
547
|
+
LitleOnlineRequest.new.sale(hash)
|
548
|
+
end
|
549
|
+
|
530
550
|
end
|
531
551
|
end
|
data/test/unit/test_token.rb
CHANGED
@@ -35,15 +35,17 @@ module LitleOnline
|
|
35
35
|
'reportGroup'=>'Planets',
|
36
36
|
'orderId'=>'12344',
|
37
37
|
'applepay'=>{
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
38
|
+
'data'=>'user',
|
39
|
+
'header'=>{
|
40
|
+
'applicationData'=>'454657413164',
|
41
|
+
'ephemeralPublicKey'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
42
|
+
'publicKeyHash'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855',
|
43
|
+
'transactionId'=>'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'
|
44
|
+
},
|
45
|
+
'signature' =>'sign',
|
46
|
+
# 'version' =>'1'
|
47
|
+
# SDL Ruby XML 10
|
48
|
+
'version' =>'10000'
|
47
49
|
}
|
48
50
|
}
|
49
51
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*?<litleOnlineRequest.*?<registerTokenRequest.*?<applepay>.*?<data>user<\/data>.*?<\/applepay>.*?<\/registerTokenRequest>.*?/m), is_a(Hash))
|
@@ -58,15 +60,17 @@ module LitleOnline
|
|
58
60
|
'orderId'=>'12344',
|
59
61
|
'accountNumber'=>'1233456789101112',
|
60
62
|
'applepay'=>{
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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
|
+
# SDL Ruby XML 10
|
73
|
+
'version' =>'10000'
|
70
74
|
}
|
71
75
|
}
|
72
76
|
exception = assert_raise(RuntimeError){LitleOnlineRequest.new.register_token_request(hash)}
|
@@ -138,18 +142,18 @@ module LitleOnline
|
|
138
142
|
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
143
|
LitleOnlineRequest.new.register_token_request(hash)
|
140
144
|
end
|
141
|
-
|
145
|
+
|
142
146
|
def test_androidpay
|
143
147
|
hash = {
|
144
148
|
'merchantId' => '101',
|
145
149
|
'version'=>'8.8',
|
146
150
|
'reportGroup'=>'Planets',
|
151
|
+
'id'=>'test',
|
147
152
|
'orderId'=>'androidpay',
|
148
153
|
'accountNumber'=>'1233456789103801'
|
149
154
|
}
|
150
155
|
LitleXmlMapper.expects(:request).with(regexp_matches(/.*<orderId>androidpay<\/orderId>.*<accountNumber>1233456789103801<\/accountNumber>.*/m), is_a(Hash))
|
151
156
|
LitleOnlineRequest.new.register_token_request(hash)
|
152
157
|
end
|
153
|
-
|
154
158
|
end
|
155
159
|
end
|