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,142 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (c) 2011 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
|
+
|
|
26
|
+
|
|
27
|
+
# This file contains the preloaded listeners for parsing the response XML.
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
module LitleOnline
|
|
31
|
+
|
|
32
|
+
# This listener will run the provided closure over every response hash
|
|
33
|
+
# This is the base class for all listeners applied to transaction responses
|
|
34
|
+
class DefaultLitleListener
|
|
35
|
+
def initialize(&action)
|
|
36
|
+
@action = action
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def apply(duck)
|
|
40
|
+
# apply the proc uniformly across all response types
|
|
41
|
+
@action.call(duck)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
class AuthorizationListener < DefaultLitleListener
|
|
46
|
+
def apply(duck)
|
|
47
|
+
if(duck["type"] == "authorizationResponse") then
|
|
48
|
+
@action.call(duck)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
class CaptureListener < DefaultLitleListener
|
|
54
|
+
def apply(duck)
|
|
55
|
+
if(duck["type"] == "captureResponse") then
|
|
56
|
+
@action.call(duck)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class ForceCaptureListener < DefaultLitleListener
|
|
62
|
+
def apply(duck)
|
|
63
|
+
if(duck["type"] == "forceCaptureResponse") then
|
|
64
|
+
@action.call(duck)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
class CaptureGivenAuthListener < DefaultLitleListener
|
|
70
|
+
def apply(duck)
|
|
71
|
+
if(duck["type"] == "captureGivenAuthResponse") then
|
|
72
|
+
@action.call(duck)
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
class SaleListener < DefaultLitleListener
|
|
78
|
+
def apply(duck)
|
|
79
|
+
if(duck["type"] == "saleResponse") then
|
|
80
|
+
@action.call(duck)
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class CreditListener < DefaultLitleListener
|
|
87
|
+
def apply(duck)
|
|
88
|
+
if(duck["type"] == "creditResponse") then
|
|
89
|
+
@action.call(duck)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
class EcheckSaleListener < DefaultLitleListener
|
|
95
|
+
def apply(duck)
|
|
96
|
+
if(duck["type"] == "echeckSaleResponse") then
|
|
97
|
+
@action.call(duck)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
class EcheckCreditListener < DefaultLitleListener
|
|
103
|
+
def apply(duck)
|
|
104
|
+
if(duck["type"] == "echeckCreditResponse") then
|
|
105
|
+
@action.call(duck)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
class EcheckVerificationListener < DefaultLitleListener
|
|
111
|
+
def apply(duck)
|
|
112
|
+
if(duck["type"] == "echeckVerificationResponse") then
|
|
113
|
+
@action.call(duck)
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
class EcheckRedepositListener < DefaultLitleListener
|
|
119
|
+
def apply(duck)
|
|
120
|
+
if(duck["type"] == "echeckRedepositResponse") then
|
|
121
|
+
@action.call(duck)
|
|
122
|
+
end
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
class AuthReversalListener < DefaultLitleListener
|
|
127
|
+
def apply(duck)
|
|
128
|
+
if(duck["type"] == "authReversalResponse") then
|
|
129
|
+
@action.call(duck)
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
class RegisterTokenListener < DefaultLitleListener
|
|
135
|
+
def apply(duck)
|
|
136
|
+
if(duck["type"] == "registerTokenResponse") then
|
|
137
|
+
@action.call(duck)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
end
|
data/lib/LitleOnline.rb
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
Copyright (c) 2011 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
|
+
|
|
26
|
+
#
|
|
27
|
+
# Header file containing required gems and ruby files
|
|
28
|
+
# Defines the Gem
|
|
29
|
+
#
|
|
30
|
+
require 'rubygems'
|
|
31
|
+
require 'net/http'
|
|
32
|
+
require 'xml-object'
|
|
33
|
+
require 'yaml'
|
|
34
|
+
require 'uri'
|
|
35
|
+
require 'net/https'
|
|
36
|
+
require 'xml/mapping'
|
|
37
|
+
|
|
38
|
+
unless Kernel.respond_to?(:require_relative)
|
|
39
|
+
module Kernel
|
|
40
|
+
def require_relative(path)
|
|
41
|
+
require File.join(File.dirname(caller[0]), path.to_str)
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
require_relative 'Communications'
|
|
48
|
+
require_relative 'LitleXmlMapper'
|
|
49
|
+
require_relative 'XMLFields'
|
|
50
|
+
require_relative 'LitleTransaction'
|
|
51
|
+
require_relative 'LitleBatchRequest'
|
|
52
|
+
require_relative 'LitleOnlineRequest'
|
|
53
|
+
require_relative 'LitleRequest'
|
|
54
|
+
require_relative 'LitleListeners'
|
|
55
|
+
require_relative 'Configuration'
|
|
56
|
+
|
|
57
|
+
#allows attribute values to be in double quotes, required by Litle Server
|
|
58
|
+
REXML::Attribute.class_eval( %q^
|
|
59
|
+
def to_string
|
|
60
|
+
%Q[#@expanded_name="#{to_s().gsub(/"/, '"')}"]
|
|
61
|
+
end
|
|
62
|
+
^ )
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
# Copyright (c) 2011 Litle & Co.
|
|
2
|
+
#
|
|
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
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
17
|
+
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
19
|
+
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
20
|
+
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
22
|
+
# OTHER DEALINGS IN THE SOFTWARE.
|
|
23
|
+
require_relative 'Configuration'
|
|
24
|
+
|
|
25
|
+
#
|
|
26
|
+
# This class handles sending the Litle online request
|
|
27
|
+
#
|
|
28
|
+
module LitleOnline
|
|
29
|
+
class LitleOnlineRequest
|
|
30
|
+
def initialize
|
|
31
|
+
# load configuration data
|
|
32
|
+
@config_hash = Configuration.new.config
|
|
33
|
+
@litle_transaction = LitleTransaction.new
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def virtual_giftcard(options)
|
|
37
|
+
transaction = @litle_transaction.virtual_giftcard(options)
|
|
38
|
+
|
|
39
|
+
commit(transaction, :virtualGiftCard, options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def create_plan(options)
|
|
43
|
+
transaction = @litle_transaction.create_plan(options)
|
|
44
|
+
|
|
45
|
+
commit(transaction, :createPlan, options)
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def update_plan(options)
|
|
49
|
+
transaction = @litle_transaction.update_plan(options)
|
|
50
|
+
|
|
51
|
+
commit(transaction, :updatePlan, options)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def cancel_subscription(options)
|
|
55
|
+
transaction = @litle_transaction.cancel_subscription(options)
|
|
56
|
+
|
|
57
|
+
commit(transaction, :cancelSubscription, options)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def update_subscription(options)
|
|
61
|
+
transaction = @litle_transaction.update_subscription(options)
|
|
62
|
+
|
|
63
|
+
commit(transaction, :updateSubscription, options)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def activate(options)
|
|
67
|
+
transaction = @litle_transaction.activate(options)
|
|
68
|
+
|
|
69
|
+
commit(transaction, :activate, options)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def deactivate(options)
|
|
73
|
+
transaction = @litle_transaction.deactivate(options)
|
|
74
|
+
|
|
75
|
+
commit(transaction, :deactivate, options)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def load_request(options)
|
|
79
|
+
transaction = @litle_transaction.load_request(options)
|
|
80
|
+
|
|
81
|
+
commit(transaction, :load, options)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def unload_request(options)
|
|
85
|
+
transaction = @litle_transaction.unload_request(options)
|
|
86
|
+
|
|
87
|
+
commit(transaction, :unload, options)
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def balance_inquiry(options)
|
|
91
|
+
transaction = @litle_transaction.balance_inquiry(options)
|
|
92
|
+
|
|
93
|
+
commit(transaction, :balanceInquiry, options)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def activate_reversal(options)
|
|
97
|
+
transaction = @litle_transaction.activate_reversal(options)
|
|
98
|
+
|
|
99
|
+
commit(transaction, :activateReversal, options)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def deposit_reversal(options)
|
|
103
|
+
transaction = @litle_transaction.deposit_reversal(options)
|
|
104
|
+
|
|
105
|
+
commit(transaction, :depositReversal, options)
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def refund_reversal(options)
|
|
109
|
+
transaction = @litle_transaction.refund_reversal(options)
|
|
110
|
+
|
|
111
|
+
commit(transaction, :refundReversal, options)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def deactivate_reversal(options)
|
|
115
|
+
transaction = @litle_transaction.deactivate_reversal(options)
|
|
116
|
+
|
|
117
|
+
commit(transaction, :deactivateReversal, options)
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def load_reversal(options)
|
|
121
|
+
transaction = @litle_transaction.load_reversal(options)
|
|
122
|
+
|
|
123
|
+
commit(transaction, :loadReversal, options)
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def unload_reversal(options)
|
|
127
|
+
transaction = @litle_transaction.unload_reversal(options)
|
|
128
|
+
|
|
129
|
+
commit(transaction, :unloadReversal, options)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def authorization(options)
|
|
133
|
+
transaction = @litle_transaction.authorization(options)
|
|
134
|
+
|
|
135
|
+
commit(transaction, :authorization, options)
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def sale(options)
|
|
139
|
+
transaction = @litle_transaction.sale(options)
|
|
140
|
+
|
|
141
|
+
commit(transaction, :sale, options)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def auth_reversal(options)
|
|
145
|
+
transaction = @litle_transaction.auth_reversal(options)
|
|
146
|
+
|
|
147
|
+
commit(transaction, :authReversal, options)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
def credit(options)
|
|
151
|
+
transaction = @litle_transaction.credit(options)
|
|
152
|
+
|
|
153
|
+
commit(transaction, :credit, options)
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
def register_token_request(options)
|
|
157
|
+
transaction = @litle_transaction.register_token_request(options)
|
|
158
|
+
|
|
159
|
+
commit(transaction, :registerTokenRequest, options)
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
def update_card_validation_num_on_token(options)
|
|
163
|
+
transaction = @litle_transaction.update_card_validation_num_on_token(options)
|
|
164
|
+
|
|
165
|
+
commit(transaction, :updateCardValidationNumOnToken, options)
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
def force_capture(options)
|
|
169
|
+
transaction = @litle_transaction.force_capture(options)
|
|
170
|
+
|
|
171
|
+
commit(transaction, :forceCapture, options)
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def capture(options)
|
|
175
|
+
transaction = @litle_transaction.capture(options)
|
|
176
|
+
|
|
177
|
+
commit(transaction, :captureTxn, options)
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def capture_given_auth(options)
|
|
181
|
+
transaction = @litle_transaction.capture_given_auth(options)
|
|
182
|
+
|
|
183
|
+
commit(transaction, :captureGivenAuth, options)
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def void(options)
|
|
187
|
+
transaction = @litle_transaction.void(options)
|
|
188
|
+
|
|
189
|
+
commit(transaction, :void, options)
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def echeck_redeposit(options)
|
|
193
|
+
transaction = @litle_transaction.echeck_redeposit(options)
|
|
194
|
+
|
|
195
|
+
commit(transaction, :echeckRedeposit, options)
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def echeck_sale(options)
|
|
199
|
+
transaction = @litle_transaction.echeck_sale(options)
|
|
200
|
+
|
|
201
|
+
commit(transaction, :echeckSale, options)
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
def echeck_credit(options)
|
|
205
|
+
transaction = @litle_transaction.echeck_credit(options)
|
|
206
|
+
|
|
207
|
+
begin
|
|
208
|
+
commit(transaction, :echeckCredit, options)
|
|
209
|
+
rescue XML::MappingError => e
|
|
210
|
+
response = LitleOnlineResponse.new
|
|
211
|
+
response.message = "The content of element 'echeckCredit' is not complete"
|
|
212
|
+
return response
|
|
213
|
+
end
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
def echeck_verification(options)
|
|
217
|
+
transaction = @litle_transaction.echeck_verification(options)
|
|
218
|
+
|
|
219
|
+
commit(transaction, :echeckVerification, options)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
def echeck_void(options)
|
|
223
|
+
transaction = @litle_transaction.echeck_void(options)
|
|
224
|
+
|
|
225
|
+
commit(transaction, :echeckVoid, options)
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
private
|
|
229
|
+
|
|
230
|
+
def add_account_info(transaction, options)
|
|
231
|
+
if transaction.respond_to?(:reportGroup)
|
|
232
|
+
transaction.reportGroup = get_report_group(options)
|
|
233
|
+
end
|
|
234
|
+
if transaction.respond_to?(:transactionId)
|
|
235
|
+
transaction.transactionId = options['id']
|
|
236
|
+
end
|
|
237
|
+
if transaction.respond_to?(:customerId)
|
|
238
|
+
transaction.customerId = options['customerId']
|
|
239
|
+
end
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
def build_request(options)
|
|
243
|
+
request = OnlineRequest.new
|
|
244
|
+
|
|
245
|
+
authentication = Authentication.new
|
|
246
|
+
authentication.user = get_config(:user, options)
|
|
247
|
+
authentication.password = get_config(:password, options)
|
|
248
|
+
|
|
249
|
+
request.authentication = authentication
|
|
250
|
+
request.merchantId = get_merchant_id(options)
|
|
251
|
+
request.version = '8.31'
|
|
252
|
+
request.loggedInUser = get_logged_in_user(options)
|
|
253
|
+
request.xmlns = 'http://www.litle.com/schema'
|
|
254
|
+
request.merchantSdk = get_merchant_sdk(options)
|
|
255
|
+
|
|
256
|
+
request
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
def commit(transaction, type, options)
|
|
260
|
+
configure_connection(options)
|
|
261
|
+
|
|
262
|
+
request = build_request(options)
|
|
263
|
+
|
|
264
|
+
add_account_info(transaction, options)
|
|
265
|
+
request.send(:"#{type}=", transaction)
|
|
266
|
+
|
|
267
|
+
xml = request.save_to_xml.to_s
|
|
268
|
+
LitleXmlMapper.request(xml, @config_hash)
|
|
269
|
+
end
|
|
270
|
+
|
|
271
|
+
def configure_connection(options = {})
|
|
272
|
+
@config_hash['proxy_addr'] = options['proxy_addr'] unless options['proxy_addr'].nil?
|
|
273
|
+
@config_hash['proxy_port'] = options['proxy_port'] unless options['proxy_port'].nil?
|
|
274
|
+
@config_hash['url'] = options['url'] unless options['url'].nil?
|
|
275
|
+
end
|
|
276
|
+
|
|
277
|
+
def get_merchant_id(options)
|
|
278
|
+
options['merchantId'] || @config_hash['currency_merchant_map']['DEFAULT']
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
def get_merchant_sdk(options)
|
|
282
|
+
options['merchantSdk'] || 'Ruby;8.31.0'
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
def get_report_group(options)
|
|
286
|
+
options['reportGroup'] || @config_hash['default_report_group']
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
def get_config(field, options)
|
|
290
|
+
options[field.to_s].nil? ? @config_hash[field.to_s] : options[field.to_s]
|
|
291
|
+
end
|
|
292
|
+
|
|
293
|
+
def get_logged_in_user(options)
|
|
294
|
+
options['loggedInUser'] || nil
|
|
295
|
+
end
|
|
296
|
+
end
|
|
297
|
+
end
|