lib/active_merchant/billing/gateways/ixopay.rb in swiss-activemerchant-1.0.4 vs lib/active_merchant/billing/gateways/ixopay.rb in swiss-activemerchant-1.0.5
- old
+ new
@@ -1,11 +1,11 @@
require 'nokogiri'
module ActiveMerchant #:nodoc:
module Billing #:nodoc:
class IxopayGateway < Gateway
- self.test_url = 'https://secure.ixopay.com/transaction'
+ self.test_url = 'https://secure.cardflo.io/transaction'
self.live_url = 'https://secure.ixopay.com/transaction'
self.supported_countries = %w(AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CR CU CV CW CX CY CZ DE DJ DK DM DO DZ EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS YE YT ZA ZM ZW)
self.default_currency = 'EUR'
self.currencies_with_three_decimal_places = %w(BHD IQD JOD KWD LWD OMR TND)
@@ -100,11 +100,11 @@
}
end
def generate_signature(http_method, xml, timestamp)
content_type = 'text/xml; charset=utf-8'
- message = "#{http_method}\n#{Digest::MD5.hexdigest(xml)}\n#{content_type}\n#{timestamp}\n\n/transaction"
+ message = "#{http_method}\n#{Digest::SHA512.hexdigest(xml)}\n#{content_type}\n#{timestamp}\n\n/transaction"
digest = OpenSSL::Digest.new('sha512')
hmac = OpenSSL::HMAC.digest(digest, @secret, message)
Base64.encode64(hmac).delete("\n")
end
@@ -116,11 +116,11 @@
response.deep_transform_keys(&:underscore).transform_keys(&:to_sym)
end
def build_xml_request
builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
- xml.transactionWithCard 'xmlns' => 'http://secure.ixopay.com/Schema/V2/TransactionWithCard' do
+ xml.transactionWithCard 'xmlns' => 'https://secure.cardflo.io/Schema/V2/TransactionWithCard' do
xml.username @options[:username]
xml.password Digest::SHA1.hexdigest(@options[:password])
yield(xml)
end
end
@@ -149,11 +149,11 @@
add_extra_data(xml, options[:extra_data]) if options[:extra_data]
xml.amount localized_amount(money, currency)
xml.currency currency
xml.description description
- xml.callbackUrl(options[:callback_url])
+ xml.callbackUrl("https://www.google.com/")
add_stored_credentials(xml, options)
end
end
def add_preauth(xml, money, options)
@@ -279,15 +279,17 @@
end
end
def commit(request)
url = (test? ? test_url : live_url)
-
+ url = "#{url}/#{options[:api_key]}/debit"
# ssl_post raises an exception for any non-2xx HTTP status from the gateway
+ debugger
response =
begin
parse(ssl_post(url, request, headers(request)))
rescue StandardError => error
+ debugger
parse(error.response.body)
end
Response.new(
success_from(response),