LitleOnline 8.12.3 → 8.12.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG +4 -0
  2. data/Rakefile +1 -1
  3. data/lib/Communications.rb +34 -32
  4. data/lib/Configuration.rb +13 -11
  5. data/lib/LitleOnline.rb +0 -1
  6. data/lib/LitleOnlineRequest.rb +546 -543
  7. data/lib/LitleXmlMapper.rb +17 -15
  8. data/lib/XMLFields.rb +903 -901
  9. data/test/certification/certTest1_base.rb +935 -933
  10. data/test/certification/certTest2_authenhanced.rb +548 -546
  11. data/test/certification/certTest3_authreversal.rb +179 -177
  12. data/test/certification/certTest4_echeck.rb +245 -243
  13. data/test/certification/certTest5_token.rb +198 -196
  14. data/test/functional/test_auth.rb +205 -204
  15. data/test/functional/test_authReversal.rb +41 -39
  16. data/test/functional/test_capture.rb +54 -52
  17. data/test/functional/test_captureGivenAuth.rb +153 -152
  18. data/test/functional/test_credit.rb +126 -126
  19. data/test/functional/test_echeckCredit.rb +88 -87
  20. data/test/functional/test_echeckRedeposit.rb +85 -84
  21. data/test/functional/test_echeckSale.rb +132 -131
  22. data/test/functional/test_echeckVerification.rb +97 -95
  23. data/test/functional/test_forceCapture.rb +113 -111
  24. data/test/functional/test_sale.rb +200 -198
  25. data/test/functional/test_token.rb +75 -73
  26. data/test/functional/test_xmlfields.rb +558 -558
  27. data/test/unit/test_LitleOnlineRequest.rb +210 -207
  28. data/test/unit/test_auth.rb +119 -116
  29. data/test/unit/test_authReversal.rb +16 -16
  30. data/test/unit/test_capture.rb +10 -8
  31. data/test/unit/test_captureGivenAuth.rb +62 -59
  32. data/test/unit/test_credit.rb +103 -100
  33. data/test/unit/test_echeckCredit.rb +15 -14
  34. data/test/unit/test_echeckRedeposit.rb +14 -13
  35. data/test/unit/test_echeckSale.rb +16 -15
  36. data/test/unit/test_echeckVerification.rb +14 -13
  37. data/test/unit/test_forceCapture.rb +61 -58
  38. data/test/unit/test_sale.rb +206 -205
  39. data/test/unit/test_token.rb +43 -41
  40. data/test/unit/test_xmlfields.rb +101 -99
  41. metadata +58 -77
  42. data/lib/Obj2xml.rb +0 -37
data/CHANGELOG CHANGED
@@ -1,5 +1,9 @@
1
1
  = LitleOnline CHANGELOG
2
2
 
3
+ == Version 8.12.4 (May 17, 2012)
4
+
5
+ * Bugfix: Use modules so that we are not polluting the global namespace
6
+
3
7
  == Version 8.12.3 (May 17, 2012)
4
8
 
5
9
  * Bugfix: Allow use without the configuration file
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.3"
37
+ s.version = "8.12.4"
38
38
  s.author = "Litle & Co"
39
39
  s.email = "sdksupport@litle.com"
40
40
  s.homepage = "http://www.litle.com/developers"
@@ -29,38 +29,40 @@ OTHER DEALINGS IN THE SOFTWARE.
29
29
  #
30
30
  # URL and proxy server settings are derived from the configuration file
31
31
  #
32
- class Communications
33
- ##For http or https post with or without a proxy
34
- def Communications.http_post(post_data,config_hash)
35
-
36
- proxy_addr = config_hash['proxy_addr']
37
- proxy_port = config_hash['proxy_port']
38
- litle_url = config_hash['url']
39
-
40
- # setup https or http post
41
- url = URI.parse(litle_url)
42
-
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")
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
-
57
-
58
- # validate response, only an HTTP 200 will work, redirects are not followed
59
- case response_xml
60
- when Net::HTTPOK
61
- return response_xml.body
62
- else
63
- raise("Error with http http_post_request, code:" + response_xml.header.code)
32
+ module LitleOnline
33
+ class Communications
34
+ ##For http or https post with or without a proxy
35
+ def Communications.http_post(post_data,config_hash)
36
+
37
+ proxy_addr = config_hash['proxy_addr']
38
+ proxy_port = config_hash['proxy_port']
39
+ litle_url = config_hash['url']
40
+
41
+ # setup https or http post
42
+ url = URI.parse(litle_url)
43
+
44
+ response_xml = nil
45
+ https = Net::HTTP.new(url.host, url.port, proxy_addr, proxy_port)
46
+ if(url.scheme == 'https')
47
+ https.use_ssl = url.scheme=='https'
48
+ https.verify_mode = OpenSSL::SSL::VERIFY_PEER
49
+ https.ca_file = File.join(File.dirname(__FILE__), "cacert.pem")
50
+ end
51
+ https.start { |http|
52
+ response = http.request_post(url.path, post_data.to_s, {'Content-type'=>'text/xml'})
53
+ response_xml = response
54
+ }
55
+
56
+
57
+
58
+
59
+ # validate response, only an HTTP 200 will work, redirects are not followed
60
+ case response_xml
61
+ when Net::HTTPOK
62
+ return response_xml.body
63
+ else
64
+ raise("Error with http http_post_request, code:" + response_xml.header.code)
65
+ end
64
66
  end
65
67
  end
66
68
  end
data/lib/Configuration.rb CHANGED
@@ -28,18 +28,20 @@ require 'yaml'
28
28
  #
29
29
  # Loads the configuration from a file
30
30
  #
31
- class Configuration
32
- def config
33
- begin
34
- if !(ENV['LITLE_CONFIG_DIR'].nil?)
35
- config_file = ENV['LITLE_CONFIG_DIR'] + "/.litle_SDK_config.yml"
36
- else
37
- config_file = ENV['HOME'] + "/.litle_SDK_config.yml"
31
+ module LitleOnline
32
+ class Configuration
33
+ def config
34
+ begin
35
+ if !(ENV['LITLE_CONFIG_DIR'].nil?)
36
+ config_file = ENV['LITLE_CONFIG_DIR'] + "/.litle_SDK_config.yml"
37
+ else
38
+ config_file = ENV['HOME'] + "/.litle_SDK_config.yml"
39
+ end
40
+ return YAML.load_file(config_file)
41
+ rescue
42
+ return {}
38
43
  end
39
- return YAML.load_file(config_file)
40
- rescue
41
- return {}
44
+
42
45
  end
43
-
44
46
  end
45
47
  end
data/lib/LitleOnline.rb CHANGED
@@ -46,7 +46,6 @@ end
46
46
 
47
47
 
48
48
  require_relative 'Communications'
49
- require_relative 'Obj2xml'
50
49
  require_relative 'LitleXmlMapper'
51
50
  require_relative 'XMLFields'
