mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Extract changing Stripe method selection logic
It will change and it's clearer in a separate method.
This commit is contained in:
@@ -101,12 +101,7 @@ module Spree
|
||||
end
|
||||
|
||||
def load_data
|
||||
@providers = if Rails.env.dev? || Rails.env.test?
|
||||
Gateway.providers.sort_by(&:name)
|
||||
else
|
||||
Gateway.providers.reject{ |p| p.name.include? "Bogus" }.sort_by(&:name)
|
||||
end
|
||||
@providers.reject!{ |provider| stripe_provider?(provider) } unless show_stripe?
|
||||
@providers = load_providers
|
||||
@calculators = PaymentMethod.calculators.sort_by(&:name)
|
||||
end
|
||||
|
||||
@@ -126,6 +121,20 @@ module Spree
|
||||
# rubocop:enable Style/TernaryParentheses
|
||||
end
|
||||
|
||||
def load_providers
|
||||
providers = Gateway.providers.sort_by(&:name)
|
||||
|
||||
unless Rails.env.dev? || Rails.env.test?
|
||||
providers.reject! { |provider| provider.name.include? "Bogus" }
|
||||
end
|
||||
|
||||
unless show_stripe?
|
||||
providers.reject! { |provider| stripe_provider?(provider) }
|
||||
end
|
||||
|
||||
providers
|
||||
end
|
||||
|
||||
# Show Stripe as an option if enabled, or if the
|
||||
# current payment_method is already a Stripe method
|
||||
def show_stripe?
|
||||
|
||||
Reference in New Issue
Block a user