mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix(admin): gate overpay certificate block by settings permission
(cherry picked from commit 28068bbe45221145df3bd580a46e7bd7fce416e9)
This commit is contained in:
@@ -1638,6 +1638,7 @@
|
||||
"quickAmountsRemove": "Remove amount {{value}} ₽",
|
||||
"overpayCertTitle": "mTLS certificate (Overpay)",
|
||||
"overpayCertValid": "✅ Valid until {{date}}",
|
||||
"overpayCertExpired": "⚠️ Expired {{date}}",
|
||||
"overpayCertUnreadable": "⚠️ Certificate cannot be read — wrong passphrase or corrupted file",
|
||||
"overpayCertMissing": "❌ Certificate not uploaded",
|
||||
"overpayCertEnvLockedPath": "Path is set via the OVERPAY_P12_PATH environment variable — the database value is not applied",
|
||||
|
||||
@@ -2315,6 +2315,7 @@
|
||||
"quickAmountsRemove": "حذف مبلغ {{value}} ₽",
|
||||
"overpayCertTitle": "گواهی mTLS (Overpay)",
|
||||
"overpayCertValid": "✅ معتبر تا {{date}}",
|
||||
"overpayCertExpired": "⚠️ در تاریخ {{date}} منقضی شده است",
|
||||
"overpayCertUnreadable": "⚠️ گواهی قابل خواندن نیست — رمز نادرست یا فایل خراب است",
|
||||
"overpayCertMissing": "❌ گواهی بارگذاری نشده است",
|
||||
"overpayCertEnvLockedPath": "مسیر از طریق متغیر محیطی OVERPAY_P12_PATH تنظیم شده است — مقدار پایگاه داده اعمال نمیشود",
|
||||
|
||||
@@ -1660,6 +1660,7 @@
|
||||
"quickAmountsRemove": "Удалить сумму {{value}} ₽",
|
||||
"overpayCertTitle": "Сертификат mTLS (Overpay)",
|
||||
"overpayCertValid": "✅ Действует до {{date}}",
|
||||
"overpayCertExpired": "⚠️ Срок действия истёк {{date}}",
|
||||
"overpayCertUnreadable": "⚠️ Сертификат не читается — неверный пароль или повреждённый файл",
|
||||
"overpayCertMissing": "❌ Сертификат не загружен",
|
||||
"overpayCertEnvLockedPath": "Путь задан через переменную окружения OVERPAY_P12_PATH — значение из БД не применяется",
|
||||
|
||||
@@ -1467,6 +1467,7 @@
|
||||
"quickAmountsRemove": "删除金额 {{value}} ₽",
|
||||
"overpayCertTitle": "mTLS 证书(Overpay)",
|
||||
"overpayCertValid": "✅ 有效期至 {{date}}",
|
||||
"overpayCertExpired": "⚠️ 已于 {{date}} 过期",
|
||||
"overpayCertUnreadable": "⚠️ 证书无法读取——密码错误或文件损坏",
|
||||
"overpayCertMissing": "❌ 未上传证书",
|
||||
"overpayCertEnvLockedPath": "路径已通过环境变量 OVERPAY_P12_PATH 设置——数据库中的值不会生效",
|
||||
|
||||
@@ -11,6 +11,7 @@ import { useHapticFeedback } from '../platform/hooks/useHaptic';
|
||||
import { useDestructiveConfirm } from '../platform/hooks/useNativeDialog';
|
||||
import { createNumberInputHandler, toNumber } from '../utils/inputHelpers';
|
||||
import { localeMap } from '../utils/withdrawalUtils';
|
||||
import { PermissionGate } from '@/components/auth/PermissionGate';
|
||||
import { BackIcon, CheckIcon, SaveIcon } from '@/components/icons';
|
||||
|
||||
function extractErrorDetail(err: unknown): string | null {
|
||||
@@ -94,6 +95,10 @@ function OverpayCertificateSection() {
|
||||
})
|
||||
: null;
|
||||
|
||||
const isExpired = certStatus?.not_valid_after
|
||||
? new Date(certStatus.not_valid_after).getTime() < Date.now()
|
||||
: false;
|
||||
|
||||
return (
|
||||
<div className="card space-y-4">
|
||||
<h3 className="text-sm font-semibold text-dark-200">
|
||||
@@ -106,9 +111,15 @@ function OverpayCertificateSection() {
|
||||
<div>
|
||||
{certStatus.valid ? (
|
||||
<>
|
||||
<p className="text-sm text-success-400">
|
||||
{t('admin.paymentMethods.overpayCertValid', { date: expiryDate })}
|
||||
</p>
|
||||
{isExpired ? (
|
||||
<p className="text-sm text-warning-400">
|
||||
{t('admin.paymentMethods.overpayCertExpired', { date: expiryDate })}
|
||||
</p>
|
||||
) : (
|
||||
<p className="text-sm text-success-400">
|
||||
{t('admin.paymentMethods.overpayCertValid', { date: expiryDate })}
|
||||
</p>
|
||||
)}
|
||||
{certStatus.subject && (
|
||||
<p className="mt-1 break-all text-xs text-dark-500">{certStatus.subject}</p>
|
||||
)}
|
||||
@@ -698,7 +709,11 @@ export default function AdminPaymentMethodEdit() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{config.method_id === 'overpay' && <OverpayCertificateSection />}
|
||||
{config.method_id === 'overpay' && (
|
||||
<PermissionGate permission="settings:read">
|
||||
<OverpayCertificateSection />
|
||||
</PermissionGate>
|
||||
)}
|
||||
|
||||
{/* Actions */}
|
||||
<div className="flex items-center gap-3">
|
||||
|
||||
Reference in New Issue
Block a user