feat: 完成错误原因合同与付款就绪提示(09-05-error-explainability-payment-readiness)
这个提交包含在:
@@ -1,4 +1,5 @@
|
||||
import { formatInvoiceOcrFieldLabels } from "../lib/invoiceOcr";
|
||||
import { resolveErrorReasonMessage, UNKNOWN_VALIDATION_MESSAGE } from "./errorReasons";
|
||||
|
||||
function readStringList(value: unknown): string[] {
|
||||
if (!Array.isArray(value)) {
|
||||
@@ -71,7 +72,13 @@ export function mapApiErrorMessage(
|
||||
code: string,
|
||||
details?: Record<string, unknown>,
|
||||
fallbackMessage?: string,
|
||||
) {
|
||||
): string {
|
||||
if (code === "VALID_001" && details?.reasonCode === "reimbursement.items_invoice_item_guard_failed") {
|
||||
return mapApiErrorMessage(code, { ...details, reasonCode: undefined, items: "invoice_item_guard_failed" });
|
||||
}
|
||||
if (code === "VALID_001" && details?.reasonCode !== undefined) {
|
||||
return resolveErrorReasonMessage(details.reasonCode) ?? UNKNOWN_VALIDATION_MESSAGE;
|
||||
}
|
||||
if (code === "AUTH_001") {
|
||||
return "账号或密码错误,请检查后重试。";
|
||||
}
|
||||
@@ -512,5 +519,5 @@ export function mapApiErrorMessage(
|
||||
}
|
||||
}
|
||||
|
||||
return fallbackMessage || "请求失败,请稍后重试。";
|
||||
return code === "VALID_001" ? UNKNOWN_VALIDATION_MESSAGE : fallbackMessage || "请求失败,请稍后重试。";
|
||||
}
|
||||
|
||||
在新工单中引用
屏蔽一个用户