mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Ensure valid payment method is selected
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user