52
51
  require_relative 'LitleOnlineRequest'
@@ -29,557 +29,560 @@ require_relative 'Configuration'
29
29
  # It also handles validation looking for missing or incorrect fields
30
30
  #contains the methods to properly create each transaction type
31
31
  #
32
- class LitleOnlineRequest
33
- def initialize
34
- #load configuration data
35
- @config_hash = Configuration.new.config
36
- end
37
-
38
- def authorization(hash_in)
39
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
40
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
41
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
42
-
43
- request = OnlineRequest.new
44
- authorization = Authorization.new
45
- authorization.reportGroup = get_report_group(hash_in)
46
- authorization.transactionId = hash_in['id']
47
- authorization.customerId = hash_in['customerId']
48
-
49
- authorization.litleTxnId = hash_in['litleTxnId']
50
- authorization.orderId = hash_in['orderId']
51
- authorization.amount = hash_in['amount']
52
- authorization.orderSource = hash_in['orderSource']
53
- authorization.customerInfo = CustomerInfo.from_hash(hash_in)
54
- authorization.billToAddress = Contact.from_hash(hash_in,'billToAddress')
55
- authorization.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
56
- authorization.card = Card.from_hash(hash_in)
57
- authorization.paypal = PayPal.from_hash(hash_in,'paypal')
58
- authorization.token = CardToken.from_hash(hash_in,'token')
59
- authorization.paypage = CardPaypage.from_hash(hash_in,'paypage')
60
- authorization.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
61
- authorization.cardholderAuthentication = FraudCheck.from_hash(hash_in)
62
- authorization.processingInstructions = ProcessingInstructions.from_hash(hash_in)
63
- authorization.pos = Pos.from_hash(hash_in)
64
- authorization.customBilling = CustomBilling.from_hash(hash_in)
65
- authorization.taxType = hash_in['taxType']
66
- authorization.enhancedData = EnhancedData.from_hash(hash_in)
67
- authorization.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
68
- authorization.allowPartialAuth = hash_in['allowPartialAuth']
69
- authorization.healthcareIIAS = HealthcareIIAS.from_hash(hash_in)
70
- authorization.filtering = Filtering.from_hash(hash_in)
71
- authorization.merchantData = MerchantData.from_hash(hash_in)
72
- authorization.recyclingRequest = RecyclingRequest.from_hash(hash_in)
73
-
74
- request.authorization = authorization
75
-
76
- authentication = Authentication.new
77
- authentication.user = 'PHXMLTEST'
78
- authentication.password = 'password'
79
- request.authentication = authentication
80
-
81
- request.merchantId = get_merchant_id(hash_in)
82
- request.version = get_version(hash_in)
83
- request.xmlns = "http://www.litle.com/schema"
84
- request.merchantSdk = get_merchant_sdk(hash_in)
85
-
86
- xml = request.save_to_xml.to_s
87
- LitleXmlMapper.request(xml, @config_hash)
88
- end
89
-
90
- def sale(hash_in)
91
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
92
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
93
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
94
-
95
- request = OnlineRequest.new
96
- sale = Sale.new
97
- sale.reportGroup = get_report_group(hash_in)
98
- sale.transactionId = hash_in['id']
99
- sale.customerId = hash_in['customerId']
100
-
101
- sale.litleTxnId = hash_in['litleTxnId']
102
- sale.orderId = hash_in['orderId']
103
- sale.amount = hash_in['amount']
104
- sale.orderSource = hash_in['orderSource']
105
- sale.customerInfo = CustomerInfo.from_hash(hash_in)
106
- sale.billToAddress = Contact.from_hash(hash_in,'billToAddress')
107
- sale.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
108
- sale.card = Card.from_hash(hash_in)
109
- sale.paypal = PayPal.from_hash(hash_in,'paypal')
110
- sale.token = CardToken.from_hash(hash_in,'token')
111
- sale.paypage = CardPaypage.from_hash(hash_in,'paypage')
112
- sale.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
113
- sale.fraudCheck = FraudCheck.from_hash(hash_in,'fraudCheck')
114
- sale.cardholderAuthentication = FraudCheck.from_hash(hash_in,'cardholderAuthentication')
115
- sale.customBilling = CustomBilling.from_hash(hash_in)
116
- sale.taxType = hash_in['taxType']
117
- sale.enhancedData = EnhancedData.from_hash(hash_in)
118
- sale.processingInstructions = ProcessingInstructions.from_hash(hash_in)
119
- sale.pos = Pos.from_hash(hash_in)
120
- sale.payPalOrderComplete = hash_in['paPpalOrderComplete']
121
- sale.payPalNotes = hash_in['payPalNotes']
122
- sale.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
123
- sale.allowPartialAuth = hash_in['allowPartialAuth']
124
- sale.healthcareIIAS = HealthcareIIAS.from_hash(hash_in)
125
- sale.filtering = Filtering.from_hash(hash_in)
126
- sale.merchantData = MerchantData.from_hash(hash_in)
127
- sale.recyclingRequest = RecyclingRequest.from_hash(hash_in)
128
-
129
- request.sale = sale
130
-
131
- authentication = Authentication.new
132
- authentication.user = 'PHXMLTEST'
133
- authentication.password = 'password'
134
- request.authentication = authentication
135
-
136
- request.merchantId = get_merchant_id(hash_in)
137
- request.version = get_version(hash_in)
138
- request.xmlns = "http://www.litle.com/schema"
139
- request.merchantSdk = get_merchant_sdk(hash_in)
140
-
141
- xml = request.save_to_xml.to_s
142
- LitleXmlMapper.request(xml, @config_hash)
143
- end
144
-
145
- def auth_reversal(hash_in)
146
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
147
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
148
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
32
+ module LitleOnline
149
33
 
150
- request = OnlineRequest.new
151
- auth_reversal = AuthReversal.new
152
- auth_reversal.reportGroup = get_report_group(hash_in)
153
- auth_reversal.transactionId = hash_in['id']
154
- auth_reversal.customerId = hash_in['customerId']
34
+ class LitleOnlineRequest
35
+ def initialize
36
+ #load configuration data
37
+ @config_hash = Configuration.new.config
38
+ end
39
+
40
+ def authorization(hash_in)
41
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
42
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
43
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
44
+
45
+ request = OnlineRequest.new
46
+ authorization = Authorization.new
47
+ authorization.reportGroup = get_report_group(hash_in)
48
+ authorization.transactionId = hash_in['id']
49
+ authorization.customerId = hash_in['customerId']
155
50
 
