lib/active_merchant/billing/gateways/visanet_peru.rb in activemerchant-1.86.0 vs lib/active_merchant/billing/gateways/visanet_peru.rb in activemerchant-1.87.0

- old
+ new

@@ -80,11 +80,11 @@ gsub(%r((\"cvv2Code\\\":\\\")\d+), '\1[FILTERED]') end private - CURRENCY_CODES = Hash.new{|h,k| raise ArgumentError.new("Unsupported currency: #{k}")} + CURRENCY_CODES = Hash.new { |h, k| raise ArgumentError.new("Unsupported currency: #{k}") } CURRENCY_CODES['USD'] = 840 CURRENCY_CODES['PEN'] = 604 def add_invoice(params, money, options) # Visanet Peru expects a 9-digit numeric purchaseNumber @@ -164,20 +164,20 @@ 'Content-Type' => 'application/json' } end def url(action, params, options={}) - if (action == 'authorize') + if action == 'authorize' "#{base_url}/#{@options[:merchant_id]}" - elsif (action == 'refund') + elsif action == 'refund' "#{base_url}/#{@options[:merchant_id]}/#{action}/#{options[:transaction_id]}" else "#{base_url}/#{@options[:merchant_id]}/#{action}/#{params[:purchaseNumber]}" end end def method(action) - (%w(authorize refund).include? action) ? :post : :put + %w(authorize refund).include?(action) ? :post : :put end def authorization_from(params, response, options) id_unico = response['data']['ID_UNICO'] || options[:id_unico] "#{params[:purchaseNumber]}|#{id_unico}"