Skip to content

Commit

Permalink
Only load active payment methods in the backend
Browse files Browse the repository at this point in the history
This was the original behaviour in Solidus < 2.1, but the active scope
got lost in solidusio#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.
  • Loading branch information
Luuk Veenis authored and jhawthorn committed Apr 10, 2017
1 parent fad9cbf commit 34a50ad
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/app/controllers/spree/admin/payments_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 34a50ad

Please sign in to comment.