From f69293c9989720afa083b77033080eee20db92dd Mon Sep 17 00:00:00 2001 From: erio Date: Mon, 6 Apr 2026 19:04:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20provider=20creation=20?= =?UTF-8?q?=E2=80=94=20fix=20JSON=20field=20names,=20i18n,=20remove=20extr?= =?UTF-8?q?a=20fields?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: frontend sent snake_case (provider_key, supported_types) but backend expects camelCase (providerKey, supportedTypes) → internal error. Changes: - Fix handleSaveProvider to send camelCase payload matching Go struct - Remove CID/CID Alipay/CID Wxpay fields (not in sub2apipay reference) - Data-driven config fields: PROVIDER_CONFIG_FIELDS per provider type (matches sub2apipay exactly: easypay=5 fields, alipay=5, wxpay=8, stripe=3) - Full i18n for all config field labels (zh: 异步通知地址/私钥/商户号/etc) - Dynamic providerConfig as Record instead of hardcoded reactive --- frontend/src/i18n/locales/en.ts | 12 +++ frontend/src/i18n/locales/zh.ts | 12 +++ frontend/src/views/admin/SettingsView.vue | 108 ++++++++++++++-------- 3 files changed, 95 insertions(+), 37 deletions(-) diff --git a/frontend/src/i18n/locales/en.ts b/frontend/src/i18n/locales/en.ts index 24ce8bc271..92e45a1524 100644 --- a/frontend/src/i18n/locales/en.ts +++ b/frontend/src/i18n/locales/en.ts @@ -4356,6 +4356,18 @@ export default { providerStripe: 'Stripe', typeDisabled: 'type disabled', enableTypesFirst: 'Enable at least one payment type above first', + field_apiBase: 'API Base URL', + field_notifyUrl: 'Notify URL', + field_returnUrl: 'Return URL', + field_privateKey: 'Private Key', + field_publicKey: 'Public Key', + field_mchId: 'Merchant ID', + field_apiV3Key: 'API v3 Key', + field_publicKeyId: 'Public Key ID', + field_certSerial: 'Certificate Serial', + field_secretKey: 'Secret Key', + field_publishableKey: 'Publishable Key', + field_webhookSecret: 'Webhook Secret', productNamePrefix: 'Product Name Prefix', productNameSuffix: 'Product Name Suffix', preview: 'Preview', diff --git a/frontend/src/i18n/locales/zh.ts b/frontend/src/i18n/locales/zh.ts index 23fae5b2b0..01c36e9376 100644 --- a/frontend/src/i18n/locales/zh.ts +++ b/frontend/src/i18n/locales/zh.ts @@ -4529,6 +4529,18 @@ export default { providerStripe: 'Stripe', typeDisabled: '类型已禁用', enableTypesFirst: '请先在上方启用至少一种支付方式', + field_apiBase: 'API 基础地址', + field_notifyUrl: '异步通知地址', + field_returnUrl: '同步跳转地址', + field_privateKey: '私钥', + field_publicKey: '公钥', + field_mchId: '商户号', + field_apiV3Key: 'API v3 密钥', + field_publicKeyId: '公钥 ID', + field_certSerial: '证书序列号', + field_secretKey: '密钥', + field_publishableKey: '公开密钥', + field_webhookSecret: 'Webhook 密钥', productNamePrefix: '商品名前缀', productNameSuffix: '商品名后缀', preview: '预览', diff --git a/frontend/src/views/admin/SettingsView.vue b/frontend/src/views/admin/SettingsView.vue index b01ebae585..945d0f71db 100644 --- a/frontend/src/views/admin/SettingsView.vue +++ b/frontend/src/views/admin/SettingsView.vue @@ -1789,34 +1789,17 @@
+

{{ t('admin.settings.payment.providerConfig') }}

- - - - -
{{ t('admin.settings.payment.selectProviderKey') }}
+
+
+ +