Skip to content

Commit

Permalink
Fix one rubocop issue and update rubocop todo manual for the new cont…
Browse files Browse the repository at this point in the history
…roller
  • Loading branch information
luisramos0 committed Dec 14, 2019
1 parent 7edc1f5 commit c1840ce
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
7 changes: 2 additions & 5 deletions .rubocop_manual_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ Metrics/LineLength:
- app/controllers/spree/admin/adjustments_controller_decorator.rb
- app/controllers/spree/admin/base_controller_decorator.rb
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/admin/payments_controller_decorator.rb
- app/controllers/spree/credit_cards_controller.rb
- app/controllers/spree/paypal_controller_decorator.rb
- app/controllers/stripe/callbacks_controller.rb
Expand Down Expand Up @@ -364,7 +363,7 @@ Metrics/AbcSize:
- app/controllers/spree/admin/orders_controller_decorator.rb
- app/controllers/spree/admin/overview_controller.rb
- app/controllers/spree/admin/payment_methods_controller.rb
- app/controllers/spree/admin/payments_controller_decorator.rb
- app/controllers/spree/admin/payments_controller.rb
- app/controllers/spree/admin/products_controller_decorator.rb
- app/controllers/spree/admin/reports_controller_decorator.rb
- app/controllers/spree/admin/search_controller_decorator.rb
Expand Down Expand Up @@ -492,7 +491,6 @@ Metrics/CyclomaticComplexity:
- app/controllers/admin/enterprise_fees_controller.rb
- app/controllers/admin/enterprises_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/spree/admin/payments_controller_decorator.rb
- app/controllers/spree/admin/taxons_controller.rb
- app/controllers/spree/orders_controller.rb
- app/helpers/checkout_helper.rb
Expand Down Expand Up @@ -522,7 +520,6 @@ Metrics/PerceivedComplexity:
- app/controllers/admin/enterprises_controller.rb
- app/controllers/api/variants_controller.rb
- app/controllers/checkout_controller.rb
- app/controllers/spree/admin/payments_controller_decorator.rb
- app/controllers/spree/admin/taxons_controller.rb
- app/controllers/spree/orders_controller.rb
- app/helpers/checkout_helper.rb
Expand Down Expand Up @@ -563,7 +560,7 @@ Metrics/MethodLength:
- app/controllers/spree/admin/image_settings_controller.rb
- app/controllers/spree/admin/orders/customer_details_controller_decorator.rb
- app/controllers/spree/admin/payment_methods_controller.rb
- app/controllers/spree/admin/payments_controller_decorator.rb
- app/controllers/spree/admin/payments_controller.rb
- app/controllers/spree/admin/products_controller_decorator.rb
- app/controllers/spree/admin/reports_controller_decorator.rb
- app/controllers/spree/admin/search_controller_decorator.rb
Expand Down
16 changes: 10 additions & 6 deletions app/controllers/spree/admin/payments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ def new

def create
@payment = @order.payments.build(object_params)
if @payment.payment_method.is_a?(Spree::Gateway) &&
@payment.payment_method.payment_profiles_supported? &&
params[:card].present? &&
(params[:card] != 'new')
@payment.source = CreditCard.find_by_id(params[:card])
end
load_payment_source

begin
unless @payment.save
Expand Down Expand Up @@ -71,6 +66,15 @@ def fire

private

def load_payment_source
if @payment.payment_method.is_a?(Spree::Gateway) &&
@payment.payment_method.payment_profiles_supported? &&
params[:card].present? &&
(params[:card] != 'new')
@payment.source = CreditCard.find_by_id(params[:card])
end
end

def object_params
if params[:payment] &&
params[:payment_source] &&
Expand Down

0 comments on commit c1840ce

Please sign in to comment.