mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-11 03:40:20 +00:00
Move list of payment methods to where it is used
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user