diff --git a/app/controllers/spree/admin/payments_controller_decorator.rb b/app/controllers/spree/admin/payments_controller_decorator.rb index 35237d3e76..23db5eca09 100644 --- a/app/controllers/spree/admin/payments_controller_decorator.rb +++ b/app/controllers/spree/admin/payments_controller_decorator.rb @@ -15,6 +15,7 @@ Spree::Admin::PaymentsController.class_eval do # Only show payments for the order's distributor def filter_payment_methods @payment_methods = @payment_methods.select{ |pm| pm.has_distributor? @order.distributor} + @payment_method ||= @payment_methods.first end end diff --git a/app/models/spree/payment_method_decorator.rb b/app/models/spree/payment_method_decorator.rb index 1f19d9498c..0f52a4e291 100644 --- a/app/models/spree/payment_method_decorator.rb +++ b/app/models/spree/payment_method_decorator.rb @@ -15,10 +15,10 @@ Spree::PaymentMethod.class_eval do where('distributor_id IN (?)', user.enterprises.map {|enterprise| enterprise.id }) end } -end -def has_distributor?(distributor) - self.distributor == distributor + def has_distributor?(distributor) + self.distributor == distributor + end end # Ensure that all derived classes also allow distributor_id