LitleOnline 8.12.0 → 8.12.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +28 -0
- data/Rakefile +2 -3
- data/lib/Communications.rb +14 -12
- data/lib/LitleOnline.rb +11 -2
- data/lib/LitleOnlineRequest.rb +435 -284
- data/lib/LitleXmlMapper.rb +1 -2
- data/lib/XMLFields.rb +900 -307
- data/lib/cacert.pem +3331 -0
- data/test/certification/certTest2_authenhanced.rb +7 -7
- data/test/certification/certTest5_token.rb +8 -8
- data/test/functional/test_auth.rb +106 -3
- data/test/functional/test_authReversal.rb +5 -6
- data/test/functional/test_capture.rb +12 -1
- data/test/functional/test_captureGivenAuth.rb +25 -5
- data/test/functional/test_credit.rb +1 -1
- data/test/functional/test_echeckRedeposit.rb +34 -0
- data/test/functional/test_echeckVerification.rb +33 -0
- data/test/functional/test_forceCapture.rb +35 -0
- data/test/functional/test_sale.rb +45 -13
- data/test/functional/test_xmlfields.rb +197 -10
- data/test/functional/ts_all.rb +2 -0
- data/test/unit/test_LitleOnlineRequest.rb +2 -59
- data/test/unit/test_auth.rb +2 -51
- data/test/unit/test_authReversal.rb +10 -5
- data/test/unit/test_capture.rb +5 -7
- data/test/unit/test_captureGivenAuth.rb +0 -19
- data/test/unit/test_credit.rb +1 -0
- data/test/unit/test_echeckCredit.rb +0 -2
- data/test/unit/test_echeckRedeposit.rb +0 -34
- data/test/unit/test_echeckSale.rb +0 -1
- data/test/unit/test_echeckVerification.rb +0 -33
- data/test/unit/test_forceCapture.rb +0 -35
- data/test/unit/test_sale.rb +20 -51
- data/test/unit/test_xmlfields.rb +44 -84
- data/test/unit/ts_unit.rb +1 -1
- metadata +13 -26
- data/index.html +0 -176
- data/index.html.1 +0 -176
- data/lib/Checker.rb +0 -56
- data/test/unit/test_Checker.rb +0 -58
data/CHANGELOG
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
= LitleOnline CHANGELOG
|
2
|
+
|
3
|
+
== Version 8.12.1 (May 15, 2012)
|
4
|
+
|
5
|
+
* Feature: Support Ruby 1.8.7
|
6
|
+
* Bugfix: Add support for line item data and tax detail to enhanced auth
|
7
|
+
|
8
|
+
== Version 8.12.0 (April 16, 2012)
|
9
|
+
|
10
|
+
* Feature: Add support for actionReason on credit
|
11
|
+
* Feature: Track SDK Usage
|
12
|
+
* Bugfix: Add support for MerchantData on auth and sale
|
13
|
+
|
14
|
+
== Version 8.10.3 (April 16, 2012)
|
15
|
+
|
16
|
+
* Feature: Support Ruby 1.8.6
|
17
|
+
* Bugfix: Setup sandbox url was incorrect
|
18
|
+
* Cleanup: Support newest sandbox conventions
|
19
|
+
|
20
|
+
== Version 8.10.1 (March 2, 2012)
|
21
|
+
|
22
|
+
* Feature: Allow use without the configuration file
|
23
|
+
* Bugfix: Reauth works
|
24
|
+
* Cleanup: Use ruby conventions
|
25
|
+
|
26
|
+
== Version 8.10.0 (February 17, 2012)
|
27
|
+
|
28
|
+
* Initial release
|
data/Rakefile
CHANGED
@@ -34,7 +34,7 @@ spec = Gem::Specification.new do |s|
|
|
34
34
|
s.description = File.read(File.join(File.dirname(__FILE__), 'DESCRIPTION'))
|
35
35
|
s.requirements =
|
36
36
|
[ 'Contact sdksupport@litle.com for more information' ]
|
37
|
-
s.version = "8.12.
|
37
|
+
s.version = "8.12.1"
|
38
38
|
s.author = "Litle & Co"
|
39
39
|
s.email = "sdksupport@litle.com"
|
40
40
|
s.homepage = "http://www.litle.com/developers"
|
@@ -44,9 +44,8 @@ spec = Gem::Specification.new do |s|
|
|
44
44
|
s.executables = [ 'sample_driver.rb', 'Setup.rb' ]
|
45
45
|
s.test_files = Dir["test/unit/ts_unit.rb"]
|
46
46
|
s.has_rdoc = true
|
47
|
-
s.add_dependency('i18n')
|
48
|
-
s.add_dependency('xml-simple')
|
49
47
|
s.add_dependency('xml-object')
|
48
|
+
s.add_dependency('xml-mapping')
|
50
49
|
s.add_development_dependency('mocha')
|
51
50
|
end
|
52
51
|
|
data/lib/Communications.rb
CHANGED
@@ -38,20 +38,22 @@ class Communications
|
|
38
38
|
litle_url = config_hash['url']
|
39
39
|
|
40
40
|
# setup https or http post
|
41
|
-
|
41
|
+
url = URI.parse(litle_url)
|
42
42
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
proxy = Net::HTTP::Proxy(proxy_addr,proxy_port)
|
50
|
-
# See notes below on recommended time outs
|
51
|
-
proxy.start(uri.host, uri.port, :use_ssl => uri.scheme=='https', :read_timeout => config_hash['timeout']) do |http|
|
52
|
-
response_xml = http.request(http_post)
|
53
|
-
end
|
43
|
+
response_xml = nil
|
44
|
+
https = Net::HTTP.new(url.host, url.port, proxy_addr, proxy_port)
|
45
|
+
if(url.scheme == 'https')
|
46
|
+
https.use_ssl = url.scheme=='https'
|
47
|
+
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
48
|
+
https.ca_file = File.join(File.dirname(__FILE__), "cacert.pem")
|
54
49
|
end
|
50
|
+
https.start { |http|
|
51
|
+
response = http.request_post(url.path, post_data.to_s, {'Content-type'=>'text/xml'})
|
52
|
+
response_xml = response
|
53
|
+
}
|
54
|
+
|
55
|
+
|
56
|
+
|
55
57
|
|
56
58
|
# validate response, only an HTTP 200 will work, redirects are not followed
|
57
59
|
case response_xml
|
data/lib/LitleOnline.rb
CHANGED
@@ -28,18 +28,27 @@ OTHER DEALINGS IN THE SOFTWARE.
|
|
28
28
|
# Defines the Gem
|
29
29
|
#
|
30
30
|
require 'rubygems'
|
31
|
-
require 'xmlsimple'
|
31
|
+
#require 'xmlsimple'
|
32
32
|
require 'net/http'
|
33
33
|
require 'xml-object'
|
34
34
|
require 'yaml'
|
35
35
|
require 'uri'
|
36
36
|
require 'net/https'
|
37
|
+
require 'xml/mapping'
|
38
|
+
|
39
|
+
unless Kernel.respond_to?(:require_relative)
|
40
|
+
module Kernel
|
41
|
+
def require_relative(path)
|
42
|
+
require File.join(File.dirname(caller[0]), path.to_str)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
37
47
|
|
38
48
|
require_relative 'Communications'
|
39
49
|
require_relative 'Obj2xml'
|
40
50
|
require_relative 'LitleXmlMapper'
|
41
51
|
require_relative 'XMLFields'
|
42
|
-
require_relative 'Checker'
|
43
52
|
require_relative 'LitleOnlineRequest'
|
44
53
|
require_relative 'Configuration'
|
45
54
|
|
data/lib/LitleOnlineRequest.rb
CHANGED
@@ -36,322 +36,465 @@ class LitleOnlineRequest
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def authorization(hash_in)
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
39
|
+
request = OnlineRequest.new
|
40
|
+
authorization = Authorization.new
|
41
|
+
authorization.reportGroup = get_report_group(hash_in)
|
42
|
+
authorization.transactionId = hash_in['id']
|
43
|
+
authorization.customerId = hash_in['customerId']
|
44
|
+
|
45
|
+
authorization.litleTxnId = hash_in['litleTxnId']
|
46
|
+
authorization.orderId = hash_in['orderId']
|
47
|
+
authorization.amount = hash_in['amount']
|
48
|
+
authorization.orderSource = hash_in['orderSource']
|
49
|
+
authorization.customerInfo = CustomerInfo.from_hash(hash_in)
|
50
|
+
authorization.billToAddress = Contact.from_hash(hash_in,'billToAddress')
|
51
|
+
authorization.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
|
52
|
+
authorization.card = Card.from_hash(hash_in)
|
53
|
+
authorization.paypal = PayPal.from_hash(hash_in,'paypal')
|
54
|
+
authorization.token = CardToken.from_hash(hash_in,'token')
|
55
|
+
authorization.paypage = CardPaypage.from_hash(hash_in,'paypage')
|
56
|
+
authorization.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
|
57
|
+
authorization.cardholderAuthentication = FraudCheck.from_hash(hash_in)
|
58
|
+
authorization.processingInstructions = ProcessingInstructions.from_hash(hash_in)
|
59
|
+
authorization.pos = Pos.from_hash(hash_in)
|
60
|
+
authorization.customBilling = CustomBilling.from_hash(hash_in)
|
61
|
+
authorization.taxType = hash_in['taxType']
|
62
|
+
authorization.enhancedData = EnhancedData.from_hash(hash_in)
|
63
|
+
authorization.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
|
64
|
+
authorization.allowPartialAuth = hash_in['allowPartialAuth']
|
65
|
+
authorization.healthcareIIAS = HealthcareIIAS.from_hash(hash_in)
|
66
|
+
authorization.filtering = Filtering.from_hash(hash_in)
|
67
|
+
authorization.merchantData = MerchantData.from_hash(hash_in)
|
68
|
+
authorization.recyclingRequest = RecyclingRequest.from_hash(hash_in)
|
69
|
+
|
70
|
+
request.authorization = authorization
|
71
|
+
|
72
|
+
authentication = Authentication.new
|
73
|
+
authentication.user = 'PHXMLTEST'
|
74
|
+
authentication.password = 'password'
|
75
|
+
request.authentication = authentication
|
76
|
+
|
77
|
+
request.merchantId = get_merchant_id(hash_in)
|
78
|
+
request.version = get_version(hash_in)
|
79
|
+
request.xmlns = "http://www.litle.com/schema"
|
80
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
71
81
|
|
72
|
-
|
73
|
-
|
74
|
-
if(!is_litle_txn_id_provided)
|
75
|
-
choice1= {'1'=>hash_out[:card],'2' =>hash_out[:paypal],'3'=>hash_out[:token],'4'=>hash_out[:paypage]}
|
76
|
-
Checker.choice(choice1)
|
77
|
-
end
|
78
|
-
Checker.required_missing(hash_out)
|
79
|
-
litle_online_hash = build_full_hash(hash_in, {:authorization => hash_out})
|
80
|
-
Checker.required_missing(litle_online_hash)
|
81
|
-
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
82
|
+
xml = request.save_to_xml.to_s
|
83
|
+
LitleXmlMapper.request(xml, @config_hash)
|
82
84
|
end
|
83
85
|
|
84
86
|
def sale(hash_in)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
87
|
+
request = OnlineRequest.new
|
88
|
+
sale = Sale.new
|
89
|
+
sale.reportGroup = get_report_group(hash_in)
|
90
|
+
sale.transactionId = hash_in['id']
|
91
|
+
sale.customerId = hash_in['customerId']
|
92
|
+
|
93
|
+
sale.litleTxnId = hash_in['litleTxnId']
|
94
|
+
sale.orderId = hash_in['orderId']
|
95
|
+
sale.amount = hash_in['amount']
|
96
|
+
sale.orderSource = hash_in['orderSource']
|
97
|
+
sale.customerInfo = CustomerInfo.from_hash(hash_in)
|
98
|
+
sale.billToAddress = Contact.from_hash(hash_in,'billToAddress')
|
99
|
+
sale.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
|
100
|
+
sale.card = Card.from_hash(hash_in)
|
101
|
+
sale.paypal = PayPal.from_hash(hash_in,'paypal')
|
102
|
+
sale.token = CardToken.from_hash(hash_in,'token')
|
103
|
+
sale.paypage = CardPaypage.from_hash(hash_in,'paypage')
|
104
|
+
sale.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
|
105
|
+
sale.fraudCheck = FraudCheck.from_hash(hash_in,'fraudCheck')
|
106
|
+
sale.cardholderAuthentication = FraudCheck.from_hash(hash_in,'cardholderAuthentication')
|
107
|
+
sale.customBilling = CustomBilling.from_hash(hash_in)
|
108
|
+
sale.taxType = hash_in['taxType']
|
109
|
+
sale.enhancedData = EnhancedData.from_hash(hash_in)
|
110
|
+
sale.processingInstructions = ProcessingInstructions.from_hash(hash_in)
|
111
|
+
sale.pos = Pos.from_hash(hash_in)
|
112
|
+
sale.payPalOrderComplete = hash_in['paPpalOrderComplete']
|
113
|
+
sale.payPalNotes = hash_in['payPalNotes']
|
114
|
+
sale.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
|
115
|
+
sale.allowPartialAuth = hash_in['allowPartialAuth']
|
116
|
+
sale.healthcareIIAS = HealthcareIIAS.from_hash(hash_in)
|
117
|
+
sale.filtering = Filtering.from_hash(hash_in)
|
118
|
+
sale.merchantData = MerchantData.from_hash(hash_in)
|
119
|
+
sale.recyclingRequest = RecyclingRequest.from_hash(hash_in)
|
120
|
+
|
121
|
+
request.sale = sale
|
122
|
+
|
123
|
+
authentication = Authentication.new
|
124
|
+
authentication.user = 'PHXMLTEST'
|
125
|
+
authentication.password = 'password'
|
126
|
+
request.authentication = authentication
|
127
|
+
|
128
|
+
request.merchantId = get_merchant_id(hash_in)
|
129
|
+
request.version = get_version(hash_in)
|
130
|
+
request.xmlns = "http://www.litle.com/schema"
|
131
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
132
|
+
|
133
|
+
xml = request.save_to_xml.to_s
|
134
|
+
LitleXmlMapper.request(xml, @config_hash)
|
124
135
|
end
|
125
136
|
|
126
137
|
def auth_reversal(hash_in)
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
138
|
+
request = OnlineRequest.new
|
139
|
+
auth_reversal = AuthReversal.new
|
140
|
+
auth_reversal.reportGroup = get_report_group(hash_in)
|
141
|
+
auth_reversal.transactionId = hash_in['id']
|
142
|
+
auth_reversal.customerId = hash_in['customerId']
|
143
|
+
|
144
|
+
auth_reversal.litleTxnId = hash_in['litleTxnId']
|
145
|
+
auth_reversal.amount = hash_in['amount']
|
146
|
+
auth_reversal.payPalNotes = hash_in['payPalNotes']
|
147
|
+
auth_reversal.actionReason = hash_in['actionReason']
|
148
|
+
|
149
|
+
request.authReversal = auth_reversal
|
150
|
+
|
151
|
+
authentication = Authentication.new
|
152
|
+
authentication.user = 'PHXMLTEST'
|
153
|
+
authentication.password = 'password'
|
154
|
+
request.authentication = authentication
|
155
|
+
|
156
|
+
request.merchantId = get_merchant_id(hash_in)
|
157
|
+
request.version = get_version(hash_in)
|
158
|
+
request.xmlns = "http://www.litle.com/schema"
|
159
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
160
|
+
|
161
|
+
xml = request.save_to_xml.to_s
|
162
|
+
LitleXmlMapper.request(xml, @config_hash)
|
139
163
|
end
|
140
164
|
|
141
165
|
def credit(hash_in)
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
166
|
+
request = OnlineRequest.new
|
167
|
+
credit = Credit.new
|
168
|
+
credit.reportGroup = get_report_group(hash_in)
|
169
|
+
credit.transactionId = hash_in['id']
|
170
|
+
credit.customerId = hash_in['customerId']
|
171
|
+
|
172
|
+
credit.litleTxnId = hash_in['litleTxnId']
|
173
|
+
credit.orderId = hash_in['orderId']
|
174
|
+
credit.amount = hash_in['amount']
|
175
|
+
credit.orderSource = hash_in['orderSource']
|
176
|
+
credit.billToAddress = Contact.from_hash(hash_in,'billToAddress')
|
177
|
+
credit.card = Card.from_hash(hash_in)
|
178
|
+
credit.paypal = CreditPayPal.from_hash(hash_in,'paypal')
|
179
|
+
credit.token = CardToken.from_hash(hash_in,'token')
|
180
|
+
credit.paypage = CardPaypage.from_hash(hash_in,'paypage')
|
181
|
+
credit.customBilling = CustomBilling.from_hash(hash_in)
|
182
|
+
credit.taxType = hash_in['taxType']
|
183
|
+
credit.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
|
184
|
+
credit.enhancedData = EnhancedData.from_hash(hash_in)
|
185
|
+
credit.processingInstructions = ProcessingInstructions.from_hash(hash_in)
|
186
|
+
credit.pos = Pos.from_hash(hash_in)
|
187
|
+
credit.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
|
188
|
+
credit.payPalNotes = hash_in['payPalNotes']
|
189
|
+
credit.actionReason = hash_in['actionReason']
|
190
|
+
|
191
|
+
request.credit = credit
|
192
|
+
|
193
|
+
authentication = Authentication.new
|
194
|
+
authentication.user = 'PHXMLTEST'
|
195
|
+
authentication.password = 'password'
|
196
|
+
request.authentication = authentication
|
197
|
+
|
198
|
+
request.merchantId = get_merchant_id(hash_in)
|
199
|
+
request.version = get_version(hash_in)
|
200
|
+
request.xmlns = "http://www.litle.com/schema"
|
201
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
202
|
+
|
203
|
+
xml = request.save_to_xml.to_s
|
204
|
+
LitleXmlMapper.request(xml, @config_hash)
|
171
205
|
end
|
172
206
|
|
173
207
|
def register_token_request(hash_in)
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
208
|
+
request = OnlineRequest.new
|
209
|
+
token_request = RegisterTokenRequest.new
|
210
|
+
token_request.reportGroup = get_report_group(hash_in)
|
211
|
+
token_request.transactionId = hash_in['id']
|
212
|
+
token_request.customerId = hash_in['customerId']
|
213
|
+
|
214
|
+
token_request.orderId = hash_in['orderId']
|
215
|
+
token_request.accountNumber = hash_in['accountNumber']
|
216
|
+
token_request.echeckForToken = EcheckForToken.from_hash(hash_in)
|
217
|
+
token_request.paypageRegistrationId = hash_in['paypageRegistrationId']
|
218
|
+
|
219
|
+
request.registerTokenRequest = token_request
|
220
|
+
|
221
|
+
authentication = Authentication.new
|
222
|
+
authentication.user = 'PHXMLTEST'
|
223
|
+
authentication.password = 'password'
|
224
|
+
request.authentication = authentication
|
225
|
+
|
226
|
+
request.merchantId = get_merchant_id(hash_in)
|
227
|
+
request.version = get_version(hash_in)
|
228
|
+
request.xmlns = "http://www.litle.com/schema"
|
229
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
230
|
+
|
231
|
+
xml = request.save_to_xml.to_s
|
232
|
+
LitleXmlMapper.request(xml, @config_hash)
|
188
233
|
end
|
189
234
|
|
190
235
|
def force_capture(hash_in)
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
236
|
+
request = OnlineRequest.new
|
237
|
+
force_capture = ForceCapture.new
|
238
|
+
force_capture.reportGroup = get_report_group(hash_in)
|
239
|
+
force_capture.transactionId = hash_in['id']
|
240
|
+
force_capture.customerId = hash_in['customerId']
|
241
|
+
|
242
|
+
force_capture.orderId = hash_in['orderId']
|
243
|
+
force_capture.amount = hash_in['amount']
|
244
|
+
force_capture.orderSource = hash_in['orderSource']
|
245
|
+
force_capture.billToAddress = Contact.from_hash(hash_in,'billToAddress')
|
246
|
+
force_capture.card = Card.from_hash(hash_in)
|
247
|
+
force_capture.token = CardToken.from_hash(hash_in,'token')
|
248
|
+
force_capture.paypage = CardPaypage.from_hash(hash_in,'paypage')
|
249
|
+
force_capture.customBilling = CustomBilling.from_hash(hash_in)
|
250
|
+
force_capture.taxType = hash_in['taxType']
|
251
|
+
force_capture.enhancedData = EnhancedData.from_hash(hash_in)
|
252
|
+
force_capture.processingInstructions = ProcessingInstructions.from_hash(hash_in)
|
253
|
+
force_capture.pos = Pos.from_hash(hash_in)
|
254
|
+
force_capture.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
|
255
|
+
|
256
|
+
request.forceCapture = force_capture
|
257
|
+
|
258
|
+
authentication = Authentication.new
|
259
|
+
authentication.user = 'PHXMLTEST'
|
260
|
+
authentication.password = 'password'
|
261
|
+
request.authentication = authentication
|
262
|
+
|
263
|
+
request.merchantId = get_merchant_id(hash_in)
|
264
|
+
request.version = get_version(hash_in)
|
265
|
+
request.xmlns = "http://www.litle.com/schema"
|
266
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
267
|
+
|
268
|
+
xml = request.save_to_xml.to_s
|
269
|
+
LitleXmlMapper.request(xml, @config_hash)
|
214
270
|
end
|
215
271
|
|
216
272
|
def capture(hash_in)
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
273
|
+
request = OnlineRequest.new
|
274
|
+
capture = Capture.new
|
275
|
+
capture.reportGroup = get_report_group(hash_in)
|
276
|
+
capture.transactionId = hash_in['id']
|
277
|
+
capture.customerId = hash_in['customerId']
|
278
|
+
|
279
|
+
capture.partial = hash_in['partial']
|
280
|
+
capture.litleTxnId = hash_in['litleTxnId']
|
281
|
+
capture.amount = hash_in['amount']
|
282
|
+
capture.enhancedData = EnhancedData.from_hash(hash_in)
|
283
|
+
capture.processingInstructions = ProcessingInstructions.from_hash(hash_in)
|
284
|
+
capture.payPalOrderComplete = hash_in['payPalOrderComplete']
|
285
|
+
capture.payPalNotes = hash_in['payPalNotes']
|
286
|
+
|
287
|
+
request.capture = capture
|
288
|
+
|
289
|
+
authentication = Authentication.new
|
290
|
+
authentication.user = 'PHXMLTEST'
|
291
|
+
authentication.password = 'password'
|
292
|
+
request.authentication = authentication
|
293
|
+
|
294
|
+
request.merchantId = get_merchant_id(hash_in)
|
295
|
+
request.version = get_version(hash_in)
|
296
|
+
request.xmlns = "http://www.litle.com/schema"
|
297
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
298
|
+
|
299
|
+
xml = request.save_to_xml.to_s
|
300
|
+
LitleXmlMapper.request(xml, @config_hash)
|
233
301
|
end
|
234
302
|
|
235
303
|
def capture_given_auth(hash_in)
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
304
|
+
request = OnlineRequest.new
|
305
|
+
capture_given_auth = CaptureGivenAuth.new
|
306
|
+
capture_given_auth.reportGroup = get_report_group(hash_in)
|
307
|
+
capture_given_auth.transactionId = hash_in['id']
|
308
|
+
capture_given_auth.customerId = hash_in['customerId']
|
309
|
+
|
310
|
+
capture_given_auth.orderId = hash_in['orderId']
|
311
|
+
capture_given_auth.authInformation = AuthInformation.from_hash(hash_in)
|
312
|
+
capture_given_auth.amount = hash_in['amount']
|
313
|
+
capture_given_auth.orderSource = hash_in['orderSource']
|
314
|
+
capture_given_auth.billToAddress = Contact.from_hash(hash_in,'billToAddress')
|
315
|
+
capture_given_auth.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
|
316
|
+
capture_given_auth.card = Card.from_hash(hash_in)
|
317
|
+
capture_given_auth.token = CardToken.from_hash(hash_in,'token')
|
318
|
+
capture_given_auth.paypage = CardPaypage.from_hash(hash_in,'paypage')
|
319
|
+
capture_given_auth.customBilling = CustomBilling.from_hash(hash_in)
|
320
|
+
capture_given_auth.taxType = hash_in['taxType']
|
321
|
+
capture_given_auth.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
|
322
|
+
capture_given_auth.enhancedData = EnhancedData.from_hash(hash_in)
|
323
|
+
capture_given_auth.processingInstructions = ProcessingInstructions.from_hash(hash_in)
|
324
|
+
capture_given_auth.pos = Pos.from_hash(hash_in)
|
325
|
+
capture_given_auth.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
|
326
|
+
|
327
|
+
request.captureGivenAuth = capture_given_auth
|
328
|
+
|
329
|
+
authentication = Authentication.new
|
330
|
+
authentication.user = 'PHXMLTEST'
|
331
|
+
authentication.password = 'password'
|
332
|
+
request.authentication = authentication
|
333
|
+
|
334
|
+
request.merchantId = get_merchant_id(hash_in)
|
335
|
+
request.version = get_version(hash_in)
|
336
|
+
request.xmlns = "http://www.litle.com/schema"
|
337
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
338
|
+
|
339
|
+
xml = request.save_to_xml.to_s
|
340
|
+
LitleXmlMapper.request(xml, @config_hash)
|
262
341
|
end
|
263
342
|
|
264
343
|
def echeck_redeposit(hash_in)
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
344
|
+
request = OnlineRequest.new
|
345
|
+
echeck_redeposit = EcheckRedeposit.new
|
346
|
+
echeck_redeposit.reportGroup = get_report_group(hash_in)
|
347
|
+
echeck_redeposit.transactionId = hash_in['id']
|
348
|
+
echeck_redeposit.customerId = hash_in['customerId']
|
349
|
+
|
350
|
+
echeck_redeposit.litleTxnId = hash_in['litleTxnId']
|
351
|
+
echeck_redeposit.echeck = Echeck.from_hash(hash_in)
|
352
|
+
echeck_redeposit.echeckToken = EcheckToken.from_hash(hash_in)
|
353
|
+
|
354
|
+
request.echeckRedeposit = echeck_redeposit
|
355
|
+
|
356
|
+
authentication = Authentication.new
|
357
|
+
authentication.user = 'PHXMLTEST'
|
358
|
+
authentication.password = 'password'
|
359
|
+
request.authentication = authentication
|
360
|
+
|
361
|
+
request.merchantId = get_merchant_id(hash_in)
|
362
|
+
request.version = get_version(hash_in)
|
363
|
+
request.xmlns = "http://www.litle.com/schema"
|
364
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
365
|
+
|
366
|
+
xml = request.save_to_xml.to_s
|
367
|
+
LitleXmlMapper.request(xml, @config_hash)
|
278
368
|
end
|
279
369
|
|
280
370
|
def echeck_sale(hash_in)
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
371
|
+
request = OnlineRequest.new
|
372
|
+
echeck_sale = EcheckSale.new
|
373
|
+
echeck_sale.reportGroup = get_report_group(hash_in)
|
374
|
+
echeck_sale.transactionId = hash_in['id']
|
375
|
+
echeck_sale.customerId = hash_in['customerId']
|
376
|
+
|
377
|
+
echeck_sale.litleTxnId = hash_in['litleTxnId']
|
378
|
+
echeck_sale.orderId = hash_in['orderId']
|
379
|
+
echeck_sale.verify = hash_in['verify']
|
380
|
+
echeck_sale.amount = hash_in['amount']
|
381
|
+
echeck_sale.orderSource = hash_in['orderSource']
|
382
|
+
echeck_sale.billToAddress = Contact.from_hash(hash_in,'billToAddress')
|
383
|
+
echeck_sale.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
|
384
|
+
echeck_sale.echeck = Echeck.from_hash(hash_in)
|
385
|
+
echeck_sale.echeckToken = EcheckToken.from_hash(hash_in)
|
386
|
+
echeck_sale.customBilling = CustomBilling.from_hash(hash_in)
|
387
|
+
|
388
|
+
request.echeckSale = echeck_sale
|
389
|
+
|
390
|
+
authentication = Authentication.new
|
391
|
+
authentication.user = 'PHXMLTEST'
|
392
|
+
authentication.password = 'password'
|
393
|
+
request.authentication = authentication
|
394
|
+
|
395
|
+
request.merchantId = get_merchant_id(hash_in)
|
396
|
+
request.version = get_version(hash_in)
|
397
|
+
request.xmlns = "http://www.litle.com/schema"
|
398
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
399
|
+
|
400
|
+
xml = request.save_to_xml.to_s
|
401
|
+
LitleXmlMapper.request(xml, @config_hash)
|
301
402
|
end
|
302
403
|
|
303
404
|
def echeck_credit(hash_in)
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
405
|
+
request = OnlineRequest.new
|
406
|
+
echeck_credit = EcheckCredit.new
|
407
|
+
echeck_credit.reportGroup = get_report_group(hash_in)
|
408
|
+
echeck_credit.transactionId = hash_in['id']
|
409
|
+
echeck_credit.customerId = hash_in['customerId']
|
410
|
+
|
411
|
+
echeck_credit.litleTxnId = hash_in['litleTxnId']
|
412
|
+
echeck_credit.orderId = hash_in['orderId']
|
413
|
+
echeck_credit.amount = hash_in['amount']
|
414
|
+
echeck_credit.orderSource = hash_in['orderSource']
|
415
|
+
echeck_credit.billToAddress = Contact.from_hash(hash_in,'billToAddress')
|
416
|
+
echeck_credit.echeck = Echeck.from_hash(hash_in)
|
417
|
+
echeck_credit.echeckToken = EcheckToken.from_hash(hash_in)
|
418
|
+
echeck_credit.customBilling = CustomBilling.from_hash(hash_in)
|
419
|
+
|
420
|
+
request.echeckCredit = echeck_credit
|
421
|
+
|
422
|
+
authentication = Authentication.new
|
423
|
+
authentication.user = 'PHXMLTEST'
|
424
|
+
authentication.password = 'password'
|
425
|
+
request.authentication = authentication
|
426
|
+
|
427
|
+
request.merchantId = get_merchant_id(hash_in)
|
428
|
+
request.version = get_version(hash_in)
|
429
|
+
request.xmlns = "http://www.litle.com/schema"
|
430
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
431
|
+
|
432
|
+
begin
|
433
|
+
xml = request.save_to_xml.to_s
|
434
|
+
rescue XML::MappingError => e
|
435
|
+
puts e
|
436
|
+
response = LitleOnlineResponse.new
|
437
|
+
response.message = "The content of element 'echeckCredit' is not complete"
|
438
|
+
return response
|
439
|
+
end
|
440
|
+
LitleXmlMapper.request(xml, @config_hash)
|
322
441
|
end
|
323
442
|
|
324
443
|
def echeck_verification(hash_in)
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
444
|
+
request = OnlineRequest.new
|
445
|
+
echeck_verification = EcheckVerification.new
|
446
|
+
echeck_verification.reportGroup = get_report_group(hash_in)
|
447
|
+
echeck_verification.transactionId = hash_in['id']
|
448
|
+
echeck_verification.customerId = hash_in['customerId']
|
449
|
+
|
450
|
+
echeck_verification.litleTxnId = hash_in['litleTxnId']
|
451
|
+
echeck_verification.orderId = hash_in['orderId']
|
452
|
+
echeck_verification.amount = hash_in['amount']
|
453
|
+
echeck_verification.orderSource = hash_in['orderSource']
|
454
|
+
echeck_verification.billToAddress = Contact.from_hash(hash_in,'billToAddress')
|
455
|
+
echeck_verification.echeck = Echeck.from_hash(hash_in)
|
456
|
+
echeck_verification.echeckToken = EcheckToken.from_hash(hash_in)
|
457
|
+
|
458
|
+
request.echeckVerification = echeck_verification
|
459
|
+
|
460
|
+
authentication = Authentication.new
|
461
|
+
authentication.user = 'PHXMLTEST'
|
462
|
+
authentication.password = 'password'
|
463
|
+
request.authentication = authentication
|
464
|
+
|
465
|
+
request.merchantId = get_merchant_id(hash_in)
|
466
|
+
request.version = get_version(hash_in)
|
467
|
+
request.xmlns = "http://www.litle.com/schema"
|
468
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
469
|
+
|
470
|
+
xml = request.save_to_xml.to_s
|
471
|
+
LitleXmlMapper.request(xml, @config_hash)
|
342
472
|
end
|
343
473
|
|
344
474
|
def void(hash_in)
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
475
|
+
request = OnlineRequest.new
|
476
|
+
void = Void.new
|
477
|
+
void.reportGroup = get_report_group(hash_in)
|
478
|
+
void.transactionId = hash_in['id']
|
479
|
+
void.customerId = hash_in['customerId']
|
480
|
+
|
481
|
+
void.litleTxnId = hash_in['litleTxnId']
|
482
|
+
void.processingInstructions = ProcessingInstructions.from_hash(hash_in)
|
483
|
+
|
484
|
+
request.void = void
|
485
|
+
|
486
|
+
authentication = Authentication.new
|
487
|
+
authentication.user = 'PHXMLTEST'
|
488
|
+
authentication.password = 'password'
|
489
|
+
request.authentication = authentication
|
490
|
+
|
491
|
+
request.merchantId = get_merchant_id(hash_in)
|
492
|
+
request.version = get_version(hash_in)
|
493
|
+
request.xmlns = "http://www.litle.com/schema"
|
494
|
+
request.merchantSdk = get_merchant_sdk(hash_in)
|
495
|
+
|
496
|
+
xml = request.save_to_xml.to_s
|
497
|
+
LitleXmlMapper.request(xml, @config_hash)
|
355
498
|
end
|
356
499
|
|
357
500
|
private
|
@@ -364,16 +507,24 @@ class LitleOnlineRequest
|
|
364
507
|
end
|
365
508
|
end
|
366
509
|
|
510
|
+
def get_version(hash_in)
|
511
|
+
if (hash_in['version'] == nil)
|
512
|
+
return @config_hash['version']
|
513
|
+
else
|
514
|
+
return hash_in['version']
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
367
518
|
def get_merchant_sdk(hash_in)
|
368
|
-
if(hash_in['merchantSdk']
|
369
|
-
return 'Ruby;8.12.
|
519
|
+
if(!hash_in['merchantSdk'])
|
520
|
+
return 'Ruby;8.12.1'
|
370
521
|
else
|
371
522
|
return hash_in['merchantSdk']
|
372
523
|
end
|
373
524
|
end
|
374
525
|
|
375
526
|
def get_report_group(hash_in)
|
376
|
-
if (hash_in['reportGroup']
|
527
|
+
if (!hash_in['reportGroup'])
|
377
528
|
return required_field(@config_hash['default_report_group'])
|
378
529
|
else
|
379
530
|
return hash_in['reportGroup']
|
@@ -381,13 +532,13 @@ class LitleOnlineRequest
|
|
381
532
|
end
|
382
533
|
|
383
534
|
def authentication(hash_in)
|
384
|
-
if(hash_in['user']
|
535
|
+
if(!hash_in['user'])
|
385
536
|
user = @config_hash['user']
|
386
537
|
else
|
387
538
|
user = hash_in['user']
|
388
539
|
end
|
389
540
|
|
390
|
-
if(hash_in['password']
|
541
|
+
if(!hash_in['password'])
|
391
542
|
password = @config_hash['password']
|
392
543
|
else
|
393
544
|
password = hash_in['password']
|