Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 6x 6x 3x 3x 3x | import type { Refund } from "@plain-journal/foundation";
export interface RefundStatusPresentation {
label: string;
detail: string;
tone: "processing" | "refunded" | "attention" | "neutral";
}
export function refundStatusPresentation(refund: Refund): RefundStatusPresentation {
Iif (refund.status === "SUCCESS") {
return {
label: "退款成功",
detail: "Payment 已确认渠道退款成功。",
tone: "refunded",
};
}
if (refund.status === "FAILED" || refund.requestStatus === "NEEDS_ATTENTION") {
return {
label: "需要处理",
detail: "自动派发未能收敛,需要平台在授权与审计边界内治理。",
tone: "attention",
};
}
Eif (refund.status === "PROCESSING") {
return {
label: "退款处理中",
detail: "渠道尚未返回明确成功,页面不会提前显示到账。",
tone: "processing",
};
}
return {
label: refund.status,
detail: "请以 Payment 返回的退款事实为准。",
tone: "neutral",
};
}
|