156
- auth_reversal.litleTxnId = hash_in['litleTxnId']
157
- auth_reversal.amount = hash_in['amount']
158
- auth_reversal.payPalNotes = hash_in['payPalNotes']
159
- auth_reversal.actionReason = hash_in['actionReason']
160
-
161
- request.authReversal = auth_reversal
162
-
163
- authentication = Authentication.new
164
- authentication.user = 'PHXMLTEST'
165
- authentication.password = 'password'
166
- request.authentication = authentication
167
-
168
- request.merchantId = get_merchant_id(hash_in)
169
- request.version = get_version(hash_in)
170
- request.xmlns = "http://www.litle.com/schema"
171
- request.merchantSdk = get_merchant_sdk(hash_in)
172
-
173
- xml = request.save_to_xml.to_s
174
- LitleXmlMapper.request(xml, @config_hash)
175
- end
176
-
177
- def credit(hash_in)
178
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
179
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
180
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
181
-
182
- request = OnlineRequest.new
183
- credit = Credit.new
184
- credit.reportGroup = get_report_group(hash_in)
185
- credit.transactionId = hash_in['id']
186
- credit.customerId = hash_in['customerId']
51
+ authorization.litleTxnId = hash_in['litleTxnId']
52
+ authorization.orderId = hash_in['orderId']
53
+ authorization.amount = hash_in['amount']
54
+ authorization.orderSource = hash_in['orderSource']
55
+ authorization.customerInfo = CustomerInfo.from_hash(hash_in)
56
+ authorization.billToAddress = Contact.from_hash(hash_in,'billToAddress')
57
+ authorization.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
58
+ authorization.card = Card.from_hash(hash_in)
59
+ authorization.paypal = PayPal.from_hash(hash_in,'paypal')
60
+ authorization.token = CardToken.from_hash(hash_in,'token')
61
+ authorization.paypage = CardPaypage.from_hash(hash_in,'paypage')
62
+ authorization.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
63
+ authorization.cardholderAuthentication = FraudCheck.from_hash(hash_in)
64
+ authorization.processingInstructions = ProcessingInstructions.from_hash(hash_in)
65
+ authorization.pos = Pos.from_hash(hash_in)
66
+ authorization.customBilling = CustomBilling.from_hash(hash_in)
67
+ authorization.taxType = hash_in['taxType']
68
+ authorization.enhancedData = EnhancedData.from_hash(hash_in)
69
+ authorization.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
70
+ authorization.allowPartialAuth = hash_in['allowPartialAuth']
71
+ authorization.healthcareIIAS = HealthcareIIAS.from_hash(hash_in)
72
+ authorization.filtering = Filtering.from_hash(hash_in)
73
+ authorization.merchantData = MerchantData.from_hash(hash_in)
74
+ authorization.recyclingRequest = RecyclingRequest.from_hash(hash_in)
187
75
 
