Skip to content

armgit / sure

Public Imported from GitHub
0

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.rb
similarity index 54%
rename from app/controllers/settings/billings_controller.rb
rename to app/controllers/settings/payments_controller.rb
index 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 < ApplicationController
layout "settings"
def show
diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb
index 22a67f5c0b..d0a7dc123e 100644
--- a/app/controllers/subscriptions_controller.rb
+++ b/app/controllers/subscriptions_controller.rb
@@ -16,7 +16,7 @@ class SubscriptionsController < ApplicationController
checkout_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 < ApplicationController
end
def 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_other
diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb
index 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.rb
index 94ee097192..83fb3597d4 100644
--- a/app/models/family/subscribeable.rb
+++ b/app/models/family/subscribeable.rb
@@ -5,7 +5,7 @@ module Family::Subscribeable
has_one :subscription, dependent: :destroy
end
- def billing_email
+ def payment_email
primary_admin = users.admin.order(:created_at).first || users.super_admin.order(:created_at).first
unless primary_admin.present?
@@ -45,7 +45,7 @@ module Family::Subscribeable
subscription.nil? && !self_hoster?
end
- def next_billing_date
+ def next_payment_date
subscription&.current_period_ends_at
end
diff --git a/app/models/provider/stripe.rb b/app/models/provider/stripe.rb
index 81fc3f96b6..3a75dd2572 100644
--- a/app/models/provider/stripe.rb
+++ b/app/models/provider/stripe.rb
@@ -56,7 +56,7 @@ class Provider::Stripe
CheckoutSessionResult.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_url
diff --git a/app/views/settings/_settings_nav.html.erb b/app/views/settings/_settings_nav.html.erb
index 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.erb
similarity index 89%
rename from app/views/settings/billings/show.html.erb
rename to app/views/settings/payments/show.html.erb
index 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.erb
index 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.yml
index 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 segons
les categories definides
title: 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 pagament
subscription_title: Gestiona la subscripció
hostings:
ensure_admin:
@@ -123,7 +123,7 @@ ca:
api_key_label: Clau API
api_keys_label: Clau API
bank_sync_label: Sincronització bancària
- billing_label: Facturació
+ payment_label: Pagament
categories_label: Categories
feedback_label: Feedback
general_section_title: General
diff --git a/config/locales/views/settings/de.yml b/config/locales/views/settings/de.yml
index 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ändlererkennung
subtitle: 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 Zahlungsdetails
subscription_title: Abonnement verwalten
preferences:
show:
@@ -90,7 +90,7 @@ de:
advanced_section_title: Erweitert
ai_prompts_label: KI-Eingabeaufforderungen
api_key_label: API-Schlüssel
- billing_label: Abrechnung
+ payment_label: Zahlung
categories_label: Kategorien
feedback_label: Feedback
general_section_title: Allgemein
diff --git a/config/locales/views/settings/en.yml b/config/locales/views/settings/en.yml
index 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 Detector
subtitle: 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 details
subscription_title: Manage subscription
preferences:
show:
@@ -111,7 +111,7 @@ en:
advanced_section_title: Advanced
ai_prompts_label: AI Prompts
api_key_label: API Key
- billing_label: Billing
+ payment_label: Payment
categories_label: Categories
feedback_label: Feedback
general_section_title: General
diff --git a/config/locales/views/settings/es.yml b/config/locales/views/settings/es.yml
index 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 Comerciantes
subtitle: 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 pago
subscription_title: Gestionar suscripción
preferences:
show:
@@ -91,7 +91,7 @@ es:
advanced_section_title: Avanzado
ai_prompts_label: Indicaciones de IA
api_key_label: Clave API
- billing_label: Facturación
+ payment_label: Pago
categories_label: Categorías
feedback_label: Comentarios
general_section_title: General
diff --git a/config/locales/views/settings/fr.yml b/config/locales/views/settings/fr.yml
index 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 vendeur
subtitle: 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 paiement
subscription_title: Gérer l'abonnement
preferences:
show:
@@ -108,7 +108,7 @@ fr:
advanced_section_title: Avancé
ai_prompts_label: Prompts IA
api_key_label: Clé API
- billing_label: Facturation
+ payment_label: Paiement
categories_label: Catégories
feedback_label: Retour d'information
general_section_title: Général
diff --git a/config/locales/views/settings/nb.yml b/config/locales/views/settings/nb.yml
index 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 dine
subscription_title: Administrer abonnement
preferences:
show:
@@ -76,7 +76,7 @@ nb:
accounts_label: Kontoer
api_key_label: API-nøkkel
advanced_section_title: Avansert
- billing_label: Fakturering
+ payment_label: Betaling
categories_label: Kategorier
feedback_label: Tilbakemelding
general_section_title: Generelt
diff --git a/config/locales/views/settings/nl.yml b/config/locales/views/settings/nl.yml
index 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 Detectie
subtitle: 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 bij
subscription_title: Abonnement beheren
preferences:
show:
@@ -111,7 +111,7 @@ nl:
advanced_section_title: Geavanceerd
ai_prompts_label: AI Prompts
api_key_label: API Key
- billing_label: Facturering
+ payment_label: Betaling
categories_label: Categorieën
feedback_label: Feedback
general_section_title: Algemeen
diff --git a/config/locales/views/settings/pt-BR.yml b/config/locales/views/settings/pt-BR.yml
index 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 Estabelecimentos
subtitle: 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 pagamento
subscription_title: Gerenciar assinatura
preferences:
show:
@@ -86,7 +86,7 @@ pt-BR:
settings_nav:
accounts_label: Contas
api_key_label: Chave da API
- billing_label: Cobrança
+ payment_label: Pagamento
categories_label: Categorias
feedback_label: Feedback
general_section_title: Geral
diff --git a/config/locales/views/settings/ro.yml b/config/locales/views/settings/ro.yml
index 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ți
subtitle: 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ă abonamentul
preferences:
show:
@@ -94,7 +94,7 @@ ro:
advanced_section_title: Avansat
ai_prompts_label: Prompturi AI
api_key_label: Cheie API
- billing_label: Facturare
+ payment_label: Plată
categories_label: Categorii
feedback_label: Feedback
general_section_title: General
diff --git a/config/locales/views/settings/tr.yml b/config/locales/views/settings/tr.yml
index 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üncelleyin
subscription_title: Aboneliği yönet
preferences:
show:
@@ -74,7 +74,7 @@ tr:
accounts_label: Hesaplar
api_key_label: API Anahtarı
advanced_section_title: Gelişmiş
- billing_label: Faturalandırma
+ payment_label: Ödeme
categories_label: Kategoriler
feedback_label: Geri Bildirim
general_section_title: Genel
diff --git a/config/locales/views/settings/zh-CN.yml b/config/locales/views/settings/zh-CN.yml
index 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.yml
index 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.rb
index 0106f6d176..c24ca2d279 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -99,7 +99,7 @@ Rails.application.routes.draw do
resource :hosting, only: %i[show update] do
delete :clear_cache, on: :collection
end
- resource :billing, only: :show
+ resource :payment, only: :show
resource :security, only: :show
resources :sso_identities, only: :destroy
resource :api_key, only: [ :show, :new, :create, :destroy ]
diff --git a/test/controllers/settings/billings_controller_test.rb b/test/controllers/settings/payments_controller_test.rb
similarity index 57%
rename from test/controllers/settings/billings_controller_test.rb
rename to test/controllers/settings/payments_controller_test.rb
index 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
# end
diff --git a/test/controllers/subscriptions_controller_test.rb b/test/controllers/subscriptions_controller_test.rb
index 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.rb
index 4d7ab84476..25f2fee702 100644
--- a/test/system/settings_test.rb
+++ b/test/system/settings_test.rb
@@ -63,10 +63,10 @@ class SettingsTest < ApplicationSystemTestCase
assert_selector 'span[data-clipboard-target="iconSuccess"]', visible: true, count: 1 # text copied and icon changed to checkmark
end
- test "does not show billing link if self hosting" do
+ test "does not show payment link if self hosting" do
Rails.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")
end
test "does not show admin settings to non-admin users" do