lib/active_merchant/billing/gateways/hdfc.rb in activemerchant-1.114.0 vs lib/active_merchant/billing/gateways/hdfc.rb in activemerchant-1.116.0

- old
+ new

@@ -12,54 +12,54 @@ self.supported_countries = ['IN'] self.default_currency = 'INR' self.money_format = :dollars self.supported_cardtypes = %i[visa master discover diners_club] - def initialize(options={}) + def initialize(options = {}) requires!(options, :login, :password) super end - def purchase(amount, payment_method, options={}) + def purchase(amount, payment_method, options = {}) post = {} add_invoice(post, amount, options) add_payment_method(post, payment_method) add_customer_data(post, options) commit('purchase', post) end - def authorize(amount, payment_method, options={}) + def authorize(amount, payment_method, options = {}) post = {} add_invoice(post, amount, options) add_payment_method(post, payment_method) add_customer_data(post, options) commit('authorize', post) end - def capture(amount, authorization, options={}) + def capture(amount, authorization, options = {}) post = {} add_invoice(post, amount, options) add_reference(post, authorization) add_customer_data(post, options) commit('capture', post) end - def refund(amount, authorization, options={}) + def refund(amount, authorization, options = {}) post = {} add_invoice(post, amount, options) add_reference(post, authorization) add_customer_data(post, options) commit('refund', post) end private - CURRENCY_CODES = Hash.new { |h, k| raise ArgumentError.new("Unsupported currency for HDFC: #{k}") } + CURRENCY_CODES = Hash.new { |_h, k| raise ArgumentError.new("Unsupported currency for HDFC: #{k}") } CURRENCY_CODES['AED'] = '784' CURRENCY_CODES['AUD'] = '036' CURRENCY_CODES['CAD'] = '124' CURRENCY_CODES['EUR'] = '978' CURRENCY_CODES['GBP'] = '826' @@ -79,18 +79,18 @@ def add_customer_data(post, options) post[:udf2] = escape(options[:email]) if options[:email] if address = (options[:billing_address] || options[:address]) post[:udf3] = escape(address[:phone]) if address[:phone] - post[:udf4] = escape(<<~EOA) + post[:udf4] = escape(<<~ADDRESS) #{address[:name]} #{address[:company]} #{address[:address1]} #{address[:address2]} #{address[:city]} #{address[:state]} #{address[:zip]} #{address[:country]} - EOA + ADDRESS end end def add_payment_method(post, payment_method) post[:member] = escape(payment_method.name, 30) @@ -192,10 +192,10 @@ def split_authorization(authorization) tranid, member = authorization.split('|') [tranid, member] end - def escape(string, max_length=250) + def escape(string, max_length = 250) return '' unless string string = string[0...max_length] if max_length string.gsub(/[^A-Za-z0-9 \-_@\.\n]/, '') end