188
- credit.litleTxnId = hash_in['litleTxnId']
189
- credit.orderId = hash_in['orderId']
190
- credit.amount = hash_in['amount']
191
- credit.orderSource = hash_in['orderSource']
192
- credit.billToAddress = Contact.from_hash(hash_in,'billToAddress')
193
- credit.card = Card.from_hash(hash_in)
194
- credit.paypal = CreditPayPal.from_hash(hash_in,'paypal')
195
- credit.token = CardToken.from_hash(hash_in,'token')
196
- credit.paypage = CardPaypage.from_hash(hash_in,'paypage')
197
- credit.customBilling = CustomBilling.from_hash(hash_in)
198
- credit.taxType = hash_in['taxType']
199
- credit.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
200
- credit.enhancedData = EnhancedData.from_hash(hash_in)
201
- credit.processingInstructions = ProcessingInstructions.from_hash(hash_in)
202
- credit.pos = Pos.from_hash(hash_in)
203
- credit.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
204
- credit.payPalNotes = hash_in['payPalNotes']
205
- credit.actionReason = hash_in['actionReason']
206
-
207
- request.credit = credit
208
-
209
- authentication = Authentication.new
210
- authentication.user = 'PHXMLTEST'
211
- authentication.password = 'password'
212
- request.authentication = authentication
213
-
214
- request.merchantId = get_merchant_id(hash_in)
215
- request.version = get_version(hash_in)
216
- request.xmlns = "http://www.litle.com/schema"
217
- request.merchantSdk = get_merchant_sdk(hash_in)
218
-
219
- xml = request.save_to_xml.to_s
220
- LitleXmlMapper.request(xml, @config_hash)
221
- end
222
-
223
- def register_token_request(hash_in)
224
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
225
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
226
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
227
-
228
- request = OnlineRequest.new
229
- token_request = RegisterTokenRequest.new
230
- token_request.reportGroup = get_report_group(hash_in)
231
- token_request.transactionId = hash_in['id']
232
- token_request.customerId = hash_in['customerId']
233
-
234
- token_request.orderId = hash_in['orderId']
235
- token_request.accountNumber = hash_in['accountNumber']
236
- token_request.echeckForToken = EcheckForToken.from_hash(hash_in)
237
- token_request.paypageRegistrationId = hash_in['paypageRegistrationId']
238
-
239
- request.registerTokenRequest = token_request
240
-
241
- authentication = Authentication.new
242
- authentication.user = 'PHXMLTEST'
243
- authentication.password = 'password'
244
- request.authentication = authentication
245
-
246
- request.merchantId = get_merchant_id(hash_in)
247
- request.version = get_version(hash_in)
248
- request.xmlns = "http://www.litle.com/schema"
249
- request.merchantSdk = get_merchant_sdk(hash_in)
250
-
251
- xml = request.save_to_xml.to_s
252
- LitleXmlMapper.request(xml, @config_hash)
253
- end
254
-
255
- def force_capture(hash_in)
256
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
257
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
258
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
259
-
260
- request = OnlineRequest.new
261
- force_capture = ForceCapture.new
262
- force_capture.reportGroup = get_report_group(hash_in)
263
- force_capture.transactionId = hash_in['id']
264
- force_capture.customerId = hash_in['customerId']
265
-
266
- force_capture.orderId = hash_in['orderId']
267
- force_capture.amount = hash_in['amount']
268
- force_capture.orderSource = hash_in['orderSource']
269
- force_capture.billToAddress = Contact.from_hash(hash_in,'billToAddress')
270
- force_capture.card = Card.from_hash(hash_in)
271
- force_capture.token = CardToken.from_hash(hash_in,'token')
272
- force_capture.paypage = CardPaypage.from_hash(hash_in,'paypage')
273
- force_capture.customBilling = CustomBilling.from_hash(hash_in)
274
- force_capture.taxType = hash_in['taxType']
275
- force_capture.enhancedData = EnhancedData.from_hash(hash_in)
276
- force_capture.processingInstructions = ProcessingInstructions.from_hash(hash_in)
277
- force_capture.pos = Pos.from_hash(hash_in)
278
- force_capture.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
279
-
280
- request.forceCapture = force_capture
281
-
282
- authentication = Authentication.new
283
- authentication.user = 'PHXMLTEST'
284
- authentication.password = 'password'
285
- request.authentication = authentication
286
-
287
- request.merchantId = get_merchant_id(hash_in)
288
- request.version = get_version(hash_in)
289
- request.xmlns = "http://www.litle.com/schema"
290
- request.merchantSdk = get_merchant_sdk(hash_in)
291
-
292
- xml = request.save_to_xml.to_s
293
- LitleXmlMapper.request(xml, @config_hash)
294
- end
295
-
296
- def capture(hash_in)
297
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
298
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
299
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
300
-
301
- request = OnlineRequest.new
302
- capture = Capture.new
303
- capture.reportGroup = get_report_group(hash_in)
304
- capture.transactionId = hash_in['id']
305
- capture.customerId = hash_in['customerId']
306
-
307
- capture.partial = hash_in['partial']
308
- capture.litleTxnId = hash_in['litleTxnId']
309
- capture.amount = hash_in['amount']
310
- capture.enhancedData = EnhancedData.from_hash(hash_in)
311
- capture.processingInstructions = ProcessingInstructions.from_hash(hash_in)
312
- capture.payPalOrderComplete = hash_in['payPalOrderComplete']
313
- capture.payPalNotes = hash_in['payPalNotes']
314
-
315
- request.captureTxn = capture
316
-
317
- authentication = Authentication.new
318
- authentication.user = 'PHXMLTEST'
319
- authentication.password = 'password'
320
- request.authentication = authentication
321
-
322
- request.merchantId = get_merchant_id(hash_in)
323
- request.version = get_version(hash_in)
324
- request.xmlns = "http://www.litle.com/schema"
325
- request.merchantSdk = get_merchant_sdk(hash_in)
326
-
327
- xml = request.save_to_xml.to_s
328
- LitleXmlMapper.request(xml, @config_hash)
329
- end
330
-
331
- def capture_given_auth(hash_in)
332
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
333
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
334
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
335
-
336
- request = OnlineRequest.new
337
- capture_given_auth = CaptureGivenAuth.new
338
- capture_given_auth.reportGroup = get_report_group(hash_in)
339
- capture_given_auth.transactionId = hash_in['id']
340
- capture_given_auth.customerId = hash_in['customerId']
341
-
342
- capture_given_auth.orderId = hash_in['orderId']
343
- capture_given_auth.authInformation = AuthInformation.from_hash(hash_in)
344
- capture_given_auth.amount = hash_in['amount']
345
- capture_given_auth.orderSource = hash_in['orderSource']
346
- capture_given_auth.billToAddress = Contact.from_hash(hash_in,'billToAddress')
347
- capture_given_auth.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
348
- capture_given_auth.card = Card.from_hash(hash_in)
349
- capture_given_auth.token = CardToken.from_hash(hash_in,'token')
350
- capture_given_auth.paypage = CardPaypage.from_hash(hash_in,'paypage')
351
- capture_given_auth.customBilling = CustomBilling.from_hash(hash_in)
352
- capture_given_auth.taxType = hash_in['taxType']
353
- capture_given_auth.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
354
- capture_given_auth.enhancedData = EnhancedData.from_hash(hash_in)
355
- capture_given_auth.processingInstructions = ProcessingInstructions.from_hash(hash_in)
356
- capture_given_auth.pos = Pos.from_hash(hash_in)
357
- capture_given_auth.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
358
-
359
- request.captureGivenAuth = capture_given_auth
360
-
361
- authentication = Authentication.new
362
- authentication.user = 'PHXMLTEST'
363
- authentication.password = 'password'
364
- request.authentication = authentication
365
-
366
- request.merchantId = get_merchant_id(hash_in)
367
- request.version = get_version(hash_in)
368
- request.xmlns = "http://www.litle.com/schema"
369
- request.merchantSdk = get_merchant_sdk(hash_in)
370
-
371
- xml = request.save_to_xml.to_s
372
- LitleXmlMapper.request(xml, @config_hash)
373
- end
374
-
375
- def echeck_redeposit(hash_in)
376
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
377
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
378
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
379
-
380
- request = OnlineRequest.new
381
- echeck_redeposit = EcheckRedeposit.new
382
- echeck_redeposit.reportGroup = get_report_group(hash_in)
383
- echeck_redeposit.transactionId = hash_in['id']
384
- echeck_redeposit.customerId = hash_in['customerId']
385
-
386
- echeck_redeposit.litleTxnId = hash_in['litleTxnId']
387
- echeck_redeposit.echeck = Echeck.from_hash(hash_in)
388
- echeck_redeposit.echeckToken = EcheckToken.from_hash(hash_in)
389
-
390
- request.echeckRedeposit = echeck_redeposit
391
-
392
- authentication = Authentication.new
393
- authentication.user = 'PHXMLTEST'
394
- authentication.password = 'password'
395
- request.authentication = authentication
396
-
397
- request.merchantId = get_merchant_id(hash_in)
398
- request.version = get_version(hash_in)
399
- request.xmlns = "http://www.litle.com/schema"
400
- request.merchantSdk = get_merchant_sdk(hash_in)
401
-
402
- xml = request.save_to_xml.to_s
403
- LitleXmlMapper.request(xml, @config_hash)
404
- end
405
-
406
- def echeck_sale(hash_in)
407
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
408
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
409
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
410
-
411
- request = OnlineRequest.new
412
- echeck_sale = EcheckSale.new
413
- echeck_sale.reportGroup = get_report_group(hash_in)
414
- echeck_sale.transactionId = hash_in['id']
415
- echeck_sale.customerId = hash_in['customerId']
416
-
417
- echeck_sale.litleTxnId = hash_in['litleTxnId']
418
- echeck_sale.orderId = hash_in['orderId']
419
- echeck_sale.verify = hash_in['verify']
420
- echeck_sale.amount = hash_in['amount']
421
- echeck_sale.orderSource = hash_in['orderSource']
422
- echeck_sale.billToAddress = Contact.from_hash(hash_in,'billToAddress')
423
- echeck_sale.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
424
- echeck_sale.echeck = Echeck.from_hash(hash_in)
425
- echeck_sale.echeckToken = EcheckToken.from_hash(hash_in)
426
- echeck_sale.customBilling = CustomBilling.from_hash(hash_in)
427
-
428
- request.echeckSale = echeck_sale
429
-
430
- authentication = Authentication.new
431
- authentication.user = 'PHXMLTEST'
432
- authentication.password = 'password'
433
- request.authentication = authentication
434
-
435
- request.merchantId = get_merchant_id(hash_in)
436
- request.version = get_version(hash_in)
437
- request.xmlns = "http://www.litle.com/schema"
438
- request.merchantSdk = get_merchant_sdk(hash_in)
439
-
440
- xml = request.save_to_xml.to_s
441
- LitleXmlMapper.request(xml, @config_hash)
442
- end
443
-
444
- def echeck_credit(hash_in)
445
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
446
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
447
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
448
-
449
- request = OnlineRequest.new
450
- echeck_credit = EcheckCredit.new
451
- echeck_credit.reportGroup = get_report_group(hash_in)
452
- echeck_credit.transactionId = hash_in['id']
453
- echeck_credit.customerId = hash_in['customerId']
454
-
455
- echeck_credit.litleTxnId = hash_in['litleTxnId']
456
- echeck_credit.orderId = hash_in['orderId']
457
- echeck_credit.amount = hash_in['amount']
458
- echeck_credit.orderSource = hash_in['orderSource']
459
- echeck_credit.billToAddress = Contact.from_hash(hash_in,'billToAddress')
460
- echeck_credit.echeck = Echeck.from_hash(hash_in)
461
- echeck_credit.echeckToken = EcheckToken.from_hash(hash_in)
462
- echeck_credit.customBilling = CustomBilling.from_hash(hash_in)
463
-
464
- request.echeckCredit = echeck_credit
465
-
466
- authentication = Authentication.new
467
- authentication.user = 'PHXMLTEST'
468
- authentication.password = 'password'
469
- request.authentication = authentication
470
-
471
- request.merchantId = get_merchant_id(hash_in)
472
- request.version = get_version(hash_in)
473
- request.xmlns = "http://www.litle.com/schema"
474
- request.merchantSdk = get_merchant_sdk(hash_in)
475
-
476
- begin
76
+ request.authorization = authorization
77
+
78
+ authentication = Authentication.new
79
+ authentication.user = 'PHXMLTEST'
80
+ authentication.password = 'password'
81
+ request.authentication = authentication
82
+
83
+ request.merchantId = get_merchant_id(hash_in)
84
+ request.version = get_version(hash_in)
85
+ request.xmlns = "http://www.litle.com/schema"
86
+ request.merchantSdk = get_merchant_sdk(hash_in)
87
+
477
88
  xml = request.save_to_xml.to_s
