lib/active_merchant/billing/gateways/first_giving.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/first_giving.rb in activemerchant-1.80.0
- old
+ new
@@ -29,25 +29,25 @@
def refund(money, identifier, options = {})
get = {}
get[:transactionId] = identifier
get[:tranType] = 'REFUNDREQUEST'
- commit("/transaction/refundrequest?" + encode(get))
+ commit('/transaction/refundrequest?' + encode(get))
end
private
def add_donation_data(post, money, options)
post[:amount] = amount(money)
post[:charityId] = @options[:charity_id]
- post[:description] = (options[:description] || "Purchase")
+ post[:description] = (options[:description] || 'Purchase')
post[:currencyCode] = (options[:currency] || currency(money))
end
def add_customer_data(post, options)
- post[:billToEmail] = (options[:email] || "activemerchant@example.com")
- post[:remoteAddr] = (options[:ip] || "127.0.0.1")
+ post[:billToEmail] = (options[:email] || 'activemerchant@example.com')
+ post[:remoteAddr] = (options[:ip] || '127.0.0.1')
end
def add_address(post, options)
if(billing_address = (options[:billing_address] || options[:address]))
post[:billToAddressLine1] = billing_address[:address1]
@@ -74,11 +74,11 @@
def parse(body)
response = {}
xml = Nokogiri::XML(body)
- element = xml.xpath("//firstGivingDonationApi/firstGivingResponse").first
+ element = xml.xpath('//firstGivingDonationApi/firstGivingResponse').first
element.attributes.each do |name, attribute|
response[name] = attribute.content
end
element.children.each do |child|
@@ -101,41 +101,41 @@
rescue ResponseError => e
response = parse(e.response.body)
end
Response.new(
- (response["acknowledgement"] == "Success"),
- (response["friendlyErrorMessage"] || response["verboseErrorMessage"] || response["acknowledgement"]),
+ (response['acknowledgement'] == 'Success'),
+ (response['friendlyErrorMessage'] || response['verboseErrorMessage'] || response['acknowledgement']),
response,
- authorization: response["transactionId"],
+ authorization: response['transactionId'],
test: test?,
)
end
def post_data(post)
- post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
+ post.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
end
def encode(hash)
hash.collect{|(k,v)| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}"}.join('&')
end
def creditcard_brand(brand)
case brand
- when "visa" then "VI"
- when "master" then "MC"
- when "discover" then "DI"
- when "american_express" then "AX"
+ when 'visa' then 'VI'
+ when 'master' then 'MC'
+ when 'discover' then 'DI'
+ when 'american_express' then 'AX'
else
raise "Unhandled credit card brand #{brand}"
end
end
def headers
{
- "User-Agent" => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
- "JG_APPLICATIONKEY" => "#{@options[:application_key]}",
- "JG_SECURITYTOKEN" => "#{@options[:security_token]}"
+ 'User-Agent' => "ActiveMerchantBindings/#{ActiveMerchant::VERSION}",
+ 'JG_APPLICATIONKEY' => "#{@options[:application_key]}",
+ 'JG_SECURITYTOKEN' => "#{@options[:security_token]}"
}
end
end
end
end