mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Merge pull request #6540 from PauloVilarinho/add-internationalization-to-payment-method-clean-name
Add internationalization to payment method clean name
This commit is contained in:
@@ -110,23 +110,8 @@ module Spree
|
||||
end
|
||||
|
||||
def self.clean_name
|
||||
case name
|
||||
when "Spree::PaymentMethod::Check"
|
||||
"Cash/EFT/etc. (payments for which automatic validation is not required)"
|
||||
when "Spree::Gateway::Migs"
|
||||
"MasterCard Internet Gateway Service (MIGS)"
|
||||
when "Spree::Gateway::Pin"
|
||||
"Pin Payments"
|
||||
when "Spree::Gateway::StripeConnect"
|
||||
"Stripe"
|
||||
when "Spree::Gateway::StripeSCA"
|
||||
"Stripe SCA"
|
||||
when "Spree::Gateway::PayPalExpress"
|
||||
"PayPal Express"
|
||||
else
|
||||
i = name.rindex('::') + 2
|
||||
name[i..-1]
|
||||
end
|
||||
i18n_key = "spree.admin.payment_methods.providers." + name.demodulize.downcase
|
||||
I18n.t(i18n_key)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@@ -3431,6 +3431,14 @@ See the %{link} to find out more about %{sitename}'s features and to start using
|
||||
deactivation_warning: "De-activating a payment method can make the payment method disappear from your list. Alternatively, you can hide a payment method from the checkout page by setting the option 'Display' to 'back office only'."
|
||||
providers:
|
||||
provider: "Provider"
|
||||
check: "Cash/EFT/etc. (payments for which automatic validation is not required)"
|
||||
migs: "MasterCard Internet Gateway Service (MIGS)"
|
||||
pin: "Pin Payments"
|
||||
paypalexpress: "PayPal Express"
|
||||
stripeconnect: "Stripe"
|
||||
stripesca: "Stripe SCA"
|
||||
bogus: "Bogus"
|
||||
bogussimple: "BogusSimple"
|
||||
payments:
|
||||
source_forms:
|
||||
stripe:
|
||||
|
||||
@@ -58,14 +58,14 @@ module Spree
|
||||
end
|
||||
|
||||
it "generates a clean name for known Payment Method types" do
|
||||
expect(Spree::PaymentMethod::Check.clean_name).to eq("Cash/EFT/etc. (payments for which automatic validation is not required)")
|
||||
expect(Spree::Gateway::Migs.clean_name).to eq("MasterCard Internet Gateway Service (MIGS)")
|
||||
expect(Spree::Gateway::Pin.clean_name).to eq("Pin Payments")
|
||||
expect(Spree::Gateway::PayPalExpress.clean_name).to eq("PayPal Express")
|
||||
expect(Spree::Gateway::StripeConnect.clean_name).to eq("Stripe")
|
||||
|
||||
# Testing else condition
|
||||
expect(Spree::Gateway::BogusSimple.clean_name).to eq("BogusSimple")
|
||||
expect(Spree::PaymentMethod::Check.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.check"))
|
||||
expect(Spree::Gateway::Migs.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.migs"))
|
||||
expect(Spree::Gateway::Pin.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.pin"))
|
||||
expect(Spree::Gateway::PayPalExpress.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.paypalexpress"))
|
||||
expect(Spree::Gateway::StripeConnect.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.stripeconnect"))
|
||||
expect(Spree::Gateway::StripeSCA.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.stripesca"))
|
||||
expect(Spree::Gateway::BogusSimple.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.bogussimple"))
|
||||
expect(Spree::Gateway::Bogus.clean_name).to eq(I18n.t("spree.admin.payment_methods.providers.bogus"))
|
||||
end
|
||||
|
||||
it "computes the amount of fees" do
|
||||
|
||||
Reference in New Issue
Block a user