收口微信支付订阅诊断日志
微信支付和订阅失败日志改为固定阶段标签 原生壳门禁拒绝支付订阅日志输出原生错误对象 同步宿主壳方案和共享决策记录
This commit is contained in:
@@ -8,11 +8,15 @@ function parsePayParams(rawValue) {
|
||||
}
|
||||
return params;
|
||||
} catch (error) {
|
||||
console.error('[wechat-pay] parse params failed', error);
|
||||
logWechatPayFailure('parse params failed', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function logWechatPayFailure(label, _error) {
|
||||
console.error(`[wechat-pay] ${label}`);
|
||||
}
|
||||
|
||||
function isVirtualPaymentParams(payParams) {
|
||||
return (
|
||||
typeof payParams.mode === 'string' &&
|
||||
@@ -111,7 +115,7 @@ function requestVirtualPayment(payParams) {
|
||||
resolve({ status: 'success', errorMessage: '' });
|
||||
},
|
||||
fail(error) {
|
||||
console.error('[wechat-pay] requestVirtualPayment failed', error);
|
||||
logWechatPayFailure('requestVirtualPayment failed', error);
|
||||
resolve({
|
||||
status: resolvePayStatus(error),
|
||||
errorMessage: normalizePayError(error),
|
||||
|
||||
@@ -129,8 +129,8 @@ describe('wechat-pay mini program payment bridge', () => {
|
||||
});
|
||||
expect(console.error).toHaveBeenCalledWith(
|
||||
'[wechat-pay] requestVirtualPayment failed',
|
||||
payError,
|
||||
);
|
||||
expect(console.error.mock.calls.flat()).not.toContain(payError);
|
||||
});
|
||||
|
||||
test('hides ordinary payment native failure details from H5 result', async () => {
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
const SUBSCRIBE_RESULT_STORAGE_KEY = 'genarrative:wechat-subscribe-result';
|
||||
const WECHAT_SUBSCRIBE_UNAVAILABLE_REASON = 'wechat subscribe unavailable';
|
||||
|
||||
function logWechatSubscribeFailure(label, _error) {
|
||||
console.error(`[subscribe-message] ${label}`);
|
||||
}
|
||||
|
||||
function appendSubscribeResult(url, result) {
|
||||
const hashIndex = String(url || '').indexOf('#');
|
||||
const baseUrl =
|
||||
@@ -99,7 +103,7 @@ function createSubscribeMessagePageController(pageContext, options = {}) {
|
||||
wx.navigateBack();
|
||||
},
|
||||
fail(error) {
|
||||
console.error('[subscribe-message] request failed', error);
|
||||
logWechatSubscribeFailure('request failed', error);
|
||||
notifyPageResult(
|
||||
page,
|
||||
'skip',
|
||||
|
||||
@@ -88,10 +88,8 @@ describe('subscribe-message mini program bridge', () => {
|
||||
SUBSCRIBE_RESULT_STORAGE_KEY,
|
||||
'request-fail:skip:wechat%20subscribe%20unavailable',
|
||||
);
|
||||
expect(console.error).toHaveBeenCalledWith(
|
||||
'[subscribe-message] request failed',
|
||||
subscribeError,
|
||||
);
|
||||
expect(console.error).toHaveBeenCalledWith('[subscribe-message] request failed');
|
||||
expect(console.error.mock.calls.flat()).not.toContain(subscribeError);
|
||||
expect(globalThis.wx.navigateBack).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user