diff --git a/app/views/settings/payments/show.html.erb b/app/views/settings/payments/show.html.erb index 95628cacd..4393e66eb 100644 --- a/app/views/settings/payments/show.html.erb +++ b/app/views/settings/payments/show.html.erb @@ -60,12 +60,16 @@
<%= image_tag "stripe-logo.svg", class: "w-5 h-5 shrink-0" %>

- Payment via Stripe - (<%= link_to "one-time contribution here", - "https://buy.stripe.com/3cIcN6euM23D7GQ3wT97G00", - class: "font-medium text-primary hover:underline transition", - target: "_blank", - rel: "noopener" %>) + <%= t( + ".payment_via_stripe_html", + contribution_link: link_to( + t(".one_time_contribution_link_text"), + Rails.application.config.x.stripe.one_time_contribution_url, + class: "font-medium text-primary hover:underline transition", + target: "_blank", + rel: "noopener" + ) + ) %>

diff --git a/config/initializers/stripe.rb b/config/initializers/stripe.rb new file mode 100644 index 000000000..2ff289863 --- /dev/null +++ b/config/initializers/stripe.rb @@ -0,0 +1,6 @@ +Rails.application.configure do + config.x.stripe.one_time_contribution_url = ENV.fetch( + "STRIPE_ONE_TIME_CONTRIBUTION_URL", + "https://buy.stripe.com/3cIcN6euM23D7GQ3wT97G00" + ) +end diff --git a/config/locales/views/settings/en.yml b/config/locales/views/settings/en.yml index d590798ca..da8cc1bb8 100644 --- a/config/locales/views/settings/en.yml +++ b/config/locales/views/settings/en.yml @@ -24,6 +24,8 @@ en: payments: show: page_title: Payments + payment_via_stripe_html: Payment via Stripe (%{contribution_link}) + one_time_contribution_link_text: one-time contribution here subscription_subtitle: Update your credit card details subscription_title: Manage contributions appearances: diff --git a/test/controllers/settings/payments_controller_test.rb b/test/controllers/settings/payments_controller_test.rb index ff4ba4a48..430a0eab7 100644 --- a/test/controllers/settings/payments_controller_test.rb +++ b/test/controllers/settings/payments_controller_test.rb @@ -18,6 +18,10 @@ class Settings::PaymentsControllerTest < ActionDispatch::IntegrationTest get settings_payment_path assert_response :success - assert_select "a[href=?]", "https://buy.stripe.com/3cIcN6euM23D7GQ3wT97G00", text: "one-time contribution here" + assert_select( + "a[href=?]", + Rails.application.config.x.stripe.one_time_contribution_url, + text: I18n.t("views.settings.payments.show.one_time_contribution_link_text") + ) end end