lib/active_merchant/billing/gateways/epay.rb in activemerchant-1.47.0 vs lib/active_merchant/billing/gateways/epay.rb in activemerchant-1.48.0

- old
+ new

@@ -1,10 +1,9 @@ module ActiveMerchant #:nodoc: module Billing #:nodoc: class EpayGateway < Gateway - API_HOST = 'ssl.ditonlinebetalingssystem.dk' - self.live_url = 'https://' + API_HOST + '/remote/payment' + self.live_url = 'https://ssl.ditonlinebetalingssystem.dk/' self.default_currency = 'DKK' self.money_format = :cents self.supported_cardtypes = [:dankort, :forbrugsforeningen, :visa, :master, :american_express, :diners_club, :jcb, :maestro] @@ -173,18 +172,18 @@ end def soap_post(method, params) data = xml_builder(params, method) headers = make_headers(data, method) - REXML::Document.new(ssl_post('https://' + API_HOST + '/remote/payment.asmx', data, headers)) + REXML::Document.new(ssl_post(live_url + 'remote/payment.asmx', data, headers)) end def do_authorize(params) headers = {} headers['Referer'] = (options[:password] || "activemerchant.org") - response = raw_ssl_request(:post, 'https://' + API_HOST + '/auth/default.aspx', authorize_post_data(params), headers) + response = raw_ssl_request(:post, live_url + 'auth/default.aspx', authorize_post_data(params), headers) # Authorize gives the response back by redirecting with the values in # the URL query if location = response['Location'] query = CGI::parse(URI.parse(location.gsub(' ', '%20')).query) @@ -231,24 +230,24 @@ end def make_headers(data, soap_call) { 'Content-Type' => 'text/xml; charset=utf-8', - 'Host' => API_HOST, + 'Host' => "ssl.ditonlinebetalingssystem.dk", 'Content-Length' => data.size.to_s, - 'SOAPAction' => self.live_url + '/' + soap_call + 'SOAPAction' => self.live_url + 'remote/payment/' + soap_call } end def xml_builder(params, soap_call) xml = Builder::XmlMarkup.new(:indent => 2) xml.instruct! xml.tag! 'soap:Envelope', { 'xmlns:xsi' => 'http://schemas.xmlsoap.org/soap/envelope/', 'xmlns:xsd' => 'http://www.w3.org/2001/XMLSchema', 'xmlns:soap' => 'http://schemas.xmlsoap.org/soap/envelope/' } do xml.tag! 'soap:Body' do - xml.tag! soap_call, { 'xmlns' => self.live_url } do + xml.tag! soap_call, { 'xmlns' => "#{self.live_url}remote/payment" } do xml.tag! 'merchantnumber', @options[:login] xml.tag! 'transactionid', params[:transaction] xml.tag! 'amount', params[:amount].to_s if soap_call != 'delete' end end @@ -257,11 +256,11 @@ end def authorize_post_data(params = {}) params[:language] = '2' params[:cms] = 'activemerchant' - params[:accepturl] = 'https://ssl.ditonlinebetalingssystem.dk/auth/default.aspx?accept=1' - params[:declineurl] = 'https://ssl.ditonlinebetalingssystem.dk/auth/default.aspx?decline=1' + params[:accepturl] = live_url + 'auth/default.aspx?accept=1' + params[:declineurl] = live_url + 'auth/default.aspx?decline=1' params[:merchantnumber] = @options[:login] params.collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&") end