diff --git a/src/mobile/router/modules.ts b/src/mobile/router/modules.ts index d57461d..870e687 100644 --- a/src/mobile/router/modules.ts +++ b/src/mobile/router/modules.ts @@ -84,6 +84,15 @@ const routeModuleList: Array = [ title: '支付宝认证', }, }, + // 支付宝代运营授权落地页(移动独占:授权回跳换 app_auth_token) + { + path: RoutePath.ISV_AUTH_ALIPAY, + name: 'AlipayIsvAuth', + component: () => import('@/mobile/views/isv-auth/alipay/index.vue'), + meta: { + title: '支付宝代运营授权', + }, + }, // 微信认证落地页(跨端:与 PC 端同 path 各指各 view,微信公众号 OAuth 重定向回调取 code) { path: RoutePath.AUTH_WECHAT, diff --git a/src/mobile/views/isv-auth/alipay/index.vue b/src/mobile/views/isv-auth/alipay/index.vue new file mode 100644 index 0000000..7256f9d --- /dev/null +++ b/src/mobile/views/isv-auth/alipay/index.vue @@ -0,0 +1,221 @@ + + + + + diff --git a/src/shared/api/isv-auth.ts b/src/shared/api/isv-auth.ts new file mode 100644 index 0000000..839eaf8 --- /dev/null +++ b/src/shared/api/isv-auth.ts @@ -0,0 +1,24 @@ +import { RequestEnum } from '@/shared/enums/httpEnum' +import { http } from '@/shared/utils/http/axios' + +/** + * 服务商(ISV)代运营授权: 授权码换取 app_auth_token + */ +export function isvAuthCallback(param: IsvAuthParam): Promise { + return http.request({ + url: '/unipay/assist/alipay/isv/auth/callback', + method: RequestEnum.POST, + data: param, + }, { + // 由页面自行处理错误展示 + isShowMessage: false, + }) +} + +/** 代运营授权回调参数 */ +export interface IsvAuthParam { + /** 通道商户号 */ + channelMchNo: string + /** 应用授权码 */ + code: string +} diff --git a/src/shared/locales/en-US/index.ts b/src/shared/locales/en-US/index.ts index d75d566..d24ae64 100644 --- a/src/shared/locales/en-US/index.ts +++ b/src/shared/locales/en-US/index.ts @@ -5,6 +5,7 @@ import common from './common.json' import error from './error.json' import home from './home.json' import http from './http.json' +import isvAuth from './isv-auth.json' import protocol from './protocol.json' import statement from './statement.json' @@ -12,6 +13,7 @@ export default { common, http, auth, + isvAuth, cashier, codePay, protocol, diff --git a/src/shared/locales/en-US/isv-auth.json b/src/shared/locales/en-US/isv-auth.json new file mode 100644 index 0000000..d25a94a --- /dev/null +++ b/src/shared/locales/en-US/isv-auth.json @@ -0,0 +1,13 @@ +{ + "alipay": { + "loading": "Completing agent authorization...", + "secureTip": "Alipay agent authorization", + "successMsg": "Authorization successful", + "failTitle": "Authorization failed", + "close": "Close", + "authCodeMissing": "Failed to get authorization code", + "stateMissing": "Failed to get channel merchant info", + "stateInvalid": "Invalid channel merchant info", + "authFail": "Authorization failed, please try again later" + } +} diff --git a/src/shared/locales/zh-CN/index.ts b/src/shared/locales/zh-CN/index.ts index d75d566..d24ae64 100644 --- a/src/shared/locales/zh-CN/index.ts +++ b/src/shared/locales/zh-CN/index.ts @@ -5,6 +5,7 @@ import common from './common.json' import error from './error.json' import home from './home.json' import http from './http.json' +import isvAuth from './isv-auth.json' import protocol from './protocol.json' import statement from './statement.json' @@ -12,6 +13,7 @@ export default { common, http, auth, + isvAuth, cashier, codePay, protocol, diff --git a/src/shared/locales/zh-CN/isv-auth.json b/src/shared/locales/zh-CN/isv-auth.json new file mode 100644 index 0000000..3f0d8ac --- /dev/null +++ b/src/shared/locales/zh-CN/isv-auth.json @@ -0,0 +1,13 @@ +{ + "alipay": { + "loading": "正在完成代运营授权...", + "secureTip": "支付宝代运营授权", + "successMsg": "授权成功", + "failTitle": "授权失败", + "close": "关闭页面", + "authCodeMissing": "授权码获取失败", + "stateMissing": "通道商户信息获取失败", + "stateInvalid": "通道商户信息无效", + "authFail": "授权失败,请稍后重试" + } +} diff --git a/src/shared/router/exclusive.ts b/src/shared/router/exclusive.ts index 3c4da25..1687f30 100644 --- a/src/shared/router/exclusive.ts +++ b/src/shared/router/exclusive.ts @@ -29,6 +29,8 @@ export const EXCLUSIVE_ROUTES: ExclusiveRoute[] = [ { path: RoutePath.CODE_PAY, name: 'CodePay', device: 'mobile' }, // 支付宝认证落地页:仅移动端实现(支付宝 App 内 JSAPI) { path: RoutePath.AUTH_ALIPAY, name: 'AlipayAuth', device: 'mobile' }, + // 支付宝代运营授权落地页:仅移动端实现(支付宝授权回跳) + { path: RoutePath.ISV_AUTH_ALIPAY, name: 'AlipayIsvAuth', device: 'mobile' }, // 商户对账单:仅 PC 端实现 { path: RoutePath.MERCHANT_STATEMENT, name: 'MerchantStatement', device: 'pc' }, ] diff --git a/src/shared/router/paths.ts b/src/shared/router/paths.ts index 17824e2..4486764 100644 --- a/src/shared/router/paths.ts +++ b/src/shared/router/paths.ts @@ -25,6 +25,8 @@ export const RoutePath = { PROTOCOL: '/protocol/:protocolType', /** 支付宝认证落地页(移动独占:JSAPI 取码) */ AUTH_ALIPAY: '/auth/alipay/:aliAppId/:queryCode', + /** 支付宝代运营授权落地页(移动独占:支付宝授权回跳换 app_auth_token) */ + ISV_AUTH_ALIPAY: '/isv-auth/alipay', /** 微信认证落地页(跨端:公众号 OAuth 重定向回调,PC 微信内置浏览器也可访问) */ AUTH_WECHAT: '/auth/wechat/:authToken', } as const