feat(trial): offer address in the contract overview
GET /v1/tenants/{id}/contracts carries street, postcode, city and
country of the trial offer, so the company profile can suggest the
registration address as the master data (portal#159, item 3; read
by portal#161). Only for the tenant's own activated offer, as the
rest of the trial block.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0f8cc33888
commit
d0b1287afb
2 files changed
+13
No files matched your search
@@ -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())
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user