lib/active_merchant/billing/gateways/forte.rb in activemerchant-1.107.3 vs lib/active_merchant/billing/gateways/forte.rb in activemerchant-1.107.4
- old
+ new
@@ -22,11 +22,11 @@
def purchase(money, payment_method, options={})
post = {}
add_amount(post, money, options)
add_invoice(post, options)
- add_payment_method(post, payment_method)
+ add_payment_method(post, payment_method, options)
add_billing_address(post, payment_method, options)
add_shipping_address(post, options)
post[:action] = 'sale'
commit(:post, post)
@@ -34,11 +34,11 @@
def authorize(money, payment_method, options={})
post = {}
add_amount(post, money, options)
add_invoice(post, options)
- add_payment_method(post, payment_method)
+ add_payment_method(post, payment_method, options)
add_billing_address(post, payment_method, options)
add_shipping_address(post, options)
post[:action] = 'authorize'
commit(:post, post)
@@ -55,11 +55,11 @@
def credit(money, payment_method, options={})
post = {}
add_amount(post, money, options)
add_invoice(post, options)
- add_payment_method(post, payment_method)
+ add_payment_method(post, payment_method, options)
add_billing_address(post, payment_method, options)
post[:action] = 'disburse'
commit(:post, post)
end
@@ -149,24 +149,25 @@
post[:shipping_address][:physical_address][:postal_code] = address[:zip] if address[:zip]
post[:shipping_address][:physical_address][:region] = address[:state] if address[:state]
post[:shipping_address][:physical_address][:locality] = address[:city] if address[:city]
end
- def add_payment_method(post, payment_method)
+ def add_payment_method(post, payment_method, options)
if payment_method.respond_to?(:brand)
add_credit_card(post, payment_method)
else
- add_echeck(post, payment_method)
+ add_echeck(post, payment_method, options)
end
end
- def add_echeck(post, payment)
+ def add_echeck(post, payment, options)
post[:echeck] = {}
post[:echeck][:account_holder] = payment.name
post[:echeck][:account_number] = payment.account_number
post[:echeck][:routing_number] = payment.routing_number
post[:echeck][:account_type] = payment.account_type
post[:echeck][:check_number] = payment.number
+ post[:echeck][:sec_code] = options[:sec_code] || "WEB"
end
def add_credit_card(post, payment)
post[:card] = {}
post[:card][:card_type] = format_card_brand(payment.brand)