From 2921fa0663c3b906cc2baab9c1276dee54a83744 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar <30073382+mighty840@users.noreply.github.com> Date: Mon, 16 Nov 2026 22:38:10 +0100 Subject: [PATCH] fix(contracts): TOMs are available once the released TOM is listed The contracts overview reported the TOMs as "pending" unconditionally, from before the TOM was released, so the portal showed "Wird bereitgestellt" above the released TOM 1.0.0 on stage. The status is now "available" when a TOM document is listed for the tenant (i.e. released and CONTRACT_DOCUMENTS on), and stays "pending" otherwise. Co-Authored-By: Claude Opus 5.5 --- internal/server/contract_documents_test.go | 7 ++++++- internal/server/trialoffers.go | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/server/contract_documents_test.go b/internal/server/contract_documents_test.go index e6b2730..392029c 100644 --- a/internal/server/contract_documents_test.go +++ b/internal/server/contract_documents_test.go @@ -23,6 +23,7 @@ import ( type contractsView struct { Trial json.RawMessage `json:"trial"` AVV contractStatus `json:"avv"` + TOMs contractStatus `json:"toms"` Documents []contractDocument `json:"documents"` } @@ -122,7 +123,7 @@ func TestContractCatalogueNamesKnownProductsAndServices(t *testing.T) { func TestContractDocuments_gateOff(t *testing.T) { f := newContractFixture(t, false) v, raw := f.contracts(t) - if !strings.Contains(raw, `"documents":[]`) || len(v.Documents) != 0 || v.AVV.Status != "not_concluded" { + if !strings.Contains(raw, `"documents":[]`) || len(v.Documents) != 0 || v.AVV.Status != "not_concluded" || v.TOMs.Status != "pending" { t.Fatalf("gate off: %s", raw) } if code, _, _ := f.contractPDF(t, "lb-plattform.pdf"); code != 404 { @@ -144,6 +145,10 @@ func TestContractDocuments_leistungsbeschreibungen(t *testing.T) { if got := docIDs(v.Documents); got != "agb,tom,lb-plattform,lb-pruefwerk,lb-firmwerk" { t.Fatalf("documents: %s", got) } + // With the TOM listed, the TOMs are available rather than pending. + if v.TOMs.Status != "available" { + t.Errorf("toms status %q", v.TOMs.Status) + } pw := v.Documents[3] if pw.Kind != "lb" || pw.Version != "1.0.3" || pw.Date != "09.11.2026" || pw.Product != "pruefwerk" || pw.TenantSpecific || pw.SHA256 != contractdocs.Default().Get("lb-pruefwerk").SHA256 || pw.Title != "Leistungsbeschreibung Prüfwerk" { diff --git a/internal/server/trialoffers.go b/internal/server/trialoffers.go index 0401575..440709d 100644 --- a/internal/server/trialoffers.go +++ b/internal/server/trialoffers.go @@ -27,6 +27,7 @@ import ( "time" "unicode" + "git.breakpilot.com/platform/tenant-registry/internal/legal/contractdocs" "git.breakpilot.com/platform/tenant-registry/internal/legal/trialterms" bpmail "git.breakpilot.com/platform/tenant-registry/internal/mail" "git.breakpilot.com/platform/tenant-registry/internal/store" @@ -675,6 +676,13 @@ func (s *Server) listTenantContracts(w http.ResponseWriter, r *http.Request) { writeError(w, http.StatusInternalServerError, "internal", err.Error()) return } + // The TOMs are "pending" until a released TOM is listed for this tenant + // (released 16.11.2026; listed only while CONTRACT_DOCUMENTS is on). + for _, d := range resp.Documents { + if d.Kind == contractdocs.KindTOM { + resp.TOMs = contractStatus{"available"} + } + } writeJSON(w, http.StatusOK, resp) } -- 2.54.1