lib/active_merchant/billing/gateways/blue_pay.rb in activemerchant-1.79.2 vs lib/active_merchant/billing/gateways/blue_pay.rb in activemerchant-1.80.0
- old
+ new
@@ -153,39 +153,39 @@
# If the payment_object is a token, then the transaction type will reverse a previous capture or purchase transaction, returning the funds to the customer. If the amount is nil, a full credit will be processed. This is referred to a REFUND transaction in BluePay.
# If the payment_object is either a CreditCard or Check object, then the transaction type will be an unmatched credit placing funds in the specified account. This is referred to a CREDIT transaction in BluePay.
# * <tt>options</tt> -- A hash of parameters.
def refund(money, identification, options = {})
if(identification && !identification.kind_of?(String))
- ActiveMerchant.deprecated "refund should only be used to refund a referenced transaction"
+ ActiveMerchant.deprecated 'refund should only be used to refund a referenced transaction'
return credit(money, identification, options)
end
post = {}
post[:PAYMENT_ACCOUNT] = ''
post[:MASTER_ID] = identification
post[:TRANS_TYPE] = 'REFUND'
- post[:NAME1] = (options[:first_name] ? options[:first_name] : "")
+ post[:NAME1] = options[:first_name] || ''
post[:NAME2] = options[:last_name] if options[:last_name]
post[:ZIP] = options[:zip] if options[:zip]
add_invoice(post, options)
add_address(post, options)
add_customer_data(post, options)
commit('CREDIT', money, post)
end
def credit(money, payment_object, options = {})
if(payment_object && payment_object.kind_of?(String))
- ActiveMerchant.deprecated "credit should only be used to credit a payment method"
+ ActiveMerchant.deprecated 'credit should only be used to credit a payment method'
return refund(money, payment_object, options)
end
post = {}
post[:PAYMENT_ACCOUNT] = ''
add_payment_method(post, payment_object)
post[:TRANS_TYPE] = 'CREDIT'
- post[:NAME1] = (options[:first_name] ? options[:first_name] : "")
+ post[:NAME1] = options[:first_name] || ''
post[:NAME2] = options[:last_name] if options[:last_name]
post[:ZIP] = options[:zip] if options[:zip]
add_invoice(post, options)
add_address(post, options)
add_customer_data(post, options)
@@ -345,11 +345,11 @@
def parse(body)
# The bp20api has max one value per form field.
response_fields = Hash[CGI::parse(body).map{|k,v| [k.upcase,v.first]}]
- if response_fields.include? "REBILL_ID"
+ if response_fields.include? 'REBILL_ID'
return parse_recurring(response_fields)
end
parsed = {}
response_fields.each do |k,v|
@@ -376,16 +376,16 @@
elsif AVS_ERRORS.include?(parsed[:avs_result_code])
message = AVSResult.messages[ parsed[:avs_result_code] ]
else
message = message.chomp('.')
end
- elsif message == "Missing ACCOUNT_ID"
- message = "The merchant login ID or password is invalid"
+ elsif message == 'Missing ACCOUNT_ID'
+ message = 'The merchant login ID or password is invalid'
elsif message =~ /Approved/
- message = "This transaction has been approved"
+ message = 'This transaction has been approved'
elsif message =~ /Expired/
- message = "The credit card has expired"
+ message = 'The credit card has expired'
end
message
end
def add_invoice(post, options)
@@ -416,17 +416,17 @@
post[:NAME1] = creditcard.first_name
post[:NAME2] = creditcard.last_name
end
CHECK_ACCOUNT_TYPES = {
- "checking" => "C",
- "savings" => "S"
+ 'checking' => 'C',
+ 'savings' => 'S'
}
def add_check(post, check)
post[:PAYMENT_TYPE] = 'ACH'
- post[:PAYMENT_ACCOUNT] = [CHECK_ACCOUNT_TYPES[check.account_type], check.routing_number, check.account_number].join(":")
+ post[:PAYMENT_ACCOUNT] = [CHECK_ACCOUNT_TYPES[check.account_type], check.routing_number, check.account_number].join(':')
post[:NAME1] = check.first_name
post[:NAME2] = check.last_name
end
def add_customer_data(post, options)
@@ -463,19 +463,19 @@
def post_data(action, parameters = {})
post = {}
post[:version] = '1'
post[:login] = ''
post[:tran_key] = ''
- post[:relay_response] = "FALSE"
+ post[:relay_response] = 'FALSE'
post[:type] = action
- post[:delim_data] = "TRUE"
- post[:delim_char] = ","
- post[:encap_char] = "$"
+ post[:delim_data] = 'TRUE'
+ post[:delim_char] = ','
+ post[:encap_char] = '$'
post[:card_num] = '4111111111111111'
post[:exp_date] = '1212'
post[:solution_ID] = application_id if application_id
- post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
+ post.merge(parameters).collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join('&')
end
def expdate(creditcard)
year = format(creditcard.year, :two_digits)
month = format(creditcard.month, :two_digits)
@@ -492,21 +492,21 @@
post[:TRANS_TYPE],
amount,
post[:MASTER_ID],
post[:NAME1],
post[:PAYMENT_ACCOUNT]
- ].join("")
+ ].join('')
)
end
def calc_rebill_tps(post)
Digest::MD5.hexdigest(
[
@options[:password],
@options[:login],
post[:TRANS_TYPE],
post[:REBILL_ID]
- ].join("")
+ ].join('')
)
end
def handle_response(response)
if ignore_http_status || (200...300).include?(response.code.to_i)