lib/active_merchant/billing/gateways/flo2cash.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/flo2cash.rb in activemerchant-1.80.0
- old
+ new
@@ -11,14 +11,14 @@
self.default_currency = 'NZD'
self.money_format = :dollars
self.supported_cardtypes = [:visa, :master, :american_express, :diners_club]
BRAND_MAP = {
- "visa" => "VISA",
- "master" => "MC",
- "american_express" => "AMEX",
- "diners_club" => "DINERS"
+ 'visa' => 'VISA',
+ 'master' => 'MC',
+ 'american_express' => 'AMEX',
+ 'diners_club' => 'DINERS'
}
def initialize(options={})
requires!(options, :username, :password, :account_id)
super
@@ -35,29 +35,29 @@
post = {}
add_invoice(post, amount, options)
add_payment_method(post, payment_method)
add_customer_data(post, options)
- commit("ProcessAuthorise", post)
+ commit('ProcessAuthorise', post)
end
def capture(amount, authorization, options={})
post = {}
add_invoice(post, amount, options)
add_reference(post, authorization)
add_customer_data(post, options)
- commit("ProcessCapture", post)
+ commit('ProcessCapture', post)
end
def refund(amount, authorization, options={})
post = {}
add_invoice(post, amount, options)
add_reference(post, authorization)
add_customer_data(post, options)
- commit("ProcessRefund", post)
+ commit('ProcessRefund', post)
end
def supports_scrubbing?
true
end
@@ -70,11 +70,11 @@
end
private
CURRENCY_CODES = Hash.new{|h,k| raise ArgumentError.new("Unsupported currency: #{k}")}
- CURRENCY_CODES["NZD"] = "554"
+ CURRENCY_CODES['NZD'] = '554'
def add_invoice(post, money, options)
post[:Amount] = amount(money)
post[:Reference] = options[:order_id]
post[:Particular] = options[:description]
@@ -105,11 +105,11 @@
data = build_request(action, post)
begin
raw = parse(ssl_post(url, data, headers(action)), action)
rescue ActiveMerchant::ResponseError => e
- if(e.response.code == "500" && e.response.body.start_with?("<?xml"))
+ if(e.response.code == '500' && e.response.body.start_with?('<?xml'))
raw = parse(e.response.body, action)
else
raise
end
end
@@ -159,11 +159,11 @@
end
def parse(body, action)
response = {}
xml = REXML::Document.new(body)
- root = (REXML::XPath.first(xml, "//#{action}Response") || REXML::XPath.first(xml, "//detail"))
+ root = (REXML::XPath.first(xml, "//#{action}Response") || REXML::XPath.first(xml, '//detail'))
root.elements.to_a.each do |node|
parse_element(response, node)
end if root
@@ -182,12 +182,12 @@
response == 'SUCCESSFUL'
end
def message_from(succeeded, response)
if succeeded
- "Succeeded"
+ 'Succeeded'
else
- response[:message] || response[:errormessage] || "Unable to read error message"
+ response[:message] || response[:errormessage] || 'Unable to read error message'
end
end
def authorization_from(action, current, original)
# Refunds require the authorization from the authorize() of the MultiResponse.