lib/helpers/controller_helpers.rb in wepay-rails-2.0.0 vs lib/helpers/controller_helpers.rb in wepay-rails-2.1.0
- old
+ new
@@ -38,9 +38,14 @@
# :shipping_fee No The amount that you want to charge for shipping.
# :charge_tax No A boolean value (0 or 1). If set to 1 and the account has a relevant tax entry (see /account/set_tax), then tax will be charged.
def init_checkout_and_send_user_to_wepay(params, access_token=nil)
wepay_gateway = WepayRails::Payments::Gateway.new(access_token)
response = wepay_gateway.perform_checkout(params)
+
+ if response['checkout_uri'].blank?
+ raise WepayRails::Exceptions::WepayCheckoutError.new("An error occurred: #{response.inspect}")
+ end
+
params.merge!({
:access_token => wepay_gateway.access_token,
:checkout_id => response['checkout_id']
})