修复电子凭证销毁与飞飞订单金额

This commit is contained in:
yml2213
2026-07-08 19:17:01 +08:00
parent 6647e815a8
commit 487d586492
6 changed files with 111 additions and 2 deletions
@@ -4,6 +4,7 @@ import assert from 'node:assert/strict'
import {
buildFeifeiPlatformOrderNo,
resolveKuaishouFeifeiClaimUrl,
resolveKuaishouFeifeiPlatformAmount,
} from './index.js'
import type { TaskRow } from '../../../types/repository/rows.js'
@@ -66,6 +67,27 @@ test('buildFeifeiPlatformOrderNo falls back to task number', () => {
)
})
test('resolveKuaishouFeifeiPlatformAmount converts order fen amount to yuan', () => {
assert.equal(resolveKuaishouFeifeiPlatformAmount({
totalAmountFen: 3800,
quantity: 1,
}), 38)
})
test('resolveKuaishouFeifeiPlatformAmount splits amount by item quantity', () => {
assert.equal(resolveKuaishouFeifeiPlatformAmount({
totalAmountFen: 7600,
quantity: 2,
}), 38)
})
test('resolveKuaishouFeifeiPlatformAmount skips empty amount', () => {
assert.equal(resolveKuaishouFeifeiPlatformAmount({
totalAmountFen: 0,
quantity: 1,
}), 0)
})
function createTask(patch: Partial<TaskRow> = {}): TaskRow {
return {
id: 123,