From 34a50adb66371f6d6be36ff99bf08c4ca380cfd8 Mon Sep 17 00:00:00 2001 From: Luuk Veenis Date: Fri, 7 Apr 2017 09:56:37 -0700 Subject: [PATCH] Only load active payment methods in the backend This was the original behaviour in Solidus < 2.1, but the active scope got lost in #1540. Payment methods used to use the `available` filter which was scoped to active payment methods only. The `available_to_admin` scope isn't limited active payment methods, so we need to add it here. --- backend/app/controllers/spree/admin/payments_controller.rb | 2 +- .../spec/controllers/spree/admin/payments_controller_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/controllers/spree/admin/payments_controller.rb b/backend/app/controllers/spree/admin/payments_controller.rb index 49de6cbf1ed..fa89e3c0204 100644 --- a/backend/app/controllers/spree/admin/payments_controller.rb +++ b/backend/app/controllers/spree/admin/payments_controller.rb @@ -78,7 +78,7 @@ def object_params def load_data @amount = params[:amount] || load_order.total - @payment_methods = Spree::PaymentMethod.available_to_admin + @payment_methods = Spree::PaymentMethod.active.available_to_admin if @payment && @payment.payment_method @payment_method = @payment.payment_method else diff --git a/backend/spec/controllers/spree/admin/payments_controller_spec.rb b/backend/spec/controllers/spree/admin/payments_controller_spec.rb index 9c4eb984e67..c5f98f1528e 100644 --- a/backend/spec/controllers/spree/admin/payments_controller_spec.rb +++ b/backend/spec/controllers/spree/admin/payments_controller_spec.rb @@ -92,7 +92,7 @@ module Admin @payment_method = create(:check_payment_method, available_to_admin: true, active: false) end - it "does not load the payment method", :pending do + it "does not load the payment method" do get :new, params: { order_id: order.number } expect(response.status).to eq(200) expect(assigns[:payment_methods]).to be_empty