478
- rescue XML::MappingError => e
479
- puts e
480
- response = LitleOnlineResponse.new
481
- response.message = "The content of element 'echeckCredit' is not complete"
482
- return response
89
+ LitleXmlMapper.request(xml, @config_hash)
483
90
  end
484
- LitleXmlMapper.request(xml, @config_hash)
485
- end
486
-
487
- def echeck_verification(hash_in)
488
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
489
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
490
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
491
-
492
- request = OnlineRequest.new
493
- echeck_verification = EcheckVerification.new
494
- echeck_verification.reportGroup = get_report_group(hash_in)
495
- echeck_verification.transactionId = hash_in['id']
496
- echeck_verification.customerId = hash_in['customerId']
497
-
498
- echeck_verification.litleTxnId = hash_in['litleTxnId']
499
- echeck_verification.orderId = hash_in['orderId']
500
- echeck_verification.amount = hash_in['amount']
501
- echeck_verification.orderSource = hash_in['orderSource']
502
- echeck_verification.billToAddress = Contact.from_hash(hash_in,'billToAddress')
503
- echeck_verification.echeck = Echeck.from_hash(hash_in)
504
- echeck_verification.echeckToken = EcheckToken.from_hash(hash_in)
505
-
506
- request.echeckVerification = echeck_verification
507
-
508
- authentication = Authentication.new
509
- authentication.user = 'PHXMLTEST'
510
- authentication.password = 'password'
511
- request.authentication = authentication
512
-
513
- request.merchantId = get_merchant_id(hash_in)
514
- request.version = get_version(hash_in)
515
- request.xmlns = "http://www.litle.com/schema"
516
- request.merchantSdk = get_merchant_sdk(hash_in)
517
-
518
- xml = request.save_to_xml.to_s
519
- LitleXmlMapper.request(xml, @config_hash)
520
- end
521
-
522
- def void(hash_in)
523
- @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
524
- @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
525
- @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
526
-
527
- request = OnlineRequest.new
528
- void = Void.new
529
- void.reportGroup = get_report_group(hash_in)
530
- void.transactionId = hash_in['id']
531
- void.customerId = hash_in['customerId']
532
-
533
- void.litleTxnId = hash_in['litleTxnId']
534
- void.processingInstructions = ProcessingInstructions.from_hash(hash_in)
535
-
536
- request.void = void
537
-
538
- authentication = Authentication.new
539
- authentication.user = 'PHXMLTEST'
540
- authentication.password = 'password'
541
- request.authentication = authentication
542
-
543
- request.merchantId = get_merchant_id(hash_in)
544
- request.version = get_version(hash_in)
545
- request.xmlns = "http://www.litle.com/schema"
546
- request.merchantSdk = get_merchant_sdk(hash_in)
547
-
548
- xml = request.save_to_xml.to_s
549
- LitleXmlMapper.request(xml, @config_hash)
550
- end
551
-
552
- private
553
-
554
- def get_merchant_id(hash_in)
555
- if (hash_in['merchantId'] == nil)
556
- return @config_hash['currency_merchant_map']['DEFAULT']
557
- else
558
- return hash_in['merchantId']
91
+
92
+ def sale(hash_in)
93
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
94
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
95
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
96
+
97
+ request = OnlineRequest.new
98
+ sale = Sale.new
99
+ sale.reportGroup = get_report_group(hash_in)
100
+ sale.transactionId = hash_in['id']
101
+ sale.customerId = hash_in['customerId']
102
+
103
+ sale.litleTxnId = hash_in['litleTxnId']
104
+ sale.orderId = hash_in['orderId']
105
+ sale.amount = hash_in['amount']
106
+ sale.orderSource = hash_in['orderSource']
107
+ sale.customerInfo = CustomerInfo.from_hash(hash_in)
108
+ sale.billToAddress = Contact.from_hash(hash_in,'billToAddress')
109
+ sale.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
110
+ sale.card = Card.from_hash(hash_in)
111
+ sale.paypal = PayPal.from_hash(hash_in,'paypal')
112
+ sale.token = CardToken.from_hash(hash_in,'token')
113
+ sale.paypage = CardPaypage.from_hash(hash_in,'paypage')
114
+ sale.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
115
+ sale.fraudCheck = FraudCheck.from_hash(hash_in,'fraudCheck')
116
+ sale.cardholderAuthentication = FraudCheck.from_hash(hash_in,'cardholderAuthentication')
117
+ sale.customBilling = CustomBilling.from_hash(hash_in)
118
+ sale.taxType = hash_in['taxType']
119
+ sale.enhancedData = EnhancedData.from_hash(hash_in)
120
+ sale.processingInstructions = ProcessingInstructions.from_hash(hash_in)
121
+ sale.pos = Pos.from_hash(hash_in)
122
+ sale.payPalOrderComplete = hash_in['paPpalOrderComplete']
123
+ sale.payPalNotes = hash_in['payPalNotes']
124
+ sale.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
125
+ sale.allowPartialAuth = hash_in['allowPartialAuth']
126
+ sale.healthcareIIAS = HealthcareIIAS.from_hash(hash_in)
127
+ sale.filtering = Filtering.from_hash(hash_in)
128
+ sale.merchantData = MerchantData.from_hash(hash_in)
129
+ sale.recyclingRequest = RecyclingRequest.from_hash(hash_in)
130
+
131
+ request.sale = sale
132
+
133
+ authentication = Authentication.new
134
+ authentication.user = 'PHXMLTEST'
135
+ authentication.password = 'password'
136
+ request.authentication = authentication
137
+
138
+ request.merchantId = get_merchant_id(hash_in)
139
+ request.version = get_version(hash_in)
140
+ request.xmlns = "http://www.litle.com/schema"
141
+ request.merchantSdk = get_merchant_sdk(hash_in)
142
+
143
+ xml = request.save_to_xml.to_s
144
+ LitleXmlMapper.request(xml, @config_hash)
559
145
  end
