fix(rectification): skip settlement for free turns
Staging Backend Quality Gate / validate (pull_request) Successful in 15m26s
Staging Backend Quality Gate / publish (pull_request) Has been skipped

This commit is contained in:
Jesse_Chen
2026-08-12 02:58:35 +08:00
parent 863f65d090
commit da384357d0
3 changed files with 22 additions and 1 deletions
@@ -209,7 +209,7 @@ export async function POST(request: Request) {
async reserve() {
// opening / read-only turns are free; the first substantive run
// reserves once, and resume/retry reuse the same case-bound request.
if (action === "opening" || action === "read_only") {
if (action !== "message") {
return { success: true, status: 200 };
}
try {
@@ -233,6 +233,7 @@ export async function POST(request: Request) {
}
},
async complete(usage) {
if (action !== "message") return true;
try {
const billingRequestId = await rectificationBillingRequestId(accounting, userId, caseId);
const settlement = await completeUsage(accounting, userId, billingRequestId, {