From 73ce82fa4e8248c32fceabbde0f3397fa48b259a Mon Sep 17 00:00:00 2001 From: DaxPay Date: Fri, 3 Jan 2025 10:25:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(daxpay):=20=E6=94=AF=E6=8C=81=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AE=9D=E5=92=8C=E5=BE=AE=E4=BF=A1=E7=89=B9=E7=BA=A6?= =?UTF-8?q?=E5=95=86=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增支付宝和微信特约商户相关的配置项和功能 - 更新了相应的API接口和UI界面以支持特约商户功能 -优化了部分现有功能,如支付限额和证书上传等 --- src/enums/daxpay/channelEnum.ts | 6 +- .../channel/alipay/config/AlipayConfig.api.ts | 4 + .../alipay/config/AlipayConfigEdit.vue | 24 ++- .../wechat/config/WechatPayConfig.api.ts | 34 +++- .../wechat/config/WechatPayConfigEdit.vue | 161 ++++++++++++------ .../common/develop/trade/DevelopTradePay.vue | 2 + .../daxpay/common/merchant/app/MchAppEdit.vue | 7 + .../daxpay/common/merchant/app/MchAppList.vue | 5 + .../merchant/channel/ChannelConfigEdit.vue | 14 +- .../merchant/channel/ChannelConfigList.vue | 4 + .../order/transfer/TransferOrder.api.ts | 2 +- .../order/transfer/TransferOrderList.vue | 9 +- src/views/sys/login/LoginForm.vue | 1 + types/store.d.ts | 1 - 14 files changed, 192 insertions(+), 82 deletions(-) diff --git a/src/enums/daxpay/channelEnum.ts b/src/enums/daxpay/channelEnum.ts index 945c4e5a..09fec138 100644 --- a/src/enums/daxpay/channelEnum.ts +++ b/src/enums/daxpay/channelEnum.ts @@ -3,7 +3,9 @@ */ export enum ChannelEnum { ALI = 'ali_pay', + ALI_ISV = 'alipay_isv', WECHAT = 'wechat_pay', + WECHAT_ISV = 'wechat_pay_isv', UNION_PAY = 'union_pay', } @@ -63,7 +65,6 @@ export enum ChannelAuthStatusEnum { NOT_EXIST = 'not_exist', } - /** * 收银台类型 */ @@ -78,7 +79,6 @@ export enum CheckoutTypeEnum { * 支付调起类型 */ export enum CheckoutCallTypeEnum { - /** 扫码支付 */ QR_CODE = 'qr_code', /** 条码支付 */ @@ -93,6 +93,4 @@ export enum CheckoutCallTypeEnum { JSAPI = 'jsapi', /** 表单方式 */ FROM = 'from', - } - diff --git a/src/views/daxpay/common/channel/alipay/config/AlipayConfig.api.ts b/src/views/daxpay/common/channel/alipay/config/AlipayConfig.api.ts index 41b852eb..bc2c9ccb 100644 --- a/src/views/daxpay/common/channel/alipay/config/AlipayConfig.api.ts +++ b/src/views/daxpay/common/channel/alipay/config/AlipayConfig.api.ts @@ -33,6 +33,10 @@ export interface AlipayConfig extends MchEntity { enable: boolean // 支付限额 limitAmount?: number + // 是否为特约商户 + isv?: boolean + // 特约商户Token + appAuthToken?: string // 商户账号ID alipayUserId?: string // 授权回调地址 diff --git a/src/views/daxpay/common/channel/alipay/config/AlipayConfigEdit.vue b/src/views/daxpay/common/channel/alipay/config/AlipayConfigEdit.vue index 71452ffe..16ee6070 100644 --- a/src/views/daxpay/common/channel/alipay/config/AlipayConfigEdit.vue +++ b/src/views/daxpay/common/channel/alipay/config/AlipayConfigEdit.vue @@ -34,7 +34,7 @@ + + + + @@ -195,7 +203,7 @@ import { BasicDrawer } from '@/components/Drawer' import { Icon } from '@/components/Icon' import BasicTitle from '@/components/Basic/src/BasicTitle.vue' - import { ChannelConfig } from '@/views/daxpay/common/merchant/channel/ChannelConfig.api' + import { ChannelConfig } from "@/views/daxpay/common/merchant/channel/ChannelConfig.api"; const { handleCancel, diffForm, labelCol, wrapperCol, confirmLoading, visible, showable } = useFormEdit() @@ -205,8 +213,9 @@ const formRef = ref() const channelConfig = ref({}) + const isIsv = ref(false) - const form = ref({ + const form = ref({ aliAppId: '', enable: false, limitAmount: 20000, @@ -220,8 +229,7 @@ alipayRootCert: '', privateKey: '', sandbox: false, - remark: '', - } as AlipayConfig) + }) let rawForm: any = {} // 校验 const rules = computed(() => { @@ -230,6 +238,7 @@ enable: [{ required: true, message: '请选择是否启用' }], limitAmount: [{ required: true, message: '请输入单次支付限额' }], authType: [{ required: true, message: '请选择认证方式' }], + appAuthToken: [{ required: isIsv.value, message: '请输入特约商户AppAuthToken' }], signType: [{ required: true, message: '请选择加密类型' }], alipayPublicKey: [{ required: form.value.authType === 'key', message: '请输入支付宝公钥' }], privateKey: [{ required: true, message: '请输入应用私钥' }], @@ -240,7 +249,6 @@ ], sandbox: [{ required: true, message: '请选择是否为沙箱环境' }], expireTime: [{ required: true, message: '请输入默认超时配置' }], - payWays: [{ required: true, message: '请选择支持的支付类型' }], } as Record }) // 事件 @@ -248,8 +256,9 @@ /** * 入口 */ - function init(config: ChannelConfig) { + function init(config: ChannelConfig, isv: boolean) { channelConfig.value = config + isIsv.value = isv resetForm() visible.value = true getInfo() @@ -284,6 +293,7 @@ 'alipayRootCert', 'privateKey', ), + isv: isIsv.value, appId: channelConfig.value.appId, }) .then(() => { diff --git a/src/views/daxpay/common/channel/wechat/config/WechatPayConfig.api.ts b/src/views/daxpay/common/channel/wechat/config/WechatPayConfig.api.ts index fcc946d6..cedb8b1d 100644 --- a/src/views/daxpay/common/channel/wechat/config/WechatPayConfig.api.ts +++ b/src/views/daxpay/common/channel/wechat/config/WechatPayConfig.api.ts @@ -30,6 +30,12 @@ export interface WechatPayConfig extends MchEntity { wxAppId?: string // 微信商户号 wxMchId?: string + // 微信子应用AppId + subAppId?: string + // 微信子商户号 + subMchId?: string + // 是否特约商户 + isv?: boolean // 是否启用 enable: boolean // 授权认证地址 @@ -44,13 +50,17 @@ export interface WechatPayConfig extends MchEntity { apiKeyV3?: string // APPID对应的接口密码,用于获取接口调用凭证access_token时使用 appSecret?: string - // 私钥Key - privateKey?: string - // 私钥证书 + // 支付公钥 + publicKey?: string + // 支付公钥ID + publicKeyId?: string + // 商户API证书 privateCert?: string - // 证书序列号 + // 商户API证书私钥 + privateKey?: string + // 商户API证书序列号 certSerialNo?: string - // p12的文件id + // p12的文件 p12?: string | null // 应用域名,回调中会使用此参数 domain?: string @@ -63,3 +73,17 @@ export interface WechatPayConfig extends MchEntity { // 备注 remark?: string } + +/** + * 特约商户服务商配置 + */ +export interface WechatPaySimpleConfig extends MchEntity { + // 服务商应用号 + isvAppId?: string + // 子商户应用AppId + subAppId?: string + // 子商户商户号 + subMchId?: string + // 是否启用 + enable?: boolean +} diff --git a/src/views/daxpay/common/channel/wechat/config/WechatPayConfigEdit.vue b/src/views/daxpay/common/channel/wechat/config/WechatPayConfigEdit.vue index c3e5f920..b5faeebf 100644 --- a/src/views/daxpay/common/channel/wechat/config/WechatPayConfigEdit.vue +++ b/src/views/daxpay/common/channel/wechat/config/WechatPayConfigEdit.vue @@ -24,13 +24,27 @@ - + + + + + + +