lib/active_merchant/billing/gateways/inspire.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/inspire.rb in activemerchant-1.80.0
- old
+ new
@@ -71,22 +71,22 @@
# Update the values (such as CC expiration) stored at
# InspireGateway. The CC number must be supplied in the
# CreditCard object.
def update(vault_id, creditcard, options = {})
post = {}
- post[:customer_vault] = "update_customer"
+ post[:customer_vault] = 'update_customer'
add_customer_vault_id(post, vault_id)
add_creditcard(post, creditcard, options)
add_address(post, creditcard, options)
add_customer_data(post, options)
commit(nil, nil, post)
end
def delete(vault_id)
post = {}
- post[:customer_vault] = "delete_customer"
+ post[:customer_vault] = 'delete_customer'
add_customer_vault_id(post, vault_id)
commit(nil, nil, post)
end
# To match the other stored-value gateways, like TrustCommerce,
@@ -139,11 +139,11 @@
params[:customer_vault_id] = vault_id
end
def add_creditcard(post, creditcard,options)
if options[:store]
- post[:customer_vault] = "add_customer"
+ post[:customer_vault] = 'add_customer'
post[:customer_vault_id] = options[:store] unless options[:store] == true
end
post[:ccnumber] = creditcard.number
post[:cvv] = creditcard.verification_value if creditcard.verification_value?
post[:ccexp] = expdate(creditcard)
@@ -173,45 +173,45 @@
def commit(action, money, parameters)
parameters[:amount] = amount(money) if money
response = parse( ssl_post(self.live_url, post_data(action,parameters)) )
- Response.new(response["response"] == "1", message_from(response), response,
- :authorization => response["transactionid"],
+ Response.new(response['response'] == '1', message_from(response), response,
+ :authorization => response['transactionid'],
:test => test?,
- :cvv_result => response["cvvresponse"],
- :avs_result => { :code => response["avsresponse"] }
+ :cvv_result => response['cvvresponse'],
+ :avs_result => { :code => response['avsresponse'] }
)
end
def message_from(response)
- case response["responsetext"]
- when "SUCCESS","Approved"
- "This transaction has been approved"
- when "DECLINE"
- "This transaction has been declined"
+ case response['responsetext']
+ when 'SUCCESS','Approved'
+ 'This transaction has been approved'
+ when 'DECLINE'
+ 'This transaction has been declined'
else
- response["responsetext"]
+ response['responsetext']
end
end
def post_data(action, parameters = {})
post = {}
post[:username] = @options[:login]
post[:password] = @options[:password]
post[:type] = action if action
- request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join("&")
+ request = post.merge(parameters).map {|key,value| "#{key}=#{CGI.escape(value.to_s)}"}.join('&')
request
end
def determine_funding_source(source)
case
when source.is_a?(String) then :vault
when CreditCard.card_companies.keys.include?(card_brand(source)) then :credit_card
when card_brand(source) == 'check' then :check
- else raise ArgumentError, "Unsupported funding source provided"
+ else raise ArgumentError, 'Unsupported funding source provided'
end
end
end
end
end