fix(contracts): TOMs are available once the released TOM is listed #133
No files matched your search
@@ -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" {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user