lib/active_merchant/billing/gateways/ogone.rb in jelaniharris-activemerchant-1.24.1 vs lib/active_merchant/billing/gateways/ogone.rb in jelaniharris-activemerchant-1.29.1
- old
+ new
@@ -34,11 +34,11 @@
# gateway = ActiveMerchant::Billing::OgoneGateway.new(
# :login => "my_ogone_psp_id",
# :user => "my_ogone_user_id",
# :password => "my_ogone_pswd",
# :signature => "my_ogone_sha_signature", # Only if you configured your Ogone environment so.
- # :signature_encryptor => "sha512", # Can be "sha1" (default), "sha256" or "sha512".
+ # :signature_encryptor => "sha512", # Can be "none" (default), "sha1", "sha256" or "sha512".
# # Must be the same as the one configured in your Ogone account.
# )
#
# # set up credit card object as in main ActiveMerchant example
# creditcard = ActiveMerchant::Billing::CreditCard.new(
@@ -120,25 +120,26 @@
:pop_up => 'POPUP', # display the identification page in a pop-up window
# and return to the main window at the end.
:pop_ix => 'POPIX' } # display the identification page in a pop-up window
# and remain in the pop-up window.
- OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE = "Signature usage will be required from a future release of ActiveMerchant's Ogone Gateway. Please update your Ogone account to use it."
- OGONE_LOW_ENCRYPTION_DEPRECATION_MESSAGE = "SHA512 signature encryptor will be required from a future release of ActiveMerchant's Ogone Gateway. Please update your Ogone account to use it."
+ 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.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/'
self.display_name = 'Ogone'
self.default_currency = 'EUR'
self.money_format = :cents
def initialize(options = {})
requires!(options, :login, :user, :password)
- @options = options
super
end
# Verify and reserve the specified amount on the account, without actually doing the transaction.
def authorize(money, payment_source, options = {})
@@ -201,14 +202,10 @@
response = authorize(1, payment_source, options)
void(response.authorization) if response.success?
response
end
- def test?
- @options[:test] || super
- end
-
private
def reference_from(authorization)
authorization.split(";").first
end
@@ -368,15 +365,18 @@
end
end
def post_data(action, parameters = {})
add_pair parameters, 'Operation', action
- @options[:signature] ? add_signature(parameters) : deprecated(OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE)
+ add_signature(parameters)
parameters.to_query
end
def add_signature(parameters)
- deprecated(OGONE_LOW_ENCRYPTION_DEPRECATION_MESSAGE) unless @options[:signature_encryptor] == 'sha512'
+ if @options[:signature].blank?
+ deprecated(OGONE_NO_SIGNATURE_DEPRECATION_MESSAGE) unless(@options[:signature_encryptor] == "none")
+ return
+ end
sha_encryptor = case @options[:signature_encryptor]
when 'sha256'
Digest::SHA256
when 'sha512'