diff --git a/internal/server/trialoffers.go b/internal/server/trialoffers.go index e497128..0401575 100644 --- a/internal/server/trialoffers.go +++ b/internal/server/trialoffers.go @@ -613,6 +613,12 @@ type trialContract struct { AcceptingPersonName string `json:"accepting_person_name"` AcceptingEmail string `json:"accepting_email"` CompanyName string `json:"company_name"` + // The address the offer was made with, so the company profile can + // suggest it as the master data (portal#159, item 3). + Street string `json:"street"` + Postcode string `json:"postcode"` + City string `json:"city"` + Country string `json:"country"` } type contractStatus struct { @@ -659,6 +665,7 @@ func (s *Server) listTenantContracts(w http.ResponseWriter, r *http.Request) { TrialStartedAt: o.TrialStartedAt, TrialExpiresAt: end, TermsVersion: o.TermsVersion, TermsDate: date, TermsSHA256: o.TermsSHA256, AcceptingPersonName: o.FirstName + " " + o.LastName, AcceptingEmail: o.Email, CompanyName: o.CompanyName, + Street: o.Street, Postcode: o.Postcode, City: o.City, Country: o.Country, } } else if err != nil && !errors.Is(err, store.ErrNotFound) { writeError(w, http.StatusInternalServerError, "internal", err.Error()) diff --git a/internal/server/trialoffers_test.go b/internal/server/trialoffers_test.go index a07432e..f692e9a 100644 --- a/internal/server/trialoffers_test.go +++ b/internal/server/trialoffers_test.go @@ -201,6 +201,12 @@ func TestTrialOffer_offerConfirmActivate(t *testing.T) { c.AVV.Status != "not_concluded" || c.TOMs.Status != "pending" || c.SaaS.Status != "not_concluded" { t.Fatalf("contracts %d %s", resp.StatusCode, raw) } + // the address of the offer, for the company profile's suggestions + for _, want := range []string{`"street":"Hauptstr. 1"`, `"postcode":"78224"`, `"city":"Singen"`, `"country":"DE"`} { + if !strings.Contains(string(raw), want) { + t.Fatalf("contracts lack %s: %s", want, raw) + } + } resp, raw = h.do("GET", "/v1/tenants/"+tn.ID+"/contracts/trial/terms.pdf", nil) if resp.StatusCode != 200 || !bytes.Equal(raw, v.PDF) || !strings.HasPrefix(resp.Header.Get("Content-Disposition"), "attachment") { t.Fatalf("contract pdf %d %v", resp.StatusCode, resp.Header)