560
- end
561
146
 
562
- def get_version(hash_in)
563
- if (hash_in['version'] == nil)
564
- return @config_hash['version']
565
- else
566
- return hash_in['version']
147
+ def auth_reversal(hash_in)
148
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
149
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
150
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
151
+
152
+ request = OnlineRequest.new
153
+ auth_reversal = AuthReversal.new
154
+ auth_reversal.reportGroup = get_report_group(hash_in)
155
+ auth_reversal.transactionId = hash_in['id']
156
+ auth_reversal.customerId = hash_in['customerId']
157
+
158
+ auth_reversal.litleTxnId = hash_in['litleTxnId']
159
+ auth_reversal.amount = hash_in['amount']
160
+ auth_reversal.payPalNotes = hash_in['payPalNotes']
161
+ auth_reversal.actionReason = hash_in['actionReason']
162
+
163
+ request.authReversal = auth_reversal
164
+
165
+ authentication = Authentication.new
166
+ authentication.user = 'PHXMLTEST'
167
+ authentication.password = 'password'
168
+ request.authentication = authentication
169
+
170
+ request.merchantId = get_merchant_id(hash_in)
171
+ request.version = get_version(hash_in)
172
+ request.xmlns = "http://www.litle.com/schema"
173
+ request.merchantSdk = get_merchant_sdk(hash_in)
174
+
175
+ xml = request.save_to_xml.to_s
176
+ LitleXmlMapper.request(xml, @config_hash)
567
177
  end
568
- end
569
178
 
