The personal finance app for everyone (by everyone)
Ruby
Rename billing to payment throughout the codebase (#726)
Juan José Mata8e36c8e7368c
diff --git a/app/controllers/settings/billings_controller.rb b/app/controllers/settings/payments_controller.rbsimilarity index 54%rename from app/controllers/settings/billings_controller.rbrename to app/controllers/settings/payments_controller.rbindex 5d69d632e6..eb40267995 100644--- a/app/controllers/settings/billings_controller.rb+++ b/app/controllers/settings/payments_controller.rb@@ -1,4 +1,4 @@-class Settings::BillingsController < ApplicationController+class Settings::PaymentsController < ApplicationControllerlayout "settings"def showdiff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rbindex 22a67f5c0b..d0a7dc123e 100644--- a/app/controllers/subscriptions_controller.rb+++ b/app/controllers/subscriptions_controller.rb@@ -16,7 +16,7 @@ class SubscriptionsController < ApplicationControllercheckout_session = stripe.create_checkout_session(plan: params[:plan],family_id: Current.family.id,- family_email: Current.family.billing_email,+ family_email: Current.family.payment_email,success_url: success_subscription_url + "?session_id={CHECKOUT_SESSION_ID}",cancel_url: upgrade_subscription_url)@@ -37,9 +37,9 @@ class SubscriptionsController < ApplicationControllerenddef show- portal_session_url = stripe.create_billing_portal_session_url(+ portal_session_url = stripe.create_payment_portal_session_url(customer_id: Current.family.stripe_customer_id,- return_url: settings_billing_url+ return_url: settings_payment_url)redirect_to portal_session_url, allow_other_host: true, status: :see_otherdiff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rbindex 1bd120e00f..af71fcd1ad 100644--- a/app/helpers/settings_helper.rb+++ b/app/helpers/settings_helper.rb@@ -6,7 +6,7 @@ module SettingsHelper{ name: "Preferences", path: :settings_preferences_path },{ name: "Profile Info", path: :settings_profile_path },{ name: "Security", path: :settings_security_path },- { name: "Billing", path: :settings_billing_path, condition: :not_self_hosted? },+ { name: "Payment", path: :settings_payment_path, condition: :not_self_hosted? },# Transactions section{ name: "Categories", path: :categories_path },{ name: "Tags", path: :tags_path },diff --git a/app/models/family/subscribeable.rb b/app/models/family/subscribeable.rbindex 94ee097192..83fb3597d4 100644--- a/app/models/family/subscribeable.rb+++ b/app/models/family/subscribeable.rb@@ -5,7 +5,7 @@ module Family::Subscribeablehas_one :subscription, dependent: :destroyend- def billing_email+ def payment_emailprimary_admin = users.admin.order(:created_at).first || users.super_admin.order(:created_at).firstunless primary_admin.present?@@ -45,7 +45,7 @@ module Family::Subscribeablesubscription.nil? && !self_hoster?end- def next_billing_date+ def next_payment_datesubscription&.current_period_ends_atenddiff --git a/app/models/provider/stripe.rb b/app/models/provider/stripe.rbindex 81fc3f96b6..3a75dd2572 100644--- a/app/models/provider/stripe.rb+++ b/app/models/provider/stripe.rb@@ -56,7 +56,7 @@ class Provider::StripeCheckoutSessionResult.new(success?: false, subscription_id: nil)end- def create_billing_portal_session_url(customer_id:, return_url:)+ def create_payment_portal_session_url(customer_id:, return_url:)client.v1.billing_portal.sessions.create(customer: customer_id,return_url: return_urldiff --git a/app/views/settings/_settings_nav.html.erb b/app/views/settings/_settings_nav.html.erbindex 54936014b3..6771cfd87d 100644--- a/app/views/settings/_settings_nav.html.erb+++ b/app/views/settings/_settings_nav.html.erb@@ -8,7 +8,7 @@ nav_sections = [{ label: t(".preferences_label"), path: settings_preferences_path, icon: "bolt" },{ label: t(".profile_label"), path: settings_profile_path, icon: "circle-user" },{ label: t(".security_label"), path: settings_security_path, icon: "shield-check" },- { label: t(".billing_label"), path: settings_billing_path, icon: "circle-dollar-sign", if: !self_hosted? }+ { label: t(".payment_label"), path: settings_payment_path, icon: "circle-dollar-sign", if: !self_hosted? }]},{diff --git a/app/views/settings/billings/show.html.erb b/app/views/settings/payments/show.html.erbsimilarity index 89%rename from app/views/settings/billings/show.html.erbrename to app/views/settings/payments/show.html.erbindex efe9046093..86a539505d 100644--- a/app/views/settings/billings/show.html.erb+++ b/app/views/settings/payments/show.html.erb@@ -15,8 +15,8 @@<p class="text-primary"><span>You are currently subscribed to the <span class="font-medium"><%= @family.subscription.name %></span>.</span>- <% if @family.next_billing_date %>- <span>Your plan renews on <span class="font-medium"><%= @family.next_billing_date.strftime("%B %d, %Y") %></span>.</span>+ <% if @family.next_payment_date %>+ <span>Your plan renews on <span class="font-medium"><%= @family.next_payment_date.strftime("%B %d, %Y") %></span>.</span><% end %></p><% elsif @family.trialing? %>@@ -28,7 +28,7 @@</p><% else %><p class="text-primary">You are currently <span class="font-medium">not subscribed</span></p>- <p class="text-secondary">Once you subscribe to <%= product_name %>, you'll see your billing settings here.</p>+ <p class="text-secondary">Once you subscribe to <%= product_name %>, you'll see your payment settings here.</p><% end %></div></div>@@ -55,7 +55,7 @@<div class="flex items-center gap-2"><%= image_tag "stripe-logo.svg", class: "w-5 h-5 shrink-0" %>- <p class="text-secondary text-sm">Billing via Stripe</p>+ <p class="text-secondary text-sm">Payment via Stripe</p></div></div><% end %>diff --git a/app/views/subscriptions/upgrade.html.erb b/app/views/subscriptions/upgrade.html.erbindex be1e2797c3..c0a31f56cd 100644--- a/app/views/subscriptions/upgrade.html.erb+++ b/app/views/subscriptions/upgrade.html.erb@@ -52,7 +52,7 @@) %><p class="text-xs text-secondary">- In the next step, you'll be redirected to Stripe which handles our billing.+ In the next step, you'll be redirected to Stripe which handles our payments.</p></div><% end %>diff --git a/config/locales/views/settings/ca.yml b/config/locales/views/settings/ca.ymlindex 1fa11698ea..52317dcbee 100644--- a/config/locales/views/settings/ca.yml+++ b/config/locales/views/settings/ca.yml@@ -19,10 +19,10 @@ ca:subtitle: La IA categoritza automàticament les teves transaccions segonsles categories definidestitle: Categoritzador de transaccions- billings:+ payments:show:- page_title: Facturació- subscription_subtitle: Actualitza la teva subscripció i dades de facturació+ page_title: Pagament+ subscription_subtitle: Actualitza la teva subscripció i dades de pagamentsubscription_title: Gestiona la subscripcióhostings:ensure_admin:@@ -123,7 +123,7 @@ ca:api_key_label: Clau APIapi_keys_label: Clau APIbank_sync_label: Sincronització bancària- billing_label: Facturació+ payment_label: Pagamentcategories_label: Categoriesfeedback_label: Feedbackgeneral_section_title: Generaldiff --git a/config/locales/views/settings/de.yml b/config/locales/views/settings/de.ymlindex becf9ea7bb..0186f2332c 100644--- a/config/locales/views/settings/de.yml+++ b/config/locales/views/settings/de.yml@@ -15,10 +15,10 @@ de:merchant_detector:title: Händlererkennungsubtitle: Die KI identifiziert und ergänzt Transaktionsdaten mit Händlerinformationen- billings:+ payments:show:- page_title: Abrechnung- subscription_subtitle: Aktualisiere dein Abonnement und deine Rechnungsdetails+ page_title: Zahlung+ subscription_subtitle: Aktualisiere dein Abonnement und deine Zahlungsdetailssubscription_title: Abonnement verwaltenpreferences:show:@@ -90,7 +90,7 @@ de:advanced_section_title: Erweitertai_prompts_label: KI-Eingabeaufforderungenapi_key_label: API-Schlüssel- billing_label: Abrechnung+ payment_label: Zahlungcategories_label: Kategorienfeedback_label: Feedbackgeneral_section_title: Allgemeindiff --git a/config/locales/views/settings/en.yml b/config/locales/views/settings/en.ymlindex cba0a4e9b7..a24476b7e2 100644--- a/config/locales/views/settings/en.yml+++ b/config/locales/views/settings/en.yml@@ -16,10 +16,10 @@ en:merchant_detector:title: Merchant Detectorsubtitle: AI identifies and enriches transaction data with merchant information- billings:+ payments:show:- page_title: Billing- subscription_subtitle: Update your subscription and billing details+ page_title: Payment+ subscription_subtitle: Update your subscription and payment detailssubscription_title: Manage subscriptionpreferences:show:@@ -111,7 +111,7 @@ en:advanced_section_title: Advancedai_prompts_label: AI Promptsapi_key_label: API Key- billing_label: Billing+ payment_label: Paymentcategories_label: Categoriesfeedback_label: Feedbackgeneral_section_title: Generaldiff --git a/config/locales/views/settings/es.yml b/config/locales/views/settings/es.ymlindex 38ede64ff6..2fa0c6ff8e 100644--- a/config/locales/views/settings/es.yml+++ b/config/locales/views/settings/es.yml@@ -16,10 +16,10 @@ es:merchant_detector:title: Detector de Comerciantessubtitle: La IA identifica y enriquece los datos de transacciones con información de comerciantes- billings:+ payments:show:- page_title: Facturación- subscription_subtitle: Actualiza tu suscripción y detalles de facturación+ page_title: Pago+ subscription_subtitle: Actualiza tu suscripción y detalles de pagosubscription_title: Gestionar suscripciónpreferences:show:@@ -91,7 +91,7 @@ es:advanced_section_title: Avanzadoai_prompts_label: Indicaciones de IAapi_key_label: Clave API- billing_label: Facturación+ payment_label: Pagocategories_label: Categoríasfeedback_label: Comentariosgeneral_section_title: Generaldiff --git a/config/locales/views/settings/fr.yml b/config/locales/views/settings/fr.ymlindex bd90b194aa..eefe027e8b 100644--- a/config/locales/views/settings/fr.yml+++ b/config/locales/views/settings/fr.yml@@ -16,10 +16,10 @@ fr:merchant_detector:title: Détection du vendeursubtitle: L'IA identifie et enrichit les données de transaction avec des informations sur le vendeur- billings:+ payments:show:- page_title: Facturation- subscription_subtitle: Mettez à jour votre abonnement et vos détails de facturation+ page_title: Paiement+ subscription_subtitle: Mettez à jour votre abonnement et vos détails de paiementsubscription_title: Gérer l'abonnementpreferences:show:@@ -108,7 +108,7 @@ fr:advanced_section_title: Avancéai_prompts_label: Prompts IAapi_key_label: Clé API- billing_label: Facturation+ payment_label: Paiementcategories_label: Catégoriesfeedback_label: Retour d'informationgeneral_section_title: Généraldiff --git a/config/locales/views/settings/nb.yml b/config/locales/views/settings/nb.ymlindex 098dd9f6ac..3f0e5b78f2 100644--- a/config/locales/views/settings/nb.yml+++ b/config/locales/views/settings/nb.yml@@ -1,10 +1,10 @@---nb:settings:- billings:+ payments:show:- page_title: Fakturering- subscription_subtitle: Oppdater abonnementet og faktureringsdetaljene dine+ page_title: Betaling+ subscription_subtitle: Oppdater abonnementet og betalingsdetaljene dinesubscription_title: Administrer abonnementpreferences:show:@@ -76,7 +76,7 @@ nb:accounts_label: Kontoerapi_key_label: API-nøkkeladvanced_section_title: Avansert- billing_label: Fakturering+ payment_label: Betalingcategories_label: Kategorierfeedback_label: Tilbakemeldinggeneral_section_title: Genereltdiff --git a/config/locales/views/settings/nl.yml b/config/locales/views/settings/nl.ymlindex 1ef08d9066..bc8c99513a 100644--- a/config/locales/views/settings/nl.yml+++ b/config/locales/views/settings/nl.yml@@ -16,10 +16,10 @@ nl:merchant_detector:title: Handelaar Detectiesubtitle: AI identificeert en verrijkt transactiegegevens met handelaarsinformatie- billings:+ payments:show:- page_title: Facturering- subscription_subtitle: Werk uw abonnement en factureringsgegevens bij+ page_title: Betaling+ subscription_subtitle: Werk uw abonnement en betalingsgegevens bijsubscription_title: Abonnement beherenpreferences:show:@@ -111,7 +111,7 @@ nl:advanced_section_title: Geavanceerdai_prompts_label: AI Promptsapi_key_label: API Key- billing_label: Facturering+ payment_label: Betalingcategories_label: Categorieënfeedback_label: Feedbackgeneral_section_title: Algemeendiff --git a/config/locales/views/settings/pt-BR.yml b/config/locales/views/settings/pt-BR.ymlindex 06934d4ea7..8ddef43bb5 100644--- a/config/locales/views/settings/pt-BR.yml+++ b/config/locales/views/settings/pt-BR.yml@@ -16,10 +16,10 @@ pt-BR:merchant_detector:title: Detector de Estabelecimentossubtitle: A IA identifica e enriquece dados de transações com informações do estabelecimento- billings:+ payments:show:- page_title: Cobrança- subscription_subtitle: Atualize sua assinatura e detalhes de cobrança+ page_title: Pagamento+ subscription_subtitle: Atualize sua assinatura e detalhes de pagamentosubscription_title: Gerenciar assinaturapreferences:show:@@ -86,7 +86,7 @@ pt-BR:settings_nav:accounts_label: Contasapi_key_label: Chave da API- billing_label: Cobrança+ payment_label: Pagamentocategories_label: Categoriasfeedback_label: Feedbackgeneral_section_title: Geraldiff --git a/config/locales/views/settings/ro.yml b/config/locales/views/settings/ro.ymlindex 3c5b7e0913..e3c3b66ac3 100644--- a/config/locales/views/settings/ro.yml+++ b/config/locales/views/settings/ro.yml@@ -16,10 +16,10 @@ ro:merchant_detector:title: Detector de comercianțisubtitle: AI identifică și îmbogățește datele tranzacțiilor cu informații despre comercianți- billings:+ payments:show:- page_title: Facturare- subscription_subtitle: Actualizează-ți abonamentul și detaliile de facturare+ page_title: Plată+ subscription_subtitle: Actualizează-ți abonamentul și detaliile de platăsubscription_title: Gestionează abonamentulpreferences:show:@@ -94,7 +94,7 @@ ro:advanced_section_title: Avansatai_prompts_label: Prompturi AIapi_key_label: Cheie API- billing_label: Facturare+ payment_label: Platăcategories_label: Categoriifeedback_label: Feedbackgeneral_section_title: Generaldiff --git a/config/locales/views/settings/tr.yml b/config/locales/views/settings/tr.ymlindex 3aa4b569b7..d8b3a00cbe 100644--- a/config/locales/views/settings/tr.yml+++ b/config/locales/views/settings/tr.yml@@ -1,10 +1,10 @@---tr:settings:- billings:+ payments:show:- page_title: Faturalandırma- subscription_subtitle: Abonelik ve fatura bilgilerinizi güncelleyin+ page_title: Ödeme+ subscription_subtitle: Abonelik ve ödeme bilgilerinizi güncelleyinsubscription_title: Aboneliği yönetpreferences:show:@@ -74,7 +74,7 @@ tr:accounts_label: Hesaplarapi_key_label: API Anahtarıadvanced_section_title: Gelişmiş- billing_label: Faturalandırma+ payment_label: Ödemecategories_label: Kategorilerfeedback_label: Geri Bildirimgeneral_section_title: Geneldiff --git a/config/locales/views/settings/zh-CN.yml b/config/locales/views/settings/zh-CN.ymlindex c1263c3524..b541bdcbf3 100644--- a/config/locales/views/settings/zh-CN.yml+++ b/config/locales/views/settings/zh-CN.yml@@ -16,10 +16,10 @@ zh-CN:transaction_categorizer:subtitle: AI 根据您定义的分类自动为交易进行分类title: 交易分类器- billings:+ payments:show:- page_title: 账单管理- subscription_subtitle: 更新订阅与账单信息+ page_title: 付款管理+ subscription_subtitle: 更新订阅与付款信息subscription_title: 管理订阅hostings:ensure_admin:@@ -96,7 +96,7 @@ zh-CN:api_key_label: API 密钥api_keys_label: API 密钥bank_sync_label: 银行同步- billing_label: 账单管理+ payment_label: 付款管理categories_label: 分类管理feedback_label: 意见反馈general_section_title: 通用设置diff --git a/config/locales/views/settings/zh-TW.yml b/config/locales/views/settings/zh-TW.ymlindex 7006e16fc2..85639c2e1c 100644--- a/config/locales/views/settings/zh-TW.yml+++ b/config/locales/views/settings/zh-TW.yml@@ -16,10 +16,10 @@ zh-TW:merchant_detector:title: 商家偵測器subtitle: AI 會辨識交易資料並自動補全商家資訊- billings:+ payments:show:- page_title: 帳單- subscription_subtitle: 更新您的訂閱方案與帳單詳情+ page_title: 付款+ subscription_subtitle: 更新您的訂閱方案與付款詳情subscription_title: 管理訂閱preferences:show:@@ -91,7 +91,7 @@ zh-TW:advanced_section_title: 進階設定ai_prompts_label: AI 提示詞api_key_label: API 金鑰- billing_label: 帳單+ payment_label: 付款categories_label: 類別feedback_label: 意見回饋general_section_title: 一般diff --git a/config/routes.rb b/config/routes.rbindex 0106f6d176..c24ca2d279 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -99,7 +99,7 @@ Rails.application.routes.draw doresource :hosting, only: %i[show update] dodelete :clear_cache, on: :collectionend- resource :billing, only: :show+ resource :payment, only: :showresource :security, only: :showresources :sso_identities, only: :destroyresource :api_key, only: [ :show, :new, :create, :destroy ]diff --git a/test/controllers/settings/billings_controller_test.rb b/test/controllers/settings/payments_controller_test.rbsimilarity index 57%rename from test/controllers/settings/billings_controller_test.rbrename to test/controllers/settings/payments_controller_test.rbindex 579bf76934..b35252ef83 100644--- a/test/controllers/settings/billings_controller_test.rb+++ b/test/controllers/settings/payments_controller_test.rb@@ -1,6 +1,6 @@require "test_helper"-class Settings::BillingsControllerTest < ActionDispatch::IntegrationTest+class Settings::PaymentsControllerTest < ActionDispatch::IntegrationTest# test "the truth" do# assert true# enddiff --git a/test/controllers/subscriptions_controller_test.rb b/test/controllers/subscriptions_controller_test.rbindex 541b5731a6..cb4d1d08ad 100644--- a/test/controllers/subscriptions_controller_test.rb+++ b/test/controllers/subscriptions_controller_test.rb@@ -44,7 +44,7 @@ class SubscriptionsControllerTest < ActionDispatch::IntegrationTest@mock_stripe.expects(:create_checkout_session).with(plan: "monthly",family_id: @family.id,- family_email: @family.billing_email,+ family_email: @family.payment_email,success_url: success_subscription_url + "?session_id={CHECKOUT_SESSION_ID}",cancel_url: upgrade_subscription_url).returns(diff --git a/test/system/settings_test.rb b/test/system/settings_test.rbindex 4d7ab84476..25f2fee702 100644--- a/test/system/settings_test.rb+++ b/test/system/settings_test.rb@@ -63,10 +63,10 @@ class SettingsTest < ApplicationSystemTestCaseassert_selector 'span[data-clipboard-target="iconSuccess"]', visible: true, count: 1 # text copied and icon changed to checkmarkend- test "does not show billing link if self hosting" do+ test "does not show payment link if self hosting" doRails.application.config.app_mode.stubs(:self_hosted?).returns(true)open_settings_from_sidebar- assert_no_selector "li", text: I18n.t("settings.settings_nav.billing_label")+ assert_no_selector "li", text: I18n.t("settings.settings_nav.payment_label")endtest "does not show admin settings to non-admin users" do