lib/adyen/form.rb in adyen-1.5.0 vs lib/adyen/form.rb in adyen-1.6.0
- old
+ new
@@ -101,10 +101,11 @@
# used is registered (see {Adyen::Configuration#register_form_skin}), or if the
# shared secret is provided as the +:shared_secret+ parameter.
# @return [Hash] The payment parameters with the +:merchant_signature+ parameter set.
# @raise [ArgumentError] Thrown if some parameter health check fails.
def payment_parameters(parameters = {}, shared_secret = nil)
+ raise ArgumentError, "Cannot generate form: parameters should be a hash!" unless parameters.is_a?(Hash)
do_parameter_transformations!(parameters)
raise ArgumentError, "Cannot generate form: :currency code attribute not found!" unless parameters[:currency_code]
raise ArgumentError, "Cannot generate form: :payment_amount code attribute not found!" unless parameters[:payment_amount]
raise ArgumentError, "Cannot generate form: :merchant_account attribute not found!" unless parameters[:merchant_account]
@@ -354,9 +355,11 @@
# @param [String] shared_secret The shared secret for the Adyen skin that was used for
# the original payment form. You can leave this out of the skin is registered
# using the {Adyen::Configuration#register_form_skin} method.
# @return [true, false] Returns true only if the signature in the parameters is correct.
def redirect_signature_check(params, shared_secret = nil)
+ raise ArgumentError, "params should be a Hash" unless params.is_a?(Hash)
+ raise ArgumentError, "params should contain :merchantSig" unless params.key?(:merchantSig)
params[:merchantSig] == redirect_signature(params, shared_secret)
end
# Returns the camelized version of a string.
# @param [:to_s] identifier The identifier to turn to camelcase