diff --git a/internal/handlers/web/invoices.go b/internal/handlers/web/invoices.go index f3ed3b6..b45b50e 100644 --- a/internal/handlers/web/invoices.go +++ b/internal/handlers/web/invoices.go @@ -170,7 +170,10 @@ func UpdateInvoiceStatusHandler(w http.ResponseWriter, r *http.Request) { return } invoiceID := parts[len(parts)-1] - status := parts[len(parts)-2] + statusPart := parts[len(parts)-2] + + // Extract the status from the statusPart + status := strings.TrimSuffix(statusPart, "-invoice") if invoiceID == "" { http.Error(w, "Invalid invoice ID", http.StatusBadRequest) @@ -179,6 +182,7 @@ func UpdateInvoiceStatusHandler(w http.ResponseWriter, r *http.Request) { // Validate the status validStatuses := map[string]bool{ + "draft": true, "fail": true, "ok": true, "pending": true,