jelaniharris-activemerchant 1.29.1 → 1.29.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -156,6 +156,7 @@ module ActiveMerchant #:nodoc:
|
|
156
156
|
add_customer_data(parameters, options)
|
157
157
|
add_payment_source(parameters, creditcard_or_billing_id)
|
158
158
|
add_addresses(parameters, options)
|
159
|
+
add_level_data(parameters, options)
|
159
160
|
commit('preauth', parameters)
|
160
161
|
end
|
161
162
|
|
@@ -170,6 +171,7 @@ module ActiveMerchant #:nodoc:
|
|
170
171
|
add_customer_data(parameters, options)
|
171
172
|
add_payment_source(parameters, creditcard_or_billing_id)
|
172
173
|
add_addresses(parameters, options)
|
174
|
+
add_level_data(parameters, options)
|
173
175
|
commit('sale', parameters)
|
174
176
|
end
|
175
177
|
|
@@ -182,6 +184,7 @@ module ActiveMerchant #:nodoc:
|
|
182
184
|
:transid => authorization,
|
183
185
|
}
|
184
186
|
|
187
|
+
add_level_data(parameters, options)
|
185
188
|
commit('postauth', parameters)
|
186
189
|
end
|
187
190
|
|
@@ -221,7 +224,7 @@ module ActiveMerchant #:nodoc:
|
|
221
224
|
:transid => authorization,
|
222
225
|
}
|
223
226
|
|
224
|
-
return commit('void', parameters) if perform_void
|
227
|
+
return commit('void', parameters) if perform_void
|
225
228
|
commit('reversal', parameters)
|
226
229
|
end
|
227
230
|
|
@@ -329,6 +332,51 @@ module ActiveMerchant #:nodoc:
|
|
329
332
|
params[:ip] = options[:ip] unless options[:ip].blank?
|
330
333
|
end
|
331
334
|
|
335
|
+
def add_level_data(params, options)
|
336
|
+
# Append the level two data
|
337
|
+
add_level_two_data(params, options)
|
338
|
+
|
339
|
+
if options[:purchaselevel].present? && options[:purchaselevel] == '3'
|
340
|
+
add_level_three_data(params, options)
|
341
|
+
end
|
342
|
+
end
|
343
|
+
|
344
|
+
def add_level_two_data(params, options)
|
345
|
+
[:purchaselevel, :taxidentifier, :tax, :purchaseordernum].each do |param|
|
346
|
+
params[param] = options[param] unless options[param].blank?
|
347
|
+
end
|
348
|
+
end
|
349
|
+
|
350
|
+
def add_level_three_data(params, options)
|
351
|
+
[:vatnum, :commoditycode, :discount, :shippinghandling, :duty, :amount].each do |param|
|
352
|
+
params[param] = options[param] unless options[param].blank?
|
353
|
+
end
|
354
|
+
|
355
|
+
unless options[:line_items].blank? || options[:line_items].empty?
|
356
|
+
line_items = options[:line_items]
|
357
|
+
|
358
|
+
# Use the line items count for the # of items to send
|
359
|
+
params[:numitems] = line_items.count
|
360
|
+
|
361
|
+
# Loop through the line items and create parameters
|
362
|
+
# TCLink supports 999 distinct line items
|
363
|
+
line_items[0..998].each_with_index do |line_item, index|
|
364
|
+
# Params has an index that starts with 1
|
365
|
+
li_index = index + 1
|
366
|
+
|
367
|
+
[:productcode, :price, :discount, :quantity, :productdescription, :unitofmeasure, :tax, :shippinghandling,
|
368
|
+
:taxamount, :taxidentifier].each do |li_field|
|
369
|
+
# From the TC Documentation:
|
370
|
+
# Additional input fields are included to define the individual line items of the order. The hash mark
|
371
|
+
# or pound sign (#) in the following field names are replaced with the list item number. For
|
372
|
+
# example, if you are referring to the second item, then you would replace "#" with "2" and provide
|
373
|
+
# that data accordingly.
|
374
|
+
params["#{li_field.to_s}#{(li_index)}".to_sym] = line_item[li_field] unless line_item[li_field].blank?
|
375
|
+
end
|
376
|
+
end
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
332
380
|
def add_addresses(params, options)
|
333
381
|
address = options[:billing_address] || options[:address]
|
334
382
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jelaniharris-activemerchant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 103
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 29
|
9
|
-
-
|
10
|
-
version: 1.29.
|
9
|
+
- 2
|
10
|
+
version: 1.29.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tobias Luetke
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain:
|
17
17
|
- gem-public_cert.pem
|
18
|
-
date: 2012-12-
|
18
|
+
date: 2012-12-12 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|