From 112e09bc6d1f0776f3f98602151a7730a8ed9245 Mon Sep 17 00:00:00 2001 From: smediainfo Date: Thu, 16 Jul 2026 09:55:08 +0300 Subject: [PATCH] fix(payment-methods): admin display_name/description override locale on balance White-label (per-method display_name + description in admin) was defeated on balance/top-up pages: render used `translatedName || method.name` and `translatedDesc || method.description`, so the bundled locale always won and the admin override was ignored. - Flip priority: admin-configured value first, locale as fallback (TopUpMethodSelect, Balance) - Add missing Description field to payment-method edit page (mirrors Display name: description / reset_description) - Add description to admin PaymentMethodConfig type - Add description/descriptionHint i18n keys (ru, en) --- src/locales/en.json | 2 ++ src/locales/ru.json | 2 ++ src/pages/AdminPaymentMethodEdit.tsx | 25 +++++++++++++++++++++++++ src/pages/Balance.tsx | 6 +++--- src/pages/TopUpMethodSelect.tsx | 6 +++--- src/types/index.ts | 1 + 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index 160c585..b3cd16e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1627,6 +1627,8 @@ "openUrlDirectHint": "ON — the payment link opens immediately, without the intermediate button panel. OFF — an \"Open payment\" button is shown. Inside Telegram the link opens in the external browser either way (otherwise paying via a bank app/SBP fails); after payment the user returns to the result page. Stars/CryptoBot (t.me/ links) always open natively and ignore this flag.", "displayName": "Display name", "displayNameHint": "Leave empty for default name", + "description": "Description", + "descriptionHint": "Shown under the method name. Empty for default text", "subOptions": "Payment options", "minAmount": "Min amount (kopeks)", "maxAmount": "Max amount (kopeks)", diff --git a/src/locales/ru.json b/src/locales/ru.json index 79f6820..381453e 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -1649,6 +1649,8 @@ "openUrlDirectHint": "ВКЛ — ссылка оплаты открывается сразу, без промежуточной панели с кнопкой. ВЫКЛ — показывается кнопка «Открыть оплату». В Telegram ссылка в обоих случаях открывается во внешнем браузере (иначе оплата через банковское приложение/СБП не срабатывает), после оплаты — возврат на страницу результата. Stars/CryptoBot (t.me/-ссылки) всегда открываются нативно, флаг к ним не применяется.", "displayName": "Отображаемое имя", "displayNameHint": "Оставьте пустым для имени по умолчанию", + "description": "Описание", + "descriptionHint": "Показывается под названием метода. Пусто — текст по умолчанию", "subOptions": "Варианты оплаты", "minAmount": "Мин. сумма (коп.)", "maxAmount": "Макс. сумма (коп.)", diff --git a/src/pages/AdminPaymentMethodEdit.tsx b/src/pages/AdminPaymentMethodEdit.tsx index c11bbf5..7614e7b 100644 --- a/src/pages/AdminPaymentMethodEdit.tsx +++ b/src/pages/AdminPaymentMethodEdit.tsx @@ -232,6 +232,7 @@ export default function AdminPaymentMethodEdit() { // Local state for editing const [isEnabled, setIsEnabled] = useState(false); const [customName, setCustomName] = useState(''); + const [customDesc, setCustomDesc] = useState(''); const [subOptions, setSubOptions] = useState>({}); const [minAmount, setMinAmount] = useState(''); const [maxAmount, setMaxAmount] = useState(''); @@ -249,6 +250,7 @@ export default function AdminPaymentMethodEdit() { if (config) { setIsEnabled(config.is_enabled); setCustomName(config.display_name || ''); + setCustomDesc(config.description || ''); setSubOptions(config.sub_options || {}); setMinAmount(config.min_amount_kopeks ?? ''); setMaxAmount(config.max_amount_kopeks ?? ''); @@ -290,6 +292,13 @@ export default function AdminPaymentMethodEdit() { data.reset_display_name = true; } + // Description + if (customDesc.trim()) { + data.description = customDesc.trim(); + } else { + data.reset_description = true; + } + // Sub-options if (config.available_sub_options) { data.sub_options = subOptions; @@ -478,6 +487,22 @@ export default function AdminPaymentMethodEdit() {

+ {/* Description */} +
+ +