load exclusively the payment methods that are available on the distributor

This commit is contained in:
Mohamed ABDELLANI
2022-11-17 11:59:54 +01:00
parent f25fb19fe8
commit c35c003e5a

View File

@@ -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