From e76f54b11fc45e58a2d22ed7a0a84a66f4c24c91 Mon Sep 17 00:00:00 2001 From: justin Date: Tue, 28 Apr 2026 04:20:05 -0500 Subject: [PATCH] Fix batch Payment Entry (paidAmountCents was 0), fix CTA button JS syntax error - Batch invoice creation now calculates actual total from line items - Fixed JS syntax error: `className = "..." style="..."` was invalid JS (style= outside string literal caused Unexpected identifier 'style') - Portal menu: set hide_standard_menu=1 to remove duplicate sidebar items Co-Authored-By: Claude Opus 4.6 (1M context) --- api/src/routes/checkout.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/src/routes/checkout.ts b/api/src/routes/checkout.ts index 194bcf0..0cc9d61 100644 --- a/api/src/routes/checkout.ts +++ b/api/src/routes/checkout.ts @@ -1279,12 +1279,16 @@ export async function handlePaymentComplete( // Create Sales Invoice try { + // Calculate batch total (sum of all line items minus discounts) + const batchTotalCents = (batchRows.rows as any[]).reduce((sum, bo) => { + return sum + (bo.service_fee_cents || 0) + (bo.gov_fee_cents || 0) - (bo.discount_cents || 0); + }, 0); const invName = await createInvoiceFromSalesOrder({ salesOrderName: soName, paymentGateway: paymentMethod, surchargePercent: (order.surcharge_pct as number) || 0, paymentReference: session_id, - paidAmountCents: 0, + paidAmountCents: batchTotalCents, externalOrderId: batchId, }); if (invName) {