LitleOnline 8.10.0 → 8.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/Communications.rb +3 -4
- data/lib/Configuration.rb +1 -1
- data/lib/LitleOnlineRequest.rb +170 -139
- data/lib/XMLFields.rb +29 -29
- data/test/certification/certTest1_base.rb +602 -606
- data/test/certification/certTest2_authenhanced.rb +6 -6
- data/test/certification/certTest3_authreversal.rb +29 -30
- data/test/certification/certTest4_echeck.rb +13 -16
- data/test/certification/certTest5_token.rb +11 -31
- data/test/functional/test_auth.rb +6 -6
- data/test/functional/test_authReversal.rb +6 -6
- data/test/functional/test_capture.rb +3 -3
- data/test/functional/test_captureGivenAuth.rb +12 -12
- data/test/functional/test_credit.rb +7 -7
- data/test/functional/test_echeckCredit.rb +11 -11
- data/test/functional/test_echeckRedeposit.rb +8 -8
- data/test/functional/test_echeckSale.rb +34 -32
- data/test/functional/test_echeckVerification.rb +8 -8
- data/test/functional/test_forceCapture.rb +8 -8
- data/test/functional/test_sale.rb +9 -11
- data/test/functional/test_token.rb +12 -12
- data/test/functional/test_xmlfields.rb +18 -18
- data/test/unit/test_LitleOnlineRequest.rb +26 -17
- data/test/unit/test_auth.rb +22 -10
- data/test/unit/test_authReversal.rb +2 -2
- data/test/unit/test_capture.rb +1 -1
- data/test/unit/test_captureGivenAuth.rb +6 -6
- data/test/unit/test_credit.rb +4 -7
- data/test/unit/test_echeckCredit.rb +2 -2
- data/test/unit/test_echeckRedeposit.rb +8 -8
- data/test/unit/test_echeckSale.rb +2 -2
- data/test/unit/test_echeckVerification.rb +8 -8
- data/test/unit/test_forceCapture.rb +8 -8
- data/test/unit/test_sale.rb +9 -9
- data/test/unit/test_token.rb +4 -4
- data/test/unit/test_xmlfields.rb +7 -9
- metadata +12 -12
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.10.
|
37
|
+
s.version = "8.10.1"
|
38
38
|
s.author = "Litle & Co"
|
39
39
|
s.email = "sdksupport@litle.com"
|
40
40
|
s.homepage = "http://www.litle.com/developers"
|
data/lib/Communications.rb
CHANGED
@@ -33,12 +33,11 @@ class Communications
|
|
33
33
|
##For http or https post with or without a proxy
|
34
34
|
def Communications.http_post(post_data,config_hash)
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
proxy_addr = config_hash['proxy_addr']
|
37
|
+
proxy_port = config_hash['proxy_port']
|
38
|
+
litle_url = config_hash['url']
|
39
39
|
|
40
40
|
# setup https or http post
|
41
|
-
litle_url = (config_hash['url'] or 'https://cert.litle.com/vap/communicator/online')
|
42
41
|
uri = URI.parse(litle_url)
|
43
42
|
|
44
43
|
http_post = Net::HTTP::Post.new(uri.request_uri)
|
data/lib/Configuration.rb
CHANGED
data/lib/LitleOnlineRequest.rb
CHANGED
@@ -36,40 +36,49 @@ 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
|
-
|
39
|
+
is_litle_txn_id_provided = !hash_in['litleTxnId'].nil?
|
40
|
+
if(is_litle_txn_id_provided)
|
41
|
+
hash_out = {
|
42
|
+
:litleTxnId => hash_in['litleTxnId']
|
43
|
+
}
|
44
|
+
else
|
45
|
+
hash_out = {
|
46
|
+
:orderId => required_field(hash_in['orderId']),
|
47
|
+
:amount =>required_field(hash_in['amount']),
|
48
|
+
:orderSource=>required_field(hash_in['orderSource']),
|
49
|
+
:customerInfo=>XMLFields.customer_info(optional_field(hash_in['customerInfo'])),
|
50
|
+
:billToAddress=>XMLFields.contact(optional_field(hash_in['billToAddress'])),
|
51
|
+
:shipToAddress=>XMLFields.contact(optional_field(hash_in['shipToAddress'])),
|
52
|
+
:card=> XMLFields.card_type(optional_field(hash_in['card'])),
|
53
|
+
:paypal=>XMLFields.pay_pal(optional_field(hash_in['paypal'])),
|
54
|
+
:token=>XMLFields.card_token_type(optional_field(hash_in['token'])),
|
55
|
+
:paypage=>XMLFields.card_paypage_type(optional_field(hash_in['paypage'])),
|
56
|
+
:billMeLaterRequest=>XMLFields.bill_me_later_request(optional_field(hash_in['billMeLaterRequest'])),
|
57
|
+
:cardholderAuthentication=>XMLFields.fraud_check_type(optional_field(hash_in['cardholderAuthentication'])),
|
58
|
+
:processingInstructions=>XMLFields.processing_instructions(optional_field(hash_in['processingInstructions'])),
|
59
|
+
:pos=>XMLFields.pos(optional_field(hash_in['pos'])),
|
60
|
+
:customBilling=>XMLFields.custom_billing(optional_field(hash_in['customBilling'])),
|
61
|
+
:taxBilling=>XMLFields.tax_billing(optional_field(hash_in['taxBilling'])),
|
62
|
+
:enhancedData=>XMLFields.enhanced_data(optional_field(hash_in['enhancedData'])),
|
63
|
+
:amexAggregatorData=>XMLFields.amex_aggregator_data(optional_field(hash_in['amexAggregatorData'])),
|
64
|
+
:allowPartialAuth=>hash_in['allowPartialAuth'],
|
65
|
+
:healthcareIIAS=>XMLFields.healthcare_iias(optional_field(hash_in['healthcareIIAS'])),
|
66
|
+
:filtering=>XMLFields.filtering_type(optional_field(hash_in['filtering'])),
|
67
|
+
:merchantData=>XMLFields.filtering_type(optional_field(hash_in['merchantData'])),
|
68
|
+
:recyclingRequest=>XMLFields.recycling_request_type(optional_field(hash_in['recyclingRequest']))
|
69
|
+
}
|
70
|
+
end
|
71
|
+
|
65
72
|
hash_out.merge!(get_common_attributes(hash_in))
|
66
73
|
Checker.purge_null(hash_out)
|
67
|
-
|
68
|
-
|
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
|
69
78
|
Checker.required_missing(hash_out)
|
70
|
-
|
71
|
-
Checker.required_missing(
|
72
|
-
LitleXmlMapper.request(
|
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)
|
73
82
|
end
|
74
83
|
|
75
84
|
def sale(hash_in)
|
@@ -78,29 +87,29 @@ class LitleOnlineRequest
|
|
78
87
|
:orderId =>required_field(hash_in['orderId']),
|
79
88
|
:amount =>required_field(hash_in['amount']),
|
80
89
|
:orderSource=>required_field(hash_in['orderSource']),
|
81
|
-
:customerInfo=>XMLFields.
|
90
|
+
:customerInfo=>XMLFields.customer_info(optional_field(hash_in['customerInfo'])),
|
82
91
|
:billToAddress=>XMLFields.contact(optional_field(hash_in['billToAddress'])),
|
83
92
|
:shipToAddress=>XMLFields.contact(optional_field(hash_in['shipToAddress'])),
|
84
|
-
:card=> XMLFields.
|
85
|
-
:paypal=>XMLFields.
|
86
|
-
:token=>XMLFields.
|
87
|
-
:paypage=>XMLFields.
|
88
|
-
:billMeLaterRequest=>XMLFields.
|
89
|
-
:fraudCheck=>XMLFields.
|
90
|
-
:cardholderAuthentication=>XMLFields.
|
91
|
-
:customBilling=>XMLFields.
|
92
|
-
:taxBilling=>XMLFields.
|
93
|
-
:enhancedData=>XMLFields.
|
94
|
-
:processingInstructions=>XMLFields.
|
93
|
+
:card=> XMLFields.card_type(optional_field(hash_in['card'])),
|
94
|
+
:paypal=>XMLFields.pay_pal(optional_field(hash_in['paypal'])),
|
95
|
+
:token=>XMLFields.card_token_type(optional_field(hash_in['token'])),
|
96
|
+
:paypage=>XMLFields.card_paypage_type(optional_field(hash_in['paypage'])),
|
97
|
+
:billMeLaterRequest=>XMLFields.bill_me_later_request(optional_field(hash_in['billMeLaterRequest'])),
|
98
|
+
:fraudCheck=>XMLFields.fraud_check_type(optional_field(hash_in['fraudCheck'])),
|
99
|
+
:cardholderAuthentication=>XMLFields.fraud_check_type(optional_field(hash_in['cardholderAuthentication'])),
|
100
|
+
:customBilling=>XMLFields.custom_billing(optional_field(hash_in['customBilling'])),
|
101
|
+
:taxBilling=>XMLFields.tax_billing(optional_field(hash_in['taxBilling'])),
|
102
|
+
:enhancedData=>XMLFields.enhanced_data(optional_field(hash_in['enhancedData'])),
|
103
|
+
:processingInstructions=>XMLFields.processing_instructions(optional_field(hash_in['processingInstructions'])),
|
95
104
|
:pos=>XMLFields.pos(optional_field(hash_in['pos'])),
|
96
105
|
:payPalOrderComplete=> hash_in['paypalOrderComplete'],
|
97
106
|
:payPalNotes=> hash_in['paypalNotesType'],
|
98
|
-
:amexAggregatorData=>XMLFields.
|
107
|
+
:amexAggregatorData=>XMLFields.amex_aggregator_data(optional_field(hash_in['amexAggregatorData'])),
|
99
108
|
:allowPartialAuth=>hash_in['allowPartialAuth'],
|
100
|
-
:healthcareIIAS=>XMLFields.
|
101
|
-
:filtering=>XMLFields.
|
102
|
-
:merchantData=>XMLFields.
|
103
|
-
:recyclingRequest=>XMLFields.
|
109
|
+
:healthcareIIAS=>XMLFields.healthcare_iias(optional_field(hash_in['healthcareIIAS'])),
|
110
|
+
:filtering=>XMLFields.filtering_type(optional_field(hash_in['filtering'])),
|
111
|
+
:merchantData=>XMLFields.filtering_type(optional_field(hash_in['merchantData'])),
|
112
|
+
:recyclingRequest=>XMLFields.recycling_request_type(optional_field(hash_in['recyclingRequest']))
|
104
113
|
}
|
105
114
|
hash_out.merge!(get_common_attributes(hash_in))
|
106
115
|
Checker.purge_null(hash_out)
|
@@ -109,12 +118,12 @@ class LitleOnlineRequest
|
|
109
118
|
Checker.choice(choice1)
|
110
119
|
Checker.choice(choice2)
|
111
120
|
Checker.required_missing(hash_out)
|
112
|
-
|
113
|
-
Checker.required_missing(
|
114
|
-
LitleXmlMapper.request(
|
121
|
+
litle_online_hash = build_full_hash(hash_in, {:sale => hash_out})
|
122
|
+
Checker.required_missing(litle_online_hash)
|
123
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
115
124
|
end
|
116
125
|
|
117
|
-
def
|
126
|
+
def auth_reversal(hash_in)
|
118
127
|
hash_out = {
|
119
128
|
:litleTxnId => required_field(hash_in['litleTxnId']),
|
120
129
|
:amount =>hash_in['amount'],
|
@@ -124,9 +133,9 @@ class LitleOnlineRequest
|
|
124
133
|
hash_out.merge!(get_common_attributes(hash_in))
|
125
134
|
Checker.purge_null(hash_out)
|
126
135
|
Checker.required_missing(hash_out)
|
127
|
-
|
128
|
-
Checker.required_missing(
|
129
|
-
LitleXmlMapper.request(
|
136
|
+
litle_online_hash = build_full_hash(hash_in, {:authReversal => hash_out})
|
137
|
+
Checker.required_missing(litle_online_hash)
|
138
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
130
139
|
end
|
131
140
|
|
132
141
|
def credit(hash_in)
|
@@ -136,17 +145,17 @@ class LitleOnlineRequest
|
|
136
145
|
:amount =>hash_in['amount'],
|
137
146
|
:orderSource=>hash_in['orderSource'],
|
138
147
|
:billToAddress=>XMLFields.contact(optional_field(hash_in['billToAddress'])),
|
139
|
-
:card=> XMLFields.
|
140
|
-
:paypal=>XMLFields.
|
141
|
-
:token=>XMLFields.
|
142
|
-
:paypage=>XMLFields.
|
143
|
-
:customBilling=>XMLFields.
|
144
|
-
:taxBilling=>XMLFields.
|
145
|
-
:billMeLaterRequest=>XMLFields.
|
146
|
-
:enhancedData=>XMLFields.
|
147
|
-
:processingInstructions=>XMLFields.
|
148
|
+
:card=> XMLFields.card_type(optional_field(hash_in['card'])),
|
149
|
+
:paypal=>XMLFields.pay_pal(optional_field(hash_in['paypal'])),
|
150
|
+
:token=>XMLFields.card_token_type(optional_field(hash_in['token'])),
|
151
|
+
:paypage=>XMLFields.card_paypage_type(optional_field(hash_in['paypage'])),
|
152
|
+
:customBilling=>XMLFields.custom_billing(optional_field(hash_in['customBilling'])),
|
153
|
+
:taxBilling=>XMLFields.tax_billing(optional_field(hash_in['taxBilling'])),
|
154
|
+
:billMeLaterRequest=>XMLFields.bill_me_later_request(optional_field(hash_in['billMeLaterRequest'])),
|
155
|
+
:enhancedData=>XMLFields.enhanced_data(optional_field(hash_in['enhancedData'])),
|
156
|
+
:processingInstructions=>XMLFields.processing_instructions(optional_field(hash_in['processingInstructions'])),
|
148
157
|
:pos=>XMLFields.pos(optional_field(hash_in['pos'])),
|
149
|
-
:amexAggregatorData=>XMLFields.
|
158
|
+
:amexAggregatorData=>XMLFields.amex_aggregator_data(optional_field(hash_in['amexAggregatorData'])),
|
150
159
|
:payPalNotes =>hash_in['payPalNotes']
|
151
160
|
}
|
152
161
|
hash_out.merge!(get_common_attributes(hash_in))
|
@@ -154,17 +163,17 @@ class LitleOnlineRequest
|
|
154
163
|
choice1= {'1'=>hash_out[:card],'2' =>hash_out[:paypal],'3'=>hash_out[:token],'4'=>hash_out[:paypage]}
|
155
164
|
Checker.choice(choice1)
|
156
165
|
Checker.required_missing(hash_out)
|
157
|
-
|
166
|
+
litle_online_hash = build_full_hash(hash_in, {:credit => hash_out})
|
158
167
|
Checker.purge_null(hash_out)
|
159
|
-
Checker.required_missing(
|
160
|
-
LitleXmlMapper.request(
|
168
|
+
Checker.required_missing(litle_online_hash)
|
169
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
161
170
|
end
|
162
171
|
|
163
|
-
def
|
172
|
+
def register_token_request(hash_in)
|
164
173
|
hash_out = {
|
165
174
|
:orderId =>optional_field(hash_in['orderId']),
|
166
175
|
:accountNumber=>hash_in['accountNumber'],
|
167
|
-
:echeckForToken=>XMLFields.
|
176
|
+
:echeckForToken=>XMLFields.echeck_for_token_type(optional_field(hash_in['echeckForToken'])),
|
168
177
|
:paypageRegistrationId=>hash_in['paypageRegistrationId']
|
169
178
|
}
|
170
179
|
hash_out.merge!(get_common_attributes(hash_in))
|
@@ -172,35 +181,35 @@ class LitleOnlineRequest
|
|
172
181
|
choice1= {'1'=>hash_out[:accountNumber],'2' =>hash_out[:echeckForToken],'3'=>hash_out[:paypageRegistrationId]}
|
173
182
|
Checker.choice(choice1)
|
174
183
|
Checker.required_missing(hash_out)
|
175
|
-
|
176
|
-
Checker.required_missing(
|
177
|
-
LitleXmlMapper.request(
|
184
|
+
litle_online_hash = build_full_hash(hash_in, {:registerTokenRequest => hash_out})
|
185
|
+
Checker.required_missing(litle_online_hash)
|
186
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
178
187
|
end
|
179
188
|
|
180
|
-
def
|
189
|
+
def force_capture(hash_in)
|
181
190
|
hash_out = {
|
182
191
|
:orderId =>required_field(hash_in['orderId']),
|
183
192
|
:amount =>(hash_in['amount']),
|
184
193
|
:orderSource=>required_field(hash_in['orderSource']),
|
185
194
|
:billToAddress=>XMLFields.contact(optional_field(hash_in['billToAddress'])),
|
186
|
-
:card=> XMLFields.
|
187
|
-
:token=>XMLFields.
|
188
|
-
:paypage=>XMLFields.
|
189
|
-
:customBilling=>XMLFields.
|
190
|
-
:taxBilling=>XMLFields.
|
191
|
-
:enhancedData=>XMLFields.
|
192
|
-
:processingInstructions=>XMLFields.
|
195
|
+
:card=> XMLFields.card_type(optional_field(hash_in['card'])),
|
196
|
+
:token=>XMLFields.card_token_type(optional_field(hash_in['token'])),
|
197
|
+
:paypage=>XMLFields.card_paypage_type(optional_field(hash_in['paypage'])),
|
198
|
+
:customBilling=>XMLFields.custom_billing(optional_field(hash_in['customBilling'])),
|
199
|
+
:taxBilling=>XMLFields.tax_billing(optional_field(hash_in['taxBilling'])),
|
200
|
+
:enhancedData=>XMLFields.enhanced_data(optional_field(hash_in['enhancedData'])),
|
201
|
+
:processingInstructions=>XMLFields.processing_instructions(optional_field(hash_in['processingInstructions'])),
|
193
202
|
:pos=>XMLFields.pos(optional_field(hash_in['pos'])),
|
194
|
-
:amexAggregatorData=>XMLFields.
|
203
|
+
:amexAggregatorData=>XMLFields.amex_aggregator_data(optional_field(hash_in['amexAggregatorData']))
|
195
204
|
}
|
196
205
|
hash_out.merge!(get_common_attributes(hash_in))
|
197
206
|
Checker.purge_null(hash_out)
|
198
207
|
choice1= {'1'=>hash_out[:card],'3'=>hash_out[:token],'4'=>hash_out[:paypage]}
|
199
208
|
Checker.choice(choice1)
|
200
209
|
Checker.required_missing(hash_out)
|
201
|
-
|
202
|
-
Checker.required_missing(
|
203
|
-
LitleXmlMapper.request(
|
210
|
+
litle_online_hash = build_full_hash(hash_in, {:forceCapture => hash_out})
|
211
|
+
Checker.required_missing(litle_online_hash)
|
212
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
204
213
|
end
|
205
214
|
|
206
215
|
def capture(hash_in)
|
@@ -209,65 +218,65 @@ class LitleOnlineRequest
|
|
209
218
|
'@partial'=>hash_in['partial'],
|
210
219
|
:litleTxnId => required_field(hash_in['litleTxnId']),
|
211
220
|
:amount =>(hash_in['amount']),
|
212
|
-
:enhancedData=>XMLFields.
|
213
|
-
:processingInstructions=>XMLFields.
|
221
|
+
:enhancedData=>XMLFields.enhanced_data(optional_field(hash_in['enhancedData'])),
|
222
|
+
:processingInstructions=>XMLFields.processing_instructions(optional_field(hash_in['processingInstructions'])),
|
214
223
|
:payPalOrderComplete=>hash_in['payPalOrderComplete'],
|
215
224
|
:payPalNotes =>hash_in['payPalNotes']
|
216
225
|
}
|
217
226
|
hash_out.merge!(get_common_attributes(hash_in))
|
218
227
|
Checker.purge_null(hash_out)
|
219
228
|
Checker.required_missing(hash_out)
|
220
|
-
|
221
|
-
Checker.required_missing(
|
222
|
-
LitleXmlMapper.request(
|
229
|
+
litle_online_hash = build_full_hash(hash_in, {:capture => hash_out})
|
230
|
+
Checker.required_missing(litle_online_hash)
|
231
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
223
232
|
end
|
224
233
|
|
225
|
-
def
|
234
|
+
def capture_given_auth(hash_in)
|
226
235
|
hash_out = {
|
227
236
|
:orderId =>required_field(hash_in['orderId']),
|
228
|
-
:authInformation=>XMLFields.
|
237
|
+
:authInformation=>XMLFields.auth_information(optional_field(hash_in['authInformation'])),
|
229
238
|
:amount =>required_field(hash_in['amount']),
|
230
239
|
:orderSource=>required_field(hash_in['orderSource']),
|
231
240
|
:billToAddress=>XMLFields.contact(optional_field(hash_in['billToAddress'])),
|
232
241
|
:shipToAddress=>XMLFields.contact(optional_field(hash_in['shipToAddress'])),
|
233
|
-
:card=> XMLFields.
|
234
|
-
:token=>XMLFields.
|
235
|
-
:paypage=>XMLFields.
|
236
|
-
:customBilling=>XMLFields.
|
237
|
-
:taxBilling=>XMLFields.
|
238
|
-
:billMeLaterRequest=>XMLFields.
|
239
|
-
:enhancedData=>XMLFields.
|
240
|
-
:processingInstructions=>XMLFields.
|
242
|
+
:card=> XMLFields.card_type(optional_field(hash_in['card'])),
|
243
|
+
:token=>XMLFields.card_token_type(optional_field(hash_in['token'])),
|
244
|
+
:paypage=>XMLFields.card_paypage_type(optional_field(hash_in['paypage'])),
|
245
|
+
:customBilling=>XMLFields.custom_billing(optional_field(hash_in['customBilling'])),
|
246
|
+
:taxBilling=>XMLFields.tax_billing(optional_field(hash_in['taxBilling'])),
|
247
|
+
:billMeLaterRequest=>XMLFields.bill_me_later_request(optional_field(hash_in['billMeLaterRequest'])),
|
248
|
+
:enhancedData=>XMLFields.enhanced_data(optional_field(hash_in['enhancedData'])),
|
249
|
+
:processingInstructions=>XMLFields.processing_instructions(optional_field(hash_in['processingInstructions'])),
|
241
250
|
:pos=>XMLFields.pos(optional_field(hash_in['pos'])),
|
242
|
-
:amexAggregatorData=>XMLFields.
|
251
|
+
:amexAggregatorData=>XMLFields.amex_aggregator_data(optional_field(hash_in['amexAggregatorData']))
|
243
252
|
}
|
244
253
|
hash_out.merge!(get_common_attributes(hash_in))
|
245
254
|
Checker.purge_null(hash_out)
|
246
255
|
choice1= {'1'=>hash_out[:card],'3'=>hash_out[:token],'4'=>hash_out[:paypage]}
|
247
256
|
Checker.choice(choice1)
|
248
257
|
Checker.required_missing(hash_out)
|
249
|
-
|
250
|
-
Checker.required_missing(
|
251
|
-
LitleXmlMapper.request(
|
258
|
+
litle_online_hash = build_full_hash(hash_in, {:captureGivenAuth => hash_out})
|
259
|
+
Checker.required_missing(litle_online_hash)
|
260
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
252
261
|
end
|
253
262
|
|
254
|
-
def
|
263
|
+
def echeck_redeposit(hash_in)
|
255
264
|
hash_out = {
|
256
265
|
:litleTxnId => required_field(hash_in['litleTxnId']),
|
257
|
-
:echeck=>XMLFields.
|
258
|
-
:echeckToken=>XMLFields.
|
266
|
+
:echeck=>XMLFields.echeck_type(optional_field(hash_in['echeck'])),
|
267
|
+
:echeckToken=>XMLFields.echeck_token_type(optional_field(hash_in['echeckToken']))
|
259
268
|
}
|
260
269
|
hash_out.merge!(get_common_attributes(hash_in))
|
261
270
|
Checker.purge_null(hash_out)
|
262
271
|
choice1= {'1'=>hash_out[:echeck],'3'=>hash_out[:echeckToken]}
|
263
272
|
Checker.choice(choice1)
|
264
273
|
Checker.required_missing(hash_out)
|
265
|
-
|
266
|
-
Checker.required_missing(
|
267
|
-
LitleXmlMapper.request(
|
274
|
+
litle_online_hash = build_full_hash(hash_in, {:echeckRedeposit => hash_out})
|
275
|
+
Checker.required_missing(litle_online_hash)
|
276
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
268
277
|
end
|
269
278
|
|
270
|
-
def
|
279
|
+
def echeck_sale(hash_in)
|
271
280
|
hash_out = {
|
272
281
|
:litleTxnId => hash_in['litleTxnId'],
|
273
282
|
:orderId =>hash_in['orderId'],
|
@@ -276,72 +285,72 @@ class LitleOnlineRequest
|
|
276
285
|
:orderSource =>hash_in['orderSource'],
|
277
286
|
:billToAddress=>XMLFields.contact(optional_field(hash_in['billToAddress'])),
|
278
287
|
:shipToAddress=>XMLFields.contact(optional_field(hash_in['shipToAddress'])),
|
279
|
-
:echeck=>XMLFields.
|
280
|
-
:echeckToken=>XMLFields.
|
281
|
-
:customBilling=>XMLFields.
|
288
|
+
:echeck=>XMLFields.echeck_type(optional_field(hash_in['echeck'])),
|
289
|
+
:echeckToken=>XMLFields.echeck_token_type(optional_field(hash_in['echeckToken'])),
|
290
|
+
:customBilling=>XMLFields.custom_billing(optional_field(hash_in['customBilling'])),
|
282
291
|
}
|
283
292
|
hash_out.merge!(get_common_attributes(hash_in))
|
284
293
|
Checker.purge_null(hash_out)
|
285
294
|
choice1= {'1'=>hash_out[:echeck],'3'=>hash_out[:echeckToken]}
|
286
295
|
Checker.choice(choice1)
|
287
296
|
Checker.required_missing(hash_out)
|
288
|
-
|
289
|
-
Checker.required_missing(
|
290
|
-
LitleXmlMapper.request(
|
297
|
+
litle_online_hash = build_full_hash(hash_in, {:echeckSale => hash_out})
|
298
|
+
Checker.required_missing(litle_online_hash)
|
299
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
291
300
|
end
|
292
301
|
|
293
|
-
def
|
302
|
+
def echeck_credit(hash_in)
|
294
303
|
hash_out = {
|
295
304
|
:litleTxnId => hash_in['litleTxnId'],
|
296
305
|
:orderId =>hash_in['orderId'],
|
297
306
|
:amount =>hash_in['amount'],
|
298
307
|
:orderSource =>hash_in['orderSource'],
|
299
308
|
:billToAddress=>XMLFields.contact(optional_field(hash_in['billToAddress'])),
|
300
|
-
:echeck=>XMLFields.
|
301
|
-
:echeckToken=>XMLFields.
|
302
|
-
:customBilling=>XMLFields.
|
309
|
+
:echeck=>XMLFields.echeck_type(optional_field(hash_in['echeck'])),
|
310
|
+
:echeckToken=>XMLFields.echeck_token_type(optional_field(hash_in['echeckToken'])),
|
311
|
+
:customBilling=>XMLFields.custom_billing(optional_field(hash_in['customBilling'])),
|
303
312
|
}
|
304
313
|
hash_out.merge!(get_common_attributes(hash_in))
|
305
314
|
Checker.purge_null(hash_out)
|
306
315
|
choice1= {'1'=>hash_out[:echeck],'3'=>hash_out[:echeckToken]}
|
307
316
|
Checker.choice(choice1)
|
308
317
|
Checker.required_missing(hash_out)
|
309
|
-
|
310
|
-
Checker.required_missing(
|
311
|
-
LitleXmlMapper.request(
|
318
|
+
litle_online_hash = build_full_hash(hash_in, {:echeckCredit => hash_out})
|
319
|
+
Checker.required_missing(litle_online_hash)
|
320
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
312
321
|
end
|
313
322
|
|
314
|
-
def
|
323
|
+
def echeck_verification(hash_in)
|
315
324
|
hash_out = {
|
316
325
|
:litleTxnId => hash_in['litleTxnId'],
|
317
326
|
:orderId =>required_field(hash_in['orderId']),
|
318
327
|
:amount =>required_field(hash_in['amount']),
|
319
328
|
:orderSource =>required_field(hash_in['orderSource']),
|
320
329
|
:billToAddress=>XMLFields.contact(optional_field(hash_in['billToAddress'])),
|
321
|
-
:echeck=>XMLFields.
|
322
|
-
:echeckToken=>XMLFields.
|
330
|
+
:echeck=>XMLFields.echeck_type(optional_field(hash_in['echeck'])),
|
331
|
+
:echeckToken=>XMLFields.echeck_token_type(optional_field(hash_in['echeckToken'])),
|
323
332
|
}
|
324
333
|
hash_out.merge!(get_common_attributes(hash_in))
|
325
334
|
Checker.purge_null(hash_out)
|
326
335
|
choice1= {'1'=>hash_out[:echeck],'3'=>hash_out[:echeckToken]}
|
327
336
|
Checker.choice(choice1)
|
328
337
|
Checker.required_missing(hash_out)
|
329
|
-
|
330
|
-
Checker.required_missing(
|
331
|
-
LitleXmlMapper.request(
|
338
|
+
litle_online_hash = build_full_hash(hash_in, {:echeckVerification => hash_out})
|
339
|
+
Checker.required_missing(litle_online_hash)
|
340
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
332
341
|
end
|
333
342
|
|
334
343
|
def void(hash_in)
|
335
344
|
hash_out = {
|
336
345
|
:litleTxnId => required_field(hash_in['litleTxnId']),
|
337
|
-
:processingInstructions=>XMLFields.
|
346
|
+
:processingInstructions=>XMLFields.processing_instructions(optional_field(hash_in['processingInstructions']))
|
338
347
|
}
|
339
348
|
hash_out.merge!(get_common_attributes(hash_in))
|
340
349
|
Checker.purge_null(hash_out)
|
341
350
|
Checker.required_missing(hash_out)
|
342
|
-
|
343
|
-
Checker.required_missing(
|
344
|
-
LitleXmlMapper.request(
|
351
|
+
litle_online_hash = build_full_hash(hash_in, {:void => hash_out})
|
352
|
+
Checker.required_missing(litle_online_hash)
|
353
|
+
LitleXmlMapper.request(litle_online_hash,@config_hash)
|
345
354
|
end
|
346
355
|
|
347
356
|
private
|
@@ -363,9 +372,21 @@ class LitleOnlineRequest
|
|
363
372
|
end
|
364
373
|
|
365
374
|
def authentication(hash_in)
|
375
|
+
if(hash_in['user'] == nil)
|
376
|
+
user = @config_hash['user']
|
377
|
+
else
|
378
|
+
user = hash_in['user']
|
379
|
+
end
|
380
|
+
|
381
|
+
if(hash_in['password'] == nil)
|
382
|
+
password = @config_hash['password']
|
383
|
+
else
|
384
|
+
password = hash_in['password']
|
385
|
+
end
|
386
|
+
|
366
387
|
hash_out = {
|
367
|
-
:user =>required_field(
|
368
|
-
:password =>required_field(
|
388
|
+
:user =>required_field(user),
|
389
|
+
:password =>required_field(password)
|
369
390
|
}
|
370
391
|
Checker.required_missing(hash_out)
|
371
392
|
end
|
@@ -379,16 +400,26 @@ class LitleOnlineRequest
|
|
379
400
|
end
|
380
401
|
|
381
402
|
def build_full_hash(hash_in, merge_hash)
|
382
|
-
|
383
|
-
|
403
|
+
if(hash_in['version'] == nil)
|
404
|
+
version = @config_hash['version']
|
405
|
+
else
|
406
|
+
version = hash_in['version']
|
407
|
+
end
|
408
|
+
|
409
|
+
litle_online_hash = {
|
410
|
+
"@version"=> required_field(version),
|
384
411
|
"@xmlns"=> "http://www.litle.com/schema",
|
385
412
|
"@merchantId"=> get_merchant_id(hash_in),
|
386
413
|
:authentication => authentication(hash_in)
|
387
414
|
}
|
388
|
-
return
|
415
|
+
return litle_online_hash.merge(merge_hash)
|
389
416
|
end
|
390
417
|
|
391
418
|
def get_common_attributes(hash_in)
|
419
|
+
@config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
|
420
|
+
@config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
|
421
|
+
@config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
|
422
|
+
|
392
423
|
return {
|
393
424
|
'@id' => hash_in['id'],
|
394
425
|
'@customerId' => hash_in['customerId'],
|