Move list of payment methods to where it is used

This commit is contained in:
Maikel Linke
2026-01-07 16:57:22 +11:00
parent 1adf94093e
commit a1bdfa0a20
3 changed files with 6 additions and 12 deletions

View File

@@ -117,7 +117,7 @@ module Spree
end
def validate_payment_method_provider
valid_payment_methods = Rails.application.config.spree.payment_methods.map(&:to_s)
valid_payment_methods = Spree::PaymentMethod.providers.map(&:to_s)
return if valid_payment_methods.include?(params[:payment_method][:type])
flash[:error] = Spree.t(:invalid_payment_provider)

View File

@@ -53,7 +53,11 @@ module Spree
}
def self.providers
Rails.application.config.spree.payment_methods
[
Spree::PaymentMethod::Check,
Spree::Gateway::StripeSCA,
Spree::Gateway::PayPalExpress,
]
end
def configured?

View File

@@ -76,16 +76,6 @@ module Openfoodnetwork
end
end
initializer "spree.register.payment_methods" do |app|
Rails.application.reloader.to_prepare do
app.config.spree.payment_methods = [
Spree::PaymentMethod::Check,
Spree::Gateway::StripeSCA,
Spree::Gateway::PayPalExpress,
]
end
end
initializer "spree.mail.settings" do |_app|
Rails.application.reloader.to_prepare do
Spree::Core::MailSettings.init