Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Raise ArgumentError when params are missing.

  • Loading branch information...
commit 70014f49c08b0d2bb94e44c6adc44ab02f1b74ce 1 parent 3dfcf47
@alloy alloy authored
Showing with 6 additions and 8 deletions.
  1. +0 −2  TODO
  2. +6 −6 lib/adyen/form.rb
View
2  TODO
@@ -1,8 +1,6 @@
1.0
===
-* Raise ArgumentError in Form instead of RuntimeError.
-
* Screen documentation
Possible/Later
View
12 lib/adyen/form.rb
@@ -79,18 +79,18 @@ def do_parameter_transformations!(parameters = {})
# 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 [StandardError] Thrown if some parameter health check fails.
+ # @raise [ArgumentError] Thrown if some parameter health check fails.
def payment_parameters(parameters = {}, shared_secret = nil)
do_parameter_transformations!(parameters)
- raise "Cannot generate form: :currency code attribute not found!" unless parameters[:currency_code]
- raise "Cannot generate form: :payment_amount code attribute not found!" unless parameters[:payment_amount]
- raise "Cannot generate form: :merchant_account attribute not found!" unless parameters[:merchant_account]
- raise "Cannot generate form: :skin_code attribute not found!" unless parameters[:skin_code]
+ 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]
+ raise ArgumentError, "Cannot generate form: :skin_code attribute not found!" unless parameters[:skin_code]
# Calculate the merchant signature using the shared secret.
shared_secret ||= parameters.delete(:shared_secret)
- raise "Cannot calculate payment request signature without shared secret!" unless shared_secret
+ raise ArgumentError, "Cannot calculate payment request signature without shared secret!" unless shared_secret
parameters[:merchant_sig] = calculate_signature(parameters, shared_secret)
return parameters
Please sign in to comment.
Something went wrong with that request. Please try again.