Method: ActiveMerchant::Billing::Integrations::TwoCheckout::Helper#auto_settle

Defined in:
lib/active_merchant/billing/integrations/two_checkout/helper.rb

#auto_settle(params = {}) ⇒ Object

Uses Third Party Cart parameter set to pass in lineitem details. (sales settle automatically)



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/active_merchant/billing/integrations/two_checkout/helper.rb', line 75

def auto_settle(params = {})
  add_field('id_type', '1')
  (max_existing_line_item_id = form_fields.keys.map do |key|
    i = key.to_s[/^c_prod_(\d+)/, 1]
    (i && i.to_i)
  end.compact.max || 0)

  line_item_id = max_existing_line_item_id + 1
  params.each do |key, value|
    add_field("c_#{key}_#{line_item_id}", value)
  end
end