lib/active_merchant/billing/gateways/first_pay.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/first_pay.rb in activemerchant-1.80.0
- old
+ new
@@ -19,21 +19,21 @@
end
def purchase(money, payment, options={})
post = {}
add_invoice(post, money, options)
- add_payment(post, payment)
+ add_payment(post, payment, options)
add_address(post, payment, options)
add_customer_data(post, options)
commit('sale', post)
end
def authorize(money, payment, options={})
post = {}
add_invoice(post, money, options)
- add_payment(post, payment)
+ add_payment(post, payment, options)
add_address(post, payment, options)
add_customer_data(post, options)
commit('auth', post)
end
@@ -85,15 +85,18 @@
def add_invoice(post, money, options)
post[:order_id] = options[:order_id]
post[:total] = amount(money)
end
- def add_payment(post, payment)
+ def add_payment(post, payment, options)
post[:card_name] = payment.brand # Unclear if need to map to known names or open text field??
post[:card_number] = payment.number
post[:card_exp] = expdate(payment)
post[:cvv2] = payment.verification_value
+ post[:recurring] = options[:recurring] if options[:recurring]
+ post[:recurringStartDate] = options[:recurring_start_date] if options[:recurring_start_date]
+ post[:recurringEndDate] = options[:recurring_end_date] if options[:recurring_end_date]
end
def add_reference(post, action, money, authorization)
post[:"#{action}_amount1"] = amount(money) if money
post[:total_number_transactions] = 1
@@ -102,10 +105,10 @@
def parse(xml)
response = {}
doc = Nokogiri::XML(xml)
- doc.root.xpath("//RESPONSE/FIELDS/FIELD").each do |field|
+ doc.root.xpath('//RESPONSE/FIELDS/FIELD').each do |field|
response[field['KEY']] = field.text
end unless doc.root.nil?
response
end