From c35c003e5a37d6601e91fa7b806d904d59c1f3ba Mon Sep 17 00:00:00 2001 From: Mohamed ABDELLANI Date: Thu, 17 Nov 2022 11:59:54 +0100 Subject: [PATCH] load exclusively the payment methods that are available on the distributor --- app/services/order_available_payment_methods.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/services/order_available_payment_methods.rb b/app/services/order_available_payment_methods.rb index 0e89825723..e7f9d1a3ff 100644 --- a/app/services/order_available_payment_methods.rb +++ b/app/services/order_available_payment_methods.rb @@ -30,8 +30,13 @@ class OrderAvailablePaymentMethods distributor.payment_methods else distributor.payment_methods.where( - id: order_cycle.distributor_payment_methods.select(:payment_method_id) + id: available_distributor_payment_methods_ids ) end.available.select(&:configured?) end + + def available_distributor_payment_methods_ids + order_cycle.distributor_payment_methods.where(distributor_id: distributor.id) + .select(:payment_method_id) + end end