From b669ccdc7427a55f0824d557e486d7ac217a85f2 Mon Sep 17 00:00:00 2001 From: Andy Brett Date: Thu, 21 Jan 2021 09:02:27 -0800 Subject: [PATCH] refactor admin payments controller --- app/controllers/spree/admin/payments_controller.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/spree/admin/payments_controller.rb b/app/controllers/spree/admin/payments_controller.rb index fb06010b63..3924ac9de6 100644 --- a/app/controllers/spree/admin/payments_controller.rb +++ b/app/controllers/spree/admin/payments_controller.rb @@ -154,13 +154,13 @@ module Spree return unless @payment.payment_method.class == Spree::Gateway::StripeSCA @payment.authorize!(spree.order_path(@payment.order, only_path: false)) - if @payment.cvv_response_message.present? - PaymentMailer.authorize_payment(@payment).deliver - raise Spree::Core::GatewayError, I18n.t('action_required') - end - return if @payment.pending? && @payment.cvv_response_message.nil? - raise Spree::Core::GatewayError, I18n.t('authorization_failure') + raise Spree::Core::GatewayError, I18n.t('authorization_failure') unless @payment.pending? + + return unless @payment.cvv_response_message.present? + + PaymentMailer.authorize_payment(@payment).deliver + raise Spree::Core::GatewayError, I18n.t('action_required') end end end