This commit is contained in:
greeneclipse committed 2026-10-16 00:34:06 +02:00
1 parent 6586722652
commit 1e7c7bbfbb
65 files changed
+1345 -640

No files matched your search

@@ -155,3 +155,19 @@ func (s *Server) handleRunBillingCycles(w http.ResponseWriter, r *http.Request)
}
JSON(w, http.StatusOK, out)
}
// handleListBillingInvoices lists genuine Stripe invoices for the active company.
// Private Stripe payment and PDF links are only accessible to company owners.
func (s *Server) handleListBillingInvoices(w http.ResponseWriter, r *http.Request) {
if !s.allowCompanyOwnerOrPlatform(w, r) {
return
}
cid, _ := CompanyIDFromContext(r.Context())
invoices, err := s.stripeSvc().ListCompanyInvoices(r.Context(), cid)
if err != nil {
LogAndError(w, http.StatusBadGateway, "could not load invoices", err)
return
}
w.Header().Set("Cache-Control", "private, no-store")
JSON(w, http.StatusOK, map[string]any{"invoices": invoices, "source": "stripe"})
}