diff --git a/internal/lpastore/client.go b/internal/lpastore/client.go index 6f40cc398e..2b6f17aa54 100644 --- a/internal/lpastore/client.go +++ b/internal/lpastore/client.go @@ -15,7 +15,7 @@ import ( const ( issuer = "opg.poas.makeregister" statusActive = "active" - statusReplacement = "replacement" + statusInactive = "inactive" statusRemoved = "removed" appointmentTypeOriginal = "original" appointmentTypeReplacement = "replacement" diff --git a/internal/lpastore/client_test.go b/internal/lpastore/client_test.go index 8904b3f981..2ff34278e1 100644 --- a/internal/lpastore/client_test.go +++ b/internal/lpastore/client_test.go @@ -122,7 +122,7 @@ func TestClientServiceContract(t *testing.T) { "country": matchers.String("GB"), }), "channel": matchers.Regex("online", "online|paper"), - "status": matchers.Regex("active", "active|inactive|removed|replacement"), + "status": matchers.Regex("active", "active|inactive|removed"), "appointmentType": matchers.Regex("original", "original|replacement"), }, 1), "trustCorporations": matchers.EachLike(map[string]any{ @@ -138,7 +138,7 @@ func TestClientServiceContract(t *testing.T) { "country": matchers.String("GB"), }), "channel": matchers.Regex("paper", "online|paper"), - "status": matchers.Regex("active", "active|replacement"), + "status": matchers.Regex("active", "active|inactive|removed"), "appointmentType": matchers.Regex("original", "original|replacement"), }, 1), "certificateProvider": matchers.Like(map[string]any{ @@ -287,7 +287,7 @@ func TestClientServiceContract(t *testing.T) { "postcode": matchers.String("A1 1FF"), "country": matchers.String("GB"), }), - "status": matchers.Regex("active", "active|replacement"), + "status": matchers.Regex("active", "active|inactive|removed"), "appointmentType": matchers.Regex("original", "original|replacement"), "channel": matchers.Regex("online", "online|post"), }, 1), diff --git a/internal/lpastore/lpa.go b/internal/lpastore/lpa.go index 2e1445cfa9..429c371059 100644 --- a/internal/lpastore/lpa.go +++ b/internal/lpastore/lpa.go @@ -217,7 +217,7 @@ func (c *Client) SendLpa(ctx context.Context, donor *donordata.Provided) error { DateOfBirth: attorney.DateOfBirth, Email: attorney.Email, Address: attorney.Address, - Status: statusReplacement, + Status: statusInactive, AppointmentType: appointmentTypeReplacement, Channel: attorney.Channel(), }) @@ -230,7 +230,7 @@ func (c *Client) SendLpa(ctx context.Context, donor *donordata.Provided) error { CompanyNumber: trustCorporation.CompanyNumber, Email: trustCorporation.Email, Address: trustCorporation.Address, - Status: statusReplacement, + Status: statusInactive, AppointmentType: appointmentTypeReplacement, Channel: trustCorporation.Channel(), }) @@ -393,10 +393,6 @@ func lpaResponseToLpa(l lpaResponse) *lpadata.Lpa { } for _, a := range l.Attorneys { - if a.Status == "inactive" { - continue - } - at := lpadata.Attorney{ UID: a.UID, FirstNames: a.FirstNames, @@ -419,10 +415,6 @@ func lpaResponseToLpa(l lpaResponse) *lpadata.Lpa { } for _, t := range l.TrustCorporations { - if t.Status == "inactive" { - continue - } - tc := lpadata.TrustCorporation{ UID: t.UID, Name: t.Name, diff --git a/internal/lpastore/lpa_test.go b/internal/lpastore/lpa_test.go index 1906f0b34b..ebbd8c14ed 100644 --- a/internal/lpastore/lpa_test.go +++ b/internal/lpastore/lpa_test.go @@ -284,12 +284,12 @@ func TestClientSendLpa(t *testing.T) { "attorneys":[ {"uid":"` + attorneyUID.String() + `","firstNames":"Adam","lastName":"Attorney","dateOfBirth":"1999-01-02","email":"adam@example.com","address":{"line1":"a-line-1","line2":"a-line-2","line3":"a-line-3","town":"a-town","postcode":"A1 1FF","country":"GB"},"appointmentType":"original","status":"active","channel":"online"}, {"uid":"` + attorney2UID.String() + `","firstNames":"Alice","lastName":"Attorney","dateOfBirth":"1998-01-02","address":{"line1":"aa-line-1","line2":"aa-line-2","line3":"aa-line-3","town":"aa-town","postcode":"A1 1AF","country":"GB"},"appointmentType":"original","status":"active","channel":"paper"}, -{"uid":"` + replacementAttorneyUID.String() + `","firstNames":"Richard","lastName":"Attorney","dateOfBirth":"1999-11-12","email":"richard@example.com","address":{"line1":"r-line-1","line2":"r-line-2","line3":"r-line-3","town":"r-town","postcode":"R1 1FF","country":"GB"},"appointmentType":"replacement","status":"replacement","channel":"online"}, -{"uid":"` + replacementAttorney2UID.String() + `","firstNames":"Rachel","lastName":"Attorney","dateOfBirth":"1998-11-12","email":"rachel@example.com","address":{"line1":"rr-line-1","line2":"rr-line-2","line3":"rr-line-3","town":"rr-town","postcode":"R1 1RF","country":"GB"},"appointmentType":"replacement","status":"replacement","channel":"online"} +{"uid":"` + replacementAttorneyUID.String() + `","firstNames":"Richard","lastName":"Attorney","dateOfBirth":"1999-11-12","email":"richard@example.com","address":{"line1":"r-line-1","line2":"r-line-2","line3":"r-line-3","town":"r-town","postcode":"R1 1FF","country":"GB"},"appointmentType":"replacement","status":"inactive","channel":"online"}, +{"uid":"` + replacementAttorney2UID.String() + `","firstNames":"Rachel","lastName":"Attorney","dateOfBirth":"1998-11-12","email":"rachel@example.com","address":{"line1":"rr-line-1","line2":"rr-line-2","line3":"rr-line-3","town":"rr-town","postcode":"R1 1RF","country":"GB"},"appointmentType":"replacement","status":"inactive","channel":"online"} ], "trustCorporations":[ {"uid":"` + trustCorporationUID.String() + `","name":"Trusty","companyNumber":"55555","email":"trusty@example.com","address":{"line1":"a-line-1","line2":"a-line-2","line3":"a-line-3","town":"a-town","postcode":"A1 1FF","country":"GB"},"appointmentType":"original","status":"active","channel":"online"}, -{"uid":"` + replacementTrustCorporationUID.String() + `","name":"UnTrusty","companyNumber":"65555","address":{"line1":"a-line-1","line2":"a-line-2","line3":"a-line-3","town":"a-town","postcode":"A1 1FF","country":"GB"},"appointmentType":"replacement","status":"replacement","channel":"paper"} +{"uid":"` + replacementTrustCorporationUID.String() + `","name":"UnTrusty","companyNumber":"65555","address":{"line1":"a-line-1","line2":"a-line-2","line3":"a-line-3","town":"a-town","postcode":"A1 1FF","country":"GB"},"appointmentType":"replacement","status":"inactive","channel":"paper"} ], "certificateProvider":{"uid":"` + certificateProviderUID.String() + `","firstNames":"Carol","lastName":"Cert","email":"carol@example.com","phone":"0700009000","address":{"line1":"c-line-1","line2":"c-line-2","line3":"c-line-3","town":"c-town","postcode":"C1 1FF","country":"GB"},"channel":"online"}, "peopleToNotify":[{"uid":"` + personToNotifyUID.String() + `","firstNames":"Peter","lastName":"Notify","address":{"line1":"p-line-1","line2":"p-line-2","line3":"p-line-3","town":"p-town","postcode":"P1 1FF","country":"GB"}}], @@ -875,10 +875,8 @@ func TestClientLpas(t *testing.T) { donorUID, _ := actoruid.Parse("6178e739-76b0-426e-b9c4-e45be426fbdf") trustCorporationUID := actoruid.New() - trustCorporation2UID := actoruid.New() attorneyUID := actoruid.New() attorney2UID := actoruid.New() - attorney3UID := actoruid.New() replacementTrustCorporationUID := actoruid.New() replacementAttorneyUID := actoruid.New() replacementAttorney2UID := actoruid.New() @@ -1116,13 +1114,11 @@ func TestClientLpas(t *testing.T) { "attorneys":[ {"uid":"` + attorneyUID.String() + `","firstNames":"Adam","lastName":"Attorney","dateOfBirth":"1999-01-02","email":"adam@example.com","address":{"line1":"a-line-1","line2":"a-line-2","line3":"a-line-3","town":"a-town","postcode":"A1 1FF","country":"GB"},"status":"active","appointmentType":"original"}, {"uid":"` + attorney2UID.String() + `","firstNames":"Alice","lastName":"Attorney","dateOfBirth":"1998-01-02","email":"alice@example.com","address":{"line1":"aa-line-1","line2":"aa-line-2","line3":"aa-line-3","town":"aa-town","postcode":"A1 1AF","country":"GB"},"status":"removed","appointmentType":"original"}, -{"uid":"` + attorney3UID.String() + `","firstNames":"Alice","lastName":"Attorney","dateOfBirth":"1998-01-02","email":"alice@example.com","address":{"line1":"aa-line-1","line2":"aa-line-2","line3":"aa-line-3","town":"aa-town","postcode":"A1 1AF","country":"GB"},"status":"inactive","appointmentType":"original"}, {"uid":"` + replacementAttorneyUID.String() + `","firstNames":"Richard","lastName":"Attorney","dateOfBirth":"1999-11-12","email":"richard@example.com","address":{"line1":"r-line-1","line2":"r-line-2","line3":"r-line-3","town":"r-town","postcode":"R1 1FF","country":"GB"},"status":"replacement","appointmentType":"replacement"}, {"uid":"` + replacementAttorney2UID.String() + `","firstNames":"Rachel","lastName":"Attorney","dateOfBirth":"1998-11-12","email":"rachel@example.com","address":{"line1":"rr-line-1","line2":"rr-line-2","line3":"rr-line-3","town":"rr-town","postcode":"R1 1RF","country":"GB"},"status":"replacement","appointmentType":"replacement"} ], "trustCorporations":[ {"uid":"` + trustCorporationUID.String() + `","name":"Trusty","companyNumber":"55555","email":"trusty@example.com","address":{"line1":"a-line-1","line2":"a-line-2","line3":"a-line-3","town":"a-town","postcode":"A1 1FF","country":"GB"},"status":"active","appointmentType":"original"}, -{"uid":"` + trustCorporation2UID.String() + `","name":"Trusty","companyNumber":"55555","email":"trusty@example.com","address":{"line1":"a-line-1","line2":"a-line-2","line3":"a-line-3","town":"a-town","postcode":"A1 1FF","country":"GB"},"status":"inactive","appointmentType":"original"}, {"uid":"` + replacementTrustCorporationUID.String() + `","name":"UnTrusty","companyNumber":"65555","email":"untrusty@example.com","address":{"line1":"a-line-1","line2":"a-line-2","line3":"a-line-3","town":"a-town","postcode":"A1 1FF","country":"GB"},"status":"removed","appointmentType":"replacement"} ], "certificateProvider":{"uid":"` + certificateProviderUID.String() + `","firstNames":"Carol","lastName":"Cert","email":"carol@example.com","phone":"0700009000","address":{"line1":"c-line-1","line2":"c-line-2","line3":"c-line-3","town":"c-town","postcode":"C1 1FF","country":"GB"},"channel":"online"},