lib/active_merchant/billing/gateways/clearhaus.rb in activemerchant-1.57.0 vs lib/active_merchant/billing/gateways/clearhaus.rb in activemerchant-1.58.0

- old
+ new

@@ -42,10 +42,11 @@ # options: # :api_key - merchant's Clearhaus API Key # :signing_key - merchant's private key for optionally signing request def initialize(options={}) requires!(options, :api_key) + options[:signing_key].strip! if options[:signing_key] super end # Make a purchase (authorize and capture) # @@ -181,10 +182,14 @@ url = (test? ? test_url : live_url) + action headers = headers(@options[:api_key]) body = parameters.to_query if signing_key = @options[:signing_key] - headers["Signature"] = generate_signature(@options[:api_key], signing_key, body) + begin + headers["Signature"] = generate_signature(@options[:api_key], signing_key, body) + rescue OpenSSL::PKey::RSAError => e + return Response.new(false, e.message) + end end response = begin parse(ssl_post(url, body, headers)) rescue ResponseError => e