From 5afb862ce174fa2eb6819650b3436116fcec5d57 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Fri, 10 Jul 2020 12:44:55 +0100 Subject: [PATCH] Extract setup and authorize to a new method called prepare_for_payment to fix rubocop ABCsize issue It looks like this rubocop rule weights a raise over a return... --- app/jobs/subscription_confirm_job.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/jobs/subscription_confirm_job.rb b/app/jobs/subscription_confirm_job.rb index c7275f00d6..acf241e4e0 100644 --- a/app/jobs/subscription_confirm_job.rb +++ b/app/jobs/subscription_confirm_job.rb @@ -61,14 +61,17 @@ class SubscriptionConfirmJob raise if order.errors.present? return unless order.payment_required? + prepare_for_payment!(order) + order.process_payments! + raise if order.errors.any? + end + + def prepare_for_payment!(order) setup_payment!(order) raise if order.errors.any? authorize_payment!(order) raise if order.errors.any? - - order.process_payments! - raise if order.errors.any? end def setup_payment!(order)