570
- def get_merchant_sdk(hash_in)
571
- if(!hash_in['merchantSdk'])
572
- return 'Ruby;8.12.3'
573
- else
574
- return hash_in['merchantSdk']
575
- end
576
- end
577
-
578
- def get_report_group(hash_in)
579
- if (!hash_in['reportGroup'])
580
- return required_field(@config_hash['default_report_group'])
581
- else
582
- return hash_in['reportGroup']
179
+ def credit(hash_in)
180
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
181
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
182
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
183
+
184
+ request = OnlineRequest.new
185
+ credit = Credit.new
186
+ credit.reportGroup = get_report_group(hash_in)
187
+ credit.transactionId = hash_in['id']
188
+ credit.customerId = hash_in['customerId']
189
+
190
+ credit.litleTxnId = hash_in['litleTxnId']
191
+ credit.orderId = hash_in['orderId']
192
+ credit.amount = hash_in['amount']
193
+ credit.orderSource = hash_in['orderSource']
194
+ credit.billToAddress = Contact.from_hash(hash_in,'billToAddress')
195
+ credit.card = Card.from_hash(hash_in)
196
+ credit.paypal = CreditPayPal.from_hash(hash_in,'paypal')
197
+ credit.token = CardToken.from_hash(hash_in,'token')
198
+ credit.paypage = CardPaypage.from_hash(hash_in,'paypage')
199
+ credit.customBilling = CustomBilling.from_hash(hash_in)
200
+ credit.taxType = hash_in['taxType']
201
+ credit.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
202
+ credit.enhancedData = EnhancedData.from_hash(hash_in)
203
+ credit.processingInstructions = ProcessingInstructions.from_hash(hash_in)
204
+ credit.pos = Pos.from_hash(hash_in)
205
+ credit.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
206
+ credit.payPalNotes = hash_in['payPalNotes']
207
+ credit.actionReason = hash_in['actionReason']
208
+
209
+ request.credit = credit
210
+
211
+ authentication = Authentication.new
212
+ authentication.user = 'PHXMLTEST'
213
+ authentication.password = 'password'
214
+ request.authentication = authentication
215
+
216
+ request.merchantId = get_merchant_id(hash_in)
217
+ request.version = get_version(hash_in)
218
+ request.xmlns = "http://www.litle.com/schema"
219
+ request.merchantSdk = get_merchant_sdk(hash_in)
220
+
221
+ xml = request.save_to_xml.to_s
222
+ LitleXmlMapper.request(xml, @config_hash)
223
+ end
224
+
225
+ def register_token_request(hash_in)
226
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
227
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
228
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
229
+
230
+ request = OnlineRequest.new
231
+ token_request = RegisterTokenRequest.new
232
+ token_request.reportGroup = get_report_group(hash_in)
233
+ token_request.transactionId = hash_in['id']
234
+ token_request.customerId = hash_in['customerId']
235
+
236
+ token_request.orderId = hash_in['orderId']
237
+ token_request.accountNumber = hash_in['accountNumber']
238
+ token_request.echeckForToken = EcheckForToken.from_hash(hash_in)
239
+ token_request.paypageRegistrationId = hash_in['paypageRegistrationId']
240
+
241
+ request.registerTokenRequest = token_request
242
+
243
+ authentication = Authentication.new
244
+ authentication.user = 'PHXMLTEST'
245
+ authentication.password = 'password'
246
+ request.authentication = authentication
247
+
248
+ request.merchantId = get_merchant_id(hash_in)
249
+ request.version = get_version(hash_in)
250
+ request.xmlns = "http://www.litle.com/schema"
251
+ request.merchantSdk = get_merchant_sdk(hash_in)
252
+
253
+ xml = request.save_to_xml.to_s
254
+ LitleXmlMapper.request(xml, @config_hash)
255
+ end
256
+
257
+ def force_capture(hash_in)
258
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
259
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
260
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
261
+
262
+ request = OnlineRequest.new
263
+ force_capture = ForceCapture.new
264
+ force_capture.reportGroup = get_report_group(hash_in)
265
+ force_capture.transactionId = hash_in['id']
266
+ force_capture.customerId = hash_in['customerId']
267
+
268
+ force_capture.orderId = hash_in['orderId']
269
+ force_capture.amount = hash_in['amount']
270
+ force_capture.orderSource = hash_in['orderSource']
271
+ force_capture.billToAddress = Contact.from_hash(hash_in,'billToAddress')
272
+ force_capture.card = Card.from_hash(hash_in)
273
+ force_capture.token = CardToken.from_hash(hash_in,'token')
274
+ force_capture.paypage = CardPaypage.from_hash(hash_in,'paypage')
275
+ force_capture.customBilling = CustomBilling.from_hash(hash_in)
276
+ force_capture.taxType = hash_in['taxType']
277
+ force_capture.enhancedData = EnhancedData.from_hash(hash_in)
278
+ force_capture.processingInstructions = ProcessingInstructions.from_hash(hash_in)
279
+ force_capture.pos = Pos.from_hash(hash_in)
280
+ force_capture.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
281
+
282
+ request.forceCapture = force_capture
283
+
284
+ authentication = Authentication.new
285
+ authentication.user = 'PHXMLTEST'
286
+ authentication.password = 'password'
287
+ request.authentication = authentication
288
+
289
+ request.merchantId = get_merchant_id(hash_in)
290
+ request.version = get_version(hash_in)
291
+ request.xmlns = "http://www.litle.com/schema"
292
+ request.merchantSdk = get_merchant_sdk(hash_in)
293
+
294
+ xml = request.save_to_xml.to_s
295
+ LitleXmlMapper.request(xml, @config_hash)
296
+ end
297
+
298
+ def capture(hash_in)
299
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
300
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
301
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
302
+
303
+ request = OnlineRequest.new
304
+ capture = Capture.new
305
+ capture.reportGroup = get_report_group(hash_in)
306
+ capture.transactionId = hash_in['id']
307
+ capture.customerId = hash_in['customerId']
308
+
309
+ capture.partial = hash_in['partial']
310
+ capture.litleTxnId = hash_in['litleTxnId']
311
+ capture.amount = hash_in['amount']
312
+ capture.enhancedData = EnhancedData.from_hash(hash_in)
313
+ capture.processingInstructions = ProcessingInstructions.from_hash(hash_in)
314
+ capture.payPalOrderComplete = hash_in['payPalOrderComplete']
315
+ capture.payPalNotes = hash_in['payPalNotes']
316
+
317
+ request.captureTxn = capture
318
+
319
+ authentication = Authentication.new
320
+ authentication.user = 'PHXMLTEST'
321
+ authentication.password = 'password'
322
+ request.authentication = authentication
323
+
324
+ request.merchantId = get_merchant_id(hash_in)
325
+ request.version = get_version(hash_in)
326
+ request.xmlns = "http://www.litle.com/schema"
327
+ request.merchantSdk = get_merchant_sdk(hash_in)
328
+
329
+ xml = request.save_to_xml.to_s
330
+ LitleXmlMapper.request(xml, @config_hash)
331
+ end
332
+
333
+ def capture_given_auth(hash_in)
334
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
335
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
336
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
337
+
338
+ request = OnlineRequest.new
339
+ capture_given_auth = CaptureGivenAuth.new
340
+ capture_given_auth.reportGroup = get_report_group(hash_in)
341
+ capture_given_auth.transactionId = hash_in['id']
342
+ capture_given_auth.customerId = hash_in['customerId']
343
+
344
+ capture_given_auth.orderId = hash_in['orderId']
345
+ capture_given_auth.authInformation = AuthInformation.from_hash(hash_in)
346
+ capture_given_auth.amount = hash_in['amount']
347
+ capture_given_auth.orderSource = hash_in['orderSource']
348
+ capture_given_auth.billToAddress = Contact.from_hash(hash_in,'billToAddress')
349
+ capture_given_auth.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
350
+ capture_given_auth.card = Card.from_hash(hash_in)
351
+ capture_given_auth.token = CardToken.from_hash(hash_in,'token')
352
+ capture_given_auth.paypage = CardPaypage.from_hash(hash_in,'paypage')
353
+ capture_given_auth.customBilling = CustomBilling.from_hash(hash_in)
354
+ capture_given_auth.taxType = hash_in['taxType']
355
+ capture_given_auth.billMeLaterRequest = BillMeLaterRequest.from_hash(hash_in)
356
+ capture_given_auth.enhancedData = EnhancedData.from_hash(hash_in)
357
+ capture_given_auth.processingInstructions = ProcessingInstructions.from_hash(hash_in)
358
+ capture_given_auth.pos = Pos.from_hash(hash_in)
359
+ capture_given_auth.amexAggregatorData = AmexAggregatorData.from_hash(hash_in)
360
+
361
+ request.captureGivenAuth = capture_given_auth
362
+
363
+ authentication = Authentication.new
364
+ authentication.user = 'PHXMLTEST'
365
+ authentication.password = 'password'
366
+ request.authentication = authentication
367
+
368
+ request.merchantId = get_merchant_id(hash_in)
369
+ request.version = get_version(hash_in)
370
+ request.xmlns = "http://www.litle.com/schema"
371
+ request.merchantSdk = get_merchant_sdk(hash_in)
372
+
373
+ xml = request.save_to_xml.to_s
374
+ LitleXmlMapper.request(xml, @config_hash)
375
+ end
376
+
377
+ def echeck_redeposit(hash_in)
378
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
379
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
380
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
381
+
382
+ request = OnlineRequest.new
383
+ echeck_redeposit = EcheckRedeposit.new
384
+ echeck_redeposit.reportGroup = get_report_group(hash_in)
385
+ echeck_redeposit.transactionId = hash_in['id']
386
+ echeck_redeposit.customerId = hash_in['customerId']
387
+
388
+ echeck_redeposit.litleTxnId = hash_in['litleTxnId']
389
+ echeck_redeposit.echeck = Echeck.from_hash(hash_in)
390
+ echeck_redeposit.echeckToken = EcheckToken.from_hash(hash_in)
391
+
392
+ request.echeckRedeposit = echeck_redeposit
393
+
394
+ authentication = Authentication.new
395
+ authentication.user = 'PHXMLTEST'
396
+ authentication.password = 'password'
397
+ request.authentication = authentication
398
+
399
+ request.merchantId = get_merchant_id(hash_in)
400
+ request.version = get_version(hash_in)
401
+ request.xmlns = "http://www.litle.com/schema"
402
+ request.merchantSdk = get_merchant_sdk(hash_in)
403
+
404
+ xml = request.save_to_xml.to_s
405
+ LitleXmlMapper.request(xml, @config_hash)
406
+ end
407
+
408
+ def echeck_sale(hash_in)
409
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
410
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
411
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
412
+
413
+ request = OnlineRequest.new
414
+ echeck_sale = EcheckSale.new
415
+ echeck_sale.reportGroup = get_report_group(hash_in)
416
+ echeck_sale.transactionId = hash_in['id']
417
+ echeck_sale.customerId = hash_in['customerId']
418
+
419
+ echeck_sale.litleTxnId = hash_in['litleTxnId']
420
+ echeck_sale.orderId = hash_in['orderId']
421
+ echeck_sale.verify = hash_in['verify']
422
+ echeck_sale.amount = hash_in['amount']
423
+ echeck_sale.orderSource = hash_in['orderSource']
424
+ echeck_sale.billToAddress = Contact.from_hash(hash_in,'billToAddress')
425
+ echeck_sale.shipToAddress = Contact.from_hash(hash_in,'shipToAddress')
426
+ echeck_sale.echeck = Echeck.from_hash(hash_in)
427
+ echeck_sale.echeckToken = EcheckToken.from_hash(hash_in)
428
+ echeck_sale.customBilling = CustomBilling.from_hash(hash_in)
429
+
430
+ request.echeckSale = echeck_sale
431
+
432
+ authentication = Authentication.new
433
+ authentication.user = 'PHXMLTEST'
434
+ authentication.password = 'password'
435
+ request.authentication = authentication
436
+
437
+ request.merchantId = get_merchant_id(hash_in)
438
+ request.version = get_version(hash_in)
439
+ request.xmlns = "http://www.litle.com/schema"
440
+ request.merchantSdk = get_merchant_sdk(hash_in)
441
+
442
+ xml = request.save_to_xml.to_s
443
+ LitleXmlMapper.request(xml, @config_hash)
444
+ end
445
+
446
+ def echeck_credit(hash_in)
447
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
448
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
449
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
450
+
451
+ request = OnlineRequest.new
452
+ echeck_credit = EcheckCredit.new
453
+ echeck_credit.reportGroup = get_report_group(hash_in)
454
+ echeck_credit.transactionId = hash_in['id']
455
+ echeck_credit.customerId = hash_in['customerId']
456
+
457
+ echeck_credit.litleTxnId = hash_in['litleTxnId']
458
+ echeck_credit.orderId = hash_in['orderId']
459
+ echeck_credit.amount = hash_in['amount']
460
+ echeck_credit.orderSource = hash_in['orderSource']
461
+ echeck_credit.billToAddress = Contact.from_hash(hash_in,'billToAddress')
462
+ echeck_credit.echeck = Echeck.from_hash(hash_in)
463
+ echeck_credit.echeckToken = EcheckToken.from_hash(hash_in)
464
+ echeck_credit.customBilling = CustomBilling.from_hash(hash_in)
465
+
466
+ request.echeckCredit = echeck_credit
467
+
468
+ authentication = Authentication.new
469
+ authentication.user = 'PHXMLTEST'
470
+ authentication.password = 'password'
471
+ request.authentication = authentication
472
+
473
+ request.merchantId = get_merchant_id(hash_in)
474
+ request.version = get_version(hash_in)
475
+ request.xmlns = "http://www.litle.com/schema"
476
+ request.merchantSdk = get_merchant_sdk(hash_in)
477
+
478
+ begin
479
+ xml = request.save_to_xml.to_s
480
+ rescue XML::MappingError => e
481
+ puts e
482
+ response = LitleOnlineResponse.new
483
+ response.message = "The content of element 'echeckCredit' is not complete"
484
+ return response
485
+ end
486
+ LitleXmlMapper.request(xml, @config_hash)
487
+ end
488
+
489
+ def echeck_verification(hash_in)
490
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
491
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
492
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
493
+
494
+ request = OnlineRequest.new
495
+ echeck_verification = EcheckVerification.new
496
+ echeck_verification.reportGroup = get_report_group(hash_in)
497
+ echeck_verification.transactionId = hash_in['id']
498
+ echeck_verification.customerId = hash_in['customerId']
499
+
500
+ echeck_verification.litleTxnId = hash_in['litleTxnId']
501
+ echeck_verification.orderId = hash_in['orderId']
502
+ echeck_verification.amount = hash_in['amount']
503
+ echeck_verification.orderSource = hash_in['orderSource']
504
+ echeck_verification.billToAddress = Contact.from_hash(hash_in,'billToAddress')
505
+ echeck_verification.echeck = Echeck.from_hash(hash_in)
506
+ echeck_verification.echeckToken = EcheckToken.from_hash(hash_in)
507
+
508
+ request.echeckVerification = echeck_verification
509
+
510
+ authentication = Authentication.new
511
+ authentication.user = 'PHXMLTEST'
512
+ authentication.password = 'password'
513
+ request.authentication = authentication
514
+
515
+ request.merchantId = get_merchant_id(hash_in)
516
+ request.version = get_version(hash_in)
517
+ request.xmlns = "http://www.litle.com/schema"
518
+ request.merchantSdk = get_merchant_sdk(hash_in)
519
+
520
+ xml = request.save_to_xml.to_s
521
+ LitleXmlMapper.request(xml, @config_hash)
522
+ end
523
+
524
+ def void(hash_in)
525
+ @config_hash['proxy_addr'] = hash_in['proxy_addr'].nil? ? @config_hash['proxy_addr'] : hash_in['proxy_addr']
526
+ @config_hash['proxy_port'] = hash_in['proxy_port'].nil? ? @config_hash['proxy_port'] : hash_in['proxy_port']
527
+ @config_hash['url'] = hash_in['url'].nil? ? @config_hash['url'] : hash_in['url']
528
+
529
+ request = OnlineRequest.new
530
+ void = Void.new
531
+ void.reportGroup = get_report_group(hash_in)
532
+ void.transactionId = hash_in['id']
533
+ void.customerId = hash_in['customerId']
534
+
535
+ void.litleTxnId = hash_in['litleTxnId']
536
+ void.processingInstructions = ProcessingInstructions.from_hash(hash_in)
537
+
538
+ request.void = void
539
+
540
+ authentication = Authentication.new
541
+ authentication.user = 'PHXMLTEST'
542
+ authentication.password = 'password'
543
+ request.authentication = authentication
544
+
545
+ request.merchantId = get_merchant_id(hash_in)
546
+ request.version = get_version(hash_in)
547
+ request.xmlns = "http://www.litle.com/schema"
548
+ request.merchantSdk = get_merchant_sdk(hash_in)
549
+
550
+ xml = request.save_to_xml.to_s
551
+ LitleXmlMapper.request(xml, @config_hash)
552
+ end
553
+
554
+ private
555
+
556
+ def get_merchant_id(hash_in)
557
+ if (hash_in['merchantId'] == nil)
558
+ return @config_hash['currency_merchant_map']['DEFAULT']
559
+ else
560
+ return hash_in['merchantId']
561
+ end
562
+ end
563
+
564
+ def get_version(hash_in)
565
+ if (hash_in['version'] == nil)
566
+ return @config_hash['version']
567
+ else
568
+ return hash_in['version']
569
+ end
570
+ end
571
+
572
+ def get_merchant_sdk(hash_in)
573
+ if(!hash_in['merchantSdk'])
574
+ return 'Ruby;8.12.4'
575
+ else
576
+ return hash_in['merchantSdk']
577
+ end
578
+ end
579
+
580
+ def get_report_group(hash_in)
581
+ if (!hash_in['reportGroup'])
582
+ return @config_hash['default_report_group']
583
+ else
584
+ return hash_in['reportGroup']
585
+ end
583
586
  end
584
587
  end
585
- end
588
+ end