diff --git a/internal/actor/actor.go b/internal/actor/actor.go new file mode 100644 index 0000000000..f2a6f053a7 --- /dev/null +++ b/internal/actor/actor.go @@ -0,0 +1,10 @@ +package actor + +import "github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid" + +type Actor struct { + Type Type + UID actoruid.UID + FirstNames string + LastName string +} diff --git a/internal/donor/donordata/provided.go b/internal/donor/donordata/provided.go index 44d7cd023b..b3177b7d3d 100644 --- a/internal/donor/donordata/provided.go +++ b/internal/donor/donordata/provided.go @@ -3,6 +3,7 @@ package donordata import ( "errors" + "iter" "slices" "strings" "time" @@ -412,3 +413,80 @@ func (l *Provided) CertificateProviderSharesDetails() bool { return false } + +// Actors returns an iterator over all human actors named on the LPA (i.e. this +// excludes trust corporations, the correspondent, and the voucher). +func (l *Provided) Actors() iter.Seq[actor.Actor] { + return func(yield func(actor.Actor) bool) { + if !yield(actor.Actor{ + Type: actor.TypeDonor, + UID: l.Donor.UID, + FirstNames: l.Donor.FirstNames, + LastName: l.Donor.LastName, + }) { + return + } + + if !yield(actor.Actor{ + Type: actor.TypeCertificateProvider, + UID: l.CertificateProvider.UID, + FirstNames: l.CertificateProvider.FirstNames, + LastName: l.CertificateProvider.LastName, + }) { + return + } + + for _, attorney := range l.Attorneys.Attorneys { + if !yield(actor.Actor{ + Type: actor.TypeAttorney, + UID: attorney.UID, + FirstNames: attorney.FirstNames, + LastName: attorney.LastName, + }) { + return + } + } + + for _, attorney := range l.ReplacementAttorneys.Attorneys { + if !yield(actor.Actor{ + Type: actor.TypeReplacementAttorney, + UID: attorney.UID, + FirstNames: attorney.FirstNames, + LastName: attorney.LastName, + }) { + return + } + } + + for _, person := range l.PeopleToNotify { + if !yield(actor.Actor{ + Type: actor.TypePersonToNotify, + UID: person.UID, + FirstNames: person.FirstNames, + LastName: person.LastName, + }) { + return + } + } + + if l.AuthorisedSignatory.FirstNames != "" { + if !yield(actor.Actor{ + Type: actor.TypeAuthorisedSignatory, + FirstNames: l.AuthorisedSignatory.FirstNames, + LastName: l.AuthorisedSignatory.LastName, + }) { + return + } + } + + if l.IndependentWitness.FirstNames != "" { + if !yield(actor.Actor{ + Type: actor.TypeIndependentWitness, + FirstNames: l.IndependentWitness.FirstNames, + LastName: l.IndependentWitness.LastName, + }) { + return + } + } + } +} diff --git a/internal/donor/donordata/donor_provided_test.go b/internal/donor/donordata/provided_test.go similarity index 79% rename from internal/donor/donordata/donor_provided_test.go rename to internal/donor/donordata/provided_test.go index 2cb0964d41..748aa7533d 100644 --- a/internal/donor/donordata/donor_provided_test.go +++ b/internal/donor/donordata/provided_test.go @@ -4,7 +4,8 @@ import ( "fmt" "testing" "time" - +"slices" + "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" "github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid" "github.com/ministryofjustice/opg-modernising-lpa/internal/date" @@ -39,7 +40,7 @@ func TestGenerateHash(t *testing.T) { // DO NOT change these initial hash values. If a field has been added/removed // you will need to handle the version gracefully by modifying - // (*DonorProvidedDetails).HashInclude and adding another testcase for the new + // (*Provided).HashInclude and adding another testcase for the new // version. testcases := map[uint8]uint64{ 0: 0x4748f866664816f4, @@ -353,3 +354,104 @@ func TestNamesChanged(t *testing.T) { assert.False(t, donor.NamesChanged("a", "b", "c")) } + +func TestProvidedActors(t *testing.T) { + lpa := &Provided{ + Donor: Donor{ + UID: actoruid.New(), + FirstNames: "Sam", + LastName: "Smith", + }, + CertificateProvider: CertificateProvider{ + UID: actoruid.New(), + FirstNames: "Charlie", + LastName: "Cooper", + }, + Attorneys: Attorneys{ + Attorneys: []Attorney{{ + UID: actoruid.New(), + FirstNames: "Alan", + LastName: "Attorney", + }, { + UID: actoruid.New(), + FirstNames: "Angela", + LastName: "Attorney", + }}, + TrustCorporation: TrustCorporation{Name: "Trusty"}, + }, + ReplacementAttorneys: Attorneys{ + Attorneys: []Attorney{{ + UID: actoruid.New(), + FirstNames: "Richard", + LastName: "Replacement", + }, { + UID: actoruid.New(), + FirstNames: "Rachel", + LastName: "Replacement", + }}, + TrustCorporation: TrustCorporation{Name: "Untrusty"}, + }, + PeopleToNotify: []PersonToNotify{{ + UID: actoruid.New(), + FirstNames: "Peter", + LastName: "Person", + }}, + AuthorisedSignatory: AuthorisedSignatory{ + FirstNames: "Arthur", + LastName: "Signor", + }, + IndependentWitness: IndependentWitness{ + FirstNames: "Independent", + LastName: "Wit", + }, + Correspondent: Correspondent{FirstNames: "Nope"}, + Voucher: Voucher{FirstNames: "Nada"}, + } + + actors := slices.Collect(lpa.Actors()) + + assert.Equal(t, []actor.Actor{{ + Type: actor.TypeDonor, + UID: lpa.Donor.UID, + FirstNames: "Sam", + LastName: "Smith", + }, { + Type: actor.TypeCertificateProvider, + UID: lpa.CertificateProvider.UID, + FirstNames: "Charlie", + LastName: "Cooper", + }, { + Type: actor.TypeAttorney, + UID: lpa.Attorneys.Attorneys[0].UID, + FirstNames: "Alan", + LastName: "Attorney", + }, { + Type: actor.TypeAttorney, + UID: lpa.Attorneys.Attorneys[1].UID, + FirstNames: "Angela", + LastName: "Attorney", + }, { + Type: actor.TypeReplacementAttorney, + UID: lpa.ReplacementAttorneys.Attorneys[0].UID, + FirstNames: "Richard", + LastName: "Replacement", + }, { + Type: actor.TypeReplacementAttorney, + UID: lpa.ReplacementAttorneys.Attorneys[1].UID, + FirstNames: "Rachel", + LastName: "Replacement", + }, { + Type: actor.TypePersonToNotify, + UID: lpa.PeopleToNotify[0].UID, + FirstNames: "Peter", + LastName: "Person", + },{ + Type: actor.TypeAuthorisedSignatory, + FirstNames: "Arthur", + LastName: "Signor", + }, { + Type: actor.TypeIndependentWitness, + FirstNames: "Independent", + LastName: "Wit", + }}, actors) +} diff --git a/internal/donor/donorpage/certificate_provider_details.go b/internal/donor/donorpage/certificate_provider_details.go index 32522cc81f..e23b1150e4 100644 --- a/internal/donor/donorpage/certificate_provider_details.go +++ b/internal/donor/donorpage/certificate_provider_details.go @@ -134,29 +134,14 @@ func certificateProviderMatches(donor *donordata.Provided, firstNames, lastName return actor.TypeNone } - if strings.EqualFold(donor.Donor.FirstNames, firstNames) && strings.EqualFold(donor.Donor.LastName, lastName) { - return actor.TypeDonor - } - - for _, attorney := range donor.Attorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeAttorney - } - } - - for _, attorney := range donor.ReplacementAttorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeReplacementAttorney + for person := range donor.Actors() { + if !person.Type.IsCertificateProvider() && + !person.Type.IsPersonToNotify() && + strings.EqualFold(person.FirstNames, firstNames) && + strings.EqualFold(person.LastName, lastName) { + return person.Type } } - if strings.EqualFold(donor.AuthorisedSignatory.FirstNames, firstNames) && strings.EqualFold(donor.AuthorisedSignatory.LastName, lastName) { - return actor.TypeAuthorisedSignatory - } - - if strings.EqualFold(donor.IndependentWitness.FirstNames, firstNames) && strings.EqualFold(donor.IndependentWitness.LastName, lastName) { - return actor.TypeIndependentWitness - } - return actor.TypeNone } diff --git a/internal/donor/donorpage/choose_attorneys.go b/internal/donor/donorpage/choose_attorneys.go index 5abd3cb375..15b1e2cff7 100644 --- a/internal/donor/donorpage/choose_attorneys.go +++ b/internal/donor/donorpage/choose_attorneys.go @@ -173,40 +173,14 @@ func attorneyMatches(donor *donordata.Provided, uid actoruid.UID, firstNames, la return actor.TypeNone } - if strings.EqualFold(donor.Donor.FirstNames, firstNames) && strings.EqualFold(donor.Donor.LastName, lastName) { - return actor.TypeDonor - } - - for _, attorney := range donor.Attorneys.Attorneys { - if attorney.UID != uid && strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeAttorney - } - } - - for _, attorney := range donor.ReplacementAttorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeReplacementAttorney - } - } - - if strings.EqualFold(donor.CertificateProvider.FirstNames, firstNames) && strings.EqualFold(donor.CertificateProvider.LastName, lastName) { - return actor.TypeCertificateProvider - } - - for _, person := range donor.PeopleToNotify { - if strings.EqualFold(person.FirstNames, firstNames) && strings.EqualFold(person.LastName, lastName) { - return actor.TypePersonToNotify + for person := range donor.Actors() { + if !(person.Type.IsAttorney() && person.UID == uid) && + strings.EqualFold(person.FirstNames, firstNames) && + strings.EqualFold(person.LastName, lastName) { + return person.Type } } - if strings.EqualFold(donor.AuthorisedSignatory.FirstNames, firstNames) && strings.EqualFold(donor.AuthorisedSignatory.LastName, lastName) { - return actor.TypeAuthorisedSignatory - } - - if strings.EqualFold(donor.IndependentWitness.FirstNames, firstNames) && strings.EqualFold(donor.IndependentWitness.LastName, lastName) { - return actor.TypeIndependentWitness - } - return actor.TypeNone } diff --git a/internal/donor/donorpage/choose_people_to_notify.go b/internal/donor/donorpage/choose_people_to_notify.go index 2e1a4ce41b..e3463d0bc6 100644 --- a/internal/donor/donorpage/choose_people_to_notify.go +++ b/internal/donor/donorpage/choose_people_to_notify.go @@ -124,25 +124,14 @@ func personToNotifyMatches(donor *donordata.Provided, uid actoruid.UID, firstNam return actor.TypeNone } - if strings.EqualFold(donor.Donor.FirstNames, firstNames) && strings.EqualFold(donor.Donor.LastName, lastName) { - return actor.TypeDonor - } - - for _, attorney := range donor.Attorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeAttorney - } - } - - for _, attorney := range donor.ReplacementAttorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeReplacementAttorney - } - } - - for _, person := range donor.PeopleToNotify { - if person.UID != uid && strings.EqualFold(person.FirstNames, firstNames) && strings.EqualFold(person.LastName, lastName) { - return actor.TypePersonToNotify + for person := range donor.Actors() { + if !(person.Type.IsPersonToNotify() && person.UID == uid) && + !person.Type.IsCertificateProvider() && + !person.Type.IsAuthorisedSignatory() && + !person.Type.IsIndependentWitness() && + strings.EqualFold(person.FirstNames, firstNames) && + strings.EqualFold(person.LastName, lastName) { + return person.Type } } diff --git a/internal/donor/donorpage/choose_replacement_attorneys.go b/internal/donor/donorpage/choose_replacement_attorneys.go index 0e523f6f91..f43b1519e9 100644 --- a/internal/donor/donorpage/choose_replacement_attorneys.go +++ b/internal/donor/donorpage/choose_replacement_attorneys.go @@ -101,39 +101,13 @@ func replacementAttorneyMatches(donor *donordata.Provided, uid actoruid.UID, fir return actor.TypeNone } - if strings.EqualFold(donor.Donor.FirstNames, firstNames) && strings.EqualFold(donor.Donor.LastName, lastName) { - return actor.TypeDonor - } - - for _, attorney := range donor.Attorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeAttorney - } - } - - for _, attorney := range donor.ReplacementAttorneys.Attorneys { - if attorney.UID != uid && strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeReplacementAttorney - } - } - - if strings.EqualFold(donor.CertificateProvider.FirstNames, firstNames) && strings.EqualFold(donor.CertificateProvider.LastName, lastName) { - return actor.TypeCertificateProvider - } - - for _, person := range donor.PeopleToNotify { - if strings.EqualFold(person.FirstNames, firstNames) && strings.EqualFold(person.LastName, lastName) { - return actor.TypePersonToNotify + for person := range donor.Actors() { + if !(person.Type.IsReplacementAttorney() && person.UID == uid) && + strings.EqualFold(person.FirstNames, firstNames) && + strings.EqualFold(person.LastName, lastName) { + return person.Type } } - if strings.EqualFold(donor.AuthorisedSignatory.FirstNames, firstNames) && strings.EqualFold(donor.AuthorisedSignatory.LastName, lastName) { - return actor.TypeAuthorisedSignatory - } - - if strings.EqualFold(donor.IndependentWitness.FirstNames, firstNames) && strings.EqualFold(donor.IndependentWitness.LastName, lastName) { - return actor.TypeIndependentWitness - } - return actor.TypeNone } diff --git a/internal/donor/donorpage/your_authorised_signatory.go b/internal/donor/donorpage/your_authorised_signatory.go index 33163671c4..d4063b6085 100644 --- a/internal/donor/donorpage/your_authorised_signatory.go +++ b/internal/donor/donorpage/your_authorised_signatory.go @@ -99,29 +99,14 @@ func signatoryMatches(donor *donordata.Provided, firstNames, lastName string) ac return actor.TypeNone } - if strings.EqualFold(donor.Donor.FirstNames, firstNames) && strings.EqualFold(donor.Donor.LastName, lastName) { - return actor.TypeDonor - } - - for _, attorney := range donor.Attorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeAttorney - } - } - - for _, attorney := range donor.ReplacementAttorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeReplacementAttorney + for person := range donor.Actors() { + if !person.Type.IsAuthorisedSignatory() && + !person.Type.IsPersonToNotify() && + strings.EqualFold(person.FirstNames, firstNames) && + strings.EqualFold(person.LastName, lastName) { + return person.Type } } - if strings.EqualFold(donor.CertificateProvider.FirstNames, firstNames) && strings.EqualFold(donor.CertificateProvider.LastName, lastName) { - return actor.TypeCertificateProvider - } - - if strings.EqualFold(donor.IndependentWitness.FirstNames, firstNames) && strings.EqualFold(donor.IndependentWitness.LastName, lastName) { - return actor.TypeIndependentWitness - } - return actor.TypeNone } diff --git a/internal/donor/donorpage/your_independent_witness.go b/internal/donor/donorpage/your_independent_witness.go index 868cd0e5f8..9a6f1171b1 100644 --- a/internal/donor/donorpage/your_independent_witness.go +++ b/internal/donor/donorpage/your_independent_witness.go @@ -99,29 +99,14 @@ func independentWitnessMatches(donor *donordata.Provided, firstNames, lastName s return actor.TypeNone } - if strings.EqualFold(donor.Donor.FirstNames, firstNames) && strings.EqualFold(donor.Donor.LastName, lastName) { - return actor.TypeDonor - } - - for _, attorney := range donor.Attorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeAttorney - } - } - - for _, attorney := range donor.ReplacementAttorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeReplacementAttorney + for person := range donor.Actors() { + if !person.Type.IsIndependentWitness() && + !person.Type.IsPersonToNotify() && + strings.EqualFold(person.FirstNames, firstNames) && + strings.EqualFold(person.LastName, lastName) { + return person.Type } } - if strings.EqualFold(donor.CertificateProvider.FirstNames, firstNames) && strings.EqualFold(donor.CertificateProvider.LastName, lastName) { - return actor.TypeCertificateProvider - } - - if strings.EqualFold(donor.AuthorisedSignatory.FirstNames, firstNames) && strings.EqualFold(donor.AuthorisedSignatory.LastName, lastName) { - return actor.TypeAuthorisedSignatory - } - return actor.TypeNone } diff --git a/internal/donor/donorpage/your_name.go b/internal/donor/donorpage/your_name.go index 009a7428dc..cb5d02da34 100644 --- a/internal/donor/donorpage/your_name.go +++ b/internal/donor/donorpage/your_name.go @@ -136,35 +136,13 @@ func donorMatches(donor *donordata.Provided, firstNames, lastName string) actor. return actor.TypeNone } - for _, attorney := range donor.Attorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeAttorney + for person := range donor.Actors() { + if !person.Type.IsDonor() && + strings.EqualFold(person.FirstNames, firstNames) && + strings.EqualFold(person.LastName, lastName) { + return person.Type } } - for _, attorney := range donor.ReplacementAttorneys.Attorneys { - if strings.EqualFold(attorney.FirstNames, firstNames) && strings.EqualFold(attorney.LastName, lastName) { - return actor.TypeReplacementAttorney - } - } - - if strings.EqualFold(donor.CertificateProvider.FirstNames, firstNames) && strings.EqualFold(donor.CertificateProvider.LastName, lastName) { - return actor.TypeCertificateProvider - } - - for _, person := range donor.PeopleToNotify { - if strings.EqualFold(person.FirstNames, firstNames) && strings.EqualFold(person.LastName, lastName) { - return actor.TypePersonToNotify - } - } - - if strings.EqualFold(donor.AuthorisedSignatory.FirstNames, firstNames) && strings.EqualFold(donor.AuthorisedSignatory.LastName, lastName) { - return actor.TypeAuthorisedSignatory - } - - if strings.EqualFold(donor.IndependentWitness.FirstNames, firstNames) && strings.EqualFold(donor.IndependentWitness.LastName, lastName) { - return actor.TypeIndependentWitness - } - return actor.TypeNone } diff --git a/internal/lpastore/lpa.go b/internal/lpastore/lpa.go index 8c4d3002b2..6e95376e84 100644 --- a/internal/lpastore/lpa.go +++ b/internal/lpastore/lpa.go @@ -486,9 +486,9 @@ func FromDonorProvidedDetails(l *donordata.Provided) *lpadata.Lpa { } } - var authorisedSignatory lpadata.Actor + var authorisedSignatory actor.Actor if v := l.AuthorisedSignatory; v.FirstNames != "" { - authorisedSignatory = lpadata.Actor{ + authorisedSignatory = actor.Actor{ // TODO: add UID for this actor Type: actor.TypeAuthorisedSignatory, FirstNames: v.FirstNames, @@ -496,9 +496,9 @@ func FromDonorProvidedDetails(l *donordata.Provided) *lpadata.Lpa { } } - var independentWitness lpadata.Actor + var independentWitness actor.Actor if v := l.IndependentWitness; v.FirstNames != "" { - independentWitness = lpadata.Actor{ + independentWitness = actor.Actor{ // TODO: add UID for this actor Type: actor.TypeIndependentWitness, FirstNames: v.FirstNames, diff --git a/internal/lpastore/lpadata/lpa.go b/internal/lpastore/lpadata/lpa.go index 8cad52c252..f045fc62f6 100644 --- a/internal/lpastore/lpadata/lpa.go +++ b/internal/lpastore/lpadata/lpa.go @@ -5,7 +5,6 @@ import ( "time" "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" - "github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid" "github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo" ) @@ -31,8 +30,8 @@ type Lpa struct { Restrictions string WhenCanTheLpaBeUsed CanBeUsedWhen LifeSustainingTreatmentOption LifeSustainingTreatment - AuthorisedSignatory Actor - IndependentWitness Actor + AuthorisedSignatory actor.Actor + IndependentWitness actor.Actor // SignedAt is the date the Donor signed their LPA (and signifies it has been // witnessed by their CertificateProvider) @@ -105,18 +104,11 @@ func (l Lpa) AllAttorneysSigned() bool { return true } -type Actor struct { - Type actor.Type - UID actoruid.UID - FirstNames string - LastName string -} - // Actors returns an iterator over all human actors named on the LPA (i.e. this // excludes trust corporations, the correspondent, and the voucher). -func (l Lpa) Actors() iter.Seq[Actor] { - return func(yield func(Actor) bool) { - if !yield(Actor{ +func (l Lpa) Actors() iter.Seq[actor.Actor] { + return func(yield func(actor.Actor) bool) { + if !yield(actor.Actor{ Type: actor.TypeDonor, UID: l.Donor.UID, FirstNames: l.Donor.FirstNames, @@ -125,7 +117,7 @@ func (l Lpa) Actors() iter.Seq[Actor] { return } - if !yield(Actor{ + if !yield(actor.Actor{ Type: actor.TypeCertificateProvider, UID: l.CertificateProvider.UID, FirstNames: l.CertificateProvider.FirstNames, @@ -135,7 +127,7 @@ func (l Lpa) Actors() iter.Seq[Actor] { } for _, attorney := range l.Attorneys.Attorneys { - if !yield(Actor{ + if !yield(actor.Actor{ Type: actor.TypeAttorney, UID: attorney.UID, FirstNames: attorney.FirstNames, @@ -146,7 +138,7 @@ func (l Lpa) Actors() iter.Seq[Actor] { } for _, attorney := range l.ReplacementAttorneys.Attorneys { - if !yield(Actor{ + if !yield(actor.Actor{ Type: actor.TypeReplacementAttorney, UID: attorney.UID, FirstNames: attorney.FirstNames, @@ -157,7 +149,7 @@ func (l Lpa) Actors() iter.Seq[Actor] { } for _, person := range l.PeopleToNotify { - if !yield(Actor{ + if !yield(actor.Actor{ Type: actor.TypePersonToNotify, UID: person.UID, FirstNames: person.FirstNames, diff --git a/internal/lpastore/lpadata/lpa_test.go b/internal/lpastore/lpadata/lpa_test.go index 1ad709a145..4032155c0c 100644 --- a/internal/lpastore/lpadata/lpa_test.go +++ b/internal/lpastore/lpadata/lpa_test.go @@ -92,8 +92,8 @@ func TestLpaCorrespondentEmailWhenCorrespondentProvided(t *testing.T) { } func TestLpaActors(t *testing.T) { - authorisedSignatory := Actor{UID: actoruid.New()} - independentWitness := Actor{UID: actoruid.New()} + authorisedSignatory := actor.Actor{UID: actoruid.New()} + independentWitness := actor.Actor{UID: actoruid.New()} lpa := &Lpa{ Donor: Donor{ @@ -143,7 +143,7 @@ func TestLpaActors(t *testing.T) { actors := slices.Collect(lpa.Actors()) - assert.Equal(t, []Actor{{ + assert.Equal(t, []actor.Actor{{ Type: actor.TypeDonor, UID: lpa.Donor.UID, FirstNames: "Sam", diff --git a/internal/lpastore/resolving_service.go b/internal/lpastore/resolving_service.go index f1237d1e00..8c4a698f7b 100644 --- a/internal/lpastore/resolving_service.go +++ b/internal/lpastore/resolving_service.go @@ -114,7 +114,7 @@ func (s *ResolvingService) merge(lpa *lpadata.Lpa, donor *donordata.Provided) *l // TODO: remove this once authorised signatory is in lpa-store if lpa.AuthorisedSignatory.FirstNames == "" && donor.AuthorisedSignatory.FirstNames != "" { - lpa.AuthorisedSignatory = lpadata.Actor{ + lpa.AuthorisedSignatory = actor.Actor{ Type: actor.TypeAuthorisedSignatory, FirstNames: donor.AuthorisedSignatory.FirstNames, LastName: donor.AuthorisedSignatory.LastName, @@ -123,7 +123,7 @@ func (s *ResolvingService) merge(lpa *lpadata.Lpa, donor *donordata.Provided) *l // TODO: remove this once independent witness is in lpa-store if lpa.IndependentWitness.FirstNames == "" && donor.IndependentWitness.FirstNames != "" { - lpa.IndependentWitness = lpadata.Actor{ + lpa.IndependentWitness = actor.Actor{ Type: actor.TypeIndependentWitness, FirstNames: donor.IndependentWitness.FirstNames, LastName: donor.IndependentWitness.LastName, diff --git a/internal/lpastore/resolving_service_test.go b/internal/lpastore/resolving_service_test.go index 7c6c54cd78..9d34e13701 100644 --- a/internal/lpastore/resolving_service_test.go +++ b/internal/lpastore/resolving_service_test.go @@ -65,12 +65,12 @@ func TestResolvingServiceGet(t *testing.T) { }, Donor: lpadata.Donor{Channel: lpadata.ChannelOnline}, Correspondent: lpadata.Correspondent{Email: "x"}, - AuthorisedSignatory: lpadata.Actor{ + AuthorisedSignatory: actor.Actor{ Type: actor.TypeAuthorisedSignatory, FirstNames: "A", LastName: "S", }, - IndependentWitness: lpadata.Actor{ + IndependentWitness: actor.Actor{ Type: actor.TypeIndependentWitness, FirstNames: "I", LastName: "W", @@ -128,12 +128,12 @@ func TestResolvingServiceGet(t *testing.T) { TrustCorporation: lpadata.TrustCorporation{Name: "d"}, }, Correspondent: lpadata.Correspondent{Email: "x"}, - AuthorisedSignatory: lpadata.Actor{ + AuthorisedSignatory: actor.Actor{ Type: actor.TypeAuthorisedSignatory, FirstNames: "A", LastName: "S", }, - IndependentWitness: lpadata.Actor{ + IndependentWitness: actor.Actor{ Type: actor.TypeIndependentWitness, FirstNames: "I", LastName: "W",