diff --git a/cmd/enumerator/main.go b/cmd/enumerator/main.go index 7758105320..59def308b9 100644 --- a/cmd/enumerator/main.go +++ b/cmd/enumerator/main.go @@ -34,6 +34,7 @@ // // func ParseT(string) (T, error) // func (t T) String() string +// func (t T) MarshalText() ([]byte, error) // // and for each value X // @@ -60,11 +61,12 @@ // // enumerator -type=Pill // -// in the same directory will create the file pill_string.go, in package painkiller, +// in the same directory will create the file enum_pill.go, in package painkiller, // containing definitions of // // func ParsePill() (Pill, error) // func (Pill) String() string +// func (Pill) MarshalText() ([]byte, error) // func (Pill) IsPlacebo() bool // func (Pill) IsAspirin() bool // func (Pill) IsIbuprofen() bool @@ -97,9 +99,9 @@ // // PillAspirin // -// a IsAspirin() method would still be generated, painkiller.Aspirin.String() -// would return "Aspirin" and ParsePill("Aspirin") would return -// painkiller.Aspirin. +// an IsAspirin() method would still be generated, +// painkiller.PillAspirin.String() would return "Aspirin" and +// ParsePill("Aspirin") would return painkiller.PillAspirin. // // The -empty flag tells enumerator to generate a method to check whether the // underlying value is 0. This is useful when an enum is defined using iota+1. @@ -309,6 +311,7 @@ func (g *Generator) generate(typeName string) { g.buildMap(runs, typeName) } + g.buildMarshalTextMethod(typeName) g.buildIsMethods(runs, typeName) g.buildParseMethod(runs, typeName) g.buildValues(runs, typeName) @@ -572,6 +575,16 @@ func (g *Generator) createIndexAndNameDecl(run []Value, typeName string, suffix return b.String(), nameConst } +func (g *Generator) buildMarshalTextMethod(typeName string) { + g.Printf(marshalTextMethod, typeName) +} + +const marshalTextMethod = ` +func (i %[1]s) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} +` + func (g *Generator) buildIsMethods(runs [][]Value, typeName string) { for _, values := range runs { for _, value := range values { diff --git a/cmd/enumerator/main_test.go b/cmd/enumerator/main_test.go index f3db532517..8e2186621d 100644 --- a/cmd/enumerator/main_test.go +++ b/cmd/enumerator/main_test.go @@ -80,6 +80,10 @@ func (i Day) String() string { return _Day_name[_Day_index[i]:_Day_index[i+1]] } +func (i Day) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Day) IsMonday() bool { return i == Monday } @@ -187,6 +191,10 @@ func (i Number) String() string { return _Number_name[_Number_index[i]:_Number_index[i+1]] } +func (i Number) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Number) IsOne() bool { return i == One } @@ -279,6 +287,10 @@ func (i Gap) String() string { } } +func (i Gap) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Gap) IsTwo() bool { return i == Two } @@ -391,6 +403,10 @@ func (i Num) String() string { return _Num_name[_Num_index[i]:_Num_index[i+1]] } +func (i Num) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Num) Ism_2() bool { return i == m_2 } @@ -492,6 +508,10 @@ func (i Unum) String() string { } } +func (i Unum) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Unum) Ism0() bool { return i == m0 } @@ -594,6 +614,10 @@ func (i Unumpos) String() string { } } +func (i Unumpos) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Unumpos) Ism1() bool { return i == m1 } @@ -714,6 +738,10 @@ func (i Prime) String() string { return "Prime(" + strconv.FormatInt(int64(i), 10) + ")" } +func (i Prime) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Prime) Isp2() bool { return i == p2 } @@ -868,6 +896,10 @@ func (i Type) String() string { return _Type_name[_Type_index[i]:_Type_index[i+1]] } +func (i Type) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Type) IsInt() bool { return i == TypeInt } @@ -981,6 +1013,10 @@ func (i Token) String() string { return _Token_name[_Token_index[i]:_Token_index[i+1]] } +func (i Token) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Token) IsAnd() bool { return i == And } diff --git a/cypress/e2e/attorney/what-happens-when-you-sign-the-lpa.cy.js b/cypress/e2e/attorney/what-happens-when-you-sign-the-lpa.cy.js index bacb14007f..3d4ec98228 100644 --- a/cypress/e2e/attorney/what-happens-when-you-sign-the-lpa.cy.js +++ b/cypress/e2e/attorney/what-happens-when-you-sign-the-lpa.cy.js @@ -13,7 +13,7 @@ describe('What happens when you sign the LPA', () => { }); it('as a personal welfare attorney', () => { - cy.visit('/fixtures/attorney?redirect=/what-happens-when-you-sign-the-lpa&lpa-type=hw&progress=signedByCertificateProvider'); + cy.visit('/fixtures/attorney?redirect=/what-happens-when-you-sign-the-lpa&lpa-type=personal-welfare&progress=signedByCertificateProvider'); cy.contains('p', "you’re officially saying that you want to be an attorney on") cy.contains('li', "their personal and medical care") @@ -29,7 +29,7 @@ describe('What happens when you sign the LPA', () => { }); it('as a personal welfare replacement attorney', () => { - cy.visit('/fixtures/attorney?redirect=/what-happens-when-you-sign-the-lpa&lpa-type=hw&progress=signedByCertificateProvider&is-replacement=1'); + cy.visit('/fixtures/attorney?redirect=/what-happens-when-you-sign-the-lpa&lpa-type=personal-welfare&progress=signedByCertificateProvider&is-replacement=1'); cy.contains('p', "you’re saying that you want to be a replacement attorney ") cy.contains('li', "their personal and medical care") diff --git a/cypress/e2e/donor/check-your-lpa.cy.js b/cypress/e2e/donor/check-your-lpa.cy.js index e452db9d83..44adf48097 100644 --- a/cypress/e2e/donor/check-your-lpa.cy.js +++ b/cypress/e2e/donor/check-your-lpa.cy.js @@ -4,7 +4,7 @@ describe('Check the LPA', () => { }); it('cannot change when personal welfare LPA can be used', () => { - cy.visit('/fixtures?redirect=/check-your-lpa&progress=peopleToNotifyAboutYourLpa&lpa-type=hw'); + cy.visit('/fixtures?redirect=/check-your-lpa&progress=peopleToNotifyAboutYourLpa&lpa-type=personal-welfare'); cy.contains('.govuk-summary-list__row', 'When your attorneys can use your LPA') .contains('Only when I do not have mental capacity') diff --git a/cypress/e2e/donor/how-should-attorneys-make-decisions.cy.js b/cypress/e2e/donor/how-should-attorneys-make-decisions.cy.js index 506e51feaa..275f167f84 100644 --- a/cypress/e2e/donor/how-should-attorneys-make-decisions.cy.js +++ b/cypress/e2e/donor/how-should-attorneys-make-decisions.cy.js @@ -19,7 +19,7 @@ describe('How should attorneys make decisions', () => { it('can choose how attorneys act - Jointly for some decisions, and jointly and severally for other decisions', () => { cy.contains('h1', 'How should your attorneys make decisions?'); - cy.get('input[name="decision-type"]').check('mixed'); + cy.get('input[name="decision-type"]').check('jointly-for-some-severally-for-others'); cy.get('#f-mixed-details').type('some details on attorneys'); cy.contains('button', 'Save and continue').click(); @@ -38,7 +38,7 @@ describe('How should attorneys make decisions', () => { }); it('errors when details empty', () => { - cy.get('input[name="decision-type"]').check('mixed'); + cy.get('input[name="decision-type"]').check('jointly-for-some-severally-for-others'); cy.contains('button', 'Save and continue').click(); cy.get('.govuk-error-summary').within(() => { diff --git a/cypress/e2e/donor/how-should-replacement-attorneys-make-decisions.cy.js b/cypress/e2e/donor/how-should-replacement-attorneys-make-decisions.cy.js index 73b4bff788..de4d48afb5 100644 --- a/cypress/e2e/donor/how-should-replacement-attorneys-make-decisions.cy.js +++ b/cypress/e2e/donor/how-should-replacement-attorneys-make-decisions.cy.js @@ -17,7 +17,7 @@ describe('How should replacement attorneys make decisions', () => { }); it('can choose how replacement attorneys act - Jointly for some decisions, and jointly and severally for other decisions', () => { - cy.get('input[name="decision-type"]').check('mixed'); + cy.get('input[name="decision-type"]').check('jointly-for-some-severally-for-others'); cy.get('#f-mixed-details').type('some details on attorneys'); cy.contains('button', 'Save and continue').click(); @@ -36,7 +36,7 @@ describe('How should replacement attorneys make decisions', () => { }); it('errors when details empty', () => { - cy.get('input[name="decision-type"]').check('mixed'); + cy.get('input[name="decision-type"]').check('jointly-for-some-severally-for-others'); cy.contains('button', 'Save and continue').click(); cy.get('.govuk-error-summary').within(() => { diff --git a/cypress/e2e/donor/how-should-replacement-attorneys-step-in.cy.js b/cypress/e2e/donor/how-should-replacement-attorneys-step-in.cy.js index a9437ebbd1..f6a9d804eb 100644 --- a/cypress/e2e/donor/how-should-replacement-attorneys-step-in.cy.js +++ b/cypress/e2e/donor/how-should-replacement-attorneys-step-in.cy.js @@ -9,7 +9,7 @@ describe('How should replacement attorneys step in', () => { // see https://github.com/alphagov/govuk-frontend/issues/979 cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); - cy.get('input[name="when-to-step-in"]').check('one'); + cy.get('input[name="when-to-step-in"]').check('one-can-no-longer-act'); cy.contains('button', 'Save and continue').click(); @@ -19,7 +19,7 @@ describe('How should replacement attorneys step in', () => { }); it('can choose how replacement attorneys step in - some other way', () => { - cy.get('input[name="when-to-step-in"]').check('other'); + cy.get('input[name="when-to-step-in"]').check('another-way'); cy.get('#f-other-details').type('some details on when to step in'); cy.contains('button', 'Save and continue').click(); @@ -38,7 +38,7 @@ describe('How should replacement attorneys step in', () => { }); it('errors when other and details empty', () => { - cy.get('input[name="when-to-step-in"]').check('other'); + cy.get('input[name="when-to-step-in"]').check('another-way'); cy.contains('button', 'Save and continue').click(); cy.get('.govuk-error-summary').within(() => { diff --git a/cypress/e2e/donor/life-sustaining-treatment.cy.js b/cypress/e2e/donor/life-sustaining-treatment.cy.js index 17b3e08837..1a56a15541 100644 --- a/cypress/e2e/donor/life-sustaining-treatment.cy.js +++ b/cypress/e2e/donor/life-sustaining-treatment.cy.js @@ -1,6 +1,6 @@ describe('Life sustaining treatment', () => { beforeEach(() => { - cy.visit('/fixtures?redirect=/life-sustaining-treatment&lpa-type=hw'); + cy.visit('/fixtures?redirect=/life-sustaining-treatment&lpa-type=personal-welfare'); }); it('can be agreed to', () => { diff --git a/cypress/e2e/donor/lpa-type.cy.js b/cypress/e2e/donor/lpa-type.cy.js index c81c261a2b..82edab9f3a 100644 --- a/cypress/e2e/donor/lpa-type.cy.js +++ b/cypress/e2e/donor/lpa-type.cy.js @@ -2,7 +2,7 @@ describe('LPA type', () => { it('can be submitted', () => { cy.visit('/fixtures?redirect=/lpa-type&progress=provideYourDetails'); - cy.get('#f-lpa-type').check('pfa'); + cy.get('#f-lpa-type').check('property-and-affairs'); cy.checkA11yApp(); diff --git a/cypress/e2e/donor/provide-your-details.cy.js b/cypress/e2e/donor/provide-your-details.cy.js index 016184bbae..e5781c4b4b 100644 --- a/cypress/e2e/donor/provide-your-details.cy.js +++ b/cypress/e2e/donor/provide-your-details.cy.js @@ -21,7 +21,7 @@ describe('Provide your details', () => { cy.get('[name="language-preference"]').check('en') cy.contains('button', 'Save and continue').click() - cy.get('#f-lpa-type').check('pfa'); + cy.get('#f-lpa-type').check('property-and-affairs'); cy.contains('button', 'Continue').click(); cy.url() diff --git a/cypress/e2e/donor/want-replacement-attorneys.cy.js b/cypress/e2e/donor/want-replacement-attorneys.cy.js index 0cfc5f1828..86ab18615f 100644 --- a/cypress/e2e/donor/want-replacement-attorneys.cy.js +++ b/cypress/e2e/donor/want-replacement-attorneys.cy.js @@ -13,7 +13,7 @@ describe('Do you want replacement attorneys', () => { }); it('wants replacement attorneys - acting jointly for some and severally for others', () => { - cy.visit('/fixtures?redirect=/do-you-want-replacement-attorneys&progress=chooseYourAttorneys&attorneys=mixed'); + cy.visit('/fixtures?redirect=/do-you-want-replacement-attorneys&progress=chooseYourAttorneys&attorneys=jointly-for-some-severally-for-others'); cy.get('div.govuk-warning-text').should('contain', 'You appointed your attorneys to act jointly for some decisions, and jointly and severally for others.') diff --git a/internal/actor/attorney_decisions.go b/internal/actor/attorney_decisions.go index c0fcb35a36..a041ab4588 100644 --- a/internal/actor/attorney_decisions.go +++ b/internal/actor/attorney_decisions.go @@ -14,7 +14,7 @@ const ( // JointlyForSomeSeverallyForOthers indicates attorneys or replacement // attorneys should act jointly for some decisions, and jointly and severally // for other decisions - JointlyForSomeSeverallyForOthers // mixed + JointlyForSomeSeverallyForOthers // jointly-for-some-severally-for-others ) // AttorneyDecisions contains details about how an attorney or replacement attorney should act, provided by the applicant diff --git a/internal/actor/donor_provided.go b/internal/actor/donor_provided.go index dc097b1134..daaffd9adb 100644 --- a/internal/actor/donor_provided.go +++ b/internal/actor/donor_provided.go @@ -18,8 +18,8 @@ type DonorTasks struct { YourDetails TaskState ChooseAttorneys TaskState ChooseReplacementAttorneys TaskState - WhenCanTheLpaBeUsed TaskState // pfa only - LifeSustainingTreatment TaskState // hw only + WhenCanTheLpaBeUsed TaskState // property and affairs only + LifeSustainingTreatment TaskState // personal welfare only Restrictions TaskState CertificateProvider TaskState CheckYourLpa TaskState diff --git a/internal/actor/enum_attorneysact.go b/internal/actor/enum_attorneysact.go index 30b831cd2f..2760f36b7b 100644 --- a/internal/actor/enum_attorneysact.go +++ b/internal/actor/enum_attorneysact.go @@ -15,9 +15,9 @@ func _() { _ = x[JointlyForSomeSeverallyForOthers-3] } -const _AttorneysAct_name = "jointlyjointly-and-severallymixed" +const _AttorneysAct_name = "jointlyjointly-and-severallyjointly-for-some-severally-for-others" -var _AttorneysAct_index = [...]uint8{0, 7, 28, 33} +var _AttorneysAct_index = [...]uint8{0, 7, 28, 65} func (i AttorneysAct) String() string { i -= 1 @@ -27,6 +27,10 @@ func (i AttorneysAct) String() string { return _AttorneysAct_name[_AttorneysAct_index[i]:_AttorneysAct_index[i+1]] } +func (i AttorneysAct) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i AttorneysAct) IsJointly() bool { return i == Jointly } @@ -45,7 +49,7 @@ func ParseAttorneysAct(s string) (AttorneysAct, error) { return Jointly, nil case "jointly-and-severally": return JointlyAndSeverally, nil - case "mixed": + case "jointly-for-some-severally-for-others": return JointlyForSomeSeverallyForOthers, nil default: return AttorneysAct(0), fmt.Errorf("invalid AttorneysAct '%s'", s) diff --git a/internal/actor/enum_canbeusedwhen.go b/internal/actor/enum_canbeusedwhen.go index 425a07cde1..4100bd682c 100644 --- a/internal/actor/enum_canbeusedwhen.go +++ b/internal/actor/enum_canbeusedwhen.go @@ -26,6 +26,10 @@ func (i CanBeUsedWhen) String() string { return _CanBeUsedWhen_name[_CanBeUsedWhen_index[i]:_CanBeUsedWhen_index[i+1]] } +func (i CanBeUsedWhen) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i CanBeUsedWhen) IsUnknown() bool { return i == CanBeUsedWhenUnknown } diff --git a/internal/actor/enum_certificateprovidercarryoutby.go b/internal/actor/enum_certificateprovidercarryoutby.go index 99293b65af..b15a2507ab 100644 --- a/internal/actor/enum_certificateprovidercarryoutby.go +++ b/internal/actor/enum_certificateprovidercarryoutby.go @@ -26,6 +26,10 @@ func (i CertificateProviderCarryOutBy) String() string { return _CertificateProviderCarryOutBy_name[_CertificateProviderCarryOutBy_index[i]:_CertificateProviderCarryOutBy_index[i+1]] } +func (i CertificateProviderCarryOutBy) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i CertificateProviderCarryOutBy) IsPaper() bool { return i == Paper } diff --git a/internal/actor/enum_certificateproviderrelationship.go b/internal/actor/enum_certificateproviderrelationship.go index bbcf6bb747..3514f53002 100644 --- a/internal/actor/enum_certificateproviderrelationship.go +++ b/internal/actor/enum_certificateproviderrelationship.go @@ -26,6 +26,10 @@ func (i CertificateProviderRelationship) String() string { return _CertificateProviderRelationship_name[_CertificateProviderRelationship_index[i]:_CertificateProviderRelationship_index[i+1]] } +func (i CertificateProviderRelationship) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i CertificateProviderRelationship) IsPersonally() bool { return i == Personally } diff --git a/internal/actor/enum_certificateproviderrelationshiplength.go b/internal/actor/enum_certificateproviderrelationshiplength.go index f4ddc2608c..19c5ffd976 100644 --- a/internal/actor/enum_certificateproviderrelationshiplength.go +++ b/internal/actor/enum_certificateproviderrelationshiplength.go @@ -26,6 +26,10 @@ func (i CertificateProviderRelationshipLength) String() string { return _CertificateProviderRelationshipLength_name[_CertificateProviderRelationshipLength_index[i]:_CertificateProviderRelationshipLength_index[i+1]] } +func (i CertificateProviderRelationshipLength) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i CertificateProviderRelationshipLength) IsRelationshipLengthUnknown() bool { return i == RelationshipLengthUnknown } diff --git a/internal/actor/enum_lifesustainingtreatment.go b/internal/actor/enum_lifesustainingtreatment.go index f01553979f..e909fd548b 100644 --- a/internal/actor/enum_lifesustainingtreatment.go +++ b/internal/actor/enum_lifesustainingtreatment.go @@ -26,6 +26,10 @@ func (i LifeSustainingTreatment) String() string { return _LifeSustainingTreatment_name[_LifeSustainingTreatment_index[i]:_LifeSustainingTreatment_index[i+1]] } +func (i LifeSustainingTreatment) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i LifeSustainingTreatment) IsOptionA() bool { return i == LifeSustainingTreatmentOptionA } diff --git a/internal/actor/enum_lpatype.go b/internal/actor/enum_lpatype.go index 49ef536c63..1e85d7472e 100644 --- a/internal/actor/enum_lpatype.go +++ b/internal/actor/enum_lpatype.go @@ -10,13 +10,13 @@ func _() { // An "invalid array index" compiler error signifies that the constant values have changed. // Re-run the stringer command to generate them again. var x [1]struct{} - _ = x[LpaTypeHealthWelfare-1] - _ = x[LpaTypePropertyFinance-2] + _ = x[LpaTypePersonalWelfare-1] + _ = x[LpaTypePropertyAndAffairs-2] } -const _LpaType_name = "hwpfa" +const _LpaType_name = "personal-welfareproperty-and-affairs" -var _LpaType_index = [...]uint8{0, 2, 5} +var _LpaType_index = [...]uint8{0, 16, 36} func (i LpaType) String() string { i -= 1 @@ -26,33 +26,37 @@ func (i LpaType) String() string { return _LpaType_name[_LpaType_index[i]:_LpaType_index[i+1]] } -func (i LpaType) IsHealthWelfare() bool { - return i == LpaTypeHealthWelfare +func (i LpaType) MarshalText() ([]byte, error) { + return []byte(i.String()), nil } -func (i LpaType) IsPropertyFinance() bool { - return i == LpaTypePropertyFinance +func (i LpaType) IsPersonalWelfare() bool { + return i == LpaTypePersonalWelfare +} + +func (i LpaType) IsPropertyAndAffairs() bool { + return i == LpaTypePropertyAndAffairs } func ParseLpaType(s string) (LpaType, error) { switch s { - case "hw": - return LpaTypeHealthWelfare, nil - case "pfa": - return LpaTypePropertyFinance, nil + case "personal-welfare": + return LpaTypePersonalWelfare, nil + case "property-and-affairs": + return LpaTypePropertyAndAffairs, nil default: return LpaType(0), fmt.Errorf("invalid LpaType '%s'", s) } } type LpaTypeOptions struct { - HealthWelfare LpaType - PropertyFinance LpaType + PersonalWelfare LpaType + PropertyAndAffairs LpaType } var LpaTypeValues = LpaTypeOptions{ - HealthWelfare: LpaTypeHealthWelfare, - PropertyFinance: LpaTypePropertyFinance, + PersonalWelfare: LpaTypePersonalWelfare, + PropertyAndAffairs: LpaTypePropertyAndAffairs, } func (i LpaType) Empty() bool { diff --git a/internal/actor/enum_paymenttask.go b/internal/actor/enum_paymenttask.go index f7f52c0ef0..83c85cb2e7 100644 --- a/internal/actor/enum_paymenttask.go +++ b/internal/actor/enum_paymenttask.go @@ -29,6 +29,10 @@ func (i PaymentTask) String() string { return _PaymentTask_name[_PaymentTask_index[i]:_PaymentTask_index[i+1]] } +func (i PaymentTask) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i PaymentTask) IsNotStarted() bool { return i == PaymentTaskNotStarted } diff --git a/internal/actor/enum_replacementattorneysstepin.go b/internal/actor/enum_replacementattorneysstepin.go index 172873b51e..3b8cc49079 100644 --- a/internal/actor/enum_replacementattorneysstepin.go +++ b/internal/actor/enum_replacementattorneysstepin.go @@ -15,9 +15,9 @@ func _() { _ = x[ReplacementAttorneysStepInAnotherWay-3] } -const _ReplacementAttorneysStepIn_name = "alloneother" +const _ReplacementAttorneysStepIn_name = "all-can-no-longer-actone-can-no-longer-actanother-way" -var _ReplacementAttorneysStepIn_index = [...]uint8{0, 3, 6, 11} +var _ReplacementAttorneysStepIn_index = [...]uint8{0, 21, 42, 53} func (i ReplacementAttorneysStepIn) String() string { i -= 1 @@ -27,6 +27,10 @@ func (i ReplacementAttorneysStepIn) String() string { return _ReplacementAttorneysStepIn_name[_ReplacementAttorneysStepIn_index[i]:_ReplacementAttorneysStepIn_index[i+1]] } +func (i ReplacementAttorneysStepIn) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i ReplacementAttorneysStepIn) IsWhenAllCanNoLongerAct() bool { return i == ReplacementAttorneysStepInWhenAllCanNoLongerAct } @@ -41,11 +45,11 @@ func (i ReplacementAttorneysStepIn) IsAnotherWay() bool { func ParseReplacementAttorneysStepIn(s string) (ReplacementAttorneysStepIn, error) { switch s { - case "all": + case "all-can-no-longer-act": return ReplacementAttorneysStepInWhenAllCanNoLongerAct, nil - case "one": + case "one-can-no-longer-act": return ReplacementAttorneysStepInWhenOneCanNoLongerAct, nil - case "other": + case "another-way": return ReplacementAttorneysStepInAnotherWay, nil default: return ReplacementAttorneysStepIn(0), fmt.Errorf("invalid ReplacementAttorneysStepIn '%s'", s) diff --git a/internal/actor/enum_yesnomaybe.go b/internal/actor/enum_yesnomaybe.go index c49c0dc149..2004d3fc48 100644 --- a/internal/actor/enum_yesnomaybe.go +++ b/internal/actor/enum_yesnomaybe.go @@ -27,6 +27,10 @@ func (i YesNoMaybe) String() string { return _YesNoMaybe_name[_YesNoMaybe_index[i]:_YesNoMaybe_index[i+1]] } +func (i YesNoMaybe) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i YesNoMaybe) IsYes() bool { return i == Yes } diff --git a/internal/actor/lpa_type.go b/internal/actor/lpa_type.go index b4a15a3596..c210302895 100644 --- a/internal/actor/lpa_type.go +++ b/internal/actor/lpa_type.go @@ -4,25 +4,25 @@ package actor type LpaType uint8 const ( - LpaTypeHealthWelfare LpaType = iota + 1 // hw - LpaTypePropertyFinance // pfa + LpaTypePersonalWelfare LpaType = iota + 1 // personal-welfare + LpaTypePropertyAndAffairs // property-and-affairs ) -func (e LpaType) LegalTermTransKey() string { +func (e LpaType) LegacyString() string { switch e { - case LpaTypePropertyFinance: - return "pfaLegalTerm" - case LpaTypeHealthWelfare: - return "hwLegalTerm" + case LpaTypePropertyAndAffairs: + return "pfa" + case LpaTypePersonalWelfare: + return "hw" } return "" } func (e LpaType) WhatLPACoversTransKey() string { switch e { - case LpaTypePropertyFinance: - return "whatPersonalAffairsCovers" - case LpaTypeHealthWelfare: + case LpaTypePropertyAndAffairs: + return "whatPropertyAndAffairsCovers" + case LpaTypePersonalWelfare: return "whatPersonalWelfareCovers" } return "" diff --git a/internal/actor/lpa_type_test.go b/internal/actor/lpa_type_test.go index f49539d0af..e4d38c7ec9 100644 --- a/internal/actor/lpa_type_test.go +++ b/internal/actor/lpa_type_test.go @@ -8,7 +8,7 @@ import ( ) func TestLpaType(t *testing.T) { - values := map[LpaType]string{LpaTypeHealthWelfare: "hw", LpaTypePropertyFinance: "pfa"} + values := map[LpaType]string{LpaTypePersonalWelfare: "personal-welfare", LpaTypePropertyAndAffairs: "property-and-affairs"} for value, s := range values { t.Run(fmt.Sprintf("parse %s", s), func(t *testing.T) { @@ -27,38 +27,38 @@ func TestLpaType(t *testing.T) { assert.NotNil(t, err) }) - t.Run("IsHealthWelfare", func(t *testing.T) { - assert.True(t, LpaTypeHealthWelfare.IsHealthWelfare()) - assert.False(t, LpaTypePropertyFinance.IsHealthWelfare()) + t.Run("IsPersonalWelfare", func(t *testing.T) { + assert.True(t, LpaTypePersonalWelfare.IsPersonalWelfare()) + assert.False(t, LpaTypePropertyAndAffairs.IsPersonalWelfare()) }) - t.Run("IsPropertyFinance", func(t *testing.T) { - assert.True(t, LpaTypePropertyFinance.IsPropertyFinance()) - assert.False(t, LpaTypeHealthWelfare.IsPropertyFinance()) + t.Run("IsPropertyAndAffairs", func(t *testing.T) { + assert.True(t, LpaTypePropertyAndAffairs.IsPropertyAndAffairs()) + assert.False(t, LpaTypePersonalWelfare.IsPropertyAndAffairs()) }) } -func TestTypeLegalTermTransKey(t *testing.T) { +func TestLpaTypeLegacyString(t *testing.T) { testCases := map[LpaType]string{ - LpaTypePropertyFinance: "pfaLegalTerm", - LpaTypeHealthWelfare: "hwLegalTerm", - LpaType(99): "", - LpaType(0): "", + LpaTypePropertyAndAffairs: "pfa", + LpaTypePersonalWelfare: "hw", + LpaType(99): "", + LpaType(0): "", } - for lpaType, translationKey := range testCases { + for lpaType, expected := range testCases { t.Run(lpaType.String(), func(t *testing.T) { - assert.Equal(t, translationKey, lpaType.LegalTermTransKey()) + assert.Equal(t, expected, lpaType.LegacyString()) }) } } -func TestTypeWhatLPACoversTransKey(t *testing.T) { +func TestLpaTypeWhatLPACoversTransKey(t *testing.T) { testCases := map[LpaType]string{ - LpaTypePropertyFinance: "whatPersonalAffairsCovers", - LpaTypeHealthWelfare: "whatPersonalWelfareCovers", - LpaType(99): "", - LpaType(0): "", + LpaTypePropertyAndAffairs: "whatPropertyAndAffairsCovers", + LpaTypePersonalWelfare: "whatPersonalWelfareCovers", + LpaType(99): "", + LpaType(0): "", } for lpaType, translationKey := range testCases { diff --git a/internal/actor/replacement_attorneys_step_in.go b/internal/actor/replacement_attorneys_step_in.go index 3f81d78e7c..da860820e2 100644 --- a/internal/actor/replacement_attorneys_step_in.go +++ b/internal/actor/replacement_attorneys_step_in.go @@ -4,7 +4,7 @@ package actor type ReplacementAttorneysStepIn uint8 const ( - ReplacementAttorneysStepInWhenAllCanNoLongerAct ReplacementAttorneysStepIn = iota + 1 // all - ReplacementAttorneysStepInWhenOneCanNoLongerAct // one - ReplacementAttorneysStepInAnotherWay // other + ReplacementAttorneysStepInWhenAllCanNoLongerAct ReplacementAttorneysStepIn = iota + 1 // all-can-no-longer-act + ReplacementAttorneysStepInWhenOneCanNoLongerAct // one-can-no-longer-act + ReplacementAttorneysStepInAnotherWay // another-way ) diff --git a/internal/actor/replacement_attorneys_step_in_test.go b/internal/actor/replacement_attorneys_step_in_test.go index 1e87a28352..ab5549c9e0 100644 --- a/internal/actor/replacement_attorneys_step_in_test.go +++ b/internal/actor/replacement_attorneys_step_in_test.go @@ -9,9 +9,9 @@ import ( func TestReplacementAttorneysStepIn(t *testing.T) { values := map[ReplacementAttorneysStepIn]string{ - ReplacementAttorneysStepInWhenAllCanNoLongerAct: "all", - ReplacementAttorneysStepInWhenOneCanNoLongerAct: "one", - ReplacementAttorneysStepInAnotherWay: "other", + ReplacementAttorneysStepInWhenAllCanNoLongerAct: "all-can-no-longer-act", + ReplacementAttorneysStepInWhenOneCanNoLongerAct: "one-can-no-longer-act", + ReplacementAttorneysStepInAnotherWay: "another-way", } for value, s := range values { diff --git a/internal/app/donor_store.go b/internal/app/donor_store.go index 023bd8493a..8311a71f04 100644 --- a/internal/app/donor_store.go +++ b/internal/app/donor_store.go @@ -157,7 +157,7 @@ func (s *donorStore) Put(ctx context.Context, donor *actor.DonorProvidedDetails) if err := s.eventClient.SendUidRequested(ctx, event.UidRequested{ LpaID: donor.LpaID, DonorSessionID: data.SessionID, - Type: donor.Type.String(), + Type: donor.Type.LegacyString(), Donor: uid.DonorDetails{ Name: donor.Donor.FullName(), Dob: donor.Donor.DateOfBirth, @@ -173,7 +173,7 @@ func (s *donorStore) Put(ctx context.Context, donor *actor.DonorProvidedDetails) if donor.LpaUID != "" && !donor.HasSentApplicationUpdatedEvent { if err := s.eventClient.SendApplicationUpdated(ctx, event.ApplicationUpdated{ UID: donor.LpaUID, - Type: donor.Type.String(), + Type: donor.Type.LegacyString(), CreatedAt: donor.CreatedAt, Donor: event.ApplicationUpdatedDonor{ FirstNames: donor.Donor.FirstNames, diff --git a/internal/app/donor_store_test.go b/internal/app/donor_store_test.go index 7562291ee9..79ec45c24a 100644 --- a/internal/app/donor_store_test.go +++ b/internal/app/donor_store_test.go @@ -269,7 +269,7 @@ func TestDonorStorePutWhenUIDNeeded(t *testing.T) { Postcode: "F1 1FF", }, }, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, HasSentUidRequestedEvent: true, } updatedDonor.Hash, _ = updatedDonor.GenerateHash() @@ -294,7 +294,7 @@ func TestDonorStorePutWhenUIDNeeded(t *testing.T) { Postcode: "F1 1FF", }, }, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, }) assert.Nil(t, err) @@ -318,7 +318,7 @@ func TestDonorStorePutWhenUIDNeededMissingSessionData(t *testing.T) { Postcode: "F1 1FF", }, }, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, }) assert.Equal(t, page.SessionMissingError{}, err) @@ -346,7 +346,7 @@ func TestDonorStorePutWhenUIDFails(t *testing.T) { Postcode: "F1 1FF", }, }, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, }) assert.Equal(t, expectedError, err) @@ -375,7 +375,7 @@ func TestDonorStorePutWhenApplicationUpdatedWhenError(t *testing.T) { Postcode: "F1 1FF", }, }, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, }) assert.Equal(t, expectedError, err) diff --git a/internal/form/enum_yesno.go b/internal/form/enum_yesno.go index fd8983b01d..50c3f060d7 100644 --- a/internal/form/enum_yesno.go +++ b/internal/form/enum_yesno.go @@ -26,6 +26,10 @@ func (i YesNo) String() string { return _YesNo_name[_YesNo_index[i]:_YesNo_index[i+1]] } +func (i YesNo) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i YesNo) IsYes() bool { return i == Yes } diff --git a/internal/localize/enum_lang.go b/internal/localize/enum_lang.go index 883166cff8..764797e335 100644 --- a/internal/localize/enum_lang.go +++ b/internal/localize/enum_lang.go @@ -26,6 +26,10 @@ func (i Lang) String() string { return _Lang_name[_Lang_index[i]:_Lang_index[i+1]] } +func (i Lang) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i Lang) IsEn() bool { return i == En } diff --git a/internal/localize/localizer.go b/internal/localize/localizer.go index c02713b6b1..5d618c9e76 100644 --- a/internal/localize/localizer.go +++ b/internal/localize/localizer.go @@ -5,6 +5,8 @@ import ( "fmt" "strings" "time" + "unicode" + "unicode/utf8" "github.com/ministryofjustice/opg-modernising-lpa/internal/date" "github.com/nicksnyder/go-i18n/v2/i18n" @@ -142,3 +144,8 @@ func (l *Localizer) FormatDateTime(t time.Time) string { return t.Format("2 January 2006 at 15:04") } + +func LowerFirst(s string) string { + r, n := utf8.DecodeRuneInString(s) + return string(unicode.ToLower(r)) + s[n:] +} diff --git a/internal/localize/localizer_test.go b/internal/localize/localizer_test.go index 14d6b8cedd..8892e86be7 100644 --- a/internal/localize/localizer_test.go +++ b/internal/localize/localizer_test.go @@ -157,3 +157,8 @@ func TestFormatDateTime(t *testing.T) { assert.Equal(t, "7 Mawrth 2020 am 03:04", cy.FormatDateTime(time.Date(2020, time.March, 7, 3, 4, 5, 6, time.UTC))) } + +func TestLowerFirst(t *testing.T) { + assert.Equal(t, "hELLO", LowerFirst("HELLO")) + assert.Equal(t, "hello", LowerFirst("hello")) +} diff --git a/internal/lpastore/client.go b/internal/lpastore/client.go index 0563595017..e3b44ab468 100644 --- a/internal/lpastore/client.go +++ b/internal/lpastore/client.go @@ -16,6 +16,12 @@ import ( "github.com/ministryofjustice/opg-modernising-lpa/internal/secrets" ) +const ( + issuer = "opg.poas.makeregister" + statusActive = "active" + statusReplacement = "replacement" +) + type responseError struct { name string body any @@ -47,27 +53,26 @@ func New(baseURL string, secretsClient SecretsClient, lambdaClient Doer) *Client } type lpaRequest struct { - LpaType string `json:"lpaType"` - Donor lpaRequestDonor `json:"donor"` - Attorneys []lpaRequestAttorney `json:"attorneys"` - TrustCorporations []lpaRequestTrustCorporation `json:"trustCorporations,omitempty"` - CertificateProvider lpaRequestCertificateProvider `json:"certificateProvider"` - PeopleToNotify []lpaRequestPersonToNotify `json:"peopleToNotify"` - HowAttorneysMakeDecisions string `json:"howAttorneysMakeDecisions"` - HowAttorneysMakeDecisionsDetails string `json:"howAttorneysMakeDecisionsDetails"` - HowReplacementAttorneysMakeDecisions string `json:"howReplacementAttorneysMakeDecisions"` - HowReplacementAttorneysMakeDecisionsDetails string `json:"howReplacementAttorneysMakeDecisionsDetails"` - HowReplacementAttorneysStepIn string `json:"howReplacementAttorneysStepIn"` - HowReplacementAttorneysStepInDetails string `json:"howReplacementAttorneysStepInDetails"` - Restrictions string `json:"restrictions"` - WhenTheLpaCanBeUsed string `json:"whenTheLpaCanBeUsed,omitempty"` - LifeSustainingTreatmentOption string `json:"lifeSustainingTreatmentOption,omitempty"` - SignedAt time.Time `json:"signedAt"` + LpaType actor.LpaType `json:"lpaType"` + Donor lpaRequestDonor `json:"donor"` + Attorneys []lpaRequestAttorney `json:"attorneys"` + TrustCorporations []lpaRequestTrustCorporation `json:"trustCorporations,omitempty"` + CertificateProvider lpaRequestCertificateProvider `json:"certificateProvider"` + PeopleToNotify []lpaRequestPersonToNotify `json:"peopleToNotify"` + HowAttorneysMakeDecisions actor.AttorneysAct `json:"howAttorneysMakeDecisions"` + HowAttorneysMakeDecisionsDetails string `json:"howAttorneysMakeDecisionsDetails"` + HowReplacementAttorneysMakeDecisions actor.AttorneysAct `json:"howReplacementAttorneysMakeDecisions"` + HowReplacementAttorneysMakeDecisionsDetails string `json:"howReplacementAttorneysMakeDecisionsDetails"` + HowReplacementAttorneysStepIn actor.ReplacementAttorneysStepIn `json:"howReplacementAttorneysStepIn"` + HowReplacementAttorneysStepInDetails string `json:"howReplacementAttorneysStepInDetails"` + Restrictions string `json:"restrictions"` + WhenTheLpaCanBeUsed actor.CanBeUsedWhen `json:"whenTheLpaCanBeUsed,omitempty"` + LifeSustainingTreatmentOption actor.LifeSustainingTreatment `json:"lifeSustainingTreatmentOption,omitempty"` + SignedAt time.Time `json:"signedAt"` } type lpaRequestDonor struct { FirstNames string `json:"firstNames"` - Surname string `json:"surname"` // TODO: remove when API is changed to take lastName LastName string `json:"lastName"` DateOfBirth date.Date `json:"dateOfBirth"` Email string `json:"email"` @@ -77,7 +82,6 @@ type lpaRequestDonor struct { type lpaRequestAttorney struct { FirstNames string `json:"firstNames"` - Surname string `json:"surname"` LastName string `json:"lastName"` DateOfBirth date.Date `json:"dateOfBirth"` Email string `json:"email"` @@ -94,11 +98,11 @@ type lpaRequestTrustCorporation struct { } type lpaRequestCertificateProvider struct { - FirstNames string `json:"firstNames"` - LastName string `json:"lastName"` - Email string `json:"email"` - Address place.Address `json:"address"` - Channel string `json:"channel"` + FirstNames string `json:"firstNames"` + LastName string `json:"lastName"` + Email string `json:"email"` + Address place.Address `json:"address"` + Channel actor.CertificateProviderCarryOutBy `json:"channel"` } type lpaRequestPersonToNotify struct { @@ -108,39 +112,10 @@ type lpaRequestPersonToNotify struct { } func (c *Client) SendLpa(ctx context.Context, donor *actor.DonorProvidedDetails) error { - var lpaType string - switch donor.Type { - case actor.LpaTypeHealthWelfare: - lpaType = "personal-welfare" - case actor.LpaTypePropertyFinance: - lpaType = "property-and-affairs" - } - - howAttorneysMakeDecisions := donor.AttorneyDecisions.How.String() - if howAttorneysMakeDecisions == "mixed" { - howAttorneysMakeDecisions = "jointly-for-some-severally-for-others" - } - - howReplacementAttorneysMakeDecisions := donor.ReplacementAttorneyDecisions.How.String() - if howReplacementAttorneysMakeDecisions == "mixed" { - howReplacementAttorneysMakeDecisions = "jointly-for-some-severally-for-others" - } - - var howReplacementAttorneysStepIn string - switch donor.HowShouldReplacementAttorneysStepIn { - case actor.ReplacementAttorneysStepInWhenAllCanNoLongerAct: - howReplacementAttorneysStepIn = "all-can-no-longer-act" - case actor.ReplacementAttorneysStepInWhenOneCanNoLongerAct: - howReplacementAttorneysStepIn = "one-can-no-longer-act" - case actor.ReplacementAttorneysStepInAnotherWay: - howReplacementAttorneysStepIn = "another-way" - } - body := lpaRequest{ - LpaType: lpaType, + LpaType: donor.Type, Donor: lpaRequestDonor{ FirstNames: donor.Donor.FirstNames, - Surname: donor.Donor.LastName, LastName: donor.Donor.LastName, DateOfBirth: donor.Donor.DateOfBirth, Email: donor.Donor.Email, @@ -152,34 +127,33 @@ func (c *Client) SendLpa(ctx context.Context, donor *actor.DonorProvidedDetails) LastName: donor.CertificateProvider.LastName, Email: donor.CertificateProvider.Email, Address: donor.CertificateProvider.Address, - Channel: donor.CertificateProvider.CarryOutBy.String(), + Channel: donor.CertificateProvider.CarryOutBy, }, - HowAttorneysMakeDecisions: howAttorneysMakeDecisions, + HowAttorneysMakeDecisions: donor.AttorneyDecisions.How, HowAttorneysMakeDecisionsDetails: donor.AttorneyDecisions.Details, - HowReplacementAttorneysMakeDecisions: howReplacementAttorneysMakeDecisions, + HowReplacementAttorneysMakeDecisions: donor.ReplacementAttorneyDecisions.How, HowReplacementAttorneysMakeDecisionsDetails: donor.ReplacementAttorneyDecisions.Details, - HowReplacementAttorneysStepIn: howReplacementAttorneysStepIn, + HowReplacementAttorneysStepIn: donor.HowShouldReplacementAttorneysStepIn, HowReplacementAttorneysStepInDetails: donor.HowShouldReplacementAttorneysStepInDetails, Restrictions: donor.Restrictions, SignedAt: donor.SignedAt, } switch donor.Type { - case actor.LpaTypePropertyFinance: - body.WhenTheLpaCanBeUsed = donor.WhenCanTheLpaBeUsed.String() - case actor.LpaTypeHealthWelfare: - body.LifeSustainingTreatmentOption = donor.LifeSustainingTreatmentOption.String() + case actor.LpaTypePropertyAndAffairs: + body.WhenTheLpaCanBeUsed = donor.WhenCanTheLpaBeUsed + case actor.LpaTypePersonalWelfare: + body.LifeSustainingTreatmentOption = donor.LifeSustainingTreatmentOption } for _, attorney := range donor.Attorneys.Attorneys { body.Attorneys = append(body.Attorneys, lpaRequestAttorney{ FirstNames: attorney.FirstNames, - Surname: attorney.LastName, LastName: attorney.LastName, DateOfBirth: attorney.DateOfBirth, Email: attorney.Email, Address: attorney.Address, - Status: "active", + Status: statusActive, }) } @@ -189,19 +163,18 @@ func (c *Client) SendLpa(ctx context.Context, donor *actor.DonorProvidedDetails) CompanyNumber: trustCorporation.CompanyNumber, Email: trustCorporation.Email, Address: trustCorporation.Address, - Status: "active", + Status: statusActive, }) } for _, attorney := range donor.ReplacementAttorneys.Attorneys { body.Attorneys = append(body.Attorneys, lpaRequestAttorney{ FirstNames: attorney.FirstNames, - Surname: attorney.LastName, LastName: attorney.LastName, DateOfBirth: attorney.DateOfBirth, Email: attorney.Email, Address: attorney.Address, - Status: "replacement", + Status: statusReplacement, }) } @@ -211,7 +184,7 @@ func (c *Client) SendLpa(ctx context.Context, donor *actor.DonorProvidedDetails) CompanyNumber: trustCorporation.CompanyNumber, Email: trustCorporation.Email, Address: trustCorporation.Address, - Status: "replacement", + Status: statusReplacement, }) } @@ -235,7 +208,7 @@ func (c *Client) SendLpa(ctx context.Context, donor *actor.DonorProvidedDetails) req.Header.Add("Content-Type", "application/json") token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.RegisteredClaims{ - Issuer: "opg.poas.makeregister", + Issuer: issuer, IssuedAt: jwt.NewNumericDate(c.now()), Subject: "todo", }) diff --git a/internal/lpastore/client_test.go b/internal/lpastore/client_test.go index 3ed42ed3c4..d5dedf0bc0 100644 --- a/internal/lpastore/client_test.go +++ b/internal/lpastore/client_test.go @@ -51,7 +51,7 @@ func TestClientSendLpa(t *testing.T) { donor := &actor.DonorProvidedDetails{ LpaUID: "M-0000-1111-2222", - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, Donor: actor.Donor{ FirstNames: "John Johnson", LastName: "Smith", @@ -68,6 +68,19 @@ func TestClientSendLpa(t *testing.T) { OtherNames: "JJ", }, Attorneys: actor.Attorneys{ + TrustCorporation: actor.TrustCorporation{ + Name: "Trusty", + CompanyNumber: "55555", + Email: "trusty@example.com", + Address: place.Address{ + Line1: "a-line-1", + Line2: "a-line-2", + Line3: "a-line-3", + TownOrCity: "a-town", + Postcode: "A1 1FF", + Country: "GB", + }, + }, Attorneys: []actor.Attorney{{ FirstNames: "Adam", LastName: "Attorney", @@ -100,6 +113,19 @@ func TestClientSendLpa(t *testing.T) { How: actor.Jointly, }, ReplacementAttorneys: actor.Attorneys{ + TrustCorporation: actor.TrustCorporation{ + Name: "UnTrusty", + CompanyNumber: "65555", + Email: "untrusty@example.com", + Address: place.Address{ + Line1: "a-line-1", + Line2: "a-line-2", + Line3: "a-line-3", + TownOrCity: "a-town", + Postcode: "A1 1FF", + Country: "GB", + }, + }, Attorneys: []actor.Attorney{{ FirstNames: "Richard", LastName: "Attorney", @@ -164,7 +190,7 @@ func TestClientSendLpa(t *testing.T) { SignedAt: time.Date(2000, time.January, 2, 3, 4, 5, 6, time.UTC), } - expectedBody := `{"lpaType":"personal-welfare","donor":{"firstNames":"John Johnson","surname":"Smith","lastName":"Smith","dateOfBirth":"2000-01-02","email":"john@example.com","address":{"line1":"line-1","line2":"line-2","line3":"line-3","town":"town","postcode":"F1 1FF","country":"GB"},"otherNamesKnownBy":"JJ"},"attorneys":[{"firstNames":"Adam","surname":"Attorney","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"},{"firstNames":"Alice","surname":"Attorney","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":"active"},{"firstNames":"Richard","surname":"Attorney","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"},{"firstNames":"Rachel","surname":"Attorney","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"}],"howAttorneysMakeDecisions":"jointly","howAttorneysMakeDecisionsDetails":"","howReplacementAttorneysMakeDecisions":"jointly-for-some-severally-for-others","howReplacementAttorneysMakeDecisionsDetails":"umm","howReplacementAttorneysStepIn":"all-can-no-longer-act","howReplacementAttorneysStepInDetails":"","certificateProvider":{"firstNames":"Carol","lastName":"Cert","email":"carol@example.com","address":{"line1":"c-line-1","line2":"c-line-2","line3":"c-line-3","town":"c-town","postcode":"C1 1FF","country":"GB"},"channel":"online"},"peopleToNotify":[{"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"}}],"restrictions":"do not do this","lifeSustainingTreatmentOption":"option-a","signedAt":"2000-01-02T03:04:05.000000006Z"}` + expectedBody := `{"lpaType":"personal-welfare","donor":{"firstNames":"John Johnson","lastName":"Smith","dateOfBirth":"2000-01-02","email":"john@example.com","address":{"line1":"line-1","line2":"line-2","line3":"line-3","town":"town","postcode":"F1 1FF","country":"GB"},"otherNamesKnownBy":"JJ"},"attorneys":[{"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"},{"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":"active"},{"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"},{"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"}],"trustCorporations":[{"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"},{"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":"replacement"}],"certificateProvider":{"firstNames":"Carol","lastName":"Cert","email":"carol@example.com","address":{"line1":"c-line-1","line2":"c-line-2","line3":"c-line-3","town":"c-town","postcode":"C1 1FF","country":"GB"},"channel":"online"},"peopleToNotify":[{"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"}}],"howAttorneysMakeDecisions":"jointly","howAttorneysMakeDecisionsDetails":"","howReplacementAttorneysMakeDecisions":"jointly-for-some-severally-for-others","howReplacementAttorneysMakeDecisionsDetails":"umm","howReplacementAttorneysStepIn":"all-can-no-longer-act","howReplacementAttorneysStepInDetails":"","restrictions":"do not do this","lifeSustainingTreatmentOption":"option-a","signedAt":"2000-01-02T03:04:05.000000006Z"}` secretsClient := newMockSecretsClient(t) secretsClient. @@ -282,7 +308,6 @@ func TestClientServiceContract(t *testing.T) { "lpaType": dsl.Regex("personal-welfare", "personal-welfare|property-and-affairs"), "donor": dsl.Like(map[string]any{ "firstNames": dsl.String("John Johnson"), - "surname": dsl.String("Smith"), "lastName": dsl.String("Smith"), "dateOfBirth": dsl.Regex("2000-01-02", "\\d{4}-\\d{2}-\\d{2}"), "email": dsl.String("john@example.com"), @@ -298,7 +323,6 @@ func TestClientServiceContract(t *testing.T) { }), "attorneys": dsl.EachLike(map[string]any{ "firstNames": dsl.String("Adam"), - "surname": dsl.String("Attorney"), "lastName": dsl.String("Attorney"), "dateOfBirth": dsl.Regex("1999-01-02", "\\d{4}-\\d{2}-\\d{2}"), "email": dsl.String("adam@example.com"), diff --git a/internal/page/certificateprovider/provide_certificate.go b/internal/page/certificateprovider/provide_certificate.go index 6aacb9a874..82f88c5cfb 100644 --- a/internal/page/certificateprovider/provide_certificate.go +++ b/internal/page/certificateprovider/provide_certificate.go @@ -7,6 +7,7 @@ import ( "github.com/ministryofjustice/opg-go-common/template" "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" + "github.com/ministryofjustice/opg-modernising-lpa/internal/localize" "github.com/ministryofjustice/opg-modernising-lpa/internal/notify" "github.com/ministryofjustice/opg-modernising-lpa/internal/page" "github.com/ministryofjustice/opg-modernising-lpa/internal/validation" @@ -60,7 +61,7 @@ func ProvideCertificate(tmpl template.Template, donorStore DonorStore, now func( if _, err := notifyClient.SendEmail(r.Context(), donor.CertificateProvider.Email, notify.CertificateProviderCertificateProvidedEmail{ DonorFullNamePossessive: appData.Localizer.Possessive(donor.Donor.FullName()), DonorFirstNamesPossessive: appData.Localizer.Possessive(donor.Donor.FirstNames), - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), CertificateProviderFullName: donor.CertificateProvider.FullName(), CertificateProvidedDateTime: appData.Localizer.FormatDateTime(certificateProvider.Certificate.Agreed), }); err != nil { diff --git a/internal/page/certificateprovider/provide_certificate_test.go b/internal/page/certificateprovider/provide_certificate_test.go index dadff80239..55eacd26ea 100644 --- a/internal/page/certificateprovider/provide_certificate_test.go +++ b/internal/page/certificateprovider/provide_certificate_test.go @@ -128,7 +128,7 @@ func TestPostProvideCertificate(t *testing.T) { LastName: "b", }, Donor: actor.Donor{FirstNames: "c", LastName: "d"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } donorStore := newMockDonorStore(t) @@ -161,7 +161,7 @@ func TestPostProvideCertificate(t *testing.T) { On("Possessive", "c d"). Return("the possessive full name") localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("the translated term") localizer. On("FormatDateTime", now). @@ -246,7 +246,7 @@ func TestPostProvideCertificateOnNotifyClientError(t *testing.T) { LastName: "b", }, Donor: actor.Donor{FirstNames: "c", LastName: "d"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }, nil) certificateProviderStore := newMockCertificateProviderStore(t) @@ -302,7 +302,7 @@ func TestPostProvideCertificateWhenShareCodeSenderErrors(t *testing.T) { Return(&actor.DonorProvidedDetails{ SignedAt: now, Donor: actor.Donor{FirstNames: "c", LastName: "d"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }, nil) certificateProviderStore := newMockCertificateProviderStore(t) @@ -321,7 +321,7 @@ func TestPostProvideCertificateWhenShareCodeSenderErrors(t *testing.T) { On("Possessive", "c d"). Return("the possessive full name") localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("the translated term") localizer. On("FormatDateTime", now). diff --git a/internal/page/data_test.go b/internal/page/data_test.go index 3da6962f4c..f2ee22f116 100644 --- a/internal/page/data_test.go +++ b/internal/page/data_test.go @@ -29,7 +29,7 @@ func TestCanGoTo(t *testing.T) { }, "getting help signing no certificate provider": { donor: &actor.DonorProvidedDetails{ - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, Tasks: actor.DonorTasks{ YourDetails: actor.TaskCompleted, }, @@ -39,7 +39,7 @@ func TestCanGoTo(t *testing.T) { }, "getting help signing": { donor: &actor.DonorProvidedDetails{ - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, Tasks: actor.DonorTasks{ CertificateProvider: actor.TaskCompleted, }, @@ -49,7 +49,7 @@ func TestCanGoTo(t *testing.T) { }, "check your lpa when unsure if can sign": { donor: &actor.DonorProvidedDetails{ - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, Tasks: actor.DonorTasks{ YourDetails: actor.TaskCompleted, ChooseAttorneys: actor.TaskCompleted, @@ -66,7 +66,7 @@ func TestCanGoTo(t *testing.T) { "check your lpa when can sign": { donor: &actor.DonorProvidedDetails{ Donor: actor.Donor{CanSign: form.Yes}, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, Tasks: actor.DonorTasks{ YourDetails: actor.TaskCompleted, ChooseAttorneys: actor.TaskCompleted, @@ -90,7 +90,7 @@ func TestCanGoTo(t *testing.T) { Donor: actor.Donor{ CanSign: form.Yes, }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, Tasks: actor.DonorTasks{ YourDetails: actor.TaskCompleted, ChooseAttorneys: actor.TaskCompleted, @@ -115,7 +115,7 @@ func TestCanGoTo(t *testing.T) { Donor: actor.Donor{ CanSign: form.Yes, }, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, Tasks: actor.DonorTasks{ YourDetails: actor.TaskCompleted, ChooseAttorneys: actor.TaskCompleted, @@ -414,7 +414,7 @@ func TestChooseReplacementAttorneysState(t *testing.T) { replacementAttorneyDecisions: actor.AttorneyDecisions{How: actor.Jointly}, taskState: actor.TaskCompleted, }, - "multiple mixed": { + "multiple jointly for some severally for others": { want: form.Yes, replacementAttorneys: actor.Attorneys{Attorneys: []actor.Attorney{{ FirstNames: "a", @@ -454,7 +454,7 @@ func TestChooseReplacementAttorneysState(t *testing.T) { attorneyDecisions: actor.AttorneyDecisions{How: actor.Jointly}, taskState: actor.TaskCompleted, }, - "mixed attorneys single": { + "jointly for some severally for others attorneys single": { want: form.Yes, replacementAttorneys: actor.Attorneys{Attorneys: []actor.Attorney{{ FirstNames: "a", @@ -516,7 +516,7 @@ func TestChooseReplacementAttorneysState(t *testing.T) { replacementAttorneyDecisions: actor.AttorneyDecisions{How: actor.Jointly}, taskState: actor.TaskCompleted, }, - "jointly and severally attorneys multiple with step in when none can act mixed": { + "jointly and severally attorneys multiple with step in when none can act jointly for some severally for others": { want: form.Yes, replacementAttorneys: actor.Attorneys{Attorneys: []actor.Attorney{{ FirstNames: "a", @@ -568,7 +568,7 @@ func TestChooseReplacementAttorneysState(t *testing.T) { replacementAttorneyDecisions: actor.AttorneyDecisions{How: actor.Jointly}, taskState: actor.TaskCompleted, }, - "jointly attorneys multiple mixed": { + "jointly attorneys multiple jointly for some severally for others": { want: form.Yes, replacementAttorneys: actor.Attorneys{Attorneys: []actor.Attorney{{ FirstNames: "a", diff --git a/internal/page/donor/check_your_lpa.go b/internal/page/donor/check_your_lpa.go index 6938ac00dc..1ae0c9afb3 100644 --- a/internal/page/donor/check_your_lpa.go +++ b/internal/page/donor/check_your_lpa.go @@ -10,6 +10,7 @@ import ( "github.com/ministryofjustice/opg-go-common/template" "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" "github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo" + "github.com/ministryofjustice/opg-modernising-lpa/internal/localize" "github.com/ministryofjustice/opg-modernising-lpa/internal/notify" "github.com/ministryofjustice/opg-modernising-lpa/internal/page" "github.com/ministryofjustice/opg-modernising-lpa/internal/validation" @@ -50,7 +51,7 @@ func (n *checkYourLpaNotifier) sendPaperNotification(ctx context.Context, appDat sms = notify.CertificateProviderActingOnPaperMeetingPromptSMS{ DonorFullName: donor.Donor.FullName(), DonorFirstNames: donor.Donor.FirstNames, - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), CertificateProviderStartPageURL: appData.AppPublicURL + appData.Lang.URL(page.Paths.CertificateProviderStart.Format()), } } @@ -73,12 +74,12 @@ func (n *checkYourLpaNotifier) sendOnlineNotification(ctx context.Context, appDa if certificateProvider.Tasks.ConfirmYourDetails.NotStarted() { sms = notify.CertificateProviderActingDigitallyHasNotConfirmedPersonalDetailsLPADetailsChangedPromptSMS{ - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), DonorFullName: donor.Donor.FullName(), } } else { sms = notify.CertificateProviderActingDigitallyHasConfirmedPersonalDetailsLPADetailsChangedPromptSMS{ - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), DonorFullNamePossessive: appData.Localizer.Possessive(donor.Donor.FullName()), DonorFirstNames: donor.Donor.FirstNames, } diff --git a/internal/page/donor/check_your_lpa_test.go b/internal/page/donor/check_your_lpa_test.go index ad7348594f..0221938958 100644 --- a/internal/page/donor/check_your_lpa_test.go +++ b/internal/page/donor/check_your_lpa_test.go @@ -192,7 +192,7 @@ func TestPostCheckYourLpaDigitalCertificateProviderOnSubsequentChecks(t *testing localizer := newMockLocalizer(t) localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("property and affairs") localizer. On("Possessive", "Teneil Throssell"). @@ -204,7 +204,7 @@ func TestPostCheckYourLpaDigitalCertificateProviderOnSubsequentChecks(t *testing donor := &actor.DonorProvidedDetails{ LpaID: "lpa-id", Hash: 5, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, Donor: actor.Donor{FirstNames: "Teneil", LastName: "Throssell"}, CheckedAt: testNow, Tasks: actor.DonorTasks{CheckYourLpa: actor.TaskCompleted}, @@ -260,7 +260,7 @@ func TestPostCheckYourLpaDigitalCertificateProviderOnSubsequentChecksCertificate err := CheckYourLpa(nil, donorStore, nil, nil, certificateProviderStore, testNowFn)(testAppData, w, r, &actor.DonorProvidedDetails{ LpaID: "lpa-id", Hash: 5, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, Donor: actor.Donor{FirstNames: "Teneil", LastName: "Throssell"}, CheckedAt: testNow, Tasks: actor.DonorTasks{CheckYourLpa: actor.TaskCompleted}, @@ -282,7 +282,7 @@ func TestPostCheckYourLpaPaperCertificateProviderOnFirstCheck(t *testing.T) { localizer := newMockLocalizer(t) localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("property and affairs") testAppData.Localizer = localizer @@ -293,7 +293,7 @@ func TestPostCheckYourLpaPaperCertificateProviderOnFirstCheck(t *testing.T) { Donor: actor.Donor{FirstNames: "Teneil", LastName: "Throssell"}, Tasks: actor.DonorTasks{CheckYourLpa: existingTaskState}, CertificateProvider: actor.CertificateProvider{CarryOutBy: actor.Paper, Mobile: "07700900000"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } updatedDonor := &actor.DonorProvidedDetails{ @@ -303,7 +303,7 @@ func TestPostCheckYourLpaPaperCertificateProviderOnFirstCheck(t *testing.T) { CheckedAt: testNow, Tasks: actor.DonorTasks{CheckYourLpa: actor.TaskCompleted}, CertificateProvider: actor.CertificateProvider{CarryOutBy: actor.Paper, Mobile: "07700900000"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } updatedDonor.CheckedHash, _ = updatedDonor.GenerateHash() @@ -349,7 +349,7 @@ func TestPostCheckYourLpaPaperCertificateProviderOnSubsequentCheck(t *testing.T) CheckedAt: testNow, Tasks: actor.DonorTasks{CheckYourLpa: actor.TaskCompleted}, CertificateProvider: actor.CertificateProvider{CarryOutBy: actor.Paper, Mobile: "07700900000"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } donorStore := newMockDonorStore(t) diff --git a/internal/page/donor/how_should_attorneys_make_decisions_test.go b/internal/page/donor/how_should_attorneys_make_decisions_test.go index c7918982be..53ba60d450 100644 --- a/internal/page/donor/how_should_attorneys_make_decisions_test.go +++ b/internal/page/donor/how_should_attorneys_make_decisions_test.go @@ -240,7 +240,7 @@ func TestHowShouldAttorneysMakeDecisionsFormValidate(t *testing.T) { }, errors: validation.With("decision-type", validation.SelectError{Label: "xyz"}), }, - "missing decision detail when mixed": { + "missing decision detail when jointly for some severally for others": { form: &howShouldAttorneysMakeDecisionsForm{ DecisionsType: actor.JointlyForSomeSeverallyForOthers, detailsErrorLabel: "xyz", diff --git a/internal/page/donor/identity_with_one_login_callback_test.go b/internal/page/donor/identity_with_one_login_callback_test.go index 52db83d310..445ae7313a 100644 --- a/internal/page/donor/identity_with_one_login_callback_test.go +++ b/internal/page/donor/identity_with_one_login_callback_test.go @@ -292,7 +292,7 @@ func TestPostIdentityWithOneLoginCallbackNotConfirmed(t *testing.T) { Donor: actor.Donor{ CanSign: form.Yes, }, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, Tasks: actor.DonorTasks{ YourDetails: actor.TaskCompleted, ChooseAttorneys: actor.TaskCompleted, diff --git a/internal/page/donor/lpa_type.go b/internal/page/donor/lpa_type.go index 906945f2fc..0f5477c547 100644 --- a/internal/page/donor/lpa_type.go +++ b/internal/page/donor/lpa_type.go @@ -9,16 +9,11 @@ import ( "github.com/ministryofjustice/opg-modernising-lpa/internal/validation" ) -type lpaTypeOptions struct { - PropertyFinance actor.LpaType - HealthWelfare actor.LpaType -} - type lpaTypeData struct { App page.AppData Errors validation.List Form *lpaTypeForm - Options lpaTypeOptions + Options actor.LpaTypeOptions } func LpaType(tmpl template.Template, donorStore DonorStore) Handler { @@ -28,10 +23,7 @@ func LpaType(tmpl template.Template, donorStore DonorStore) Handler { Form: &lpaTypeForm{ LpaType: donor.Type, }, - Options: lpaTypeOptions{ - PropertyFinance: actor.LpaTypePropertyFinance, - HealthWelfare: actor.LpaTypeHealthWelfare, - }, + Options: actor.LpaTypeValues, } if r.Method == http.MethodPost { @@ -41,7 +33,7 @@ func LpaType(tmpl template.Template, donorStore DonorStore) Handler { if data.Errors.None() { if donor.Type != data.Form.LpaType { donor.Type = data.Form.LpaType - if donor.Type.IsHealthWelfare() { + if donor.Type.IsPersonalWelfare() { donor.WhenCanTheLpaBeUsed = actor.CanBeUsedWhenCapacityLost } else { donor.WhenCanTheLpaBeUsed = actor.CanBeUsedWhenUnknown diff --git a/internal/page/donor/lpa_type_test.go b/internal/page/donor/lpa_type_test.go index 6cb32c04ec..c39ee36011 100644 --- a/internal/page/donor/lpa_type_test.go +++ b/internal/page/donor/lpa_type_test.go @@ -21,12 +21,9 @@ func TestGetLpaType(t *testing.T) { template := newMockTemplate(t) template. On("Execute", w, &lpaTypeData{ - App: testAppData, - Form: &lpaTypeForm{}, - Options: lpaTypeOptions{ - PropertyFinance: actor.LpaTypePropertyFinance, - HealthWelfare: actor.LpaTypeHealthWelfare, - }, + App: testAppData, + Form: &lpaTypeForm{}, + Options: actor.LpaTypeValues, }). Return(nil) @@ -46,16 +43,13 @@ func TestGetLpaTypeFromStore(t *testing.T) { On("Execute", w, &lpaTypeData{ App: testAppData, Form: &lpaTypeForm{ - LpaType: actor.LpaTypePropertyFinance, - }, - Options: lpaTypeOptions{ - PropertyFinance: actor.LpaTypePropertyFinance, - HealthWelfare: actor.LpaTypeHealthWelfare, + LpaType: actor.LpaTypePropertyAndAffairs, }, + Options: actor.LpaTypeValues, }). Return(nil) - err := LpaType(template.Execute, nil)(testAppData, w, r, &actor.DonorProvidedDetails{Type: actor.LpaTypePropertyFinance}) + err := LpaType(template.Execute, nil)(testAppData, w, r, &actor.DonorProvidedDetails{Type: actor.LpaTypePropertyAndAffairs}) resp := w.Result() assert.Nil(t, err) @@ -80,14 +74,14 @@ func TestGetLpaTypeWhenTemplateErrors(t *testing.T) { func TestPostLpaType(t *testing.T) { testcases := map[actor.LpaType]*actor.DonorProvidedDetails{ - actor.LpaTypePropertyFinance: { + actor.LpaTypePropertyAndAffairs: { LpaID: "lpa-id", - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, Tasks: actor.DonorTasks{YourDetails: actor.TaskCompleted}, }, - actor.LpaTypeHealthWelfare: { + actor.LpaTypePersonalWelfare: { LpaID: "lpa-id", - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, WhenCanTheLpaBeUsed: actor.CanBeUsedWhenCapacityLost, Tasks: actor.DonorTasks{YourDetails: actor.TaskCompleted}, }, @@ -123,7 +117,7 @@ func TestPostLpaType(t *testing.T) { func TestPostLpaTypeWhenNotChanged(t *testing.T) { form := url.Values{ - "lpa-type": {actor.LpaTypePropertyFinance.String()}, + "lpa-type": {actor.LpaTypePropertyAndAffairs.String()}, } w := httptest.NewRecorder() @@ -132,7 +126,7 @@ func TestPostLpaTypeWhenNotChanged(t *testing.T) { err := LpaType(nil, nil)(testAppData, w, r, &actor.DonorProvidedDetails{ LpaID: "lpa-id", - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }) resp := w.Result() @@ -143,7 +137,7 @@ func TestPostLpaTypeWhenNotChanged(t *testing.T) { func TestPostLpaTypeWhenStoreErrors(t *testing.T) { form := url.Values{ - "lpa-type": {actor.LpaTypePropertyFinance.String()}, + "lpa-type": {actor.LpaTypePropertyAndAffairs.String()}, } w := httptest.NewRecorder() @@ -181,7 +175,7 @@ func TestPostLpaTypeWhenValidationErrors(t *testing.T) { func TestReadLpaTypeForm(t *testing.T) { form := url.Values{ - "lpa-type": {actor.LpaTypePropertyFinance.String()}, + "lpa-type": {actor.LpaTypePropertyAndAffairs.String()}, } r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(form.Encode())) @@ -189,7 +183,7 @@ func TestReadLpaTypeForm(t *testing.T) { result := readLpaTypeForm(r) - assert.Equal(t, actor.LpaTypePropertyFinance, result.LpaType) + assert.Equal(t, actor.LpaTypePropertyAndAffairs, result.LpaType) } func TestLpaTypeFormValidate(t *testing.T) { diff --git a/internal/page/donor/register_test.go b/internal/page/donor/register_test.go index d8da5e04c2..13cd2cd265 100644 --- a/internal/page/donor/register_test.go +++ b/internal/page/donor/register_test.go @@ -203,7 +203,7 @@ func TestMakeLpaHandleWhenDetailsProvidedAndUIDExists(t *testing.T) { DateOfBirth: date.New("2000", "1", "2"), Address: place.Address{Postcode: "ABC123"}, }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, Tasks: actor.DonorTasks{YourDetails: actor.TaskCompleted}, LpaUID: "a-uid", }, nil) diff --git a/internal/page/donor/task_list.go b/internal/page/donor/task_list.go index f29c9dd386..a9b6be8f31 100644 --- a/internal/page/donor/task_list.go +++ b/internal/page/donor/task_list.go @@ -44,7 +44,7 @@ func TaskList(tmpl template.Template, evidenceReceivedStore EvidenceReceivedStor Path: page.Paths.WhenCanTheLpaBeUsed.Format(donor.LpaID), State: donor.Tasks.WhenCanTheLpaBeUsed, } - if donor.Type == actor.LpaTypeHealthWelfare { + if donor.Type == actor.LpaTypePersonalWelfare { typeSpecificStep = taskListItem{ Name: "lifeSustainingTreatment", Path: page.Paths.LifeSustainingTreatment.Format(donor.LpaID), diff --git a/internal/page/donor/task_list_test.go b/internal/page/donor/task_list_test.go index a84d95a10e..d908cf3cab 100644 --- a/internal/page/donor/task_list_test.go +++ b/internal/page/donor/task_list_test.go @@ -65,7 +65,7 @@ func TestGetTaskList(t *testing.T) { }, }, "hw": { - donor: &actor.DonorProvidedDetails{LpaID: "lpa-id", Type: actor.LpaTypeHealthWelfare, Donor: actor.Donor{LastName: "a", Address: place.Address{Line1: "x"}}}, + donor: &actor.DonorProvidedDetails{LpaID: "lpa-id", Type: actor.LpaTypePersonalWelfare, Donor: actor.Donor{LastName: "a", Address: place.Address{Line1: "x"}}}, expected: func(sections []taskListSection) []taskListSection { sections[0].Items[3] = taskListItem{ Name: "lifeSustainingTreatment", diff --git a/internal/page/fixtures/attorney.go b/internal/page/fixtures/attorney.go index 6b133d0f1b..b114b923ce 100644 --- a/internal/page/fixtures/attorney.go +++ b/internal/page/fixtures/attorney.go @@ -71,7 +71,7 @@ func Attorney( return tmpl(w, &fixturesData{App: appData, Sub: attorneySub}) } - if lpaType == "hw" && isTrustCorporation { + if lpaType == "personal-welfare" && isTrustCorporation { return tmpl(w, &fixturesData{App: appData, Errors: validation.With("", validation.CustomError{Label: "Can't add a trust corporation to a personal welfare LPA"})}) } @@ -115,12 +115,12 @@ func Attorney( } donor.LpaUID = makeUID() - if lpaType == "hw" && !isTrustCorporation { - donor.Type = actor.LpaTypeHealthWelfare + if lpaType == "personal-welfare" && !isTrustCorporation { + donor.Type = actor.LpaTypePersonalWelfare donor.WhenCanTheLpaBeUsed = actor.CanBeUsedWhenCapacityLost donor.LifeSustainingTreatmentOption = actor.LifeSustainingTreatmentOptionA } else { - donor.Type = actor.LpaTypePropertyFinance + donor.Type = actor.LpaTypePropertyAndAffairs donor.WhenCanTheLpaBeUsed = actor.CanBeUsedWhenHasCapacity } diff --git a/internal/page/fixtures/certificate_provider.go b/internal/page/fixtures/certificate_provider.go index f4b4567a6b..f646f57b3f 100644 --- a/internal/page/fixtures/certificate_provider.go +++ b/internal/page/fixtures/certificate_provider.go @@ -78,9 +78,9 @@ func CertificateProvider( donor.LpaUID = makeUID() donor.Donor = makeDonor() - donor.Type = actor.LpaTypePropertyFinance - if lpaType == "hw" { - donor.Type = actor.LpaTypeHealthWelfare + donor.Type = actor.LpaTypePropertyAndAffairs + if lpaType == "personal-welfare" { + donor.Type = actor.LpaTypePersonalWelfare donor.WhenCanTheLpaBeUsed = actor.CanBeUsedWhenCapacityLost donor.LifeSustainingTreatmentOption = actor.LifeSustainingTreatmentOptionA } else { diff --git a/internal/page/fixtures/dashboard.go b/internal/page/fixtures/dashboard.go index 4e049a55c3..1d708c99f6 100644 --- a/internal/page/fixtures/dashboard.go +++ b/internal/page/fixtures/dashboard.go @@ -57,7 +57,7 @@ func Dashboard( donor.LpaUID = makeUID() donor.Donor = makeDonor() - donor.Type = actor.LpaTypePropertyFinance + donor.Type = actor.LpaTypePropertyAndAffairs donor.Attorneys = actor.Attorneys{ Attorneys: []actor.Attorney{makeAttorney(attorneyNames[0])}, diff --git a/internal/page/fixtures/donor.go b/internal/page/fixtures/donor.go index d0ea1bc85a..8f00c96f0f 100644 --- a/internal/page/fixtures/donor.go +++ b/internal/page/fixtures/donor.go @@ -101,11 +101,11 @@ func Donor( if progress >= slices.Index(progressValues, "provideYourDetails") { donorDetails.Donor = makeDonor() - donorDetails.Type = actor.LpaTypePropertyFinance + donorDetails.Type = actor.LpaTypePropertyAndAffairs donorDetails.ContactLanguagePreference = localize.En - if lpaType == "hw" { - donorDetails.Type = actor.LpaTypeHealthWelfare + if lpaType == "personal-welfare" { + donorDetails.Type = actor.LpaTypePersonalWelfare donorDetails.WhenCanTheLpaBeUsed = actor.CanBeUsedWhenCapacityLost } @@ -113,7 +113,7 @@ func Donor( if err := eventClient.SendUidRequested(r.Context(), event.UidRequested{ LpaID: donorDetails.LpaID, DonorSessionID: donorSessionID, - Type: donorDetails.Type.String(), + Type: donorDetails.Type.LegacyString(), Donor: uid.DonorDetails{ Name: donorDetails.Donor.FullName(), Dob: donorDetails.Donor.DateOfBirth, @@ -162,7 +162,7 @@ func Donor( donorDetails.AttorneyDecisions = actor.AttorneyDecisions{} case "jointly": donorDetails.AttorneyDecisions.How = actor.Jointly - case "mixed": + case "jointly-for-some-severally-for-others": donorDetails.AttorneyDecisions.How = actor.JointlyForSomeSeverallyForOthers donorDetails.AttorneyDecisions.Details = "do this and that" } @@ -192,7 +192,7 @@ func Donor( } if progress >= slices.Index(progressValues, "chooseWhenTheLpaCanBeUsed") { - if donorDetails.Type == actor.LpaTypeHealthWelfare { + if donorDetails.Type == actor.LpaTypePersonalWelfare { donorDetails.LifeSustainingTreatmentOption = actor.LifeSustainingTreatmentOptionA donorDetails.Tasks.LifeSustainingTreatment = actor.TaskCompleted } else { diff --git a/internal/page/paths.go b/internal/page/paths.go index a45d870690..a8d76e2522 100644 --- a/internal/page/paths.go +++ b/internal/page/paths.go @@ -416,7 +416,7 @@ func canGoToLpaPath(donor *actor.DonorProvidedDetails, path string) bool { section1Completed := donor.Tasks.YourDetails.Completed() && donor.Tasks.ChooseAttorneys.Completed() && donor.Tasks.ChooseReplacementAttorneys.Completed() && - (donor.Type.IsHealthWelfare() && donor.Tasks.LifeSustainingTreatment.Completed() || donor.Type.IsPropertyFinance() && donor.Tasks.WhenCanTheLpaBeUsed.Completed()) && + (donor.Type.IsPersonalWelfare() && donor.Tasks.LifeSustainingTreatment.Completed() || donor.Type.IsPropertyAndAffairs() && donor.Tasks.WhenCanTheLpaBeUsed.Completed()) && donor.Tasks.Restrictions.Completed() && donor.Tasks.CertificateProvider.Completed() && donor.Tasks.PeopleToNotify.Completed() && @@ -448,7 +448,7 @@ func canGoToLpaPath(donor *actor.DonorProvidedDetails, path string) bool { return donor.Tasks.YourDetails.Completed() && donor.Tasks.ChooseAttorneys.Completed() && donor.Tasks.ChooseReplacementAttorneys.Completed() && - (donor.Type.IsHealthWelfare() && donor.Tasks.LifeSustainingTreatment.Completed() || donor.Tasks.WhenCanTheLpaBeUsed.Completed()) && + (donor.Type.IsPersonalWelfare() && donor.Tasks.LifeSustainingTreatment.Completed() || donor.Tasks.WhenCanTheLpaBeUsed.Completed()) && donor.Tasks.Restrictions.Completed() && donor.Tasks.CertificateProvider.Completed() && donor.Tasks.PeopleToNotify.Completed() && diff --git a/internal/page/paths_test.go b/internal/page/paths_test.go index ae56a5ad06..18311c9ee3 100644 --- a/internal/page/paths_test.go +++ b/internal/page/paths_test.go @@ -67,7 +67,7 @@ func TestLpaPathRedirect(t *testing.T) { Donor: actor.Donor{ CanSign: form.Yes, }, - Type: actor.LpaTypeHealthWelfare, + Type: actor.LpaTypePersonalWelfare, Tasks: actor.DonorTasks{ YourDetails: actor.TaskCompleted, ChooseAttorneys: actor.TaskCompleted, diff --git a/internal/page/share_code.go b/internal/page/share_code.go index 0f14601ab4..2dfc623262 100644 --- a/internal/page/share_code.go +++ b/internal/page/share_code.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" + "github.com/ministryofjustice/opg-modernising-lpa/internal/localize" "github.com/ministryofjustice/opg-modernising-lpa/internal/notify" ) @@ -37,7 +38,7 @@ func (s *ShareCodeSender) SendCertificateProviderInvite(ctx context.Context, app return s.sendCertificateProvider(ctx, appData, donor, notify.CertificateProviderInviteEmail{ CertificateProviderFullName: donor.CertificateProvider.FullName(), DonorFullName: donor.Donor.FullName(), - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), CertificateProviderStartURL: fmt.Sprintf("%s%s", s.appPublicURL, Paths.CertificateProviderStart), DonorFirstNames: donor.Donor.FirstNames, DonorFirstNamesPossessive: appData.Localizer.Possessive(donor.Donor.FirstNames), @@ -49,7 +50,7 @@ func (s *ShareCodeSender) SendCertificateProviderPrompt(ctx context.Context, app return s.sendCertificateProvider(ctx, appData, donor, notify.CertificateProviderProvideCertificatePromptEmail{ CertificateProviderFullName: donor.CertificateProvider.FullName(), DonorFullName: donor.Donor.FullName(), - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), CertificateProviderStartURL: fmt.Sprintf("%s%s", s.appPublicURL, Paths.CertificateProviderStart), }) } @@ -111,7 +112,7 @@ func (s *ShareCodeSender) sendOriginalAttorney(ctx context.Context, appData AppD DonorFirstNames: donor.Donor.FirstNames, DonorFirstNamesPossessive: appData.Localizer.Possessive(donor.Donor.FirstNames), DonorFullName: donor.Donor.FullName(), - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), AttorneyStartPageURL: fmt.Sprintf("%s%s", s.appPublicURL, Paths.Attorney.Start), }, actor.ShareCodeData{ @@ -132,7 +133,7 @@ func (s *ShareCodeSender) sendReplacementAttorney(ctx context.Context, appData A DonorFirstNames: donor.Donor.FirstNames, DonorFirstNamesPossessive: appData.Localizer.Possessive(donor.Donor.FirstNames), DonorFullName: donor.Donor.FullName(), - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), AttorneyStartPageURL: fmt.Sprintf("%s%s", s.appPublicURL, Paths.Attorney.Start), }, actor.ShareCodeData{ SessionID: appData.SessionID, @@ -153,7 +154,7 @@ func (s *ShareCodeSender) sendTrustCorporation(ctx context.Context, appData AppD DonorFirstNames: donor.Donor.FirstNames, DonorFirstNamesPossessive: appData.Localizer.Possessive(donor.Donor.FirstNames), DonorFullName: donor.Donor.FullName(), - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), AttorneyStartPageURL: fmt.Sprintf("%s%s", s.appPublicURL, Paths.Attorney.Start), }, actor.ShareCodeData{ @@ -174,7 +175,7 @@ func (s *ShareCodeSender) sendReplacementTrustCorporation(ctx context.Context, a DonorFirstNames: donor.Donor.FirstNames, DonorFirstNamesPossessive: appData.Localizer.Possessive(donor.Donor.FirstNames), DonorFullName: donor.Donor.FullName(), - LpaType: appData.Localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(appData.Localizer.T(donor.Type.String())), AttorneyStartPageURL: fmt.Sprintf("%s%s", s.appPublicURL, Paths.Attorney.Start), }, actor.ShareCodeData{ diff --git a/internal/page/share_code_test.go b/internal/page/share_code_test.go index e1f09f2b97..0d9adb05a4 100644 --- a/internal/page/share_code_test.go +++ b/internal/page/share_code_test.go @@ -23,13 +23,13 @@ func TestShareCodeSenderSendCertificateProviderInvite(t *testing.T) { FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } localizer := newMockLocalizer(t) localizer. - On("T", donor.Type.LegalTermTransKey()). - Return("property and affairs"). + On("T", donor.Type.String()). + Return("Property and affairs"). Once() localizer. On("T", donor.Type.WhatLPACoversTransKey()). @@ -97,15 +97,15 @@ func TestShareCodeSenderSendCertificateProviderInviteWithTestCode(t *testing.T) FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } for name, tc := range testcases { t.Run(name, func(t *testing.T) { localizer := newMockLocalizer(t) localizer. - On("T", donor.Type.LegalTermTransKey()). - Return("property and affairs"). + On("T", donor.Type.String()). + Return("Property and affairs"). Twice() localizer. On("Possessive", "Jan"). @@ -194,7 +194,7 @@ func TestShareCodeSenderSendCertificateProviderInviteWhenEmailErrors(t *testing. FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } localizer := newMockLocalizer(t) @@ -256,13 +256,13 @@ func TestShareCodeSenderSendCertificateProviderPrompt(t *testing.T) { FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } localizer := newMockLocalizer(t) localizer. - On("T", donor.Type.LegalTermTransKey()). - Return("property and affairs"). + On("T", donor.Type.String()). + Return("Property and affairs"). Once() TestAppData.Localizer = localizer @@ -320,15 +320,15 @@ func TestShareCodeSenderSendCertificateProviderPromptWithTestCode(t *testing.T) FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } for name, tc := range testcases { t.Run(name, func(t *testing.T) { localizer := newMockLocalizer(t) localizer. - On("T", donor.Type.LegalTermTransKey()). - Return("property and affairs"). + On("T", donor.Type.String()). + Return("Property and affairs"). Twice() TestAppData.Localizer = localizer @@ -406,7 +406,7 @@ func TestShareCodeSenderSendCertificateProviderPromptWhenEmailErrors(t *testing. FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } localizer := newMockLocalizer(t) @@ -496,12 +496,12 @@ func TestShareCodeSenderSendAttorneys(t *testing.T) { FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } localizer := newMockLocalizer(t) localizer. - On("T", donor.Type.LegalTermTransKey()). + On("T", donor.Type.String()). Return("property and affairs") localizer. On("Possessive", "Jan"). @@ -618,12 +618,12 @@ func TestShareCodeSenderSendAttorneysWithTestCode(t *testing.T) { FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } localizer := newMockLocalizer(t) localizer. - On("T", donor.Type.LegalTermTransKey()). + On("T", donor.Type.String()). Return("property and affairs") localizer. On("Possessive", "Jan"). @@ -697,12 +697,12 @@ func TestShareCodeSenderSendAttorneysWhenEmailErrors(t *testing.T) { FirstNames: "Jan", LastName: "Smith", }, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, } localizer := newMockLocalizer(t) localizer. - On("T", donor.Type.LegalTermTransKey()). + On("T", donor.Type.String()). Return("property and affairs") localizer. On("Possessive", "Jan"). @@ -730,10 +730,10 @@ func TestShareCodeSenderSendAttorneysWhenShareCodeStoreErrors(t *testing.T) { localizer := newMockLocalizer(t) localizer. - On("T", ""). + On("T", mock.Anything). Return("property and affairs") localizer. - On("Possessive", ""). + On("Possessive", mock.Anything). Return("Jan's") TestAppData.Localizer = localizer diff --git a/internal/page/witness_code.go b/internal/page/witness_code.go index b590169736..03d951e11d 100644 --- a/internal/page/witness_code.go +++ b/internal/page/witness_code.go @@ -6,6 +6,7 @@ import ( "time" "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" + "github.com/ministryofjustice/opg-modernising-lpa/internal/localize" "github.com/ministryofjustice/opg-modernising-lpa/internal/notify" "github.com/ministryofjustice/opg-modernising-lpa/internal/random" ) @@ -39,7 +40,7 @@ func (s *WitnessCodeSender) SendToCertificateProvider(ctx context.Context, donor _, err := s.notifyClient.SendSMS(ctx, donor.CertificateProvider.Mobile, notify.WitnessCodeSMS{ WitnessCode: code, DonorFullName: localizer.Possessive(donor.Donor.FullName()), - LpaType: localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(localizer.T(donor.Type.String())), }) if err != nil { return err @@ -59,7 +60,7 @@ func (s *WitnessCodeSender) SendToIndependentWitness(ctx context.Context, donor _, err := s.notifyClient.SendSMS(ctx, donor.IndependentWitness.Mobile, notify.WitnessCodeSMS{ WitnessCode: code, DonorFullName: localizer.Possessive(donor.Donor.FullName()), - LpaType: localizer.T(donor.Type.LegalTermTransKey()), + LpaType: localize.LowerFirst(localizer.T(donor.Type.String())), }) if err != nil { return err diff --git a/internal/page/witness_code_test.go b/internal/page/witness_code_test.go index dbb6472cbb..a2bf359279 100644 --- a/internal/page/witness_code_test.go +++ b/internal/page/witness_code_test.go @@ -30,13 +30,13 @@ func TestWitnessCodeSenderSendToCertificateProvider(t *testing.T) { Donor: actor.Donor{FirstNames: "Joe", LastName: "Jones"}, CertificateProvider: actor.CertificateProvider{Mobile: "0777"}, CertificateProviderCodes: actor.WitnessCodes{{Code: "1234", Created: now}}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }). Return(nil) localizer := newMockLocalizer(t) localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("property and affairs") localizer. On("Possessive", "Joe Jones"). @@ -51,7 +51,7 @@ func TestWitnessCodeSenderSendToCertificateProvider(t *testing.T) { err := sender.SendToCertificateProvider(ctx, &actor.DonorProvidedDetails{ Donor: actor.Donor{FirstNames: "Joe", LastName: "Jones"}, CertificateProvider: actor.CertificateProvider{Mobile: "0777"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }, localizer) assert.Nil(t, err) @@ -77,7 +77,7 @@ func TestWitnessCodeSenderSendToCertificateProviderWhenNotifyClientErrors(t *tes localizer := newMockLocalizer(t) localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("property and affairs") localizer. On("Possessive", "Joe Jones"). @@ -91,7 +91,7 @@ func TestWitnessCodeSenderSendToCertificateProviderWhenNotifyClientErrors(t *tes err := sender.SendToCertificateProvider(context.Background(), &actor.DonorProvidedDetails{ CertificateProvider: actor.CertificateProvider{Mobile: "0777"}, Donor: actor.Donor{FirstNames: "Joe", LastName: "Jones"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }, localizer) assert.Equal(t, expectedError, err) @@ -110,7 +110,7 @@ func TestWitnessCodeSenderSendToCertificateProviderWhenDonorStoreErrors(t *testi localizer := newMockLocalizer(t) localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("property and affairs") localizer. On("Possessive", "Joe Jones"). @@ -125,7 +125,7 @@ func TestWitnessCodeSenderSendToCertificateProviderWhenDonorStoreErrors(t *testi err := sender.SendToCertificateProvider(context.Background(), &actor.DonorProvidedDetails{ CertificateProvider: actor.CertificateProvider{Mobile: "0777"}, Donor: actor.Donor{FirstNames: "Joe", LastName: "Jones"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }, localizer) assert.Equal(t, expectedError, err) @@ -150,13 +150,13 @@ func TestWitnessCodeSenderSendToIndependentWitness(t *testing.T) { Donor: actor.Donor{FirstNames: "Joe", LastName: "Jones"}, IndependentWitness: actor.IndependentWitness{Mobile: "0777"}, IndependentWitnessCodes: actor.WitnessCodes{{Code: "1234", Created: now}}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }). Return(nil) localizer := newMockLocalizer(t) localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("property and affairs") localizer. On("Possessive", "Joe Jones"). @@ -171,7 +171,7 @@ func TestWitnessCodeSenderSendToIndependentWitness(t *testing.T) { err := sender.SendToIndependentWitness(ctx, &actor.DonorProvidedDetails{ Donor: actor.Donor{FirstNames: "Joe", LastName: "Jones"}, IndependentWitness: actor.IndependentWitness{Mobile: "0777"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }, localizer) assert.Nil(t, err) @@ -197,7 +197,7 @@ func TestWitnessCodeSenderSendToIndependentWitnessWhenNotifyClientErrors(t *test localizer := newMockLocalizer(t) localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("property and affairs") localizer. On("Possessive", "Joe Jones"). @@ -211,7 +211,7 @@ func TestWitnessCodeSenderSendToIndependentWitnessWhenNotifyClientErrors(t *test err := sender.SendToIndependentWitness(context.Background(), &actor.DonorProvidedDetails{ IndependentWitness: actor.IndependentWitness{Mobile: "0777"}, Donor: actor.Donor{FirstNames: "Joe", LastName: "Jones"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }, localizer) assert.Equal(t, expectedError, err) @@ -230,7 +230,7 @@ func TestWitnessCodeSenderSendToIndependentWitnessWhenDonorStoreErrors(t *testin localizer := newMockLocalizer(t) localizer. - On("T", "pfaLegalTerm"). + On("T", "property-and-affairs"). Return("property and affairs") localizer. On("Possessive", "Joe Jones"). @@ -245,7 +245,7 @@ func TestWitnessCodeSenderSendToIndependentWitnessWhenDonorStoreErrors(t *testin err := sender.SendToIndependentWitness(context.Background(), &actor.DonorProvidedDetails{ IndependentWitness: actor.IndependentWitness{Mobile: "0777"}, Donor: actor.Donor{FirstNames: "Joe", LastName: "Jones"}, - Type: actor.LpaTypePropertyFinance, + Type: actor.LpaTypePropertyAndAffairs, }, localizer) assert.Equal(t, expectedError, err) diff --git a/internal/pay/enum_evidencedelivery.go b/internal/pay/enum_evidencedelivery.go index 328e88cf47..aab7c3de86 100644 --- a/internal/pay/enum_evidencedelivery.go +++ b/internal/pay/enum_evidencedelivery.go @@ -26,6 +26,10 @@ func (i EvidenceDelivery) String() string { return _EvidenceDelivery_name[_EvidenceDelivery_index[i]:_EvidenceDelivery_index[i+1]] } +func (i EvidenceDelivery) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i EvidenceDelivery) IsUpload() bool { return i == Upload } diff --git a/internal/pay/enum_feetype.go b/internal/pay/enum_feetype.go index eabc59a14d..d76c38a8a7 100644 --- a/internal/pay/enum_feetype.go +++ b/internal/pay/enum_feetype.go @@ -28,6 +28,10 @@ func (i FeeType) String() string { return _FeeType_name[_FeeType_index[i]:_FeeType_index[i+1]] } +func (i FeeType) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i FeeType) IsFullFee() bool { return i == FullFee } diff --git a/internal/pay/enum_previousfee.go b/internal/pay/enum_previousfee.go index a719781a48..ef837c3145 100644 --- a/internal/pay/enum_previousfee.go +++ b/internal/pay/enum_previousfee.go @@ -28,6 +28,10 @@ func (i PreviousFee) String() string { return _PreviousFee_name[_PreviousFee_index[i]:_PreviousFee_index[i+1]] } +func (i PreviousFee) MarshalText() ([]byte, error) { + return []byte(i.String()), nil +} + func (i PreviousFee) IsPreviousFeeFull() bool { return i == PreviousFeeFull } diff --git a/internal/templatefn/fn.go b/internal/templatefn/fn.go index 569104b995..c66d729cda 100644 --- a/internal/templatefn/fn.go +++ b/internal/templatefn/fn.go @@ -7,8 +7,6 @@ import ( "slices" "strings" "time" - "unicode" - "unicode/utf8" humanize "github.com/dustin/go-humanize" "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" @@ -43,7 +41,7 @@ func All(tag, region string) map[string]any { "formatDate": formatDate, "formatDateTime": formatDateTime, "formatPhone": formatPhone, - "lowerFirst": lowerFirst, + "lowerFirst": localize.LowerFirst, "listAttorneys": listAttorneys, "warning": warning, "listPeopleToNotify": listPeopleToNotify, @@ -262,11 +260,6 @@ func formatPhone(s string) string { return s } -func lowerFirst(s string) string { - r, n := utf8.DecodeRuneInString(s) - return string(unicode.ToLower(r)) + s[n:] -} - type attorneySummaryData struct { App page.AppData CanChange bool diff --git a/internal/templatefn/fn_test.go b/internal/templatefn/fn_test.go index b1fa43c2a4..7ffbd3b45a 100644 --- a/internal/templatefn/fn_test.go +++ b/internal/templatefn/fn_test.go @@ -267,11 +267,6 @@ func TestFormatPhone(t *testing.T) { assert.Equal(t, "+44 something else", formatPhone("+44 something else")) } -func TestLowerFirst(t *testing.T) { - assert.Equal(t, "hELLO", lowerFirst("HELLO")) - assert.Equal(t, "hello", lowerFirst("hello")) -} - func TestListAttorneysWithAttorneys(t *testing.T) { trustCorporation := actor.TrustCorporation{Name: "a"} attorneys := []actor.Attorney{ diff --git a/lang/cy.json b/lang/cy.json index 256aadb495..0838c65b5c 100644 --- a/lang/cy.json +++ b/lang/cy.json @@ -18,8 +18,6 @@ "openGovernmentLicenceContent": "Mae’r holl gynnwys ar gael o dan Trwydded Llywodraeth Agored v3.0, oni nodir yn wahanol", "crownCopyright": "© Hawlfraint y goron", "continue": "Parhau", - "pfaLegalTerm": "eiddo a materion ariannol", - "hwLegalTerm": "lles personol", "thereIsAProblem": "Mae yna broblem", "yes": "Ydw", "no": "Nac ydw", @@ -111,10 +109,10 @@ "whichTypeOfLpaToMake": "Pa fath o LPA ydych chi eisiau ei gwneud?", "whichTypeOfLpaToMakeContent": "
Ceir 2 fath o LPA. Gallwch wneud LPA sy’n cynnwys penderfyniadau ynglŷn â’ch:
Gallwch gael un neu’r ddau fath o LPA.
Nid oes rhaid eu gwneud ar yr un pryd a gallwch ailddefnyddio unrhyw wybodaeth a roddwch i wneud LPA arall nes ymlaen.
Gallwch ddewis gwahanol bobl i fod yn atwrneiod i chi ar gyfer pob LPA.
Darllenwch fwy am y 2 fath o LPA.
", "theTypeOfLpaToMake": "pa fath o LPA ydych chi eisiau ei gwneud", - "lpaTypePfa": "Eiddo a materion ariannol", - "lpaTypePfaHint": "Mae hyn yn cwmpasu penderfyniadau am eich arian, cyllid ac eiddo.", - "lpaTypeHw": "Lles personol", - "lpaTypeHwHint": "Mae hyn yn cwmpasu penderfyniadau am eich gofal iechyd, triniaeth feddygol a lles personol.", + "property-and-affairs": "Eiddo a materion ariannol", + "propertyAndAffairsHint": "Mae hyn yn cwmpasu penderfyniadau am eich arian, cyllid ac eiddo.", + "personal-welfare": "Lles personol", + "personalWelfareHint": "Mae hyn yn cwmpasu penderfyniadau am eich gofal iechyd, triniaeth feddygol a lles personol.", "makeYourTypeLpa": "Gwneud eich LPA {{.Type}}", "yourTaskList": "Eich rhestr o dasgau", "taskListHelp": "Help i wneud yr LPA hon", @@ -154,8 +152,8 @@ "doYouWantToRemovePersonToNotify": "Welsh", "doYouWantToRemoveReplacementAttorney": "Welsh", "whoWouldYouLikeToBeTheAttorneysDetailsTitle": "Canllawiau ar ddewis atwrnai", - "whoWouldYouLikeToBeTheAttorneysDetailsContentPA": "Eich atwrneiod yw’r bobl a fydd yn gallu eich helpu i wneud penderfyniadau am eich arian, eich eiddo a’ch cyllid, os byddwch chi byth eisiau neu angen eu cymorth yn y dyfodol.
Mae’n bwysig eich bod yn dewis pobl rydych yn ymddiried ynddynt i barchu eich dymuniadau ac i weithredu er eich lles pennaf. Gallai eich atwrneiod fod eich priod, aelodau o’ch teulu, ffrindiau agos neu weithiwr proffesiynol, fel cyfreithiwr.
Gallwch gael mwy nag un atwrnai. Mae gan y rhan fwyaf o bobl rhwng 1 a 3 atwrnai.
Os ydych yn dewis cael mwy nag un atwrnai, dylech ddewis pobl sy’n gallu gweithio’n dda gyda’i gilydd.
Rhaid i’ch atwrneiod fod yn 18 oed neu’n hŷn.
Rhaid i atwrnai beidio â bod yn fethdalwr na chael gorchymyn rhyddhau o ddyled. Darllenwch fwy am atwrneiod.
Gofynnir i chi os hoffech ychwanegu atwrneiod wrth gefn mewn cwestiwn ar wahân. Byddant yn camu i’r adwy os yw eich atwrneiod gwreiddiol yn methu neu’n anfodlon parhau.
", - "whoWouldYouLikeToBeTheAttorneysDetailsContentPW": "Welsh
Welsh
Welsh
Welsh
Welsh. Welsh.
Welsh Welsh Welsh.
", + "whoWouldYouLikeToBeTheAttorneysDetailsContent:property-and-affairs": "Eich atwrneiod yw’r bobl a fydd yn gallu eich helpu i wneud penderfyniadau am eich arian, eich eiddo a’ch cyllid, os byddwch chi byth eisiau neu angen eu cymorth yn y dyfodol.
Mae’n bwysig eich bod yn dewis pobl rydych yn ymddiried ynddynt i barchu eich dymuniadau ac i weithredu er eich lles pennaf. Gallai eich atwrneiod fod eich priod, aelodau o’ch teulu, ffrindiau agos neu weithiwr proffesiynol, fel cyfreithiwr.
Gallwch gael mwy nag un atwrnai. Mae gan y rhan fwyaf o bobl rhwng 1 a 3 atwrnai.
Os ydych yn dewis cael mwy nag un atwrnai, dylech ddewis pobl sy’n gallu gweithio’n dda gyda’i gilydd.
Rhaid i’ch atwrneiod fod yn 18 oed neu’n hŷn.
Rhaid i atwrnai beidio â bod yn fethdalwr na chael gorchymyn rhyddhau o ddyled. Darllenwch fwy am atwrneiod.
Gofynnir i chi os hoffech ychwanegu atwrneiod wrth gefn mewn cwestiwn ar wahân. Byddant yn camu i’r adwy os yw eich atwrneiod gwreiddiol yn methu neu’n anfodlon parhau.
", + "whoWouldYouLikeToBeTheAttorneysDetailsContent:personal-welfare": "Welsh
Welsh
Welsh
Welsh
Welsh. Welsh.
Welsh Welsh Welsh.
", "attorney": "Atwrnai", "attorneyDateOfBirthIsUnder18": "Mae’r atwrnai hwn o dan 18 oed. Ni fyddwch yn gallu gorffen gwneud yr LPA hon nes eu bod yn 18.", "wantReplacementAttorneys": "Ydych chi eisiau unrhyw atwrneiod wrth gefn?", @@ -185,8 +183,8 @@ "restrictionsOnYourAttorneysPowerTitle": "Cyfyngu ar y penderfyniadau y gall eich atwrneiod eu gwneud", "restrictionsOnYourAttorneysPowerContent": "Gallwch gyfyngu ar y penderfyniadau y gall eich atwrneiod eu gwneud drwy ychwanegu cyfyngiadau neu amodau at eich LPA.
Mae’r adran hon yn ddewisol.
Bydd yr hyn a ddywedwch yma yn dweud wrth John a Joan am y pethau:
Nid oes rhaid i chi ychwanegu cyfyngiadau neu amodau at eich LPA.
Mae yna reolau cyfreithiol ynglŷn â sut dylid geirio eich cyfyngiadau a’ch amodau, felly mae’n bwysig darllen ein canllawiau ar ysgrifennu cyfyngiadau ac amodau.
Os ydych yn ansicr, neu os oes gennych gyfyngiadau neu amodau manwl, dylech gael cyngor cyfreithiol.
", "restrictionExamples": "Dangoswch rai enghreifftiau i fi", - "restrictionExamplesContentPfa": "Cyn llofnodi, rhaid i chi ddarllen eich hawliau a’ch cyfrifoldebau cyfreithiol.
Drwy lofnodi eich LPA, rydych yn penodi eich atwrneiod i wneud penderfyniadau ar eich rhan.
Rhaid i’ch atwrneiod ddilyn Deddf Galluedd Meddyliol 2005, rheoliadau a wneir oddi tani a’r Cod Ymarfer. Mae hyn yn cynnwys egwyddorion y Ddeddf Galluedd Meddyliol:
Before signing, you must read your legal rights and responsibilities.
By signing your LPA, you are appointing your attorneys to make decisions for you.
Your attorneys must follow the Mental Capacity Act 2005 (MCA) and the Code of Practice. This includes the principles of the MCA:
Cyn llofnodi, rhaid i chi ddarllen eich hawliau a’ch cyfrifoldebau cyfreithiol.
Drwy lofnodi eich LPA, rydych yn penodi eich atwrneiod i wneud penderfyniadau ar eich rhan.
Rhaid i’ch atwrneiod ddilyn Deddf Galluedd Meddyliol 2005, rheoliadau a wneir oddi tani a’r Cod Ymarfer. Mae hyn yn cynnwys egwyddorion y Ddeddf Galluedd Meddyliol:
Before signing, you must read your legal rights and responsibilities.
By signing your LPA, you are appointing your attorneys to make decisions for you.
Your attorneys must follow the Mental Capacity Act 2005 (MCA) and the Code of Practice. This includes the principles of the MCA:
Welsh {{ .DonorFullName }}.
Welsh:
Welsh {{ .DonorFirstNames }}.
Welsh
Welsh
", "ifYouHaveConcerns": "Welsh", "provideYourCertificate": "Darparu eich tystysgrif", @@ -583,17 +581,17 @@ "confirmYourDetails": "Cadarnhau eich manylion", "readTheLpa": "Darllen yr atwrneiaeth arhosol", "signTheLpa": "Llofnodi’r atwrneiaeth arhosol", - "attorneyCodeOfConductPfa": "Fel atwrnai eiddo a materion ariannol, bydd gennych chi’r hawl i wneud penderfyniadau am arian ac eiddo’r rhoddwr ({{.DonorFullNamePossessive}}). Gallai hyn gynnwys rheoli cyfrifon banc, biliau a budd-daliadau, a gwerthu eiddo.\n
Cyn cytuno i fod yn atwrnai dros {{.DonorFirstNamesPossessive}} mae’n bwysig deall sut dylech chi weithredu wrth wneud penderfyniadau a defnyddio’r atwrneiaeth arhosol.
Rhaid i chi ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Os byddwch yn camddefnyddio arian y rhoddwr a’i fod yn mynd yn fethdalwr, ni fyddwch yn gallu gweithredu fel ei atwrnai mwyach.
Dylech roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os byddwch yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad.
", - "attorneyCodeOfConductHw": "Fel atwrnai lles personol, bydd gennych hawl i wneud penderfyniadau am drefn ddyddiol a gofal personol a meddygol y rhoddwr ({{.DonorFullNamePossessive}}).
Cyn cytuno i fod yn atwrnai dros {{.DonorFirstNamesPossessive}} mae’n bwysig deall sut dylech chi weithredu wrth wneud penderfyniadau a defnyddio’r atwrneiaeth arhosol.
Rhaid i chi ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol..
Mae hyn yn cynnwys:
Dylech roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os byddwch yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad.
", - "trustCorporationCodeOfConductPfa": "Fel atwrnai eiddo a materion ariannol, bydd gan y gorfforaeth ymddiriedolaeth y pŵer i wneud penderfyniadau am arian ac eiddo’r rhoddwr ({{.DonorFullNamePossessive}}).
Cyn cytuno, ar ran y cwmni, i fod yn atwrnai dros {{.DonorFirstNamesPossessive}}, mae’n bwysig deall sut dylai’r cwmni weithredu wrth ddefnyddio’r atwrniaeth arhosol i wneud penderfyniadau.
Rhaid i’r cwmni ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Os bydd y cwmni yn camddefnyddio arian y rhoddwr a’i fod yn mynd yn fethdalwr, ni fydd yn gallu gweithredu fel ei atwrnai mwyach.
Dylai’r cwmni roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os bydd yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill drosderfynu eich penodiad (dod â’r penodiad i ben).
", + "attorneyCodeOfConduct:property-and-affairs": "Fel atwrnai eiddo a materion ariannol, bydd gennych chi’r hawl i wneud penderfyniadau am arian ac eiddo’r rhoddwr ({{.DonorFullNamePossessive}}). Gallai hyn gynnwys rheoli cyfrifon banc, biliau a budd-daliadau, a gwerthu eiddo.\n
Cyn cytuno i fod yn atwrnai dros {{.DonorFirstNamesPossessive}} mae’n bwysig deall sut dylech chi weithredu wrth wneud penderfyniadau a defnyddio’r atwrneiaeth arhosol.
Rhaid i chi ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Os byddwch yn camddefnyddio arian y rhoddwr a’i fod yn mynd yn fethdalwr, ni fyddwch yn gallu gweithredu fel ei atwrnai mwyach.
Dylech roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os byddwch yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad.
", + "attorneyCodeOfConduct:personal-welfare": "Fel atwrnai lles personol, bydd gennych hawl i wneud penderfyniadau am drefn ddyddiol a gofal personol a meddygol y rhoddwr ({{.DonorFullNamePossessive}}).
Cyn cytuno i fod yn atwrnai dros {{.DonorFirstNamesPossessive}} mae’n bwysig deall sut dylech chi weithredu wrth wneud penderfyniadau a defnyddio’r atwrneiaeth arhosol.
Rhaid i chi ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol..
Mae hyn yn cynnwys:
Dylech roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os byddwch yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad.
", + "trustCorporationCodeOfConduct": "Fel atwrnai eiddo a materion ariannol, bydd gan y gorfforaeth ymddiriedolaeth y pŵer i wneud penderfyniadau am arian ac eiddo’r rhoddwr ({{.DonorFullNamePossessive}}).
Cyn cytuno, ar ran y cwmni, i fod yn atwrnai dros {{.DonorFirstNamesPossessive}}, mae’n bwysig deall sut dylai’r cwmni weithredu wrth ddefnyddio’r atwrniaeth arhosol i wneud penderfyniadau.
Rhaid i’r cwmni ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Os bydd y cwmni yn camddefnyddio arian y rhoddwr a’i fod yn mynd yn fethdalwr, ni fydd yn gallu gweithredu fel ei atwrnai mwyach.
Dylai’r cwmni roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os bydd yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill drosderfynu eich penodiad (dod â’r penodiad i ben).
", "actingAsAttorney": "Gweithredu fel atwrnai", "weHaveIdentifiedYourReplacementAttorneyReferenceNumber": "Rydym wedi adnabod eich cyfeirnod atwrnai wrth gefn", - "replacementAttorneyCodeOfConductHw": "Fel atwrnai wrth gefn, ni fyddwch yn gallu gweithredu ar ran y rhoddwr ({{.DonorFullName}}) ar unwaith. Mae’n bosibl na fydd angen i chi weithredu o gwbl. Fodd bynnag, mae’n dal yn bwysig deall sut y dylech wneud penderfyniadau rhag ofn y bydd angen i chi wneud hynny.
Fel atwrnai lles personol, bydd gennych hawl i wneud penderfyniadau am drefn ddyddiol a gofal personol a meddygol y rhoddwr.
Rhaid i chi ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Dylech roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os byddwch yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad.
", + "replacementAttorneyCodeOfConduct:personal-welfare": "Fel atwrnai wrth gefn, ni fyddwch yn gallu gweithredu ar ran y rhoddwr ({{.DonorFullName}}) ar unwaith. Mae’n bosibl na fydd angen i chi weithredu o gwbl. Fodd bynnag, mae’n dal yn bwysig deall sut y dylech wneud penderfyniadau rhag ofn y bydd angen i chi wneud hynny.
Fel atwrnai lles personol, bydd gennych hawl i wneud penderfyniadau am drefn ddyddiol a gofal personol a meddygol y rhoddwr.
Rhaid i chi ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Dylech roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os byddwch yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad.
", "weHaveIdentifiedYourAttorneyReferenceNumber": "Rydym wedi adnabod eich cyfeirnod atwrnai", "weHaveIdentifiedTheTrustCorporationsAttorneyReferenceNumber": "Rydym wedi dod o hyd i gyfeirnod atwrnai’r gorfforaeth ymddiriedolaeth", "weHaveIdentifiedTheTrustCorporationsReplacementAttorneyReferenceNumber": "Rydym wedi dod o hyd i gyfeirnod atwrnai wrth gefn y gorfforaeth ymddiriedolaeth", - "replacementAttorneyCodeOfConductPfa": "Fel atwrnai wrth gefn, ni fyddwch yn gallu gweithredu ar ran y rhoddwr ({{.DonorFullName}}) ar unwaith. Mae’n bosibl na fydd angen i chi weithredu o gwbl. Fodd bynnag, mae’n dal yn bwysig deall sut y dylech wneud penderfyniadau rhag ofn y bydd angen i chi wneud hynny.
Fel atwrnai eiddo a materion ariannol, bydd gennych hawl i wneud penderfyniadau am arian ac eiddo’r rhoddwr. Gallai hyn gynnwys rheoli cyfrifon banc, biliau a budd-daliadau, a gwerthu eiddo.
Rhaid i chi ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Os byddwch yn camddefnyddio arian y rhoddwr a’i fod yn mynd yn fethdalwr, ni fyddwch yn gallu gweithredu fel ei atwrnai mwyach.
Dylech roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os byddwch yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad..
", - "replacementTrustCorporationCodeOfConductPfa": "Fel atwrnai wrth gefn, ni fydd y gorfforaeth ymddiriedolaeth yn gallu gweithredu ar ran y rhoddwr ({{.DonorFullName}}) ar unwaith. Mae’n bosib ni fydd angen i’r cwmni i weithredu o gwbl. Fodd bynnag, mae o hyd yn bwysig i ddeall sut y dylid gwneud penderfyniadau os oes angen.
Fel atwrnai eiddo a materion ariannol, bydd gan y gorfforaeth ymddiriedolaeth y pŵer i wneud penderfyniadau am arian ac eiddo’r rhoddwr ({{.DonorFullNamePossessive}}).
Rhaid i’r cwmni ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Os bydd y cwmni yn camddefnyddio arian y rhoddwr a’i fod yn mynd yn fethdalwr, ni fydd yn gallu gweithredu fel ei atwrnai mwyach.
Dylai’r cwmni roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os bydd yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad (dod â’r penodiad i ben).
", + "replacementAttorneyCodeOfConduct:property-and-affairs": "Fel atwrnai wrth gefn, ni fyddwch yn gallu gweithredu ar ran y rhoddwr ({{.DonorFullName}}) ar unwaith. Mae’n bosibl na fydd angen i chi weithredu o gwbl. Fodd bynnag, mae’n dal yn bwysig deall sut y dylech wneud penderfyniadau rhag ofn y bydd angen i chi wneud hynny.
Fel atwrnai eiddo a materion ariannol, bydd gennych hawl i wneud penderfyniadau am arian ac eiddo’r rhoddwr. Gallai hyn gynnwys rheoli cyfrifon banc, biliau a budd-daliadau, a gwerthu eiddo.
Rhaid i chi ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Os byddwch yn camddefnyddio arian y rhoddwr a’i fod yn mynd yn fethdalwr, ni fyddwch yn gallu gweithredu fel ei atwrnai mwyach.
Dylech roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os byddwch yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad..
", + "replacementTrustCorporationCodeOfConduct": "Fel atwrnai wrth gefn, ni fydd y gorfforaeth ymddiriedolaeth yn gallu gweithredu ar ran y rhoddwr ({{.DonorFullName}}) ar unwaith. Mae’n bosib ni fydd angen i’r cwmni i weithredu o gwbl. Fodd bynnag, mae o hyd yn bwysig i ddeall sut y dylid gwneud penderfyniadau os oes angen.
Fel atwrnai eiddo a materion ariannol, bydd gan y gorfforaeth ymddiriedolaeth y pŵer i wneud penderfyniadau am arian ac eiddo’r rhoddwr ({{.DonorFullNamePossessive}}).
Rhaid i’r cwmni ddilyn egwyddorion y Ddeddf Galluedd Meddyliol (2005) a Chod Ymarfer y Ddeddf Galluedd Meddyliol.
Mae hyn yn cynnwys:
Os bydd y cwmni yn camddefnyddio arian y rhoddwr a’i fod yn mynd yn fethdalwr, ni fydd yn gallu gweithredu fel ei atwrnai mwyach.
Dylai’r cwmni roi gwybod i’r rhoddwr a Swyddfa’r Gwarcheidwad Cyhoeddus os bydd yn dewis rhoi’r gorau i fod yn atwrnai.
Mae rhesymau eraill dros derfynu eich penodiad (dod â’r penodiad i ben).
", "whatIsYourUkMobileNumber": "Beth yw eich rhif ffôn symudol yn y DU?", "enterYourUkMobileNumberOptional": "Rhowch eich rhif ffôn symudol yn y DU (dewisol)", "youCanChooseToTellUsYourMobileNumber": "Gallwch ddewis rhoi eich rhif ffôn symudol i ni rhag ofn y bydd angen i ni gysylltu â chi.", @@ -686,8 +684,8 @@ "otherNamesHint": "Er enghraifft, eich enw cyn priodi.", "chooseWhichTypeOfLpaToMake": "Dewiswch pa fath o LPA ydych chi eisiau ei gwneud", "choosingYourAttorneys": "Dewis eich atwrneiod", - "choosingYourAttorneysContentPA": "Eich atwrneiod yw’r bobl a fydd yn gallu eich helpu i wneud penderfyniadau am eich arian, eiddo a chyllid os byddwch byth eisiau neu angen eu cymorth arnoch yn y dyfodol.
Mae’n bwysig eich bod yn dewis pobl rydych yn ymddiried ynddynt i barchu eich dymuniadau ac i weithredu er eich lles pennaf. Gallai eich atwrneiod fod eich priod, aelodau o’ch teulu, ffrindiau agos neu weithiwr proffesiynol, fel cyfreithiwr.
Os ydych yn dewis cael mwy nag un atwrnai, dylech ddewis pobl sy’n gallu gweithio’n dda gyda’i gilydd. Mae gan y rhan fwyaf o bobl rhwng 1 a 3 atwrnai.
Does dim rhaid i chi gael mwy nag un atwrnai ond, os mai dim ond un sydd gennych, ac na allant weithredu mwyach, bydd eich LPA yn dod i ben.
Rhaid i’ch atwrneiod fod yn 18 oed neu’n hŷn. Rhaid i atwrnai beidio â bod yn fethdalwr na chael gorchymyn rhyddhau o ddyled. Darllenwch fwy am atwrneiod.
Os ydych chi’n ystyried penodi corfforaeth ymddiriedolaeth, dylech holi am ffioedd a chael cyngor cyfreithiol.
Gall corfforaethau ymddiriedolaeth weithredu ar eu pen eu hunain neu gydag atwrneiod eraill. Gallant hefyd fod yn atwrnai wrth gefn.
Gofynnir i chi os hoffech ychwanegu atwrneiod wrth gefn mewn cwestiwn ar wahân. Byddant yn camu i’r adwy os bydd eich atwrneiod gwreiddiol yn methu neu’n anfodlon parhau.
", - "choosingYourAttorneysContentPW": "Welsh
Welsh
Welsh
Welsh
Welsh. Welsh.
Welsh Welsh Welsh
", + "choosingYourAttorneysContent:property-and-affairs": "Eich atwrneiod yw’r bobl a fydd yn gallu eich helpu i wneud penderfyniadau am eich arian, eiddo a chyllid os byddwch byth eisiau neu angen eu cymorth arnoch yn y dyfodol.
Mae’n bwysig eich bod yn dewis pobl rydych yn ymddiried ynddynt i barchu eich dymuniadau ac i weithredu er eich lles pennaf. Gallai eich atwrneiod fod eich priod, aelodau o’ch teulu, ffrindiau agos neu weithiwr proffesiynol, fel cyfreithiwr.
Os ydych yn dewis cael mwy nag un atwrnai, dylech ddewis pobl sy’n gallu gweithio’n dda gyda’i gilydd. Mae gan y rhan fwyaf o bobl rhwng 1 a 3 atwrnai.
Does dim rhaid i chi gael mwy nag un atwrnai ond, os mai dim ond un sydd gennych, ac na allant weithredu mwyach, bydd eich LPA yn dod i ben.
Rhaid i’ch atwrneiod fod yn 18 oed neu’n hŷn. Rhaid i atwrnai beidio â bod yn fethdalwr na chael gorchymyn rhyddhau o ddyled. Darllenwch fwy am atwrneiod.
Os ydych chi’n ystyried penodi corfforaeth ymddiriedolaeth, dylech holi am ffioedd a chael cyngor cyfreithiol.
Gall corfforaethau ymddiriedolaeth weithredu ar eu pen eu hunain neu gydag atwrneiod eraill. Gallant hefyd fod yn atwrnai wrth gefn.
Gofynnir i chi os hoffech ychwanegu atwrneiod wrth gefn mewn cwestiwn ar wahân. Byddant yn camu i’r adwy os bydd eich atwrneiod gwreiddiol yn methu neu’n anfodlon parhau.
", + "choosingYourAttorneysContent:personal-welfare": "Welsh
Welsh
Welsh
Welsh
Welsh. Welsh.
Welsh Welsh Welsh
", "enterYourAttorneysDetails": "Nodwch fanylion eich atwrnai", "organisationsMightNotAcceptAttorney": "Efallai na fydd sefydliadau yn derbyn eich LPA os nad yw manylion eich atwrnai yn cyd-fynd â’u dogfennau adnabod ac efallai y byddant yn gofyn am eu gweld.", "youMustEnterTheirNameAsItAppears": "Rhaid i chi nodi eu henw fel y mae’n ymddangos ar ddogfennau swyddogol, fel eu pasbort neu drwydded yrru.", @@ -963,7 +961,7 @@ "decisionsYourReplacementAttorneysMustMakeTogether": "Welsh", "detailsAboutTheDecisionsYourAttorneysMustMakeTogether": "Welsh", "detailsAboutTheDecisionsYourReplacementAttorneysMustMakeTogether": "Welsh", - "whatPersonalAffairsCovers" : "Welsh", + "whatPropertyAndAffairsCovers" : "Welsh", "whatPersonalWelfareCovers" : "Welsh", "yourPreferredLanguage": "Eich dewis iaith", "yourPreferredLanguageIntroContent": "Mae’r gwasanaeth hwn ar gael yn Gymraeg a Saesneg. Gallwch newid rhwng yr ieithoedd hyn ar unrhyw dudalen.
", diff --git a/lang/en.json b/lang/en.json index 0128cd0172..b2d519e5e8 100644 --- a/lang/en.json +++ b/lang/en.json @@ -19,8 +19,6 @@ "crownCopyright": "© Crown copyright", "continue": "Continue", "thereIsAProblem": "There is a problem", - "pfaLegalTerm": "property and affairs", - "hwLegalTerm": "personal welfare", "yes": "Yes", "no": "No", "yesByddwn": "Yes", @@ -109,10 +107,10 @@ "whichTypeOfLpaToMake": "Which type of LPA do you want to make?", "whichTypeOfLpaToMakeContent": "There are 2 types of LPA. You can make an LPA that covers decisions about your:
You can have one or both types of LPA.
They do not have to be made at the same time and you can reuse any information you enter to make other LPAs later.
You can choose different people to be your attorneys for each LPA.
Find out more about the 2 types of LPAs.
", "theTypeOfLpaToMake": "the type of LPA to make", - "lpaTypePfa": "Property and affairs", - "lpaTypePfaHint": "This covers decisions about your money, finances and property.", - "lpaTypeHw": "Personal welfare", - "lpaTypeHwHint": "This covers decisions about your health care, medical treatment and personal welfare.", + "property-and-affairs": "Property and affairs", + "propertyAndAffairsHint": "This covers decisions about your money, finances and property.", + "personal-welfare": "Personal welfare", + "personalWelfareHint": "This covers decisions about your health care, medical treatment and personal welfare.", "makeYourTypeLpa": "Make your {{.Type}} LPA", "yourTaskList": "Your task list", "taskListHelp": "Help with making this LPA", @@ -149,8 +147,8 @@ "doYouWantToRemovePersonToNotify": "Are you sure you want to remove this person to notify?", "doYouWantToRemoveReplacementAttorney": "Are you sure you want to remove this replacement attorney?", "whoWouldYouLikeToBeTheAttorneysDetailsTitle": "Guidance on choosing an attorney", - "whoWouldYouLikeToBeTheAttorneysDetailsContentPA": "Your attorneys are the people who will be able to help you make decisions about your money, property and finances, if you ever want or need their help in the future.
It’s important that you choose people you trust to respect your wishes and act in your best interests. Your attorneys could be your spouse, family members, close friends or a professional, like a solicitor.
You can have more than one attorney. Most people have between 1 and 3 attorneys.
If you do choose to have more than one attorney, you should choose people who can work well together.
Your attorneys must be aged 18 or over. An attorney must not be bankrupt or have a debt relief order. Find out more about attorneys.
You’ll be asked if you would like to add replacement attorneys in a separate question. They step in if your original attorneys are unable or unwilling to continue.
", - "whoWouldYouLikeToBeTheAttorneysDetailsContentPW": "Your attorneys are the people who will be able to help you make decisions about your personal welfare, if you ever need their help in the future.
It’s important that you choose people you trust to respect your wishes and act in your best interests. Your attorneys could be your spouse, family members, close friends or a professional, like a solicitor.
You can have more than one attorney. Most people have between 1 and 3 attorneys.
If you do choose to have more than one attorney, you should choose people who can work well together.
Your attorneys must be aged 18 or over. Find out more about attorneys.
You’ll be asked if you would like to add replacement attorneys in a separate question. They step in if your original attorneys are unable or unwilling to continue.
", + "whoWouldYouLikeToBeTheAttorneysDetailsContent:property-and-affairs": "Your attorneys are the people who will be able to help you make decisions about your money, property and finances, if you ever want or need their help in the future.
It’s important that you choose people you trust to respect your wishes and act in your best interests. Your attorneys could be your spouse, family members, close friends or a professional, like a solicitor.
You can have more than one attorney. Most people have between 1 and 3 attorneys.
If you do choose to have more than one attorney, you should choose people who can work well together.
Your attorneys must be aged 18 or over. An attorney must not be bankrupt or have a debt relief order. Find out more about attorneys.
You’ll be asked if you would like to add replacement attorneys in a separate question. They step in if your original attorneys are unable or unwilling to continue.
", + "whoWouldYouLikeToBeTheAttorneysDetailsContent:personal-welfare": "Your attorneys are the people who will be able to help you make decisions about your personal welfare, if you ever need their help in the future.
It’s important that you choose people you trust to respect your wishes and act in your best interests. Your attorneys could be your spouse, family members, close friends or a professional, like a solicitor.
You can have more than one attorney. Most people have between 1 and 3 attorneys.
If you do choose to have more than one attorney, you should choose people who can work well together.
Your attorneys must be aged 18 or over. Find out more about attorneys.
You’ll be asked if you would like to add replacement attorneys in a separate question. They step in if your original attorneys are unable or unwilling to continue.
", "attorney": "Attorney", "attorneyDateOfBirthIsUnder18": "This attorney is under 18 years old. You will not be able to finish making this LPA until they are 18.", "wantReplacementAttorneys": "Do you want any replacement attorneys?", @@ -175,8 +173,8 @@ "restrictionsOnYourAttorneysPowerTitle": "Restrict the decisions your attorneys can make", "restrictionsOnYourAttorneysPowerContent": "You can limit the decisions your attorneys can make by adding restrictions or conditions to your LPA.
This section is optional.
What you say here will tell your attorneys things they:
You do not have to add restrictions or conditions to your LPA.
There are legal rules about how your restrictions and conditions should be worded, so it’s important to read our guidance on writing restrictions and conditions.
If you’re unsure, or you have detailed restrictions or conditions, you should get legal advice.
", "restrictionExamples": "Show me some examples", - "restrictionExamplesContentPfa": "Before signing, you must read your legal rights and responsibilities.
By signing your LPA, you are appointing your attorneys to make decisions for you.
Your attorneys must follow the Mental Capacity Act 2005 (MCA) and the Code of Practice. This includes the principles of the MCA:
Before signing, you must read your legal rights and responsibilities.
By signing your LPA, you are appointing your attorneys to make decisions for you.
Your attorneys must follow the Mental Capacity Act 2005 (MCA) and the Code of Practice. This includes the principles of the MCA:
Before signing, you must read your legal rights and responsibilities.
By signing your LPA, you are appointing your attorneys to make decisions for you.
Your attorneys must follow the Mental Capacity Act 2005 (MCA) and the Code of Practice. This includes the principles of the MCA:
Before signing, you must read your legal rights and responsibilities.
By signing your LPA, you are appointing your attorneys to make decisions for you.
Your attorneys must follow the Mental Capacity Act 2005 (MCA) and the Code of Practice. This includes the principles of the MCA:
You should have met and talked with the donor, {{ .DonorFullName }}.
You should now be of the opinion that:
You may have taken some notes about your conversation. If we ever have any concerns, we may ask you to tell us more about the conversation you had with {{ .DonorFirstNames }}.
You must now decide if you want to provide the certificate for this LPA.
If you are ready and have no concerns, you can provide your certificate by signing online. You can do this on the next page.
", "ifYouHaveConcerns": "If you have concerns and do not want to sign, there will also be an option to tell us you do not want to provide your certificate on the next page.", "provideYourCertificate": "Provide your certificate", @@ -538,12 +536,12 @@ "weHaveIdentifiedTheTrustCorporationsAttorneyReferenceNumber": "We have identified the trust corporation’s attorney reference number", "weHaveIdentifiedYourReplacementAttorneyReferenceNumber": "We have identified your replacement attorney reference number", "weHaveIdentifiedTheTrustCorporationsReplacementAttorneyReferenceNumber": "We have identified the trust corporation’s replacement attorney reference number", - "attorneyCodeOfConductPfa": "As a property and affairs attorney, you’ll have the power to make decisions about the donor’s ({{.DonorFullNamePossessive}}) money and property. This could include managing bank accounts, bills and benefits, and selling property.
Before agreeing to become {{.DonorFirstNamesPossessive}} attorney, it’s important to understand how you should act when using the LPA to make decisions.
You must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
If you misuse the donor’s money and they become bankrupt, you will no longer be able to act as their attorney.
You should inform the donor and the Office of the Public Guardian if you choose to stop being an attorney.
There are other reasons your appointment may be terminated (ended).
", - "attorneyCodeOfConductHw": "As a personal welfare attorney, you’ll have the power to make decisions about the donor’s ({{.DonorFullNamePossessive}}) daily routine and personal and medical care.
You can only act as an attorney on a personal welfare lasting power of attorney when {{.DonorFirstNames}} lacks the mental capacity to make decisions themselves.
Before agreeing to become {{.DonorFirstNamesPossessive}} attorney, it’s important to understand how you should act when using the LPA to make decisions.
You must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
You should inform the donor and the Office of the Public Guardian if you choose to stop being an attorney.
There are other reasons your appointment may be terminated (ended).
", - "replacementAttorneyCodeOfConductPfa": "As a replacement attorney, you will not be able to act on behalf of the donor ({{.DonorFullName}}) immediately. It is possible you may not be needed to act at all. However, it’s still important to understand how you should make decisions in case you ever need to.
As a property and affairs attorney, you’ll have the power to make decisions about the donor’s money and property. This could include managing bank accounts, bills and benefits, and selling property.
You must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
If you misuse the donor’s money and they become bankrupt, you will no longer be able to act as their attorney.
You should inform the donor and the Office of the Public Guardian if you choose to stop being an attorney.
There are other reasons your appointment may be terminated (ended).
", - "replacementAttorneyCodeOfConductHw": "As a replacement attorney, you will not be able to act on behalf of the donor ({{.DonorFullName}}) immediately. It is possible you may not be needed to act at all. However, it’s still important to understand how you should make decisions in case you ever need to.
As a personal welfare attorney, you’ll have the power to make decisions about the donor’s daily routine and personal and medical care.
You must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
You should inform the donor and the Office of the Public Guardian if you choose to stop being an attorney.
There are other reasons your appointment may be terminated (ended).
", - "trustCorporationCodeOfConductPfa": "As a property and affairs attorney, the trust corporation will have the power to make decisions about the donor’s ({{.DonorFullNamePossessive}}) money and property.
Before agreeing, on behalf of the company, to become {{.DonorFirstNamesPossessive}} attorney, it’s important to understand how the company should act when using the LPA to make decisions.
The company must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
If the company misuses the donor’s money and they become bankrupt, it will no longer be able to act as their attorney.
The company should inform the donor and the Office of the Public Guardian if it chooses to stop being an attorney.
There are other reasons the appointment may be terminated (ended).
", - "replacementTrustCorporationCodeOfConductPfa": "As a replacement attorney, the trust corporation will not be able to act on behalf of the donor ({{.DonorFullName}}) immediately. It is possible that the company may not be needed to act at all. However, it’s still important to understand how decisions should be made if needed.
As a property and affairs attorney, the trust corporation will have the power to make decisions about the donor’s ({{.DonorFullNamePossessive}}) money and property.
The company must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
If the company misuses the donor’s money and they become bankrupt, it will no longer be able to act as their attorney.
The company should inform the donor and the Office of the Public Guardian if it chooses to stop being an attorney.
There are other reasons the appointment may be terminated (ended).
", + "attorneyCodeOfConduct:property-and-affairs": "As a property and affairs attorney, you’ll have the power to make decisions about the donor’s ({{.DonorFullNamePossessive}}) money and property. This could include managing bank accounts, bills and benefits, and selling property.
Before agreeing to become {{.DonorFirstNamesPossessive}} attorney, it’s important to understand how you should act when using the LPA to make decisions.
You must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
If you misuse the donor’s money and they become bankrupt, you will no longer be able to act as their attorney.
You should inform the donor and the Office of the Public Guardian if you choose to stop being an attorney.
There are other reasons your appointment may be terminated (ended).
", + "attorneyCodeOfConduct:personal-welfare": "As a personal welfare attorney, you’ll have the power to make decisions about the donor’s ({{.DonorFullNamePossessive}}) daily routine and personal and medical care.
You can only act as an attorney on a personal welfare lasting power of attorney when {{.DonorFirstNames}} lacks the mental capacity to make decisions themselves.
Before agreeing to become {{.DonorFirstNamesPossessive}} attorney, it’s important to understand how you should act when using the LPA to make decisions.
You must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
You should inform the donor and the Office of the Public Guardian if you choose to stop being an attorney.
There are other reasons your appointment may be terminated (ended).
", + "replacementAttorneyCodeOfConduct:property-and-affairs": "As a replacement attorney, you will not be able to act on behalf of the donor ({{.DonorFullName}}) immediately. It is possible you may not be needed to act at all. However, it’s still important to understand how you should make decisions in case you ever need to.
As a property and affairs attorney, you’ll have the power to make decisions about the donor’s money and property. This could include managing bank accounts, bills and benefits, and selling property.
You must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
If you misuse the donor’s money and they become bankrupt, you will no longer be able to act as their attorney.
You should inform the donor and the Office of the Public Guardian if you choose to stop being an attorney.
There are other reasons your appointment may be terminated (ended).
", + "replacementAttorneyCodeOfConduct:personal-welfare": "As a replacement attorney, you will not be able to act on behalf of the donor ({{.DonorFullName}}) immediately. It is possible you may not be needed to act at all. However, it’s still important to understand how you should make decisions in case you ever need to.
As a personal welfare attorney, you’ll have the power to make decisions about the donor’s daily routine and personal and medical care.
You must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
You should inform the donor and the Office of the Public Guardian if you choose to stop being an attorney.
There are other reasons your appointment may be terminated (ended).
", + "trustCorporationCodeOfConduct": "As a property and affairs attorney, the trust corporation will have the power to make decisions about the donor’s ({{.DonorFullNamePossessive}}) money and property.
Before agreeing, on behalf of the company, to become {{.DonorFirstNamesPossessive}} attorney, it’s important to understand how the company should act when using the LPA to make decisions.
The company must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
If the company misuses the donor’s money and they become bankrupt, it will no longer be able to act as their attorney.
The company should inform the donor and the Office of the Public Guardian if it chooses to stop being an attorney.
There are other reasons the appointment may be terminated (ended).
", + "replacementTrustCorporationCodeOfConduct": "As a replacement attorney, the trust corporation will not be able to act on behalf of the donor ({{.DonorFullName}}) immediately. It is possible that the company may not be needed to act at all. However, it’s still important to understand how decisions should be made if needed.
As a property and affairs attorney, the trust corporation will have the power to make decisions about the donor’s ({{.DonorFullNamePossessive}}) money and property.
The company must follow the principles of the Mental Capacity Act (2005) and the Mental Capacity Act Code of Practice.
This includes:
If the company misuses the donor’s money and they become bankrupt, it will no longer be able to act as their attorney.
The company should inform the donor and the Office of the Public Guardian if it chooses to stop being an attorney.
There are other reasons the appointment may be terminated (ended).
", "whatIsYourUkMobileNumber": "What is your UK mobile number?", "enterYourUkMobileNumberOptional": "Enter your UK mobile number (optional)", "youCanChooseToTellUsYourMobileNumber": "You can choose to tell us your mobile number in case we ever need to contact you.", @@ -638,8 +636,8 @@ "otherNamesHint": "For example, your maiden name.", "chooseWhichTypeOfLpaToMake": "Choose which type of LPA you want to make", "choosingYourAttorneys": "Choosing your attorneys", - "choosingYourAttorneysContentPA": "Your attorneys are the people who will be able to help you make decisions about your money, property and finances, if you ever want or need their help in the future.
It’s important that you choose people you trust to respect your wishes and act in your best interests. Your attorneys could be your spouse, family members, close friends or a professional, like a solicitor.
If you do choose to have more than one attorney, you should choose people who can work well together. Most people have between 1 and 3 attorneys.
If you only have one attorney and they can no longer act, your LPA will end.
Your attorneys must be aged 18 or over. An attorney must not be bankrupt or have a debt relief order. Find out more about attorneys.
If you are considering appointing a trust corporation, you should ask about fees and get legal advice.
Trust corporations can act alone or with other attorneys. They can also be a replacement attorney.
You’ll be asked if you would like to add replacement attorneys in a separate question. They step in if your original attorneys are unable or unwilling to continue.
", - "choosingYourAttorneysContentPW": "Your attorneys are the people who will be able to help you make decisions about your personal welfare, if you ever need their help in the future.
It’s important that you choose people you trust to respect your wishes and act in your best interests. Your attorneys could be your spouse, family members, close friends or a professional, like a solicitor.
If you do choose to have more than one attorney, you should choose people who can work well together. Most people have between 1 and 3 attorneys.
If you only have one attorney and they can no longer act, your LPA will end.
Your attorneys must be aged 18 or over. Find out more about attorneys.
You’ll be asked if you would like to add replacement attorneys in a separate question. They step in if your original attorneys are unable or unwilling to continue.
", + "choosingYourAttorneysContent:property-and-affairs": "Your attorneys are the people who will be able to help you make decisions about your money, property and finances, if you ever want or need their help in the future.
It’s important that you choose people you trust to respect your wishes and act in your best interests. Your attorneys could be your spouse, family members, close friends or a professional, like a solicitor.
If you do choose to have more than one attorney, you should choose people who can work well together. Most people have between 1 and 3 attorneys.
If you only have one attorney and they can no longer act, your LPA will end.
Your attorneys must be aged 18 or over. An attorney must not be bankrupt or have a debt relief order. Find out more about attorneys.
If you are considering appointing a trust corporation, you should ask about fees and get legal advice.
Trust corporations can act alone or with other attorneys. They can also be a replacement attorney.
You’ll be asked if you would like to add replacement attorneys in a separate question. They step in if your original attorneys are unable or unwilling to continue.
", + "choosingYourAttorneysContent:personal-welfare": "Your attorneys are the people who will be able to help you make decisions about your personal welfare, if you ever need their help in the future.
It’s important that you choose people you trust to respect your wishes and act in your best interests. Your attorneys could be your spouse, family members, close friends or a professional, like a solicitor.
If you do choose to have more than one attorney, you should choose people who can work well together. Most people have between 1 and 3 attorneys.
If you only have one attorney and they can no longer act, your LPA will end.
Your attorneys must be aged 18 or over. Find out more about attorneys.
You’ll be asked if you would like to add replacement attorneys in a separate question. They step in if your original attorneys are unable or unwilling to continue.
", "enterYourAttorneysDetails": "Enter your attorney’s details", "organisationsMightNotAcceptAttorney": "Organisations might not accept your LPA if your attorney’s details do not match any ID they may ask to see.", "youMustEnterTheirNameAsItAppears": "You must enter your attorney’s name as it appears on official documents, such as their passport or driving licence.", @@ -910,7 +908,7 @@ "decisionsYourReplacementAttorneysMustMakeTogether": "Decisions your replacement attorneys must make together", "detailsAboutTheDecisionsYourAttorneysMustMakeTogether": "details about the decisions your attorneys must make together", "detailsAboutTheDecisionsYourReplacementAttorneysMustMakeTogether": "details about the decisions your replacement attorneys must make together", - "whatPersonalAffairsCovers" : "money, finances and any property they might own", + "whatPropertyAndAffairsCovers" : "money, finances and any property they might own", "whatPersonalWelfareCovers" : "health care and personal welfare", "yourPreferredLanguage": "Your preferred language", "yourPreferredLanguageIntroContent": "This service is available in English and Welsh (Cymraeg). You can switch between these languages on any page.
", diff --git a/web/template/attorney_code_of_conduct.gohtml b/web/template/attorney_code_of_conduct.gohtml index 679ecc7053..fac7234638 100644 --- a/web/template/attorney_code_of_conduct.gohtml +++ b/web/template/attorney_code_of_conduct.gohtml @@ -37,19 +37,15 @@ {{ $content := "" }} {{ if .App.IsReplacementAttorney }} {{ if .App.IsTrustCorporation }} - {{ $content = "replacementTrustCorporationCodeOfConductPfa" }} - {{ else if .Donor.Type.IsPropertyFinance }} - {{ $content = "replacementAttorneyCodeOfConductPfa" }} + {{ $content = "replacementTrustCorporationCodeOfConduct" }} {{ else }} - {{ $content = "replacementAttorneyCodeOfConductHw" }} + {{ $content = printf "replacementAttorneyCodeOfConduct:%s" .Donor.Type.String }} {{ end }} {{ else }} {{ if .App.IsTrustCorporation }} - {{ $content = "trustCorporationCodeOfConductPfa" }} - {{ else if .Donor.Type.IsPropertyFinance }} - {{ $content = "attorneyCodeOfConductPfa" }} + {{ $content = "trustCorporationCodeOfConduct" }} {{ else }} - {{ $content = "attorneyCodeOfConductHw" }} + {{ $content = printf "attorneyCodeOfConduct:%s" .Donor.Type.String }} {{ end }} {{ end }} diff --git a/web/template/attorney_fixtures.gohtml b/web/template/attorney_fixtures.gohtml index f00f1042e4..fe2ab3502f 100644 --- a/web/template/attorney_fixtures.gohtml +++ b/web/template/attorney_fixtures.gohtml @@ -32,11 +32,11 @@