实现腾讯通用票据OCR安全适配(07-28-travel-reimbursement-guide)
这个提交包含在:
@@ -1,6 +1,7 @@
|
||||
const {
|
||||
INVOICE_UNAVAILABLE_REASONS,
|
||||
classifyInvoiceConflict,
|
||||
buildInvoiceDedupFilters,
|
||||
formatInvoiceOcrFailureMessage,
|
||||
resolveInvoiceAvailability,
|
||||
resolveUploadDedupDecision,
|
||||
@@ -32,6 +33,17 @@ function buildTx(conflicts) {
|
||||
}
|
||||
|
||||
describe("invoiceGovernance dedup", () => {
|
||||
it("uses invoice number alone only when the caller marks a known no-code subtype", () => {
|
||||
expect(
|
||||
buildInvoiceDedupFilters({
|
||||
invoiceNumber: "251234",
|
||||
deduplicateByInvoiceNumberOnly: true,
|
||||
}),
|
||||
).toEqual([{ invoice_code: null, invoice_number: "251234" }]);
|
||||
|
||||
expect(buildInvoiceDedupFilters({ invoiceNumber: "251234" })).toEqual([]);
|
||||
});
|
||||
|
||||
it("ignores manually archived invoices when re-uploading the same file", async () => {
|
||||
const archivedManual = buildInvoice({
|
||||
status: "archived",
|
||||
@@ -122,5 +134,13 @@ describe("invoiceGovernance dedup", () => {
|
||||
expect(formatInvoiceOcrFailureMessage("mock_ocr_failed")).toBe(
|
||||
"票据识别失败,请重试或人工补齐关键信息。",
|
||||
);
|
||||
expect(formatInvoiceOcrFailureMessage("multiple_invoices_not_supported")).toBe(
|
||||
"一个 PDF 第一页只能包含一张发票,请拆分后重新上传。",
|
||||
);
|
||||
expect(
|
||||
formatInvoiceOcrFailureMessage(
|
||||
"[pdf_native][ResourceUnavailable.ResourcePackageRunOut] resource package run out",
|
||||
),
|
||||
).toBe("票据识别额度或计费状态暂不可用,请联系管理员。");
|
||||
});
|
||||
});
|
||||
|
||||
在新工单中引用
屏蔽一个用户