fix: retire public payment verify and backfill trade no

This commit is contained in:
IanShaw027
2026-04-21 11:41:02 +08:00
parent 33b208ab6f
commit 9742796ee7
8 changed files with 369 additions and 37 deletions

View File

@@ -0,0 +1,36 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
const { get, post } = vi.hoisted(() => ({
get: vi.fn(),
post: vi.fn(),
}))
vi.mock('@/api/client', () => ({
apiClient: {
get,
post,
},
}))
import { paymentAPI } from '@/api/payment'
describe('payment api', () => {
beforeEach(() => {
get.mockReset()
post.mockReset()
get.mockResolvedValue({ data: {} })
post.mockResolvedValue({ data: {} })
})
it('does not expose anonymous public out_trade_no verification', () => {
expect(Object.prototype.hasOwnProperty.call(paymentAPI, 'verifyOrderPublic')).toBe(false)
})
it('keeps signed public resume-token resolve endpoint', async () => {
await paymentAPI.resolveOrderPublicByResumeToken('resume-token-123')
expect(post).toHaveBeenCalledWith('/payment/public/orders/resolve', {
resume_token: 'resume-token-123',
})
})
})