lib/active_merchant/billing/gateways/ogone.rb in activemerchant-1.34.1 vs lib/active_merchant/billing/gateways/ogone.rb in activemerchant-1.35.0

- old
+ new

@@ -97,16 +97,10 @@ # returned in the post sale request or final redirection. # :complus => Field to submit a value you wish to be returned in the post sale request or output. # :language => Customer's language, for example: "en_EN" # class OgoneGateway < Gateway - - URLS = { - :order => 'https://secure.ogone.com/ncol/%s/orderdirect.asp', - :maintenance => 'https://secure.ogone.com/ncol/%s/maintenancedirect.asp' - } - CVV_MAPPING = { 'OK' => 'M', 'KO' => 'N', 'NO' => 'P' } AVS_MAPPING = { 'OK' => 'M', @@ -123,12 +117,12 @@ # and remain in the pop-up window. OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE = "Signature usage will be the default for a future release of ActiveMerchant. You should either begin using it, or update your configuration to explicitly disable it (signature_encryptor: none)" OGONE_STORE_OPTION_DEPRECATION_MESSAGE = "The 'store' option has been renamed to 'billing_id', and its usage is deprecated." - self.test_url = URLS[:order] % "test" - self.live_url = URLS[:order] % "prod" + self.test_url = "https://secure.ogone.com/ncol/test/" + self.live_url = "https://secure.ogone.com/ncol/prod/" self.supported_countries = ['BE', 'DE', 'FR', 'NL', 'AT', 'CH'] # also supports Airplus and UATP self.supported_cardtypes = [:visa, :master, :american_express, :diners_club, :discover, :jcb, :maestro] self.homepage_url = 'http://www.ogone.com/' @@ -329,19 +323,22 @@ def commit(action, parameters) add_pair parameters, 'PSPID', @options[:login] add_pair parameters, 'USERID', @options[:user] add_pair parameters, 'PSWD', @options[:password] - url = URLS[parameters['PAYID'] ? :maintenance : :order] % [test? ? "test" : "prod"] - response = parse(ssl_post(url, post_data(action, parameters))) + response = parse(ssl_post(url(parameters['PAYID']), post_data(action, parameters))) options = { :authorization => [response["PAYID"], action].join(";"), :test => test?, :avs_result => { :code => AVS_MAPPING[response["AAVCheck"]] }, :cvv_result => CVV_MAPPING[response["CVCCheck"]] } OgoneResponse.new(successful?(response), message_from(response), response, options) + end + + def url(payid) + (test? ? test_url : live_url) + (payid ? "maintenancedirect.asp" : "orderdirect.asp") end def successful?(response) response["NCERROR"] == "0" end