fix payment visible methods and resume recovery

This commit is contained in:
IanShaw027
2026-04-21 00:14:05 +08:00
parent 5d58c7c6fb
commit 16be82b959
6 changed files with 201 additions and 19 deletions

View File

@ -76,6 +76,7 @@ describe('PaymentResultView', () => {
it('restores order id from a matching resume token and does not trust query success flags', async () => {
routeState.query = {
resume_token: 'resume-42',
order_id: '999',
status: 'success',
}
window.localStorage.setItem(PAYMENT_RECOVERY_STORAGE_KEY, JSON.stringify({
@ -110,6 +111,29 @@ describe('PaymentResultView', () => {
expect(wrapper.text()).not.toContain('payment.result.success')
})
it('does not fall back to public out_trade_no verification when resume_token recovery fails', async () => {
routeState.query = {
resume_token: 'resume-fail',
out_trade_no: 'legacy-should-not-run',
trade_status: 'TRADE_SUCCESS',
}
resolveOrderPublicByResumeToken.mockRejectedValueOnce(new Error('resume failed'))
mount(PaymentResultView, {
global: {
stubs: {
OrderStatusBadge: true,
},
},
})
await flushPromises()
expect(resolveOrderPublicByResumeToken).toHaveBeenCalledWith('resume-fail')
expect(verifyOrderPublic).not.toHaveBeenCalled()
expect(verifyOrder).not.toHaveBeenCalled()
})
it('keeps legacy out_trade_no verification as a fallback when no order context is available', async () => {
routeState.query = {
out_trade_no: 'legacy-123',