|
|
|
@ -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, |
|
|
|
|