Commit a18866c4 by zhengxiao

fix: openId不一致时重新获取openId

parent dafaa841
...@@ -117,6 +117,10 @@ export enum PayErrorMessage { ...@@ -117,6 +117,10 @@ export enum PayErrorMessage {
WECHAT_JSSDK_PAY_ERROR = '支付失败', WECHAT_JSSDK_PAY_ERROR = '支付失败',
WECHAT_H5_PAY_BREAK = '微信h5支付中断', WECHAT_H5_PAY_BREAK = '微信h5支付中断',
ALIPAY_H5_PAY_BREAK = '支付宝支付中断', ALIPAY_H5_PAY_BREAK = '支付宝支付中断',
/**
* 微信支付appid和openid不匹配
*/
WECHAT_OPENID_APPID_NOT_MATCH = '微信支付appid和openid不匹配',
} }
export type ToPayReturns = { export type ToPayReturns = {
......
...@@ -272,6 +272,9 @@ export class Payment { ...@@ -272,6 +272,9 @@ export class Payment {
doUnifiedParams.payChannel = payChannel doUnifiedParams.payChannel = payChannel
} }
const res = await requestForJava.post<DoUnifiedParams, DefaultResponse>(UNIT_PAY, doUnifiedParams) const res = await requestForJava.post<DoUnifiedParams, DefaultResponse>(UNIT_PAY, doUnifiedParams)
if (Utils.isWechat() && res.msg === PayErrorMessage.WECHAT_OPENID_APPID_NOT_MATCH) {
window.location.href = `https://m.ydl.com/pay/wx-pay-open-id?toLink=${window.location.href}`;
}
if (res.code !== '200') return {errorMessage: res.msg as any, success: false, errorType: PayError.BACKEND} if (res.code !== '200') return {errorMessage: res.msg as any, success: false, errorType: PayError.BACKEND}
if (params.payType === PayType.BALANCE && res.data) { if (params.payType === PayType.BALANCE && res.data) {
return {success: res.data.result, errorType: PayError.BALANCE} return {success: res.data.result, errorType: PayError.BALANCE}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment