lib/active_merchant/billing/gateways/qbms.rb in activemerchant-1.105.0 vs lib/active_merchant/billing/gateways/qbms.rb in activemerchant-1.106.0
- old
+ new
@@ -13,16 +13,16 @@
self.default_currency = 'USD'
self.supported_cardtypes = [:visa, :master, :discover, :american_express, :diners_club, :jcb]
self.supported_countries = ['US']
TYPES = {
- :authorize => 'CustomerCreditCardAuth',
- :capture => 'CustomerCreditCardCapture',
- :purchase => 'CustomerCreditCardCharge',
- :refund => 'CustomerCreditCardTxnVoidOrRefund',
- :void => 'CustomerCreditCardTxnVoid',
- :query => 'MerchantAccountQuery',
+ authorize: 'CustomerCreditCardAuth',
+ capture: 'CustomerCreditCardCapture',
+ purchase: 'CustomerCreditCardCharge',
+ refund: 'CustomerCreditCardTxnVoidOrRefund',
+ void: 'CustomerCreditCardTxnVoid',
+ query: 'MerchantAccountQuery',
}
# Creates a new QbmsGateway
#
# The gateway requires that a valid app id, app login, and ticket be passed
@@ -49,11 +49,11 @@
# * <tt>money</tt> -- The amount to be authorized as an Integer value in cents.
# * <tt>creditcard</tt> -- The CreditCard details for the transaction.
# * <tt>options</tt> -- A hash of optional parameters.
#
def authorize(money, creditcard, options = {})
- commit(:authorize, money, options.merge(:credit_card => creditcard))
+ commit(:authorize, money, options.merge(credit_card: creditcard))
end
# Perform a purchase, which is essentially an authorization and capture in a single operation.
#
# ==== Parameters
@@ -61,32 +61,32 @@
# * <tt>money</tt> -- The amount to be purchased as an Integer value in cents.
# * <tt>creditcard</tt> -- The CreditCard details for the transaction.
# * <tt>options</tt> -- A hash of optional parameters.
#
def purchase(money, creditcard, options = {})
- commit(:purchase, money, options.merge(:credit_card => creditcard))
+ commit(:purchase, money, options.merge(credit_card: creditcard))
end
# Captures the funds from an authorized transaction.
#
# ==== Parameters
#
# * <tt>money</tt> -- The amount to be captured as an Integer value in cents.
# * <tt>authorization</tt> -- The authorization returned from the previous authorize request.
#
def capture(money, authorization, options = {})
- commit(:capture, money, options.merge(:transaction_id => authorization))
+ commit(:capture, money, options.merge(transaction_id: authorization))
end
# Void a previous transaction
#
# ==== Parameters
#
# * <tt>authorization</tt> - The authorization returned from the previous authorize request.
#
def void(authorization, options = {})
- commit(:void, nil, options.merge(:transaction_id => authorization))
+ commit(:void, nil, options.merge(transaction_id: authorization))
end
# Credit an account.
#
# This transaction is also referred to as a Refund and indicates to the gateway that
@@ -103,11 +103,11 @@
ActiveMerchant.deprecated CREDIT_DEPRECATION_MESSAGE
refund(money, identification, {})
end
def refund(money, identification, options = {})
- commit(:refund, money, options.merge(:transaction_id => identification))
+ commit(:refund, money, options.merge(transaction_id: identification))
end
# Query the merchant account status
def query
commit(:query, nil, {})
@@ -141,15 +141,15 @@
data = ssl_post(url, req, 'Content-Type' => 'application/x-qbmsxml')
response = parse(type, data)
message = (response[:status_message] || '').strip
Response.new(success?(response), message, response,
- :test => test?,
- :authorization => response[:credit_card_trans_id],
- :fraud_review => fraud_review?(response),
- :avs_result => { :code => avs_result(response) },
- :cvv_result => cvv_result(response)
+ test: test?,
+ authorization: response[:credit_card_trans_id],
+ fraud_review: fraud_review?(response),
+ avs_result: { code: avs_result(response) },
+ cvv_result: cvv_result(response)
)
end
def success?(response)
response[:status_code] == 0
@@ -165,20 +165,20 @@
signon = REXML::XPath.first(xml, "//SignonMsgsRs/#{hosted? ? 'SignonAppCertRs' : 'SignonDesktopRs'}")
status_code = signon.attributes['statusCode'].to_i
if status_code != 0
return {
- :status_code => status_code,
- :status_message => signon.attributes['statusMessage'],
+ status_code: status_code,
+ status_message: signon.attributes['statusMessage'],
}
end
response = REXML::XPath.first(xml, "//QBMSXMLMsgsRs/#{type}Rs")
results = {
- :status_code => response.attributes['statusCode'].to_i,
- :status_message => response.attributes['statusMessage'],
+ status_code: response.attributes['statusCode'].to_i,
+ status_message: response.attributes['statusMessage'],
}
response.elements.each do |e|
name = e.name.underscore.to_sym
value = e.text()
@@ -193,13 +193,13 @@
results
end
def build_request(type, money, parameters = {})
- xml = Builder::XmlMarkup.new(:indent => 0)
+ xml = Builder::XmlMarkup.new(indent: 0)
- xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')
- xml.instruct!(:qbmsxml, :version => API_VERSION)
+ xml.instruct!(:xml, version: '1.0', encoding: 'utf-8')
+ xml.instruct!(:qbmsxml, version: API_VERSION)
xml.tag!('QBMSXML') do
xml.tag!('SignonMsgsRq') do
xml.tag!(hosted? ? 'SignonAppCertRq' : 'SignonDesktopRq') do
xml.tag!('ClientDateTime', Time.now.xmlschema)