From a38fe0b43cc86d7f407f771563d7ee5ba60ff3f2 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Fri, 28 May 2021 09:10:34 +0200 Subject: [PATCH] fix raising errors from lib --- lib/pay_zen/client.rb | 4 ++-- lib/pay_zen/helper.rb | 4 ++-- lib/stripe/service.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pay_zen/client.rb b/lib/pay_zen/client.rb index 870c273e1..860abf4e0 100644 --- a/lib/pay_zen/client.rb +++ b/lib/pay_zen/client.rb @@ -27,10 +27,10 @@ class PayZen::Client } res = Net::HTTP.post(uri, payload.to_json, headers) - raise PayzenError unless res.is_a?(Net::HTTPSuccess) + raise ::PayzenError unless res.is_a?(Net::HTTPSuccess) json = JSON.parse(res.body) - raise PayzenError(json['answer']['errorMessage']) if json['status'] == 'ERROR' + raise ::PayzenError, json['answer']['errorMessage'] if json['status'] == 'ERROR' json end diff --git a/lib/pay_zen/helper.rb b/lib/pay_zen/helper.rb index f783b6167..6d8ae76e9 100644 --- a/lib/pay_zen/helper.rb +++ b/lib/pay_zen/helper.rb @@ -76,7 +76,7 @@ class PayZen::Helper supported_hash_algorithm = ['sha256_hmac'] # check if the hash algorithm is supported - raise PayzenError("hash algorithm not supported: #{algorithm}. Update your SDK") unless supported_hash_algorithm.include? algorithm + raise ::PayzenError, "hash algorithm not supported: #{algorithm}. Update your SDK" unless supported_hash_algorithm.include? algorithm # if key is not defined, we use kr-hash-key parameter to choose it if key.nil? @@ -85,7 +85,7 @@ class PayZen::Helper elsif hash_key == 'password' key = Setting.get('payzen_password') else - raise PayzenError('invalid hash-key parameter') + raise ::PayzenError, 'invalid hash-key parameter' end end diff --git a/lib/stripe/service.rb b/lib/stripe/service.rb index 23a59b075..08553184a 100644 --- a/lib/stripe/service.rb +++ b/lib/stripe/service.rb @@ -74,7 +74,7 @@ class Stripe::Service < Payment::Service def create_or_update_product(klass, id) StripeWorker.perform_async(:create_or_update_stp_product, klass, id) rescue Stripe::InvalidRequestError => e - raise PaymentGatewayError(e) + raise ::PaymentGatewayError, e end def stripe_amount(amount)