lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.103.0 vs lib/active_merchant/billing/gateways/sage_pay.rb in activemerchant-1.104.0

- old
+ new

@@ -310,10 +310,11 @@ truncate(cleansed, 40) end def sanitize_phone(phone) return nil unless phone + cleansed = phone.to_s.gsub(/[^0-9+]/, '') truncate(cleansed, 20) end def is_usa(country) @@ -359,15 +360,15 @@ def authorization_from(response, params, action) case action when :store response['Token'] else - [ params[:VendorTxCode], - response['VPSTxId'] || params[:VPSTxId], - response['TxAuthNo'], - response['SecurityKey'] || params[:SecurityKey], - action ].join(';') + [params[:VendorTxCode], + response['VPSTxId'] || params[:VPSTxId], + response['TxAuthNo'], + response['SecurityKey'] || params[:SecurityKey], + action].join(';') end end def abort_or_void_from(identification) original_transaction = identification.split(';').last @@ -387,11 +388,11 @@ end "#{test? ? self.test_url : self.live_url}/#{endpoint}.vsp" end def build_simulator_url(action) - endpoint = [ :purchase, :authorization ].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx" + endpoint = [:purchase, :authorization].include?(action) ? 'VSPDirectGateway.asp' : "VSPServerGateway.asp?Service=Vendor#{TRANSACTIONS[action].capitalize}Tx" "#{self.simulator_url}/#{endpoint}" end def message_from(response) response['Status'] == APPROVED ? 'Success' : (response['StatusDetail'] || 'Unspecified error') # simonr 20080207 can't actually get non-nil blanks, so this is shorter @@ -424,9 +425,10 @@ post[key] = value if !value.blank? || options[:required] end def past_purchase_reference?(payment_method) return false unless payment_method.is_a?(String) + payment_method.split(';').last == 'purchase' end end end end