CnpOnline 8.31.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +139 -0
- data/CONTRIBUTORS +2 -0
- data/DESCRIPTION +5 -0
- data/LICENSE +22 -0
- data/README.md +72 -0
- data/Rakefile +89 -0
- data/Rakefile~ +89 -0
- data/SETUP.md +46 -0
- data/bin/Setup.rb +124 -0
- data/bin/sample_batch_driver.rb +123 -0
- data/bin/sample_driver.rb +49 -0
- data/lib/Communications.rb +85 -0
- data/lib/Configuration.rb +67 -0
- data/lib/EnvironmentVariables.rb +22 -0
- data/lib/LitleBatchRequest.rb +562 -0
- data/lib/LitleListeners.rb +142 -0
- data/lib/LitleOnline.rb +62 -0
- data/lib/LitleOnlineRequest.rb +297 -0
- data/lib/LitleRequest.rb +494 -0
- data/lib/LitleTransaction.rb +463 -0
- data/lib/LitleXmlMapper.rb +64 -0
- data/lib/XMLFields.rb +1869 -0
- data/lib/cacert.pem +3331 -0
- data/samples/Auth/LitleAuthReversalTransaction.rb +15 -0
- data/samples/Auth/LitleAuthorizationTransaction.rb +31 -0
- data/samples/Auth/LitlePaymentFullLifeCycle.rb +47 -0
- data/samples/Batch/AccountUpdate.rb +64 -0
- data/samples/Batch/SampleBatchDriver.rb +94 -0
- data/samples/Capture/LitleCaptureGivenAuthTransaction.rb +30 -0
- data/samples/Capture/LitleCaptureTransaction.rb +14 -0
- data/samples/Capture/LitleForceCaptureTransaction.rb +26 -0
- data/samples/Capture/LitlePartialCapture.rb +16 -0
- data/samples/Credit/LitleCreditTransaction.rb +16 -0
- data/samples/Credit/LitleRefundTransaction.rb +29 -0
- data/samples/Other/LitleAvsTransaction.rb +34 -0
- data/samples/Other/LitleVoidTransaction.rb +18 -0
- data/samples/Paypage/FullPaypageLifeCycle.rb +74 -0
- data/samples/Run_all.rb +17 -0
- data/samples/Sale/LitleSaleTransaction.rb +29 -0
- data/samples/Sale/SampleSaleTransaction.rb +24 -0
- data/test/certification/certTest1_base.rb +945 -0
- data/test/certification/certTest2_authenhanced.rb +573 -0
- data/test/certification/certTest3_authreversal.rb +185 -0
- data/test/certification/certTest4_echeck.rb +278 -0
- data/test/certification/certTest5_token.rb +204 -0
- data/test/certification/certTest_batchAll.rb +337 -0
- data/test/certification/ts_all.rb +33 -0
- data/test/functional/test_activate.rb +100 -0
- data/test/functional/test_activateReversal.rb +56 -0
- data/test/functional/test_auth.rb +298 -0
- data/test/functional/test_authReversal.rb +69 -0
- data/test/functional/test_balanceInquiry.rb +80 -0
- data/test/functional/test_batch.rb +164 -0
- data/test/functional/test_batchStream.rb +145 -0
- data/test/functional/test_cancelSubscription.rb +55 -0
- data/test/functional/test_capture.rb +84 -0
- data/test/functional/test_captureGivenAuth.rb +235 -0
- data/test/functional/test_configuration.rb +89 -0
- data/test/functional/test_createPlan.rb +85 -0
- data/test/functional/test_credit.rb +174 -0
- data/test/functional/test_deactivate.rb +80 -0
- data/test/functional/test_deactivateReversal.rb +56 -0
- data/test/functional/test_depositReversal.rb +56 -0
- data/test/functional/test_echeckCredit.rb +134 -0
- data/test/functional/test_echeckRedeposit.rb +88 -0
- data/test/functional/test_echeckSale.rb +177 -0
- data/test/functional/test_echeckVerification.rb +127 -0
- data/test/functional/test_echeckVoid.rb +41 -0
- data/test/functional/test_forceCapture.rb +183 -0
- data/test/functional/test_litle_requests.rb +356 -0
- data/test/functional/test_load.rb +82 -0
- data/test/functional/test_loadReversal.rb +56 -0
- data/test/functional/test_override.rb +64 -0
- data/test/functional/test_refundReversal.rb +56 -0
- data/test/functional/test_sale.rb +259 -0
- data/test/functional/test_token.rb +115 -0
- data/test/functional/test_unload.rb +82 -0
- data/test/functional/test_unloadReversal.rb +56 -0
- data/test/functional/test_updateCardValidationNumOnToken.rb +43 -0
- data/test/functional/test_updatePlan.rb +58 -0
- data/test/functional/test_updateSubscription.rb +76 -0
- data/test/functional/test_xmlfields.rb +427 -0
- data/test/functional/ts_all.rb +66 -0
- data/test/unit/test_LitleAUBatch.rb +216 -0
- data/test/unit/test_LitleBatchRequest.rb +643 -0
- data/test/unit/test_LitleOnlineRequest.rb +295 -0
- data/test/unit/test_LitleRequest.rb +316 -0
- data/test/unit/test_LitleTransaction.rb +397 -0
- data/test/unit/test_activate.rb +92 -0
- data/test/unit/test_activateReversal.rb +44 -0
- data/test/unit/test_auth.rb +421 -0
- data/test/unit/test_authReversal.rb +82 -0
- data/test/unit/test_balanceInquiry.rb +52 -0
- data/test/unit/test_cancelSubscription.rb +43 -0
- data/test/unit/test_capture.rb +73 -0
- data/test/unit/test_captureGivenAuth.rb +188 -0
- data/test/unit/test_createPlan.rb +52 -0
- data/test/unit/test_credit.rb +342 -0
- data/test/unit/test_deactivate.rb +52 -0
- data/test/unit/test_deactivateReversal.rb +44 -0
- data/test/unit/test_depositReversal.rb +44 -0
- data/test/unit/test_echeckCredit.rb +71 -0
- data/test/unit/test_echeckRedeposit.rb +94 -0
- data/test/unit/test_echeckSale.rb +71 -0
- data/test/unit/test_echeckVerification.rb +71 -0
- data/test/unit/test_echeckVoid.rb +54 -0
- data/test/unit/test_forceCapture.rb +145 -0
- data/test/unit/test_load.rb +53 -0
- data/test/unit/test_loadReversal.rb +44 -0
- data/test/unit/test_refundReversal.rb +44 -0
- data/test/unit/test_sale.rb +465 -0
- data/test/unit/test_token.rb +144 -0
- data/test/unit/test_unload.rb +53 -0
- data/test/unit/test_unloadReversal.rb +44 -0
- data/test/unit/test_updateCardValidationNumOnToken.rb +80 -0
- data/test/unit/test_updatePlan.rb +45 -0
- data/test/unit/test_updateSubscription.rb +172 -0
- data/test/unit/test_xmlfields.rb +2930 -0
- data/test/unit/ts_unit.rb +65 -0
- metadata +255 -0
@@ -0,0 +1,463 @@
|
|
1
|
+
=begin
|
2
|
+
Copyright (c) 2011 Litle & Co.
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person
|
5
|
+
obtaining a copy of this software and associated documentation
|
6
|
+
files (the "Software"), to deal in the Software without
|
7
|
+
restriction, including without limitation the rights to use,
|
8
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the
|
10
|
+
Software is furnished to do so, subject to the following
|
11
|
+
conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
=end
|
25
|
+
require_relative 'Configuration'
|
26
|
+
|
27
|
+
#
|
28
|
+
# This class does all the heavy lifting of mapping the Ruby hash into Litle XML format
|
29
|
+
# It also handles validation looking for missing or incorrect fields
|
30
|
+
# contains the methods to properly create each transaction type
|
31
|
+
#
|
32
|
+
module LitleOnline
|
33
|
+
|
34
|
+
class LitleTransaction
|
35
|
+
def authorization(options)
|
36
|
+
transaction = Authorization.new
|
37
|
+
transaction.secondaryAmount = options['secondaryAmount']
|
38
|
+
transaction.surchargeAmount = options['surchargeAmount']
|
39
|
+
transaction.recurringRequest = RecurringRequest.from_hash(options,'recurringRequest')
|
40
|
+
transaction.debtRepayment = options['debtRepayment']
|
41
|
+
transaction.advancedFraudChecks = AdvancedFraudChecks.from_hash(options, 'advancedFraudChecks')
|
42
|
+
transaction.processingType = options['processingType']
|
43
|
+
transaction.originalNetworkTransactionId = options['originalNetworkTransactionId']
|
44
|
+
transaction.originalTransactionAmount = options['originalTransactionAmount']
|
45
|
+
add_transaction_info(transaction, options)
|
46
|
+
|
47
|
+
return transaction
|
48
|
+
end
|
49
|
+
|
50
|
+
def cancel_subscription(options)
|
51
|
+
transaction = CancelSubscription.new
|
52
|
+
transaction.subscriptionId = options['subscriptionId']
|
53
|
+
return transaction
|
54
|
+
end
|
55
|
+
|
56
|
+
def activate(options)
|
57
|
+
transaction = Activate.new
|
58
|
+
transaction.orderId = options['orderId']
|
59
|
+
transaction.orderSource = options['orderSource']
|
60
|
+
transaction.amount = options['amount']
|
61
|
+
transaction.card = Card.from_hash(options,'card')
|
62
|
+
transaction.virtualGiftCard = VirtualGiftCard.from_hash(options,'virtualGiftCard')
|
63
|
+
return transaction
|
64
|
+
end
|
65
|
+
|
66
|
+
def deactivate(options)
|
67
|
+
transaction = Deactivate.new
|
68
|
+
transaction.orderId = options['orderId']
|
69
|
+
transaction.orderSource = options['orderSource']
|
70
|
+
transaction.card = Card.from_hash(options,'card')
|
71
|
+
return transaction
|
72
|
+
end
|
73
|
+
|
74
|
+
def load_request(options)
|
75
|
+
transaction = Load.new
|
76
|
+
transaction.orderId = options['orderId']
|
77
|
+
transaction.orderSource = options['orderSource']
|
78
|
+
transaction.amount = options['amount']
|
79
|
+
transaction.card = Card.from_hash(options,'card')
|
80
|
+
return transaction
|
81
|
+
end
|
82
|
+
|
83
|
+
def unload_request(options)
|
84
|
+
transaction = Unload.new
|
85
|
+
transaction.orderId = options['orderId']
|
86
|
+
transaction.orderSource = options['orderSource']
|
87
|
+
transaction.amount = options['amount']
|
88
|
+
transaction.card = Card.from_hash(options,'card')
|
89
|
+
return transaction
|
90
|
+
end
|
91
|
+
|
92
|
+
def balance_inquiry(options)
|
93
|
+
transaction = BalanceInquiry.new
|
94
|
+
transaction.orderId = options['orderId']
|
95
|
+
transaction.orderSource = options['orderSource']
|
96
|
+
transaction.card = Card.from_hash(options,'card')
|
97
|
+
return transaction
|
98
|
+
end
|
99
|
+
|
100
|
+
def update_subscription(options)
|
101
|
+
transaction = UpdateSubscription.new
|
102
|
+
transaction.subscriptionId = options['subscriptionId']
|
103
|
+
transaction.planCode=options['planCode']
|
104
|
+
transaction.billToAddress=Contact.from_hash(options,'billToAddress')
|
105
|
+
transaction.card=Card.from_hash(options,'card')
|
106
|
+
transaction.billingDate=options['billingDate']
|
107
|
+
transaction.card = Card.from_hash(options)
|
108
|
+
transaction.token = CardToken.from_hash(options,'token')
|
109
|
+
transaction.paypage = CardPaypage.from_hash(options,'paypage')
|
110
|
+
if(options['createDiscount'])
|
111
|
+
options['createDiscount'].each_index {| index | transaction.createDiscount << CreateDiscount.from_hash(options, index,'createDiscount')}
|
112
|
+
end
|
113
|
+
if(options['updateDiscount'])
|
114
|
+
options['updateDiscount'].each_index {| index | transaction.updateDiscount << UpdateDiscount.from_hash(options, index,'updateDiscount')}
|
115
|
+
end
|
116
|
+
if(options['deleteDiscount'])
|
117
|
+
options['deleteDiscount'].each_index {| index | transaction.deleteDiscount << DeleteDiscount.from_hash(options, index,'deleteDiscount')}
|
118
|
+
end
|
119
|
+
if(options['createAddOn'])
|
120
|
+
options['createAddOn'].each_index {| index | transaction.createAddOn << CreateAddOn.from_hash(options, index,'createAddOn')}
|
121
|
+
end
|
122
|
+
if(options['updateAddOn'])
|
123
|
+
options['updateAddOn'].each_index {| index | transaction.updateAddOn << UpdateAddOn.from_hash(options, index,'updateAddOn')}
|
124
|
+
end
|
125
|
+
if(options['deleteAddOn'])
|
126
|
+
options['deleteAddOn'].each_index {| index | transaction.deleteAddOn << DeleteAddOn.from_hash(options, index,'deleteAddOn')}
|
127
|
+
end
|
128
|
+
|
129
|
+
return transaction
|
130
|
+
end
|
131
|
+
|
132
|
+
def create_plan(options)
|
133
|
+
transaction = CreatePlan.new
|
134
|
+
transaction.planCode = options['planCode']
|
135
|
+
transaction.name=options['name']
|
136
|
+
transaction.description=options['description']
|
137
|
+
transaction.intervalType=options['intervalType']
|
138
|
+
transaction.amount=options['amount']
|
139
|
+
transaction.numberOfPayments=options['numberOfPayments']
|
140
|
+
transaction.trialNumberOfIntervals=options['trialNumberOfIntervals']
|
141
|
+
transaction.trialIntervalType=options['trialIntervalType']
|
142
|
+
transaction.active=options['active']
|
143
|
+
return transaction
|
144
|
+
end
|
145
|
+
|
146
|
+
def update_plan(options)
|
147
|
+
transaction = UpdatePlan.new
|
148
|
+
transaction.planCode = options['planCode']
|
149
|
+
transaction.active=options['active']
|
150
|
+
return transaction
|
151
|
+
end
|
152
|
+
|
153
|
+
def virtual_giftcard(options)
|
154
|
+
transaction = VirtualGiftCard.new
|
155
|
+
transaction.accountNumberLength = options['accountNumberLength']
|
156
|
+
transaction.giftCardBin = options['giftCardBin']
|
157
|
+
return transaction
|
158
|
+
end
|
159
|
+
|
160
|
+
def activate_reversal(options)
|
161
|
+
transaction = ActivateReversal.new
|
162
|
+
transaction.litleTxnId = options['litleTxnId']
|
163
|
+
return transaction
|
164
|
+
end
|
165
|
+
|
166
|
+
def deposit_reversal(options)
|
167
|
+
transaction = DepositReversal.new
|
168
|
+
transaction.litleTxnId = options['litleTxnId']
|
169
|
+
return transaction
|
170
|
+
end
|
171
|
+
|
172
|
+
def refund_reversal(options)
|
173
|
+
transaction = RefundReversal.new
|
174
|
+
transaction.litleTxnId = options['litleTxnId']
|
175
|
+
return transaction
|
176
|
+
end
|
177
|
+
|
178
|
+
def deactivate_reversal(options)
|
179
|
+
transaction = DeactivateReversal.new
|
180
|
+
transaction.litleTxnId = options['litleTxnId']
|
181
|
+
return transaction
|
182
|
+
end
|
183
|
+
|
184
|
+
def load_reversal(options)
|
185
|
+
transaction = LoadReversal.new
|
186
|
+
transaction.litleTxnId = options['litleTxnId']
|
187
|
+
return transaction
|
188
|
+
end
|
189
|
+
|
190
|
+
def unload_reversal(options)
|
191
|
+
transaction = UnloadReversal.new
|
192
|
+
transaction.litleTxnId = options['litleTxnId']
|
193
|
+
return transaction
|
194
|
+
end
|
195
|
+
|
196
|
+
def sale(options)
|
197
|
+
transaction = Sale.new
|
198
|
+
add_transaction_info(transaction, options)
|
199
|
+
transaction.secondaryAmount = options['secondaryAmount']
|
200
|
+
transaction.surchargeAmount = options['surchargeAmount']
|
201
|
+
transaction.fraudCheck = FraudCheck.from_hash(options,'fraudCheck')
|
202
|
+
transaction.payPalOrderComplete = options['payPalOrderComplete']
|
203
|
+
transaction.payPalNotes = options['payPalNotes']
|
204
|
+
transaction.recurringRequest = RecurringRequest.from_hash(options,'recurringRequest')
|
205
|
+
transaction.litleInternalRecurringRequest = LitleInternalRecurringRequest.from_hash(options,'litleInternalRecurringRequest')
|
206
|
+
transaction.debtRepayment = options['debtRepayment']
|
207
|
+
transaction.advancedFraudChecks = AdvancedFraudChecks.from_hash(options, 'advancedFraudChecks')
|
208
|
+
transaction.processingType = options['processingType']
|
209
|
+
transaction.originalNetworkTransactionId = options['originalNetworkTransactionId']
|
210
|
+
transaction.originalTransactionAmount = options['originalTransactionAmount']
|
211
|
+
return transaction
|
212
|
+
end
|
213
|
+
|
214
|
+
def credit(options)
|
215
|
+
transaction = Credit.new
|
216
|
+
transaction.litleTxnId = options['litleTxnId']
|
217
|
+
if(transaction.litleTxnId.nil?)
|
218
|
+
transaction.orderId = options['orderId']
|
219
|
+
transaction.orderSource = options['orderSource']
|
220
|
+
transaction.taxType = options['taxType']
|
221
|
+
transaction.billToAddress = Contact.from_hash(options,'billToAddress')
|
222
|
+
transaction.amexAggregatorData = AmexAggregatorData.from_hash(options)
|
223
|
+
transaction.card = Card.from_hash(options)
|
224
|
+
transaction.token = CardToken.from_hash(options,'token')
|
225
|
+
transaction.paypage = CardPaypage.from_hash(options,'paypage')
|
226
|
+
transaction.mpos = Mpos.from_hash(options,'mpos')
|
227
|
+
end
|
228
|
+
transaction.amount = options['amount']
|
229
|
+
transaction.secondaryAmount = options['secondaryAmount']
|
230
|
+
transaction.surchargeAmount = options['surchargeAmount']
|
231
|
+
transaction.customBilling = CustomBilling.from_hash(options)
|
232
|
+
transaction.enhancedData = EnhancedData.from_hash(options)
|
233
|
+
transaction.processingInstructions = ProcessingInstructions.from_hash(options)
|
234
|
+
transaction.pos = Pos.from_hash(options)
|
235
|
+
transaction.billMeLaterRequest = BillMeLaterRequest.from_hash(options)
|
236
|
+
transaction.payPalNotes = options['payPalNotes']
|
237
|
+
transaction.actionReason = options['actionReason']
|
238
|
+
transaction.paypal = CreditPayPal.from_hash(options,'paypal')
|
239
|
+
|
240
|
+
add_account_info(transaction, options)
|
241
|
+
return transaction
|
242
|
+
end
|
243
|
+
|
244
|
+
def auth_reversal(options)
|
245
|
+
transaction = AuthReversal.new
|
246
|
+
|
247
|
+
transaction.litleTxnId = options['litleTxnId']
|
248
|
+
transaction.amount = options['amount']
|
249
|
+
transaction.surchargeAmount = options['surchargeAmount']
|
250
|
+
transaction.payPalNotes = options['payPalNotes']
|
251
|
+
transaction.actionReason = options['actionReason']
|
252
|
+
|
253
|
+
add_account_info(transaction, options)
|
254
|
+
return transaction
|
255
|
+
end
|
256
|
+
|
257
|
+
def register_token_request(options)
|
258
|
+
transaction = RegisterTokenRequest.new
|
259
|
+
|
260
|
+
transaction.orderId = options['orderId']
|
261
|
+
transaction.accountNumber = options['accountNumber']
|
262
|
+
transaction.echeckForToken = EcheckForToken.from_hash(options)
|
263
|
+
transaction.paypageRegistrationId = options['paypageRegistrationId']
|
264
|
+
transaction.applepay = Applepay.from_hash(options,'applepay')
|
265
|
+
add_account_info(transaction, options)
|
266
|
+
return transaction
|
267
|
+
end
|
268
|
+
|
269
|
+
def update_card_validation_num_on_token(options)
|
270
|
+
transaction = UpdateCardValidationNumOnToken.new
|
271
|
+
|
272
|
+
transaction.orderId = options['orderId']
|
273
|
+
transaction.litleToken = options['litleToken']
|
274
|
+
transaction.cardValidationNum = options['cardValidationNum']
|
275
|
+
|
276
|
+
SchemaValidation.validate_length(transaction.litleToken, true, 13, 25, "updateCardValidationNumOnToken", "litleToken")
|
277
|
+
SchemaValidation.validate_length(transaction.cardValidationNum, true, 1, 4, "updateCardValidationNumOnToken", "cardValidationNum")
|
278
|
+
|
279
|
+
add_account_info(transaction, options)
|
280
|
+
return transaction
|
281
|
+
end
|
282
|
+
|
283
|
+
def force_capture(options)
|
284
|
+
transaction = ForceCapture.new
|
285
|
+
transaction.secondaryAmount = options['secondaryAmount']
|
286
|
+
transaction.surchargeAmount = options['surchargeAmount']
|
287
|
+
transaction.customBilling = CustomBilling.from_hash(options)
|
288
|
+
transaction.debtRepayment = options['debtRepayment']
|
289
|
+
transaction.processingType = options['processingType']
|
290
|
+
add_order_info(transaction, options)
|
291
|
+
|
292
|
+
return transaction
|
293
|
+
end
|
294
|
+
|
295
|
+
def capture(options)
|
296
|
+
transaction = Capture.new
|
297
|
+
|
298
|
+
transaction.partial = options['partial']
|
299
|
+
transaction.litleTxnId = options['litleTxnId']
|
300
|
+
transaction.amount = options['amount']
|
301
|
+
transaction.surchargeAmount = options['surchargeAmount']
|
302
|
+
transaction.enhancedData = EnhancedData.from_hash(options)
|
303
|
+
transaction.processingInstructions = ProcessingInstructions.from_hash(options)
|
304
|
+
transaction.payPalOrderComplete = options['payPalOrderComplete']
|
305
|
+
transaction.payPalNotes = options['payPalNotes']
|
306
|
+
transaction.customBilling = options['customBilling']
|
307
|
+
|
308
|
+
add_account_info(transaction, options)
|
309
|
+
return transaction
|
310
|
+
end
|
311
|
+
|
312
|
+
def capture_given_auth(options)
|
313
|
+
transaction = CaptureGivenAuth.new
|
314
|
+
add_order_info(transaction, options)
|
315
|
+
transaction.secondaryAmount = options['secondaryAmount']
|
316
|
+
transaction.surchargeAmount = options['surchargeAmount']
|
317
|
+
transaction.authInformation = AuthInformation.from_hash(options)
|
318
|
+
transaction.shipToAddress = Contact.from_hash(options,'shipToAddress')
|
319
|
+
transaction.customBilling = CustomBilling.from_hash(options)
|
320
|
+
transaction.billMeLaterRequest = BillMeLaterRequest.from_hash(options)
|
321
|
+
transaction.debtRepayment = options['debtRepayment']
|
322
|
+
transaction.processingType = options['processingType']
|
323
|
+
transaction.originalNetworkTransactionId = options['originalNetworkTransactionId']
|
324
|
+
transaction.originalTransactionAmount = options['originalTransactionAmount']
|
325
|
+
return transaction
|
326
|
+
end
|
327
|
+
|
328
|
+
def void(options)
|
329
|
+
transaction = Void.new
|
330
|
+
|
331
|
+
transaction.litleTxnId = options['litleTxnId']
|
332
|
+
transaction.processingInstructions = ProcessingInstructions.from_hash(options)
|
333
|
+
|
334
|
+
add_account_info(transaction, options)
|
335
|
+
return transaction
|
336
|
+
end
|
337
|
+
|
338
|
+
def echeck_redeposit(options)
|
339
|
+
transaction = EcheckRedeposit.new
|
340
|
+
add_echeck(transaction, options)
|
341
|
+
|
342
|
+
transaction.litleTxnId = options['litleTxnId']
|
343
|
+
transaction.merchantData = MerchantData.from_hash(options)
|
344
|
+
|
345
|
+
return transaction
|
346
|
+
end
|
347
|
+
|
348
|
+
def echeck_sale(options)
|
349
|
+
transaction = EcheckSale.new
|
350
|
+
add_echeck(transaction, options)
|
351
|
+
add_echeck_order_info(transaction, options)
|
352
|
+
transaction.secondaryAmount = options['secondaryAmount']
|
353
|
+
transaction.verify = options['verify']
|
354
|
+
transaction.shipToAddress = Contact.from_hash(options,'shipToAddress')
|
355
|
+
transaction.customBilling = CustomBilling.from_hash(options)
|
356
|
+
|
357
|
+
return transaction
|
358
|
+
end
|
359
|
+
|
360
|
+
def echeck_credit(options)
|
361
|
+
transaction = EcheckCredit.new
|
362
|
+
transaction.customBilling = CustomBilling.from_hash(options)
|
363
|
+
transaction.secondaryAmount = options['secondaryAmount']
|
364
|
+
add_echeck_order_info(transaction, options)
|
365
|
+
add_echeck(transaction, options)
|
366
|
+
|
367
|
+
return transaction
|
368
|
+
end
|
369
|
+
|
370
|
+
def echeck_verification(options)
|
371
|
+
transaction = EcheckVerification.new
|
372
|
+
|
373
|
+
add_echeck_order_info(transaction, options)
|
374
|
+
add_echeck(transaction, options)
|
375
|
+
transaction.merchantData = MerchantData.from_hash(options)
|
376
|
+
|
377
|
+
return transaction
|
378
|
+
end
|
379
|
+
|
380
|
+
def echeck_void(options)
|
381
|
+
transaction = EcheckVoid.new
|
382
|
+
transaction.litleTxnId = options['litleTxnId']
|
383
|
+
|
384
|
+
add_account_info(transaction, options)
|
385
|
+
return transaction
|
386
|
+
end
|
387
|
+
|
388
|
+
def account_update(options)
|
389
|
+
transaction = AccountUpdate.new
|
390
|
+
transaction.card = Card.from_hash(options)
|
391
|
+
transaction.token = CardToken.from_hash(options,'token')
|
392
|
+
transaction.orderId = options['orderId']
|
393
|
+
|
394
|
+
add_account_info(transaction, options)
|
395
|
+
|
396
|
+
return transaction
|
397
|
+
end
|
398
|
+
|
399
|
+
private
|
400
|
+
|
401
|
+
def add_account_info(transaction, options)
|
402
|
+
transaction.reportGroup = get_report_group(options)
|
403
|
+
transaction.transactionId = options['id']
|
404
|
+
transaction.customerId = options['customerId']
|
405
|
+
end
|
406
|
+
|
407
|
+
def add_transaction_info(transaction, options)
|
408
|
+
transaction.litleTxnId = options['litleTxnId']
|
409
|
+
transaction.customerInfo = CustomerInfo.from_hash(options)
|
410
|
+
transaction.shipToAddress = Contact.from_hash(options,'shipToAddress')
|
411
|
+
transaction.billMeLaterRequest = BillMeLaterRequest.from_hash(options)
|
412
|
+
transaction.cardholderAuthentication = FraudCheck.from_hash(options, 'cardholderAuthentication')
|
413
|
+
transaction.allowPartialAuth = options['allowPartialAuth']
|
414
|
+
transaction.healthcareIIAS = HealthcareIIAS.from_hash(options)
|
415
|
+
transaction.filtering = Filtering.from_hash(options)
|
416
|
+
transaction.merchantData = MerchantData.from_hash(options)
|
417
|
+
transaction.recyclingRequest = RecyclingRequest.from_hash(options)
|
418
|
+
transaction.fraudFilterOverride = options['fraudFilterOverride']
|
419
|
+
transaction.customBilling = CustomBilling.from_hash(options)
|
420
|
+
transaction.paypal = PayPal.from_hash(options,'paypal')
|
421
|
+
transaction.applepay = Applepay.from_hash(options,'applepay')
|
422
|
+
|
423
|
+
add_order_info(transaction, options)
|
424
|
+
end
|
425
|
+
|
426
|
+
def add_order_info(transaction, options)
|
427
|
+
transaction.amount = options['amount']
|
428
|
+
transaction.orderId = options['orderId']
|
429
|
+
transaction.orderSource = options['orderSource']
|
430
|
+
transaction.taxType = options['taxType']
|
431
|
+
transaction.billToAddress = Contact.from_hash(options,'billToAddress')
|
432
|
+
transaction.enhancedData = EnhancedData.from_hash(options)
|
433
|
+
transaction.processingInstructions = ProcessingInstructions.from_hash(options)
|
434
|
+
transaction.pos = Pos.from_hash(options)
|
435
|
+
transaction.amexAggregatorData = AmexAggregatorData.from_hash(options)
|
436
|
+
transaction.card = Card.from_hash(options)
|
437
|
+
transaction.token = CardToken.from_hash(options,'token')
|
438
|
+
transaction.paypage = CardPaypage.from_hash(options,'paypage')
|
439
|
+
transaction.mpos = Mpos.from_hash(options,'mpos')
|
440
|
+
add_account_info(transaction, options)
|
441
|
+
end
|
442
|
+
|
443
|
+
def add_echeck_order_info(transaction, options)
|
444
|
+
transaction.litleTxnId = options['litleTxnId']
|
445
|
+
transaction.orderId = options['orderId']
|
446
|
+
transaction.amount = options['amount']
|
447
|
+
transaction.orderSource = options['orderSource']
|
448
|
+
transaction.billToAddress = Contact.from_hash(options,'billToAddress')
|
449
|
+
end
|
450
|
+
|
451
|
+
def add_echeck(transaction, options)
|
452
|
+
transaction.echeck = Echeck.from_hash(options)
|
453
|
+
transaction.echeckToken = EcheckToken.from_hash(options)
|
454
|
+
|
455
|
+
add_account_info(transaction, options)
|
456
|
+
end
|
457
|
+
|
458
|
+
def get_report_group(options)
|
459
|
+
#options['reportGroup'] || @config_hash['default_report_group']
|
460
|
+
options['reportGroup']
|
461
|
+
end
|
462
|
+
end
|
463
|
+
end
|