From 188a94f66a3c265de507016d935fdb200ed880fd Mon Sep 17 00:00:00 2001 From: Alex Saunders Date: Mon, 13 Nov 2023 12:03:44 +0000 Subject: [PATCH] MLPAB-1525, MLPAB-1521: Update certificate provider task flow (#832) --- cypress/e2e/donor/certificate-provider.cy.js | 51 ++++---- go.sum | 115 +----------------- internal/actor/certificate_provider.go | 11 +- ...m_certificateproviderrelationshiplength.go | 64 ++++++++++ .../donor/certificate_provider_address.go | 30 +++-- .../certificate_provider_address_test.go | 59 ++++++++- .../donor/certificate_provider_details.go | 6 +- .../certificate_provider_details_test.go | 46 ++++++- internal/page/donor/choose_address.go | 31 +++++ internal/page/donor/choose_address_test.go | 56 +++++++++ .../page/donor/choose_attorneys_address.go | 20 +-- .../donor/choose_attorneys_address_test.go | 14 +++ .../donor/choose_people_to_notify_address.go | 14 +-- .../choose_people_to_notify_address_test.go | 13 ++ .../choose_replacement_attorneys_address.go | 15 ++- ...oose_replacement_attorneys_address_test.go | 14 +++ ...r_replacement_trust_corporation_address.go | 12 +- ...lacement_trust_corporation_address_test.go | 13 ++ .../donor/enter_trust_corporation_address.go | 12 +- .../enter_trust_corporation_address_test.go | 13 ++ ...w_do_you_know_your_certificate_provider.go | 21 ++-- ...you_know_your_certificate_provider_test.go | 85 +++++++++++-- ...ong_have_you_known_certificate_provider.go | 25 ++-- ...ave_you_known_certificate_provider_test.go | 44 +++---- internal/page/donor/register.go | 2 +- internal/page/donor/upload_evidence_sse.go | 4 +- .../page/donor/upload_evidence_sse_test.go | 10 +- internal/page/donor/your_address.go | 11 +- internal/page/donor/your_address_test.go | 24 +++- .../donor/your_independent_witness_address.go | 13 +- .../your_independent_witness_address_test.go | 16 ++- internal/page/fixtures/fixtures.go | 2 +- lang/cy.json | 4 + lang/en.json | 4 + web/template/choose_address.gohtml | 30 ++--- ...have_you_known_certificate_provider.gohtml | 10 +- .../certificate-provider-details.gohtml | 4 +- 37 files changed, 635 insertions(+), 283 deletions(-) create mode 100644 internal/actor/enum_certificateproviderrelationshiplength.go create mode 100644 internal/page/donor/choose_address_test.go diff --git a/cypress/e2e/donor/certificate-provider.cy.js b/cypress/e2e/donor/certificate-provider.cy.js index 88ef7f78e4..dab975c06c 100644 --- a/cypress/e2e/donor/certificate-provider.cy.js +++ b/cypress/e2e/donor/certificate-provider.cy.js @@ -30,6 +30,13 @@ describe('Certificate provider task', () => { cy.get('#f-mobile').type(TestMobile); cy.contains('button', 'Save and continue').click(); + cy.url().should('contain', '/how-do-you-know-your-certificate-provider'); + cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); + + cy.contains('How do you know John Doe, your certificate provider?'); + cy.contains('label', 'Professionally').click(); + cy.contains('button', 'Save and continue').click(); + cy.url().should('contain', '/how-would-certificate-provider-prefer-to-carry-out-their-role'); cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); @@ -39,21 +46,11 @@ describe('Certificate provider task', () => { cy.url().should('contain', '/certificate-provider-address'); - cy.contains('label', 'Enter a new address').click(); - cy.contains('button', 'Continue').click(); AddressFormAssertions.assertCanAddAddressFromSelect() - cy.url().should('contain', '/how-do-you-know-your-certificate-provider'); + cy.url().should('contain', '/task-list'); cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); - cy.contains('How do you know John Doe, your certificate provider?'); - cy.contains('label', 'Professionally').click(); - cy.contains('button', 'Save and continue').click(); - - cy.url().should('contain', '/do-you-want-to-notify-people'); - cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); - - cy.visitLpa('/task-list') cy.contains('li', "Choose your certificate provider") .should('contain', 'Completed'); }); @@ -81,18 +78,6 @@ describe('Certificate provider task', () => { cy.get('#f-mobile').type(TestMobile); cy.contains('button', 'Save and continue').click(); - cy.url().should('contain', '/how-would-certificate-provider-prefer-to-carry-out-their-role'); - cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); - - cy.contains('label', 'Using paper forms').click(); - cy.contains('button', 'Save and continue').click() - - cy.url().should('contain', '/certificate-provider-address'); - - cy.contains('label', 'Enter a new address').click(); - cy.contains('button', 'Continue').click(); - AddressFormAssertions.assertCanAddAddressFromSelect() - cy.url().should('contain', '/how-do-you-know-your-certificate-provider'); cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); @@ -107,10 +92,22 @@ describe('Certificate provider task', () => { cy.contains('label', '2 years or more').click(); cy.contains('button', 'Save and continue').click(); - cy.url().should('contain', '/do-you-want-to-notify-people'); + cy.url().should('contain', '/how-would-certificate-provider-prefer-to-carry-out-their-role'); + + cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); + cy.contains('label', 'Using paper forms').click(); + + cy.contains('button', 'Save and continue').click() + + cy.url().should('contain', '/certificate-provider-address'); + cy.contains('label', 'Enter a new address').click(); + cy.contains('button', 'Continue').click(); + + AddressFormAssertions.assertCanAddAddressFromSelect() + + cy.url().should('contain', '/task-list'); cy.checkA11yApp({ rules: { 'aria-allowed-attr': { enabled: false } } }); - cy.visitLpa('/task-list') cy.contains('li', "Choose your certificate provider") .should('contain', 'Completed'); }); @@ -258,7 +255,7 @@ describe('Certificate provider task', () => { cy.contains('There is also an attorney called Jessie Jones.'); cy.contains('button', 'Save and continue').click(); - cy.url().should('contain', '/how-would-certificate-provider-prefer-to-carry-out-their-role'); + cy.url().should('contain', '/how-do-you-know-your-certificate-provider'); }); it('warns when lastname shared with other donor', () => { @@ -274,6 +271,6 @@ describe('Certificate provider task', () => { cy.contains('Your certificate provider’s last name is the same as yours or very similar'); cy.contains('button', 'Save and continue').click(); - cy.url().should('contain', '/how-would-certificate-provider-prefer-to-carry-out-their-role'); + cy.url().should('contain', '/how-do-you-know-your-certificate-provider'); }); }); diff --git a/go.sum b/go.sum index ef3c60855e..b36eccf388 100644 --- a/go.sum +++ b/go.sum @@ -7,147 +7,57 @@ github.com/MicahParks/keyfunc v1.9.0/go.mod h1:IdnCilugA0O/99dW+/MkvlyrsX8+L8+x9 github.com/aws/aws-lambda-go v1.41.0 h1:l/5fyVb6Ud9uYd411xdHZzSf2n86TakxzpvIoz7l+3Y= github.com/aws/aws-lambda-go v1.41.0/go.mod h1:jwFe2KmMsHmffA1X2R09hH6lFzJQxzI8qK17ewzbQMM= github.com/aws/aws-sdk-go-v2 v1.21.0/go.mod h1:/RfNgGmRxI+iFOB1OeJUyxiU+9s88k3pfHvDagGEp0M= -github.com/aws/aws-sdk-go-v2 v1.21.2 h1:+LXZ0sgo8quN9UOKXXzAWRT3FWd4NxeXWOZom9pE7GA= -github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM= -github.com/aws/aws-sdk-go-v2 v1.22.1 h1:sjnni/AuoTXxHitsIdT0FwmqUuNUuHtufcVDErVFT9U= -github.com/aws/aws-sdk-go-v2 v1.22.1/go.mod h1:Kd0OJtkW3Q0M0lUWGszapWjEvrXDzRW+D21JNsroB+c= github.com/aws/aws-sdk-go-v2 v1.22.2 h1:lV0U8fnhAnPz8YcdmZVV60+tr6CakHzqA6P8T46ExJI= github.com/aws/aws-sdk-go-v2 v1.22.2/go.mod h1:Kd0OJtkW3Q0M0lUWGszapWjEvrXDzRW+D21JNsroB+c= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14 h1:Sc82v7tDQ/vdU1WtuSyzZ1I7y/68j//HJ6uozND1IDs= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.4.14/go.mod h1:9NCTOURS8OpxvoAVHq79LK81/zC78hfRWFn+aL0SPcY= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.0 h1:hHgLiIrTRtddC0AKcJr5s7i/hLgcpTt+q/FKxf1Zayk= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.0/go.mod h1:w4I/v3NOWgD+qvs1NPEwhd++1h3XPHFaVxasfY6HlYQ= -github.com/aws/aws-sdk-go-v2/config v1.19.1 h1:oe3vqcGftyk40icfLymhhhNysAwk0NfiwkDi2GTPMXs= -github.com/aws/aws-sdk-go-v2/config v1.19.1/go.mod h1:ZwDUgFnQgsazQTnWfeLWk5GjeqTQTL8lMkoE1UXzxdE= -github.com/aws/aws-sdk-go-v2/config v1.22.0 h1:9Mm99OalzZRz0ab5fpodMoHBApHS6pqRNp3M9NmzvDg= -github.com/aws/aws-sdk-go-v2/config v1.22.0/go.mod h1:2eWgw5lps8fKI7LZVTrRTYP6HE6k/uEFUuTSHfXwqP0= github.com/aws/aws-sdk-go-v2/config v1.23.0 h1:kqzEfGGDIrRJpfJckgwuZfFTbU9NB1jZnRcaO9MpOqE= github.com/aws/aws-sdk-go-v2/config v1.23.0/go.mod h1:p7wbxKXXjS1GGQOss7VXOazVMFF9bjUGq85/4wR/fSw= -github.com/aws/aws-sdk-go-v2/credentials v1.13.43 h1:LU8vo40zBlo3R7bAvBVy/ku4nxGEyZe9N8MqAeFTzF8= -github.com/aws/aws-sdk-go-v2/credentials v1.13.43/go.mod h1:zWJBz1Yf1ZtX5NGax9ZdNjhhI4rgjfgsyk6vTY1yfVg= -github.com/aws/aws-sdk-go-v2/credentials v1.15.1 h1:hmf6lAm9hk7uLCfapZn/jL05lm6Uwdbn1B0fgjyuf4M= -github.com/aws/aws-sdk-go-v2/credentials v1.15.1/go.mod h1:QTcHga3ZbQOneJuxmGBOCxiClxmp+TlvmjFexAnJ790= github.com/aws/aws-sdk-go-v2/credentials v1.15.2 h1:rKH7khRMxPdD0u3dHecd0Q7NOVw3EUe7AqdkUOkiOGI= github.com/aws/aws-sdk-go-v2/credentials v1.15.2/go.mod h1:tXM8wmaeAhfC7nZoCxb0FzM/aRaB1m1WQ7x0qlBLq80= -github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.10.43 h1:jlR1Rwjb3z5d1p0sqhNcuCaqdp73H+1O/X8Lc2kBDrY= -github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.10.43/go.mod h1:X1HGecFASboCkBt1GJRM4a/FDYYogu9AciUoXVsbr4U= -github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.0 h1:nKmTvugKsuO2bHkL0vkpHEFtRoT/ijOVx0VdP+LLjgw= -github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.0/go.mod h1:vxJ/EEKuP9CCSG4lEViyU9i5gr2M0X5OIJqTcX/oxuU= github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.1 h1:vU+Zfrai6v6ONVnBvDrPbIhorudvOBbgVp+XSMb8xYY= github.com/aws/aws-sdk-go-v2/feature/dynamodb/attributevalue v1.12.1/go.mod h1:duyhEYoJhlhUVwz5Uns56CbE5Vk6qt63p/8mv5xP6cc= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13 h1:PIktER+hwIG286DqXyvVENjgLTAwGgoeriLDD5C+YlQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.13.13/go.mod h1:f/Ib/qYjhV2/qdsf79H3QP/eRE4AkVyEf6sk7XfZ1tg= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2 h1:gIeH4+o1MN/caGBWjoGQTUTIu94xD6fI5B2+TcwBf70= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.2/go.mod h1:wLyMIo/zPOhQhPXTddpfdkSleyigtFi8iMnC+2m/SK4= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.3 h1:G5KawTAkyHH6WyKQCdHiW4h3PmAXNJpOgwKg3H7sDRE= github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.3/go.mod h1:hugKmSFnZB+HgNI1sYGT14BUPZkO6alC/e0AWu+0IAQ= github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.41/go.mod h1:CrObHAuPneJBlfEJ5T3szXOUkLEThaGfvnhTf33buas= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43 h1:nFBQlGtkbPzp/NjZLuFxRqmT91rLJkgvsEQs68h962Y= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.43/go.mod h1:auo+PiyLl0n1l8A0e8RIeR8tOzYPfZZH/JNlrJ8igTQ= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1 h1:fi1ga6WysOyYb5PAf3Exd6B5GiSNpnZim4h1rhlBqx0= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.1/go.mod h1:V5CY8wNurvPUibTi9mwqUqpiFZ5LnioKWIFUDtIzdI8= github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.2 h1:AaQsr5vvGR7rmeSWBtTCcw16tT9r51mWijuCQhzLnq8= github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.2/go.mod h1:o1IiRn7CWocIFTXJjGKJDOwxv1ibL53NpcvcqGWyRBA= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.35/go.mod h1:SJC1nEVVva1g3pHAIdCp7QsRIkMmLAgoDquQ9Rr8kYw= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37 h1:JRVhO25+r3ar2mKGP7E0LDl8K9/G36gjlqca5iQbaqc= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.37/go.mod h1:Qe+2KtKml+FEsQF/DHmDV+xjtche/hwoF75EG4UlHW8= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1 h1:ZpaV/j48RlPc4AmOZuPv22pJliXjXq8/reL63YzyFnw= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.1/go.mod h1:R8aXraabD2e3qv1csxM14/X9WF4wFMIY0kH4YEtYD5M= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.2 h1:UZx8SXZ0YtzRiALzYAWcjb9Y9hZUR7MBKaBQ5ouOjPs= github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.2/go.mod h1:ipuRpcSaklmxR6C39G187TpBAO132gUfleTGccUPs8c= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45 h1:hze8YsjSh8Wl1rYa1CJpRmXP21BvOBuc76YhW0HsuQ4= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.45/go.mod h1:lD5M20o09/LCuQ2mE62Mb/iSdSlCNuj6H5ci7tW7OsE= -github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0 h1:DqOQvIfmGkXZUVJnl9VRk0AnxyS59tCtX9k1Pyss4Ak= -github.com/aws/aws-sdk-go-v2/internal/ini v1.5.0/go.mod h1:VV/Kbw9Mg1GWJOT9WK+oTL3cWZiXtapnNvDSRqTZLsg= github.com/aws/aws-sdk-go-v2/internal/ini v1.6.0 h1:hwZB07/beLiCopuRKF0t+dEHmP39iN4YtDh3X5d3hrg= github.com/aws/aws-sdk-go-v2/internal/ini v1.6.0/go.mod h1:rdAuXeHWhI/zkpYcO5n8WCpaIgY9MUxFyBsuqq3kjyA= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.6 h1:wmGLw2i8ZTlHLw7a9ULGfQbuccw8uIiNr6sol5bFzc8= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.1.6/go.mod h1:Q0Hq2X/NuL7z8b1Dww8rmOFl+jzusKEcyvkKspwdpyc= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.1 h1:vzYLDkwTw4CY0vUk84MeSufRf8XIsC/GsoIFXD60sTg= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.1/go.mod h1:ToBFBnjeGR2ruMx8IWp/y7vSK3Irj5/oPwifruiqoOM= github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.2 h1:pyVrNAf7Hwz0u39dLKN5t+n0+K/3rMYKuiOoIum3AsU= github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.2/go.mod h1:mydrfOb9uiOYCxuCPR8YHQNQyGQwUQ7gPMZGBKbH8NY= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.23.0 h1:xmSAn14nM6IdHyuWO/bsrAagOQtnqzuUCLxdVmj9nhg= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.23.0/go.mod h1:1HkLh8vaL4obF95fne7ZOu7sxomS/+vkBt3/+gqqwE4= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.0 h1:wAG9NailFhGhg8Ngg2YeCtzGmFWc63SYqJKdvN5ZMkE= -github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.0/go.mod h1:ByrosnNlEq6xkA0d+FwB4f0HH/5KWCcgBqVxAt+Rsps= github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.1 h1:bqSGIS7Nk5EfMKTNDgtaukJQzjOE3LV5Bdz6lRrTsXA= github.com/aws/aws-sdk-go-v2/service/dynamodb v1.25.1/go.mod h1:Fe7bvO6LxNp6WA6y5VmbgW9RRu+g0RlCXpFAmtcHfQs= -github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.15.7 h1:WCeS9WZbIqEKCbgIkrHB5jw/9mO2QMYTLPF8wee3v4Y= -github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.15.7/go.mod h1:uT1paW42RVCVEoAEbWKu98gEI0GMBWUsT/H+pI4ODJQ= -github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.17.0 h1:iTGBKvqZNU9SsQCzRiK8f0u9kVtdG4K1Q68A97JRn6w= -github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.17.0/go.mod h1:EabdnPA1OVcrolKX/hyMSNvJv8MBCZtlAlncsg/b/rA= github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.17.1 h1:gpE4wbWGxfLsjY3zKL0PBpPw1j1hHaVOkpmAM7pndeI= github.com/aws/aws-sdk-go-v2/service/dynamodbstreams v1.17.1/go.mod h1:/S4RgrpSKs9sOw4q8aoNGxvM1iUdOczrt8Ss+/nxsMg= -github.com/aws/aws-sdk-go-v2/service/eventbridge v1.22.2 h1:OyuAwr4t1emvQdH+M6BqZR/0a67SUOm6glJ2ot6NQE4= -github.com/aws/aws-sdk-go-v2/service/eventbridge v1.22.2/go.mod h1:z29eBmJY+MYzdT1gbSdcjXgJ5CMVw3wKcclrxcitLqw= -github.com/aws/aws-sdk-go-v2/service/eventbridge v1.24.0 h1:602uhl5EMsyPGOvufUOSuRbLYT5RI1mFwWOI/OKUMXc= -github.com/aws/aws-sdk-go-v2/service/eventbridge v1.24.0/go.mod h1:KiYs9sDklqLLv/tq+fae/8mLiJj4b7mV8Uqn1Sn3aZA= github.com/aws/aws-sdk-go-v2/service/eventbridge v1.24.1 h1:0PcasNDyklQUvanmvkqR269NUtKxSza5JkkHjjduUNM= github.com/aws/aws-sdk-go-v2/service/eventbridge v1.24.1/go.mod h1:/MQWb/5JxxK/pKr2lJelg2kkyjaC0oEp52HmxeCh3Hc= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15 h1:7R8uRYyXzdD71KWVCL78lJZltah6VVznXBazvKjfH58= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.9.15/go.mod h1:26SQUPcTNgV1Tapwdt4a1rOsYRsnBsJHLMPoxK2b0d8= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0 h1:CJxo7ZBbaIzmXfV3hjcx36n9V87gJsIUPJflwqEHl3Q= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.0/go.mod h1:yjVfjuY4nD1EW9i387Kau+I6V5cBA5YnC/mWNopjZrI= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.38 h1:skaFGzv+3kA+v2BPKhuekeb1Hbb105+44r8ASC+q5SE= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.1.38/go.mod h1:epIZoRSSbRIwLPJU5F+OldHhwZPBdpDeQkRdCeY3+00= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.1 h1:15FUCJzAP9Y25nioTqTrGlZmhOtthaXBWlt4pS+d3Xo= -github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.1/go.mod h1:5655NW53Un6l7JzkI6AA3rZvf0m532cSnLThA1fVXcA= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.2 h1:f2LhPofnjcdOQKRtumKjMvIHkfSQ8aH/rwKUDEQ/SB4= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.2/go.mod h1:q+xX0H4OfuWDuBy7y/LDi4v8IBOWuF+vtp8Z6ex+lw4= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.37 h1:4LoizcvPT9A0tiAFhepxn0bGZXkzvN0pG0epydY3Pno= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.7.37/go.mod h1:7xBUZyP6LeLc+5Ym9PG7atqw4sR28sBtYcHETik+bPE= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.1 h1:aY45T0Xk+xHHrQPlQrp8IhrgN7k4SL5VF2UXhsmI2rs= -github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.1/go.mod h1:5E/dXkj2ljMIAvuYaFuYwitKJg6ULwsDbUr3g8izVB0= github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.2 h1:M2oj5PSph40+tqQ25MTZKfCveRWWXSskKFt3BMoJOao= github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.8.2/go.mod h1:fcLhoxFM7KEONrUI5zY12MncXr53tHHwQOckCOrX8A4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37 h1:WWZA/I2K4ptBS1kg0kV1JbBtG/umed0vwHRrmcr9z7k= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.37/go.mod h1:vBmDnwWXWxNPFRMmG2m/3MKOe+xEcMDo1tanpaWCcck= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1 h1:2OXw3ppu1XsB6rqKEMV4tnecTjIY3PRV2U6IP6KPJQo= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.1/go.mod h1:FZB4AdakIqW/yERVdGJA6Z9jraax1beXfhBBnK2wwR8= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.2 h1:h7j73yuAVVjic8pqswh+L/7r2IHP43QwRyOu6zcCDDE= github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.2/go.mod h1:H07AHdK5LSy8F7EJUQhoxyiCNkePoHj2D8P2yGTWafo= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.6 h1:9ulSU5ClouoPIYhDQdg9tpl83d5Yb91PXTKK+17q+ow= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.15.6/go.mod h1:lnc2taBsR9nTlz9meD+lhFZZ9EWY712QHrRflWpTcOA= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1 h1:dnl0klXYX9EKpzZbWlH5LJL+YTcEZcJEMPFFr/rAHUQ= -github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.1/go.mod h1:Mfk/9Joso4tCQYzM4q4HRUIqwln8lnIIMB/OE8Zebdc= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.2 h1:gbIaOzpXixUpoPK+js/bCBK1QBDXM22SigsnzGZio0U= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.2/go.mod h1:p+S7RNbdGN8qgHDSg2SCQJ9FeMAmvcETQiVpeGhYnNM= -github.com/aws/aws-sdk-go-v2/service/s3 v1.40.2 h1:Ll5/YVCOzRB+gxPqs2uD0R7/MyATC0w85626glSKmp4= -github.com/aws/aws-sdk-go-v2/service/s3 v1.40.2/go.mod h1:Zjfqt7KhQK+PO1bbOsFNzKgaq7TcxzmEoDWN8lM0qzQ= -github.com/aws/aws-sdk-go-v2/service/s3 v1.42.0 h1:u0YoSrxjr3Lm+IqIlRAV+4YTFwkXjyB9db9CfUFge2w= -github.com/aws/aws-sdk-go-v2/service/s3 v1.42.0/go.mod h1:98EIdRu+BNsdqITsXfy+57TZfwlUQC9aDn9a9qoo90U= github.com/aws/aws-sdk-go-v2/service/s3 v1.42.1 h1:o6MCcX1rJW8Y3g+hvg2xpjF6JR6DftuYhfl3Nc1WV9Q= github.com/aws/aws-sdk-go-v2/service/s3 v1.42.1/go.mod h1:UDtxEWbREX6y4KREapT+jjtjoH0TiVSS6f5nfaY1UaM= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.6 h1:y3n83jEM6EuawrD5HZCh3eMj9RsfxniVLcXlyFMNITM= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.21.6/go.mod h1:A108ijf0IFtqhYApU+Gia80aPSAUfi9dItm+h5fWGJE= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.23.0 h1:PXSCgeF51ApT3k+fduqw7IaCxICt1nozWV1iPz7TyxU= -github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.23.0/go.mod h1:bpDXZjRbNT5gb9pa2jJlSUvBkfNwfG3OWgGqFYY73kA= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.23.1 h1:xK86ln1cEDa0cUpLaCbFFX/BABPw4ognfzpGfbF4PkY= github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.23.1/go.mod h1:eqTdeirkcyBiDviU/N1JMcImS9zEJDn5wOzX3BsU4wU= github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5 h1:RyDpTOMEJO6ycxw1vU/6s0KLFaH3M0z/z9gXHSndPTk= github.com/aws/aws-sdk-go-v2/service/sqs v1.24.5/go.mod h1:RZBu4jmYz3Nikzpu/VuVvRnTEJ5a+kf36WT2fcl5Q+Q= -github.com/aws/aws-sdk-go-v2/service/sso v1.15.2 h1:JuPGc7IkOP4AaqcZSIcyqLpFSqBWK32rM9+a1g6u73k= -github.com/aws/aws-sdk-go-v2/service/sso v1.15.2/go.mod h1:gsL4keucRCgW+xA85ALBpRFfdSLH4kHOVSnLMSuBECo= -github.com/aws/aws-sdk-go-v2/service/sso v1.17.0 h1:I/Oh3IxGPfHXiGnwM54TD6hNr/8TlUrBXAtTyGhR+zw= -github.com/aws/aws-sdk-go-v2/service/sso v1.17.0/go.mod h1:H6NCMvDBqA+CvIaXzaSqM6LWtzv9BzZrqBOqz+PzRF8= github.com/aws/aws-sdk-go-v2/service/sso v1.17.1 h1:km+ZNjtLtpXYf42RdaDZnNHm9s7SYAuDGTafy6nd89A= github.com/aws/aws-sdk-go-v2/service/sso v1.17.1/go.mod h1:aHBr3pvBSD5MbzOvQtYutyPLLRPbl/y9x86XyJJnUXQ= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3 h1:HFiiRkf1SdaAmV3/BHOFZ9DjFynPHj8G/UIO1lQS+fk= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.17.3/go.mod h1:a7bHA82fyUXOm+ZSWKU6PIoBxrjSprdLoM8xPYvzYVg= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0 h1:irbXQkfVYIRaewYSXcu4yVk0m2T+JzZd0dkop7FjmO0= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.0/go.mod h1:4wPNCkM22+oRe71oydP66K50ojDUC33XutSMi2pEF/M= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.1 h1:iRFNqZH4a67IqPvK8xxtyQYnyrlsvwmpHOe9r55ggBA= github.com/aws/aws-sdk-go-v2/service/ssooidc v1.19.1/go.mod h1:pTy5WM+6sNv2tB24JNKFtn6EvciQ5k40ZJ0pq/Iaxj0= -github.com/aws/aws-sdk-go-v2/service/sts v1.23.2 h1:0BkLfgeDjfZnZ+MhB3ONb01u9pwFYTCZVhlsSSBvlbU= -github.com/aws/aws-sdk-go-v2/service/sts v1.23.2/go.mod h1:Eows6e1uQEsc4ZaHANmsPRzAKcVDrcmjjWiih2+HUUQ= -github.com/aws/aws-sdk-go-v2/service/sts v1.25.0 h1:sYIFy8tm1xQwRvVQ4CRuBGXKIg9sHNuG6+3UAQuoujk= -github.com/aws/aws-sdk-go-v2/service/sts v1.25.0/go.mod h1:S/LOQUeYDfJeJpFCIJDMjy7dwL4aA33HUdVi+i7uH8k= github.com/aws/aws-sdk-go-v2/service/sts v1.25.1 h1:txgVXIXWPXyqdiVn92BV6a/rgtpX31HYdsOYj0sVQQQ= github.com/aws/aws-sdk-go-v2/service/sts v1.25.1/go.mod h1:VAiJiNaoP1L89STFlEMgmHX1bKixY+FaP+TpRFrmyZ4= github.com/aws/smithy-go v1.14.2/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.15.0 h1:PS/durmlzvAFpQHDs4wi4sNNP9ExsqZh6IlfdHXgKK8= -github.com/aws/smithy-go v1.15.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= github.com/aws/smithy-go v1.16.0 h1:gJZEH/Fqh+RsvlJ1Zt4tVAtV6bKkp3cC+R6FCZMNzik= github.com/aws/smithy-go v1.16.0/go.mod h1:NukqUGpCZIILqqiV0NIjeFh24kd/FAa4beRb6nbIUPE= github.com/brunoscheufler/aws-ecs-metadata-go v0.0.0-20220812150832-b6b31c6eeeaf h1:WCnJxXZXx9c8gwz598wvdqmu+YTzB9wx2X1OovK3Le8= @@ -164,9 +74,6 @@ github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkp github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= -github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= @@ -220,19 +127,15 @@ github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeN github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= -github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= -github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= -github.com/gorilla/sessions v1.2.1 h1:DHd3rPN5lE3Ts3D8rKkQ8x/0kqfeNmBAaiSi+o7FsgI= -github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM= github.com/gorilla/sessions v1.2.2 h1:lqzMYz6bOfvn2WriPUjNByzeXIlVzURcPmgMczkmTjY= github.com/gorilla/sessions v1.2.2/go.mod h1:ePLdVu+jbEgHH+KWw8I1z2wqd0BAdAQh/8LRvBeoNcQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= @@ -349,8 +252,6 @@ golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvx golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= -golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0= golang.org/x/mod v0.14.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -362,8 +263,6 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg= golang.org/x/net v0.18.0/go.mod h1:/czyP5RqHAH4odGYxBJ1qz0+CE5WZ+2j1YgoEo8F2jQ= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -372,8 +271,8 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= -golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -383,8 +282,6 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0 h1:Vz7Qs629MkJkGyHxUlRHizWJRG2j8fbQKjELVSNhy7Q= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -394,8 +291,6 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -407,8 +302,6 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200323144430-8dcfad9e016e/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= -golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/actor/certificate_provider.go b/internal/actor/certificate_provider.go index 8901f3dd01..3ee84268a9 100644 --- a/internal/actor/certificate_provider.go +++ b/internal/actor/certificate_provider.go @@ -22,6 +22,15 @@ const ( Online // online ) +//go:generate enumerator -type CertificateProviderRelationshipLength -linecomment +type CertificateProviderRelationshipLength uint8 + +const ( + RelationshipLengthUnknown CertificateProviderRelationshipLength = iota // unknown + LessThanTwoYears // lt-2-years + GreaterThanEqualToTwoYears // gte-2-years +) + // CertificateProvider contains details about the certificate provider, provided by the applicant type CertificateProvider struct { // First names of the certificate provider @@ -41,7 +50,7 @@ type CertificateProvider struct { // The certificate provider's relationship to the applicant Relationship CertificateProviderRelationship // Amount of time Relationship has been in place if Personally - RelationshipLength string + RelationshipLength CertificateProviderRelationshipLength } func (c CertificateProvider) FullName() string { diff --git a/internal/actor/enum_certificateproviderrelationshiplength.go b/internal/actor/enum_certificateproviderrelationshiplength.go new file mode 100644 index 0000000000..f4ddc2608c --- /dev/null +++ b/internal/actor/enum_certificateproviderrelationshiplength.go @@ -0,0 +1,64 @@ +// Code generated by "enumerator -type CertificateProviderRelationshipLength -linecomment"; DO NOT EDIT. +package actor + +import ( + "fmt" + "strconv" +) + +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[RelationshipLengthUnknown-0] + _ = x[LessThanTwoYears-1] + _ = x[GreaterThanEqualToTwoYears-2] +} + +const _CertificateProviderRelationshipLength_name = "unknownlt-2-yearsgte-2-years" + +var _CertificateProviderRelationshipLength_index = [...]uint8{0, 7, 17, 28} + +func (i CertificateProviderRelationshipLength) String() string { + if i >= CertificateProviderRelationshipLength(len(_CertificateProviderRelationshipLength_index)-1) { + return "CertificateProviderRelationshipLength(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _CertificateProviderRelationshipLength_name[_CertificateProviderRelationshipLength_index[i]:_CertificateProviderRelationshipLength_index[i+1]] +} + +func (i CertificateProviderRelationshipLength) IsRelationshipLengthUnknown() bool { + return i == RelationshipLengthUnknown +} + +func (i CertificateProviderRelationshipLength) IsLessThanTwoYears() bool { + return i == LessThanTwoYears +} + +func (i CertificateProviderRelationshipLength) IsGreaterThanEqualToTwoYears() bool { + return i == GreaterThanEqualToTwoYears +} + +func ParseCertificateProviderRelationshipLength(s string) (CertificateProviderRelationshipLength, error) { + switch s { + case "unknown": + return RelationshipLengthUnknown, nil + case "lt-2-years": + return LessThanTwoYears, nil + case "gte-2-years": + return GreaterThanEqualToTwoYears, nil + default: + return CertificateProviderRelationshipLength(0), fmt.Errorf("invalid CertificateProviderRelationshipLength '%s'", s) + } +} + +type CertificateProviderRelationshipLengthOptions struct { + RelationshipLengthUnknown CertificateProviderRelationshipLength + LessThanTwoYears CertificateProviderRelationshipLength + GreaterThanEqualToTwoYears CertificateProviderRelationshipLength +} + +var CertificateProviderRelationshipLengthValues = CertificateProviderRelationshipLengthOptions{ + RelationshipLengthUnknown: RelationshipLengthUnknown, + LessThanTwoYears: LessThanTwoYears, + GreaterThanEqualToTwoYears: GreaterThanEqualToTwoYears, +} diff --git a/internal/page/donor/certificate_provider_address.go b/internal/page/donor/certificate_provider_address.go index f9d719a553..67c8d6bdc8 100644 --- a/internal/page/donor/certificate_provider_address.go +++ b/internal/page/donor/certificate_provider_address.go @@ -4,6 +4,7 @@ import ( "net/http" "github.com/ministryofjustice/opg-go-common/template" + "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" "github.com/ministryofjustice/opg-modernising-lpa/internal/form" "github.com/ministryofjustice/opg-modernising-lpa/internal/page" "github.com/ministryofjustice/opg-modernising-lpa/internal/place" @@ -11,16 +12,30 @@ import ( func CertificateProviderAddress(logger Logger, tmpl template.Template, addressClient AddressClient, donorStore DonorStore) Handler { return func(appData page.AppData, w http.ResponseWriter, r *http.Request, lpa *page.Lpa) error { - data := &chooseAddressData{ - App: appData, - ActorLabel: "certificateProvider", - FullName: lpa.CertificateProvider.FullName(), - Form: &form.AddressForm{}, + data := newChooseAddressData( + appData, + "certificateProvider", + lpa.CertificateProvider.FullName(), + "", + false, + ) + + // so keys are set when amending address + if lpa.CertificateProvider.Relationship.IsProfessionally() { + data.overrideTitleKeys(titleKeys{ + Manual: "personsWorkAddress", + PostcodeSelectAndPostcodeLookup: "selectPersonsWorkAddress", + Postcode: "whatIsPersonsWorkPostcode", + ReuseAndReuseSelect: "selectAnAddressForPerson", + ReuseOrNew: "addPersonsAddress", + }) } if lpa.CertificateProvider.Address.Line1 != "" { data.Form.Action = "manual" data.Form.Address = &lpa.CertificateProvider.Address + } else if lpa.CertificateProvider.Relationship.IsProfessionally() { + data.Form.Action = "postcode" } if r.Method == http.MethodPost { @@ -29,6 +44,7 @@ func CertificateProviderAddress(logger Logger, tmpl template.Template, addressCl setAddress := func(address place.Address) error { lpa.CertificateProvider.Address = *data.Form.Address + lpa.Tasks.CertificateProvider = actor.TaskCompleted return donorStore.Put(r.Context(), lpa) } @@ -40,7 +56,7 @@ func CertificateProviderAddress(logger Logger, tmpl template.Template, addressCl return err } - return appData.Redirect(w, r, lpa, page.Paths.HowDoYouKnowYourCertificateProvider.Format(lpa.ID)) + return appData.Redirect(w, r, lpa, page.Paths.TaskList.Format(lpa.ID)) } case "postcode-select": @@ -66,7 +82,7 @@ func CertificateProviderAddress(logger Logger, tmpl template.Template, addressCl return err } - return appData.Redirect(w, r, lpa, page.Paths.HowDoYouKnowYourCertificateProvider.Format(lpa.ID)) + return appData.Redirect(w, r, lpa, page.Paths.TaskList.Format(lpa.ID)) } else { data.Addresses = lpa.ActorAddresses() } diff --git a/internal/page/donor/certificate_provider_address_test.go b/internal/page/donor/certificate_provider_address_test.go index d0681a4f0a..6caed9c4bc 100644 --- a/internal/page/donor/certificate_provider_address_test.go +++ b/internal/page/donor/certificate_provider_address_test.go @@ -33,6 +33,42 @@ func TestGetCertificateProviderAddress(t *testing.T) { Form: &form.AddressForm{}, FullName: "John Smith", ActorLabel: "certificateProvider", + TitleKeys: testTitleKeys, + }). + Return(nil) + + err := CertificateProviderAddress(nil, template.Execute, nil, nil)(testAppData, w, r, &page.Lpa{CertificateProvider: certificateProvider}) + resp := w.Result() + + assert.Nil(t, err) + assert.Equal(t, http.StatusOK, resp.StatusCode) +} + +func TestGetCertificateProviderAddressWhenProfessionalCertificateProvider(t *testing.T) { + w := httptest.NewRecorder() + r, _ := http.NewRequest(http.MethodGet, "/", nil) + + certificateProvider := actor.CertificateProvider{ + FirstNames: "John", + LastName: "Smith", + Address: place.Address{}, + Relationship: actor.Professionally, + } + + template := newMockTemplate(t) + template. + On("Execute", w, &chooseAddressData{ + App: testAppData, + Form: &form.AddressForm{Action: "postcode"}, + FullName: "John Smith", + ActorLabel: "certificateProvider", + TitleKeys: titleKeys{ + Manual: "personsWorkAddress", + PostcodeSelectAndPostcodeLookup: "selectPersonsWorkAddress", + Postcode: "whatIsPersonsWorkPostcode", + ReuseAndReuseSelect: "selectAnAddressForPerson", + ReuseOrNew: "addPersonsAddress", + }, }). Return(nil) @@ -61,6 +97,7 @@ func TestGetCertificateProviderAddressFromStore(t *testing.T) { }, FullName: " ", ActorLabel: "certificateProvider", + TitleKeys: testTitleKeys, }). Return(nil) @@ -89,6 +126,7 @@ func TestGetCertificateProviderAddressManual(t *testing.T) { }, FullName: " ", ActorLabel: "certificateProvider", + TitleKeys: testTitleKeys, }). Return(nil) @@ -110,6 +148,7 @@ func TestGetCertificateProviderAddressWhenTemplateErrors(t *testing.T) { Form: &form.AddressForm{}, FullName: " ", ActorLabel: "certificateProvider", + TitleKeys: testTitleKeys, }). Return(expectedError) @@ -139,6 +178,7 @@ func TestPostCertificateProviderAddressManual(t *testing.T) { On("Put", r.Context(), &page.Lpa{ ID: "lpa-id", CertificateProvider: actor.CertificateProvider{Address: testAddress}, + Tasks: page.Tasks{CertificateProvider: actor.TaskCompleted}, }). Return(nil) @@ -147,7 +187,7 @@ func TestPostCertificateProviderAddressManual(t *testing.T) { assert.Nil(t, err) assert.Equal(t, http.StatusFound, resp.StatusCode) - assert.Equal(t, page.Paths.HowDoYouKnowYourCertificateProvider.Format("lpa-id"), resp.Header.Get("Location")) + assert.Equal(t, page.Paths.TaskList.Format("lpa-id"), resp.Header.Get("Location")) } func TestPostCertificateProviderAddressManualWhenStoreErrors(t *testing.T) { @@ -168,6 +208,7 @@ func TestPostCertificateProviderAddressManualWhenStoreErrors(t *testing.T) { donorStore. On("Put", r.Context(), &page.Lpa{ CertificateProvider: actor.CertificateProvider{Address: testAddress}, + Tasks: page.Tasks{CertificateProvider: actor.TaskCompleted}, }). Return(expectedError) @@ -198,6 +239,7 @@ func TestPostCertificateProviderAddressManualFromStore(t *testing.T) { FirstNames: "John", Address: testAddress, }, + Tasks: page.Tasks{CertificateProvider: actor.TaskCompleted}, }). Return(nil) @@ -212,7 +254,7 @@ func TestPostCertificateProviderAddressManualFromStore(t *testing.T) { assert.Nil(t, err) assert.Equal(t, http.StatusFound, resp.StatusCode) - assert.Equal(t, page.Paths.HowDoYouKnowYourCertificateProvider.Format("lpa-id"), resp.Header.Get("Location")) + assert.Equal(t, page.Paths.TaskList.Format("lpa-id"), resp.Header.Get("Location")) } func TestPostCertificateProviderAddressManualWhenValidationError(t *testing.T) { @@ -245,6 +287,7 @@ func TestPostCertificateProviderAddressManualWhenValidationError(t *testing.T) { FullName: " ", ActorLabel: "certificateProvider", Errors: validation.With("address-line-1", validation.EnterError{Label: "addressLine1"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -277,6 +320,7 @@ func TestPostCertificateProviderPostcodeSelect(t *testing.T) { }, FullName: " ", ActorLabel: "certificateProvider", + TitleKeys: testTitleKeys, }). Return(nil) @@ -318,6 +362,7 @@ func TestPostCertificateProviderPostcodeSelectWhenValidationError(t *testing.T) ActorLabel: "certificateProvider", Addresses: addresses, Errors: validation.With("select-address", validation.SelectError{Label: "anAddressFromTheList"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -358,6 +403,7 @@ func TestPostCertificateProviderPostcodeLookup(t *testing.T) { FullName: " ", ActorLabel: "certificateProvider", Addresses: addresses, + TitleKeys: testTitleKeys, }). Return(nil) @@ -399,6 +445,7 @@ func TestPostCertificateProviderPostcodeLookupError(t *testing.T) { ActorLabel: "certificateProvider", Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "couldNotLookupPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -445,6 +492,7 @@ func TestPostCertificateProviderPostcodeLookupInvalidPostcodeError(t *testing.T) ActorLabel: "certificateProvider", Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.EnterError{Label: "invalidPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -485,6 +533,7 @@ func TestPostCertificateProviderPostcodeLookupValidPostcodeNoAddresses(t *testin ActorLabel: "certificateProvider", Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "noAddressesFound"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -514,6 +563,7 @@ func TestPostCertificateProviderPostcodeLookupWhenValidationError(t *testing.T) FullName: " ", ActorLabel: "certificateProvider", Errors: validation.With("lookup-postcode", validation.EnterError{Label: "aPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -542,6 +592,7 @@ func TestPostCertificateProviderAddressReuse(t *testing.T) { FullName: " ", ActorLabel: "certificateProvider", Addresses: []place.Address{{Line1: "donor lane"}}, + TitleKeys: testTitleKeys, }). Return(nil) @@ -578,6 +629,7 @@ func TestPostCertificateProviderAddressReuseSelect(t *testing.T) { Country: "GB", }, }, + Tasks: page.Tasks{CertificateProvider: actor.TaskCompleted}, }). Return(nil) @@ -586,7 +638,7 @@ func TestPostCertificateProviderAddressReuseSelect(t *testing.T) { assert.Nil(t, err) assert.Equal(t, http.StatusFound, resp.StatusCode) - assert.Equal(t, page.Paths.HowDoYouKnowYourCertificateProvider.Format("lpa-id"), resp.Header.Get("Location")) + assert.Equal(t, page.Paths.TaskList.Format("lpa-id"), resp.Header.Get("Location")) } func TestPostCertificateProviderAddressReuseSelectWhenValidationError(t *testing.T) { @@ -609,6 +661,7 @@ func TestPostCertificateProviderAddressReuseSelectWhenValidationError(t *testing Errors: validation.With("select-address", validation.SelectError{Label: "anAddressFromTheList"}), FullName: " ", ActorLabel: "certificateProvider", + TitleKeys: testTitleKeys, }). Return(nil) diff --git a/internal/page/donor/certificate_provider_details.go b/internal/page/donor/certificate_provider_details.go index 1b8488ad01..fc8d3d84f7 100644 --- a/internal/page/donor/certificate_provider_details.go +++ b/internal/page/donor/certificate_provider_details.go @@ -64,11 +64,15 @@ func CertificateProviderDetails(tmpl template.Template, donorStore DonorStore) H lpa.CertificateProvider.Mobile = data.Form.Mobile } + if !lpa.Tasks.CertificateProvider.Completed() { + lpa.Tasks.CertificateProvider = actor.TaskInProgress + } + if err := donorStore.Put(r.Context(), lpa); err != nil { return err } - return appData.Redirect(w, r, lpa, page.Paths.HowWouldCertificateProviderPreferToCarryOutTheirRole.Format(lpa.ID)) + return appData.Redirect(w, r, lpa, page.Paths.HowDoYouKnowYourCertificateProvider.Format(lpa.ID)) } } diff --git a/internal/page/donor/certificate_provider_details_test.go b/internal/page/donor/certificate_provider_details_test.go index 54d7877571..9702f5ee9f 100644 --- a/internal/page/donor/certificate_provider_details_test.go +++ b/internal/page/donor/certificate_provider_details_test.go @@ -181,6 +181,7 @@ func TestPostCertificateProviderDetails(t *testing.T) { LastName: "Doe", }, CertificateProvider: tc.certificateProviderDetails, + Tasks: page.Tasks{CertificateProvider: actor.TaskInProgress}, }). Return(nil) @@ -195,11 +196,54 @@ func TestPostCertificateProviderDetails(t *testing.T) { assert.Nil(t, err) assert.Equal(t, http.StatusFound, resp.StatusCode) - assert.Equal(t, page.Paths.HowWouldCertificateProviderPreferToCarryOutTheirRole.Format("lpa-id"), resp.Header.Get("Location")) + assert.Equal(t, page.Paths.HowDoYouKnowYourCertificateProvider.Format("lpa-id"), resp.Header.Get("Location")) }) } } +func TestPostCertificateProviderDetailsWhenAmendingDetailsAfterStateComplete(t *testing.T) { + form := url.Values{ + "first-names": {"John"}, + "last-name": {"Rey"}, + "mobile": {"07535111111"}, + } + + w := httptest.NewRecorder() + r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(form.Encode())) + r.Header.Add("Content-Type", page.FormUrlEncoded) + + donorStore := newMockDonorStore(t) + donorStore. + On("Put", r.Context(), &page.Lpa{ + ID: "lpa-id", + Donor: actor.Donor{ + FirstNames: "Jane", + LastName: "Doe", + }, + CertificateProvider: actor.CertificateProvider{ + FirstNames: "John", + LastName: "Rey", + Mobile: "07535111111", + }, + Tasks: page.Tasks{CertificateProvider: actor.TaskCompleted}, + }). + Return(nil) + + err := CertificateProviderDetails(nil, donorStore)(testAppData, w, r, &page.Lpa{ + ID: "lpa-id", + Donor: actor.Donor{ + FirstNames: "Jane", + LastName: "Doe", + }, + Tasks: page.Tasks{CertificateProvider: actor.TaskCompleted}, + }) + resp := w.Result() + + assert.Nil(t, err) + assert.Equal(t, http.StatusFound, resp.StatusCode) + assert.Equal(t, page.Paths.HowDoYouKnowYourCertificateProvider.Format("lpa-id"), resp.Header.Get("Location")) +} + func TestPostCertificateProviderDetailsWhenInputRequired(t *testing.T) { testCases := map[string]struct { form url.Values diff --git a/internal/page/donor/choose_address.go b/internal/page/donor/choose_address.go index ddb9272685..1e164b00ac 100644 --- a/internal/page/donor/choose_address.go +++ b/internal/page/donor/choose_address.go @@ -10,6 +10,24 @@ import ( "github.com/ministryofjustice/opg-modernising-lpa/internal/validation" ) +func newChooseAddressData(appData page.AppData, actorLabel, fullName, ID string, canSkip bool) *chooseAddressData { + return &chooseAddressData{ + App: appData, + ActorLabel: actorLabel, + FullName: fullName, + ID: ID, + CanSkip: canSkip, + Form: &form.AddressForm{}, + TitleKeys: titleKeys{ + Manual: "personsAddress", + Postcode: "whatIsPersonsPostcode", + PostcodeSelectAndPostcodeLookup: "selectAnAddressForPerson", + ReuseAndReuseSelect: "selectAnAddressForPerson", + ReuseOrNew: "addPersonsAddress", + }, + } +} + type chooseAddressData struct { App page.AppData Errors validation.List @@ -19,6 +37,19 @@ type chooseAddressData struct { CanSkip bool Addresses []place.Address Form *form.AddressForm + TitleKeys titleKeys +} + +type titleKeys struct { + Manual string + PostcodeSelectAndPostcodeLookup string + Postcode string + ReuseAndReuseSelect string + ReuseOrNew string +} + +func (d *chooseAddressData) overrideTitleKeys(newTitleKeys titleKeys) { + d.TitleKeys = newTitleKeys } func lookupAddress(ctx context.Context, logger Logger, addressClient AddressClient, data *chooseAddressData, your bool) { diff --git a/internal/page/donor/choose_address_test.go b/internal/page/donor/choose_address_test.go new file mode 100644 index 0000000000..7658fcd2d4 --- /dev/null +++ b/internal/page/donor/choose_address_test.go @@ -0,0 +1,56 @@ +package donor + +import ( + "testing" + + "github.com/ministryofjustice/opg-modernising-lpa/internal/form" + "github.com/stretchr/testify/assert" +) + +var testTitleKeys = titleKeys{ + Manual: "personsAddress", + Postcode: "whatIsPersonsPostcode", + PostcodeSelectAndPostcodeLookup: "selectAnAddressForPerson", + ReuseAndReuseSelect: "selectAnAddressForPerson", + ReuseOrNew: "addPersonsAddress", +} + +func TestNewChooseAddressData(t *testing.T) { + assert.Equal(t, &chooseAddressData{ + Form: &form.AddressForm{}, + TitleKeys: testTitleKeys, + App: testAppData, + ActorLabel: "a", + FullName: "b", + ID: "c", + CanSkip: true, + }, newChooseAddressData(testAppData, "a", "b", "c", true)) +} + +func TestOverrideProfessionalCertificateProviderKeys(t *testing.T) { + data := newChooseAddressData(testAppData, "1", "2", "3", true) + + data.overrideTitleKeys(titleKeys{ + Manual: "a", + PostcodeSelectAndPostcodeLookup: "b", + Postcode: "c", + ReuseAndReuseSelect: "d", + ReuseOrNew: "e", + }) + + assert.Equal(t, &chooseAddressData{ + Form: &form.AddressForm{}, + TitleKeys: titleKeys{ + Manual: "a", + PostcodeSelectAndPostcodeLookup: "b", + Postcode: "c", + ReuseAndReuseSelect: "d", + ReuseOrNew: "e", + }, + App: testAppData, + ActorLabel: "1", + FullName: "2", + ID: "3", + CanSkip: true, + }, data) +} diff --git a/internal/page/donor/choose_attorneys_address.go b/internal/page/donor/choose_attorneys_address.go index 322bb74662..b3c3b2e3d0 100644 --- a/internal/page/donor/choose_attorneys_address.go +++ b/internal/page/donor/choose_attorneys_address.go @@ -18,14 +18,18 @@ func ChooseAttorneysAddress(logger Logger, tmpl template.Template, addressClient return appData.Redirect(w, r, lpa, page.Paths.ChooseAttorneys.Format(lpa.ID)) } - data := &chooseAddressData{ - App: appData, - ActorLabel: "attorney", - FullName: attorney.FullName(), - ID: attorney.ID, - CanSkip: true, - Form: &form.AddressForm{}, - } + data := newChooseAddressData( + appData, + "attorney", + attorney.FullName(), + attorney.ID, + true, + ) + + data.ActorLabel = "attorney" + data.FullName = attorney.FullName() + data.ID = attorney.ID + data.CanSkip = true if attorney.Address.Line1 != "" { data.Form.Action = "manual" diff --git a/internal/page/donor/choose_attorneys_address_test.go b/internal/page/donor/choose_attorneys_address_test.go index f5ee7f4d43..45fd1377ca 100644 --- a/internal/page/donor/choose_attorneys_address_test.go +++ b/internal/page/donor/choose_attorneys_address_test.go @@ -29,6 +29,7 @@ func TestGetChooseAttorneysAddress(t *testing.T) { FullName: "John Smith", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -67,6 +68,7 @@ func TestGetChooseAttorneysAddressFromStore(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -95,6 +97,7 @@ func TestGetChooseAttorneysAddressManual(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -120,6 +123,7 @@ func TestGetChooseAttorneysAddressWhenTemplateErrors(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(expectedError) @@ -350,6 +354,7 @@ func TestPostChooseAttorneysAddressManualWhenValidationError(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -386,6 +391,7 @@ func TestPostChooseAttorneysAddressPostcodeSelect(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -431,6 +437,7 @@ func TestPostChooseAttorneysAddressPostcodeSelectWhenValidationError(t *testing. FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -475,6 +482,7 @@ func TestPostChooseAttorneysPostcodeLookup(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -520,6 +528,7 @@ func TestPostChooseAttorneysPostcodeLookupError(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -570,6 +579,7 @@ func TestPostChooseAttorneysPostcodeLookupInvalidPostcodeError(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -612,6 +622,7 @@ func TestPostChooseAttorneysPostcodeLookupValidPostcodeNoAddresses(t *testing.T) FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -645,6 +656,7 @@ func TestPostChooseAttorneysPostcodeLookupWhenValidationError(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -678,6 +690,7 @@ func TestPostChooseAttorneysAddressReuse(t *testing.T) { CanSkip: true, ActorLabel: "attorney", Addresses: []place.Address{{Line1: "donor lane"}}, + TitleKeys: testTitleKeys, }). Return(nil) @@ -755,6 +768,7 @@ func TestPostChooseAttorneysAddressReuseSelectWhenValidationError(t *testing.T) FullName: " ", CanSkip: true, ActorLabel: "attorney", + TitleKeys: testTitleKeys, }). Return(nil) diff --git a/internal/page/donor/choose_people_to_notify_address.go b/internal/page/donor/choose_people_to_notify_address.go index bedab6adb9..7aecac7cec 100644 --- a/internal/page/donor/choose_people_to_notify_address.go +++ b/internal/page/donor/choose_people_to_notify_address.go @@ -19,13 +19,13 @@ func ChoosePeopleToNotifyAddress(logger Logger, tmpl template.Template, addressC return appData.Redirect(w, r, lpa, page.Paths.ChoosePeopleToNotify.Format(lpa.ID)) } - data := &chooseAddressData{ - App: appData, - ActorLabel: "personToNotify", - FullName: personToNotify.FullName(), - ID: personToNotify.ID, - Form: &form.AddressForm{}, - } + data := newChooseAddressData( + appData, + "personToNotify", + personToNotify.FullName(), + personToNotify.ID, + false, + ) if personToNotify.Address.Line1 != "" { data.Form.Action = "manual" diff --git a/internal/page/donor/choose_people_to_notify_address_test.go b/internal/page/donor/choose_people_to_notify_address_test.go index 08381ddfbf..fda5bd3728 100644 --- a/internal/page/donor/choose_people_to_notify_address_test.go +++ b/internal/page/donor/choose_people_to_notify_address_test.go @@ -35,6 +35,7 @@ func TestGetChoosePeopleToNotifyAddress(t *testing.T) { ID: "123", FullName: "John Smith", ActorLabel: "personToNotify", + TitleKeys: testTitleKeys, }). Return(nil) @@ -60,6 +61,7 @@ func TestGetChoosePeopleToNotifyAddressFromStore(t *testing.T) { ID: "123", FullName: " ", ActorLabel: "personToNotify", + TitleKeys: testTitleKeys, }). Return(nil) @@ -87,6 +89,7 @@ func TestGetChoosePeopleToNotifyAddressManual(t *testing.T) { ID: "123", FullName: " ", ActorLabel: "personToNotify", + TitleKeys: testTitleKeys, }). Return(nil) @@ -114,6 +117,7 @@ func TestGetChoosePeopleToNotifyAddressWhenTemplateErrors(t *testing.T) { ID: "123", FullName: " ", ActorLabel: "personToNotify", + TitleKeys: testTitleKeys, }). Return(expectedError) @@ -254,6 +258,7 @@ func TestPostChoosePeopleToNotifyPostcodeSelect(t *testing.T) { ID: "123", FullName: "John ", ActorLabel: "personToNotify", + TitleKeys: testTitleKeys, }). Return(nil) @@ -302,6 +307,7 @@ func TestPostChoosePeopleToNotifyPostcodeSelectWhenValidationError(t *testing.T) ActorLabel: "personToNotify", Addresses: addresses, Errors: validation.With("select-address", validation.SelectError{Label: "anAddressFromTheList"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -343,6 +349,7 @@ func TestPostChoosePeopleToNotifyPostcodeLookup(t *testing.T) { FullName: "John ", ActorLabel: "personToNotify", Addresses: addresses, + TitleKeys: testTitleKeys, }). Return(nil) @@ -385,6 +392,7 @@ func TestPostChoosePeopleToNotifyPostcodeLookupError(t *testing.T) { ActorLabel: "personToNotify", Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "couldNotLookupPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -432,6 +440,7 @@ func TestPostChoosePeopleToNotifyPostcodeLookupInvalidPostcodeError(t *testing.T ActorLabel: "personToNotify", Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.EnterError{Label: "invalidPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -473,6 +482,7 @@ func TestPostChoosePeopleToNotifyPostcodeLookupValidPostcodeNoAddresses(t *testi ActorLabel: "personToNotify", Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "noAddressesFound"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -508,6 +518,7 @@ func TestPostChoosePeopleToNotifyPostcodeLookupWhenValidationError(t *testing.T) FullName: " ", ActorLabel: "personToNotify", Errors: validation.With("lookup-postcode", validation.EnterError{Label: "aPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -538,6 +549,7 @@ func TestPostChoosePeopleToNotifyAddressReuse(t *testing.T) { FullName: " ", ActorLabel: "personToNotify", Addresses: []place.Address{{Line1: "donor lane"}}, + TitleKeys: testTitleKeys, }). Return(nil) @@ -609,6 +621,7 @@ func TestPostChoosePeopleToNotifyAddressReuseSelectWhenValidationError(t *testin ID: "123", FullName: " ", ActorLabel: "personToNotify", + TitleKeys: testTitleKeys, }). Return(nil) diff --git a/internal/page/donor/choose_replacement_attorneys_address.go b/internal/page/donor/choose_replacement_attorneys_address.go index 67501449b8..561ff0dd99 100644 --- a/internal/page/donor/choose_replacement_attorneys_address.go +++ b/internal/page/donor/choose_replacement_attorneys_address.go @@ -14,14 +14,13 @@ func ChooseReplacementAttorneysAddress(logger Logger, tmpl template.Template, ad attorneyId := r.FormValue("id") attorney, _ := lpa.ReplacementAttorneys.Get(attorneyId) - data := &chooseAddressData{ - App: appData, - ActorLabel: "replacementAttorney", - FullName: attorney.FullName(), - ID: attorney.ID, - CanSkip: true, - Form: &form.AddressForm{}, - } + data := newChooseAddressData( + appData, + "replacementAttorney", + attorney.FullName(), + attorney.ID, + true, + ) if attorney.Address.Line1 != "" { data.Form.Action = "manual" diff --git a/internal/page/donor/choose_replacement_attorneys_address_test.go b/internal/page/donor/choose_replacement_attorneys_address_test.go index e3d1df94dc..5affa3b7c8 100644 --- a/internal/page/donor/choose_replacement_attorneys_address_test.go +++ b/internal/page/donor/choose_replacement_attorneys_address_test.go @@ -36,6 +36,7 @@ func TestGetChooseReplacementAttorneysAddress(t *testing.T) { FullName: "John Smith", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -67,6 +68,7 @@ func TestGetChooseReplacementAttorneysAddressFromStore(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -98,6 +100,7 @@ func TestGetChooseReplacementAttorneysAddressManual(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -126,6 +129,7 @@ func TestGetChooseReplacementAttorneysAddressWhenTemplateErrors(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(expectedError) @@ -311,6 +315,7 @@ func TestPostChooseReplacementAttorneysAddressManualWhenValidationError(t *testi FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -345,6 +350,7 @@ func TestPostChooseReplacementAttorneysPostcodeSelect(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -388,6 +394,7 @@ func TestPostChooseReplacementAttorneysPostcodeSelectWhenValidationError(t *test FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -430,6 +437,7 @@ func TestPostChooseReplacementAttorneysPostcodeLookup(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -473,6 +481,7 @@ func TestPostChooseReplacementAttorneysPostcodeLookupError(t *testing.T) { FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -521,6 +530,7 @@ func TestPostChooseReplacementAttorneysPostcodeLookupInvalidPostcodeError(t *tes FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -565,6 +575,7 @@ func TestPostChooseReplacementAttorneysPostcodeLookupValidPostcodeNoAddresses(t FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -598,6 +609,7 @@ func TestPostChooseReplacementAttorneysPostcodeLookupWhenValidationError(t *test FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) @@ -629,6 +641,7 @@ func TestPostChooseReplacementAttorneysAddressReuse(t *testing.T) { CanSkip: true, ActorLabel: "replacementAttorney", Addresses: []place.Address{{Line1: "donor lane"}}, + TitleKeys: testTitleKeys, }). Return(nil) @@ -706,6 +719,7 @@ func TestPostChooseReplacementAttorneysAddressReuseSelectWhenValidationError(t * FullName: " ", CanSkip: true, ActorLabel: "replacementAttorney", + TitleKeys: testTitleKeys, }). Return(nil) diff --git a/internal/page/donor/enter_replacement_trust_corporation_address.go b/internal/page/donor/enter_replacement_trust_corporation_address.go index 413b0c75b9..4caa0d2363 100644 --- a/internal/page/donor/enter_replacement_trust_corporation_address.go +++ b/internal/page/donor/enter_replacement_trust_corporation_address.go @@ -13,11 +13,13 @@ func EnterReplacementTrustCorporationAddress(logger Logger, tmpl template.Templa return func(appData page.AppData, w http.ResponseWriter, r *http.Request, lpa *page.Lpa) error { trustCorporation := lpa.ReplacementAttorneys.TrustCorporation - data := &chooseAddressData{ - App: appData, - ActorLabel: "theTrustCorporation", - Form: &form.AddressForm{}, - } + data := newChooseAddressData( + appData, + "theTrustCorporation", + "", + "", + false, + ) if trustCorporation.Address.Line1 != "" { data.Form.Action = "manual" diff --git a/internal/page/donor/enter_replacement_trust_corporation_address_test.go b/internal/page/donor/enter_replacement_trust_corporation_address_test.go index 6a60ed489f..48dd610ca8 100644 --- a/internal/page/donor/enter_replacement_trust_corporation_address_test.go +++ b/internal/page/donor/enter_replacement_trust_corporation_address_test.go @@ -26,6 +26,7 @@ func TestGetEnterReplacementTrustCorporationAddress(t *testing.T) { App: testAppData, Form: &form.AddressForm{}, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -51,6 +52,7 @@ func TestGetEnterReplacementTrustCorporationAddressManual(t *testing.T) { Address: &place.Address{}, }, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -73,6 +75,7 @@ func TestGetEnterReplacementTrustCorporationAddressWhenTemplateErrors(t *testing App: testAppData, Form: &form.AddressForm{}, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(expectedError) @@ -220,6 +223,7 @@ func TestPostEnterReplacementTrustCorporationAddressManualWhenValidationError(t }, Errors: validation.With("address-line-1", validation.EnterError{Label: "addressLine1"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -253,6 +257,7 @@ func TestPostEnterReplacementTrustCorporationAddressPostcodeSelect(t *testing.T) Address: &testAddress, }, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -295,6 +300,7 @@ func TestPostEnterReplacementTrustCorporationAddressPostcodeSelectWhenValidation Addresses: addresses, Errors: validation.With("select-address", validation.SelectError{Label: "anAddressFromTheList"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -336,6 +342,7 @@ func TestPostEnterReplacementTrustCorporationPostcodeLookup(t *testing.T) { }, Addresses: addresses, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -378,6 +385,7 @@ func TestPostEnterReplacementTrustCorporationPostcodeLookupError(t *testing.T) { Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "couldNotLookupPostcode"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -425,6 +433,7 @@ func TestPostEnterReplacementTrustCorporationAddressPostcodeLookupInvalidPostcod Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.EnterError{Label: "invalidPostcode"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -464,6 +473,7 @@ func TestPostEnterReplacementTrustCorporationAddressPostcodeLookupValidPostcodeN Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "noAddressesFound"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -494,6 +504,7 @@ func TestPostEnterReplacementTrustCorporationAddressPostcodeLookupWhenValidation }, Errors: validation.With("lookup-postcode", validation.EnterError{Label: "aPostcode"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -524,6 +535,7 @@ func TestPostEnterReplacementTrustCorporationAddressReuse(t *testing.T) { }, ActorLabel: "theTrustCorporation", Addresses: []place.Address{{Line1: "donor lane"}}, + TitleKeys: testTitleKeys, }). Return(nil) @@ -600,6 +612,7 @@ func TestPostEnterReplacementTrustCorporationAddressReuseSelectWhenValidationErr Addresses: []place.Address{{Line1: "donor lane"}}, Errors: validation.With("select-address", validation.SelectError{Label: "anAddressFromTheList"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) diff --git a/internal/page/donor/enter_trust_corporation_address.go b/internal/page/donor/enter_trust_corporation_address.go index f8e1d432f5..bbde2bd981 100644 --- a/internal/page/donor/enter_trust_corporation_address.go +++ b/internal/page/donor/enter_trust_corporation_address.go @@ -13,11 +13,13 @@ func EnterTrustCorporationAddress(logger Logger, tmpl template.Template, address return func(appData page.AppData, w http.ResponseWriter, r *http.Request, lpa *page.Lpa) error { trustCorporation := lpa.Attorneys.TrustCorporation - data := &chooseAddressData{ - App: appData, - ActorLabel: "theTrustCorporation", - Form: &form.AddressForm{}, - } + data := newChooseAddressData( + appData, + "theTrustCorporation", + "", + "", + false, + ) if trustCorporation.Address.Line1 != "" { data.Form.Action = "manual" diff --git a/internal/page/donor/enter_trust_corporation_address_test.go b/internal/page/donor/enter_trust_corporation_address_test.go index 26bc84c9b2..f3532ba218 100644 --- a/internal/page/donor/enter_trust_corporation_address_test.go +++ b/internal/page/donor/enter_trust_corporation_address_test.go @@ -26,6 +26,7 @@ func TestGetEnterTrustCorporationAddress(t *testing.T) { App: testAppData, Form: &form.AddressForm{}, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -51,6 +52,7 @@ func TestGetEnterTrustCorporationAddressManual(t *testing.T) { Address: &place.Address{}, }, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -73,6 +75,7 @@ func TestGetEnterTrustCorporationAddressWhenTemplateErrors(t *testing.T) { App: testAppData, Form: &form.AddressForm{}, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(expectedError) @@ -220,6 +223,7 @@ func TestPostEnterTrustCorporationAddressManualWhenValidationError(t *testing.T) }, Errors: validation.With("address-line-1", validation.EnterError{Label: "addressLine1"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -253,6 +257,7 @@ func TestPostEnterTrustCorporationAddressPostcodeSelect(t *testing.T) { Address: &testAddress, }, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -295,6 +300,7 @@ func TestPostEnterTrustCorporationAddressPostcodeSelectWhenValidationError(t *te Addresses: addresses, Errors: validation.With("select-address", validation.SelectError{Label: "anAddressFromTheList"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -336,6 +342,7 @@ func TestPostEnterTrustCorporationPostcodeLookup(t *testing.T) { }, Addresses: addresses, ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -378,6 +385,7 @@ func TestPostEnterTrustCorporationPostcodeLookupError(t *testing.T) { Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "couldNotLookupPostcode"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -425,6 +433,7 @@ func TestPostEnterTrustCorporationAddressPostcodeLookupInvalidPostcodeError(t *t Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.EnterError{Label: "invalidPostcode"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -464,6 +473,7 @@ func TestPostEnterTrustCorporationAddressPostcodeLookupValidPostcodeNoAddresses( Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "noAddressesFound"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -494,6 +504,7 @@ func TestPostEnterTrustCorporationAddressPostcodeLookupWhenValidationError(t *te }, Errors: validation.With("lookup-postcode", validation.EnterError{Label: "aPostcode"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) @@ -524,6 +535,7 @@ func TestPostEnterTrustCorporationAddressReuse(t *testing.T) { }, ActorLabel: "theTrustCorporation", Addresses: []place.Address{{Line1: "donor lane"}}, + TitleKeys: testTitleKeys, }). Return(nil) @@ -600,6 +612,7 @@ func TestPostEnterTrustCorporationAddressReuseSelectWhenValidationError(t *testi Addresses: []place.Address{{Line1: "donor lane"}}, Errors: validation.With("select-address", validation.SelectError{Label: "anAddressFromTheList"}), ActorLabel: "theTrustCorporation", + TitleKeys: testTitleKeys, }). Return(nil) diff --git a/internal/page/donor/how_do_you_know_your_certificate_provider.go b/internal/page/donor/how_do_you_know_your_certificate_provider.go index e132cbb82b..b5019e9f0b 100644 --- a/internal/page/donor/how_do_you_know_your_certificate_provider.go +++ b/internal/page/donor/how_do_you_know_your_certificate_provider.go @@ -6,6 +6,7 @@ import ( "github.com/ministryofjustice/opg-go-common/template" "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" "github.com/ministryofjustice/opg-modernising-lpa/internal/page" + "github.com/ministryofjustice/opg-modernising-lpa/internal/place" "github.com/ministryofjustice/opg-modernising-lpa/internal/validation" ) @@ -33,30 +34,26 @@ func HowDoYouKnowYourCertificateProvider(tmpl template.Template, donorStore Dono data.Errors = data.Form.Validate() if data.Errors.None() { - lpa.CertificateProvider.Relationship = data.Form.How - - requireLength := false - if lpa.CertificateProvider.Relationship.IsPersonally() { - requireLength = true + if data.Form.How.IsProfessionally() && lpa.CertificateProvider.Relationship.IsPersonally() { + lpa.CertificateProvider.RelationshipLength = actor.RelationshipLengthUnknown } - if requireLength { - // TODO: should stay as Completed if editing and not changing the answer here + if !lpa.CertificateProvider.Relationship.Empty() && data.Form.How != lpa.CertificateProvider.Relationship { lpa.Tasks.CertificateProvider = actor.TaskInProgress - } else { - lpa.CertificateProvider.RelationshipLength = "" - lpa.Tasks.CertificateProvider = actor.TaskCompleted + lpa.CertificateProvider.Address = place.Address{} } + lpa.CertificateProvider.Relationship = data.Form.How + if err := donorStore.Put(r.Context(), lpa); err != nil { return err } - if requireLength { + if lpa.CertificateProvider.Relationship.IsPersonally() { return appData.Redirect(w, r, lpa, page.Paths.HowLongHaveYouKnownCertificateProvider.Format(lpa.ID)) } - return appData.Redirect(w, r, lpa, page.Paths.DoYouWantToNotifyPeople.Format(lpa.ID)) + return appData.Redirect(w, r, lpa, page.Paths.HowWouldCertificateProviderPreferToCarryOutTheirRole.Format(lpa.ID)) } } diff --git a/internal/page/donor/how_do_you_know_your_certificate_provider_test.go b/internal/page/donor/how_do_you_know_your_certificate_provider_test.go index d0cb7c30b5..6f568cdbd8 100644 --- a/internal/page/donor/how_do_you_know_your_certificate_provider_test.go +++ b/internal/page/donor/how_do_you_know_your_certificate_provider_test.go @@ -9,6 +9,7 @@ import ( "github.com/ministryofjustice/opg-modernising-lpa/internal/actor" "github.com/ministryofjustice/opg-modernising-lpa/internal/page" + "github.com/ministryofjustice/opg-modernising-lpa/internal/place" "github.com/ministryofjustice/opg-modernising-lpa/internal/validation" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -81,7 +82,6 @@ func TestPostHowDoYouKnowYourCertificateProvider(t *testing.T) { testCases := map[string]struct { form url.Values certificateProviderDetails actor.CertificateProvider - taskState actor.TaskState redirect page.LpaPath }{ "professionally": { @@ -90,8 +90,7 @@ func TestPostHowDoYouKnowYourCertificateProvider(t *testing.T) { FirstNames: "John", Relationship: actor.Professionally, }, - taskState: actor.TaskCompleted, - redirect: page.Paths.DoYouWantToNotifyPeople, + redirect: page.Paths.HowWouldCertificateProviderPreferToCarryOutTheirRole, }, "personally": { form: url.Values{"how": {actor.Personally.String()}}, @@ -99,8 +98,7 @@ func TestPostHowDoYouKnowYourCertificateProvider(t *testing.T) { FirstNames: "John", Relationship: actor.Personally, }, - taskState: actor.TaskInProgress, - redirect: page.Paths.HowLongHaveYouKnownCertificateProvider, + redirect: page.Paths.HowLongHaveYouKnownCertificateProvider, }, } @@ -116,9 +114,8 @@ func TestPostHowDoYouKnowYourCertificateProvider(t *testing.T) { ID: "lpa-id", CertificateProvider: tc.certificateProviderDetails, Tasks: page.Tasks{ - YourDetails: actor.TaskCompleted, - ChooseAttorneys: actor.TaskCompleted, - CertificateProvider: tc.taskState, + YourDetails: actor.TaskCompleted, + ChooseAttorneys: actor.TaskCompleted, }, }). Return(nil) @@ -140,6 +137,78 @@ func TestPostHowDoYouKnowYourCertificateProvider(t *testing.T) { } } +func TestPostHowDoYouKnowYourCertificateProviderWhenSwitchingRelationship(t *testing.T) { + testCases := map[string]struct { + form url.Values + existingCertificateProviderDetails actor.CertificateProvider + updatedCertificateProviderDetails actor.CertificateProvider + redirect page.LpaPath + taskState actor.TaskState + }{ + "personally to professionally": { + form: url.Values{"how": {actor.Professionally.String()}}, + existingCertificateProviderDetails: actor.CertificateProvider{ + RelationshipLength: actor.GreaterThanEqualToTwoYears, + Relationship: actor.Personally, + Address: testAddress, + }, + updatedCertificateProviderDetails: actor.CertificateProvider{ + Relationship: actor.Professionally, + Address: place.Address{}, + }, + redirect: page.Paths.HowWouldCertificateProviderPreferToCarryOutTheirRole, + }, + "professionally to personally": { + form: url.Values{"how": {actor.Personally.String()}}, + existingCertificateProviderDetails: actor.CertificateProvider{ + Relationship: actor.Professionally, + Address: testAddress, + }, + updatedCertificateProviderDetails: actor.CertificateProvider{ + Relationship: actor.Personally, + Address: place.Address{}, + }, + redirect: page.Paths.HowLongHaveYouKnownCertificateProvider, + }, + } + + for name, tc := range testCases { + t.Run(name, func(t *testing.T) { + w := httptest.NewRecorder() + r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(tc.form.Encode())) + r.Header.Add("Content-Type", page.FormUrlEncoded) + + donorStore := newMockDonorStore(t) + donorStore. + On("Put", r.Context(), &page.Lpa{ + ID: "lpa-id", + CertificateProvider: tc.updatedCertificateProviderDetails, + Tasks: page.Tasks{ + YourDetails: actor.TaskCompleted, + ChooseAttorneys: actor.TaskCompleted, + CertificateProvider: actor.TaskInProgress, + }, + }). + Return(nil) + + err := HowDoYouKnowYourCertificateProvider(nil, donorStore)(testAppData, w, r, &page.Lpa{ + ID: "lpa-id", + CertificateProvider: tc.existingCertificateProviderDetails, + Tasks: page.Tasks{ + YourDetails: actor.TaskCompleted, + ChooseAttorneys: actor.TaskCompleted, + CertificateProvider: actor.TaskCompleted, + }, + }) + resp := w.Result() + + assert.Nil(t, err) + assert.Equal(t, http.StatusFound, resp.StatusCode) + assert.Equal(t, tc.redirect.Format("lpa-id"), resp.Header.Get("Location")) + }) + } +} + func TestPostHowDoYouKnowYourCertificateProviderWhenStoreErrors(t *testing.T) { form := url.Values{ "how": {actor.Personally.String()}, diff --git a/internal/page/donor/how_long_have_you_known_certificate_provider.go b/internal/page/donor/how_long_have_you_known_certificate_provider.go index c967c00ea3..df6b784509 100644 --- a/internal/page/donor/how_long_have_you_known_certificate_provider.go +++ b/internal/page/donor/how_long_have_you_known_certificate_provider.go @@ -13,7 +13,8 @@ type howLongHaveYouKnownCertificateProviderData struct { App page.AppData Errors validation.List CertificateProvider actor.CertificateProvider - HowLong string + RelationshipLength actor.CertificateProviderRelationshipLength + Options actor.CertificateProviderRelationshipLengthOptions } func HowLongHaveYouKnownCertificateProvider(tmpl template.Template, donorStore DonorStore) Handler { @@ -21,7 +22,8 @@ func HowLongHaveYouKnownCertificateProvider(tmpl template.Template, donorStore D data := &howLongHaveYouKnownCertificateProviderData{ App: appData, CertificateProvider: lpa.CertificateProvider, - HowLong: lpa.CertificateProvider.RelationshipLength, + RelationshipLength: lpa.CertificateProvider.RelationshipLength, + Options: actor.CertificateProviderRelationshipLengthValues, } if r.Method == http.MethodPost { @@ -29,17 +31,16 @@ func HowLongHaveYouKnownCertificateProvider(tmpl template.Template, donorStore D data.Errors = form.Validate() if data.Errors.None() { - if form.HowLong == "lt-2-years" { + if form.RelationshipLength == actor.LessThanTwoYears { return appData.Redirect(w, r, lpa, page.Paths.ChooseNewCertificateProvider.Format(lpa.ID)) } - lpa.Tasks.CertificateProvider = actor.TaskCompleted - lpa.CertificateProvider.RelationshipLength = form.HowLong + lpa.CertificateProvider.RelationshipLength = form.RelationshipLength if err := donorStore.Put(r.Context(), lpa); err != nil { return err } - return appData.Redirect(w, r, lpa, page.Paths.DoYouWantToNotifyPeople.Format(lpa.ID)) + return appData.Redirect(w, r, lpa, page.Paths.HowWouldCertificateProviderPreferToCarryOutTheirRole.Format(lpa.ID)) } } @@ -48,20 +49,24 @@ func HowLongHaveYouKnownCertificateProvider(tmpl template.Template, donorStore D } type howLongHaveYouKnownCertificateProviderForm struct { - HowLong string + RelationshipLength actor.CertificateProviderRelationshipLength + Error error } func readHowLongHaveYouKnownCertificateProviderForm(r *http.Request) *howLongHaveYouKnownCertificateProviderForm { + relationshipLength, err := actor.ParseCertificateProviderRelationshipLength(page.PostFormString(r, "relationship-length")) + return &howLongHaveYouKnownCertificateProviderForm{ - HowLong: page.PostFormString(r, "how-long"), + RelationshipLength: relationshipLength, + Error: err, } } func (f *howLongHaveYouKnownCertificateProviderForm) Validate() validation.List { var errors validation.List - errors.String("how-long", "howLongYouHaveKnownCertificateProvider", f.HowLong, - validation.Select("gte-2-years", "lt-2-years")) + errors.Error("relationship-length", "howLongYouHaveKnownCertificateProvider", f.Error, + validation.Selected()) return errors } diff --git a/internal/page/donor/how_long_have_you_known_certificate_provider_test.go b/internal/page/donor/how_long_have_you_known_certificate_provider_test.go index 29fd54a277..a6d40f3dc9 100644 --- a/internal/page/donor/how_long_have_you_known_certificate_provider_test.go +++ b/internal/page/donor/how_long_have_you_known_certificate_provider_test.go @@ -23,7 +23,8 @@ func TestGetHowLongHaveYouKnownCertificateProvider(t *testing.T) { template := newMockTemplate(t) template. On("Execute", w, &howLongHaveYouKnownCertificateProviderData{ - App: testAppData, + App: testAppData, + Options: actor.CertificateProviderRelationshipLengthValues, }). Return(nil) @@ -38,14 +39,15 @@ func TestGetHowLongHaveYouKnownCertificateProviderFromStore(t *testing.T) { w := httptest.NewRecorder() r, _ := http.NewRequest(http.MethodGet, "/", nil) - certificateProvider := actor.CertificateProvider{RelationshipLength: "gte-2-years"} + certificateProvider := actor.CertificateProvider{RelationshipLength: actor.GreaterThanEqualToTwoYears} template := newMockTemplate(t) template. On("Execute", w, &howLongHaveYouKnownCertificateProviderData{ App: testAppData, CertificateProvider: certificateProvider, - HowLong: "gte-2-years", + RelationshipLength: actor.GreaterThanEqualToTwoYears, + Options: actor.CertificateProviderRelationshipLengthValues, }). Return(nil) @@ -63,7 +65,8 @@ func TestGetHowLongHaveYouKnownCertificateProviderWhenTemplateErrors(t *testing. template := newMockTemplate(t) template. On("Execute", w, &howLongHaveYouKnownCertificateProviderData{ - App: testAppData, + App: testAppData, + Options: actor.CertificateProviderRelationshipLengthValues, }). Return(expectedError) @@ -76,7 +79,7 @@ func TestGetHowLongHaveYouKnownCertificateProviderWhenTemplateErrors(t *testing. func TestPostHowLongHaveYouKnownCertificateProviderMoreThan2Years(t *testing.T) { form := url.Values{ - "how-long": {"gte-2-years"}, + "relationship-length": {actor.GreaterThanEqualToTwoYears.String()}, } w := httptest.NewRecorder() @@ -89,8 +92,8 @@ func TestPostHowLongHaveYouKnownCertificateProviderMoreThan2Years(t *testing.T) ID: "lpa-id", Attorneys: actor.Attorneys{Attorneys: []actor.Attorney{{FirstNames: "a", LastName: "b", Address: place.Address{Line1: "c"}, DateOfBirth: date.New("1990", "1", "1")}}}, AttorneyDecisions: actor.AttorneyDecisions{How: actor.Jointly}, - CertificateProvider: actor.CertificateProvider{RelationshipLength: "gte-2-years"}, - Tasks: page.Tasks{YourDetails: actor.TaskCompleted, ChooseAttorneys: actor.TaskCompleted, CertificateProvider: actor.TaskCompleted}, + CertificateProvider: actor.CertificateProvider{RelationshipLength: actor.GreaterThanEqualToTwoYears}, + Tasks: page.Tasks{YourDetails: actor.TaskCompleted, ChooseAttorneys: actor.TaskCompleted}, }). Return(nil) @@ -104,12 +107,12 @@ func TestPostHowLongHaveYouKnownCertificateProviderMoreThan2Years(t *testing.T) assert.Nil(t, err) assert.Equal(t, http.StatusFound, resp.StatusCode) - assert.Equal(t, page.Paths.DoYouWantToNotifyPeople.Format("lpa-id"), resp.Header.Get("Location")) + assert.Equal(t, page.Paths.HowWouldCertificateProviderPreferToCarryOutTheirRole.Format("lpa-id"), resp.Header.Get("Location")) } func TestPostHowLongHaveYouKnownCertificateProviderLessThan2Years(t *testing.T) { form := url.Values{ - "how-long": {"lt-2-years"}, + "relationship-length": {"lt-2-years"}, } w := httptest.NewRecorder() @@ -126,7 +129,7 @@ func TestPostHowLongHaveYouKnownCertificateProviderLessThan2Years(t *testing.T) func TestPostHowLongHaveYouKnownCertificateProviderWhenStoreErrors(t *testing.T) { form := url.Values{ - "how-long": {"gte-2-years"}, + "relationship-length": {actor.GreaterThanEqualToTwoYears.String()}, } w := httptest.NewRecorder() @@ -151,8 +154,9 @@ func TestPostHowLongHaveYouKnownCertificateProviderWhenValidationErrors(t *testi template := newMockTemplate(t) template. On("Execute", w, &howLongHaveYouKnownCertificateProviderData{ - App: testAppData, - Errors: validation.With("how-long", validation.SelectError{Label: "howLongYouHaveKnownCertificateProvider"}), + App: testAppData, + Errors: validation.With("relationship-length", validation.SelectError{Label: "howLongYouHaveKnownCertificateProvider"}), + Options: actor.CertificateProviderRelationshipLengthValues, }). Return(nil) @@ -165,7 +169,7 @@ func TestPostHowLongHaveYouKnownCertificateProviderWhenValidationErrors(t *testi func TestReadHowLongHaveYouKnownCertificateProviderForm(t *testing.T) { form := url.Values{ - "how-long": {"gte-2-years"}, + "relationship-length": {actor.GreaterThanEqualToTwoYears.String()}, } r, _ := http.NewRequest(http.MethodPost, "/", strings.NewReader(form.Encode())) @@ -173,7 +177,7 @@ func TestReadHowLongHaveYouKnownCertificateProviderForm(t *testing.T) { result := readHowLongHaveYouKnownCertificateProviderForm(r) - assert.Equal(t, "gte-2-years", result.HowLong) + assert.Equal(t, actor.GreaterThanEqualToTwoYears, result.RelationshipLength) } func TestHowLongHaveYouKnownCertificateProviderFormValidate(t *testing.T) { @@ -181,20 +185,16 @@ func TestHowLongHaveYouKnownCertificateProviderFormValidate(t *testing.T) { form *howLongHaveYouKnownCertificateProviderForm errors validation.List }{ - "gte-2-years": { + "valid": { form: &howLongHaveYouKnownCertificateProviderForm{ - HowLong: "gte-2-years", + RelationshipLength: actor.GreaterThanEqualToTwoYears, }, }, - "missing": { - form: &howLongHaveYouKnownCertificateProviderForm{}, - errors: validation.With("how-long", validation.SelectError{Label: "howLongYouHaveKnownCertificateProvider"}), - }, "invalid": { form: &howLongHaveYouKnownCertificateProviderForm{ - HowLong: "what", + Error: expectedError, }, - errors: validation.With("how-long", validation.SelectError{Label: "howLongYouHaveKnownCertificateProvider"}), + errors: validation.With("relationship-length", validation.SelectError{Label: "howLongYouHaveKnownCertificateProvider"}), }, } diff --git a/internal/page/donor/register.go b/internal/page/donor/register.go index fcdc08b641..30f94b336a 100644 --- a/internal/page/donor/register.go +++ b/internal/page/donor/register.go @@ -373,7 +373,7 @@ func Register( LpaProgress(tmpls.Get("lpa_progress.gohtml"), certificateProviderStore, attorneyStore)) handleWithLpa(page.Paths.UploadEvidenceSSE, None, - UploadEvidenceSSE(documentStore, 3*time.Minute, 2*time.Second)) + UploadEvidenceSSE(documentStore, 3*time.Minute, 2*time.Second, time.Now)) } type handleOpt byte diff --git a/internal/page/donor/upload_evidence_sse.go b/internal/page/donor/upload_evidence_sse.go index fda0f4a55a..24491c0cf3 100644 --- a/internal/page/donor/upload_evidence_sse.go +++ b/internal/page/donor/upload_evidence_sse.go @@ -9,7 +9,7 @@ import ( "github.com/ministryofjustice/opg-modernising-lpa/internal/page" ) -func UploadEvidenceSSE(documentStore DocumentStore, ttl time.Duration, flushFrequency time.Duration) Handler { +func UploadEvidenceSSE(documentStore DocumentStore, ttl time.Duration, flushFrequency time.Duration, now func() time.Time) Handler { return func(appData page.AppData, w http.ResponseWriter, r *http.Request, lpa *page.Lpa) error { w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Connection", "keep-alive") @@ -24,7 +24,7 @@ func UploadEvidenceSSE(documentStore DocumentStore, ttl time.Duration, flushFreq alreadyScannedCount := len(documents.Scanned()) batchToBeScannedCount := len(documents.NotScanned()) - for start := time.Now(); time.Since(start) < ttl; { + for start := now(); time.Since(start) < ttl; { documents, err := documentStore.GetAll(r.Context()) if err != nil { printMessage("data: {\"closeConnection\": \"1\"}\n\n", w) diff --git a/internal/page/donor/upload_evidence_sse_test.go b/internal/page/donor/upload_evidence_sse_test.go index 72a6c4f5f8..60701435e6 100644 --- a/internal/page/donor/upload_evidence_sse_test.go +++ b/internal/page/donor/upload_evidence_sse_test.go @@ -35,7 +35,9 @@ func TestUploadEvidenceSSE(t *testing.T) { {Scanned: true}, }, nil).Once() - err := UploadEvidenceSSE(documentStore, 4*time.Millisecond, 2*time.Millisecond)(testAppData, w, r, &page.Lpa{}) + now := time.Now() + + err := UploadEvidenceSSE(documentStore, 4*time.Millisecond, 2*time.Millisecond, func() time.Time { return now })(testAppData, w, r, &page.Lpa{}) resp := w.Result() bodyBytes, _ := io.ReadAll(resp.Body) @@ -57,7 +59,7 @@ func TestUploadEvidenceSSEOnDonorStoreError(t *testing.T) { {Scanned: true}, }, expectedError) - err := UploadEvidenceSSE(documentStore, 4*time.Millisecond, 2*time.Millisecond)(testAppData, w, r, &page.Lpa{}) + err := UploadEvidenceSSE(documentStore, 4*time.Millisecond, 2*time.Millisecond, nil)(testAppData, w, r, &page.Lpa{}) resp := w.Result() bodyBytes, _ := io.ReadAll(resp.Body) @@ -88,7 +90,9 @@ func TestUploadEvidenceSSEOnDonorStoreErrorWhenRefreshingDocuments(t *testing.T) }, expectedError). Once() - err := UploadEvidenceSSE(documentStore, 4*time.Millisecond, 2*time.Millisecond)(testAppData, w, r, &page.Lpa{}) + now := time.Now() + + err := UploadEvidenceSSE(documentStore, 4*time.Millisecond, 2*time.Millisecond, func() time.Time { return now })(testAppData, w, r, &page.Lpa{}) resp := w.Result() bodyBytes, _ := io.ReadAll(resp.Body) diff --git a/internal/page/donor/your_address.go b/internal/page/donor/your_address.go index feef28c2e1..d271e9acbe 100644 --- a/internal/page/donor/your_address.go +++ b/internal/page/donor/your_address.go @@ -11,10 +11,13 @@ import ( func YourAddress(logger Logger, tmpl template.Template, addressClient AddressClient, donorStore DonorStore) Handler { return func(appData page.AppData, w http.ResponseWriter, r *http.Request, lpa *page.Lpa) error { - data := &chooseAddressData{ - App: appData, - Form: &form.AddressForm{}, - } + data := newChooseAddressData( + appData, + "", + "", + "", + false, + ) if lpa.Donor.Address.Line1 != "" { data.Form.Action = "manual" diff --git a/internal/page/donor/your_address_test.go b/internal/page/donor/your_address_test.go index 3948accd56..f8d27cdccf 100644 --- a/internal/page/donor/your_address_test.go +++ b/internal/page/donor/your_address_test.go @@ -23,8 +23,9 @@ func TestGetYourAddress(t *testing.T) { template := newMockTemplate(t) template. On("Execute", w, &chooseAddressData{ - App: testAppData, - Form: &form.AddressForm{}, + App: testAppData, + Form: &form.AddressForm{}, + TitleKeys: testTitleKeys, }). Return(nil) @@ -49,6 +50,7 @@ func TestGetYourAddressFromStore(t *testing.T) { Action: "manual", Address: &address, }, + TitleKeys: testTitleKeys, }). Return(nil) @@ -75,6 +77,7 @@ func TestGetYourAddressManual(t *testing.T) { Action: "manual", Address: &place.Address{}, }, + TitleKeys: testTitleKeys, }). Return(nil) @@ -92,8 +95,9 @@ func TestGetYourAddressWhenTemplateErrors(t *testing.T) { template := newMockTemplate(t) template. On("Execute", w, &chooseAddressData{ - App: testAppData, - Form: &form.AddressForm{}, + App: testAppData, + Form: &form.AddressForm{}, + TitleKeys: testTitleKeys, }). Return(expectedError) @@ -273,7 +277,8 @@ func TestPostYourAddressManualWhenValidationError(t *testing.T) { Country: "GB", }, }, - Errors: validation.With("address-line-1", validation.EnterError{Label: "addressLine1OfYourAddress"}), + Errors: validation.With("address-line-1", validation.EnterError{Label: "addressLine1OfYourAddress"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -311,6 +316,7 @@ func TestPostYourAddressSelect(t *testing.T) { LookupPostcode: "NG1", Address: expectedAddress, }, + TitleKeys: testTitleKeys, }). Return(nil) @@ -350,6 +356,7 @@ func TestPostYourAddressSelectWhenValidationError(t *testing.T) { }, Addresses: addresses, Errors: validation.With("select-address", validation.SelectError{Label: "yourAddressFromTheList"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -388,6 +395,7 @@ func TestPostYourAddressLookup(t *testing.T) { LookupPostcode: "NG1", }, Addresses: addresses, + TitleKeys: testTitleKeys, }). Return(nil) @@ -427,6 +435,7 @@ func TestPostYourAddressLookupError(t *testing.T) { }, Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "couldNotLookupPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -471,6 +480,7 @@ func TestPostYourAddressInvalidPostcodeError(t *testing.T) { }, Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.EnterError{Label: "invalidPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -509,6 +519,7 @@ func TestPostYourAddressValidPostcodeNoAddresses(t *testing.T) { }, Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "noYourAddressesFound"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -535,7 +546,8 @@ func TestPostYourAddressLookupWhenValidationError(t *testing.T) { Form: &form.AddressForm{ Action: "postcode", }, - Errors: validation.With("lookup-postcode", validation.EnterError{Label: "yourPostcode"}), + Errors: validation.With("lookup-postcode", validation.EnterError{Label: "yourPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) diff --git a/internal/page/donor/your_independent_witness_address.go b/internal/page/donor/your_independent_witness_address.go index 9344325f75..1d8795c161 100644 --- a/internal/page/donor/your_independent_witness_address.go +++ b/internal/page/donor/your_independent_witness_address.go @@ -12,12 +12,13 @@ import ( func YourIndependentWitnessAddress(logger Logger, tmpl template.Template, addressClient AddressClient, donorStore DonorStore) Handler { return func(appData page.AppData, w http.ResponseWriter, r *http.Request, lpa *page.Lpa) error { - data := &chooseAddressData{ - App: appData, - ActorLabel: "independentWitness", - FullName: lpa.IndependentWitness.FullName(), - Form: &form.AddressForm{}, - } + data := newChooseAddressData( + appData, + "independentWitness", + lpa.IndependentWitness.FullName(), + "", + false, + ) if lpa.IndependentWitness.Address.Line1 != "" { data.Form.Action = "manual" diff --git a/internal/page/donor/your_independent_witness_address_test.go b/internal/page/donor/your_independent_witness_address_test.go index 278f2e475e..08d41cdc8d 100644 --- a/internal/page/donor/your_independent_witness_address_test.go +++ b/internal/page/donor/your_independent_witness_address_test.go @@ -27,6 +27,7 @@ func TestGetYourIndependentWitnessAddress(t *testing.T) { ActorLabel: "independentWitness", FullName: "John Smith", Form: &form.AddressForm{}, + TitleKeys: testTitleKeys, }). Return(nil) @@ -58,6 +59,7 @@ func TestGetYourIndependentWitnessAddressFromStore(t *testing.T) { Action: "manual", Address: &address, }, + TitleKeys: testTitleKeys, }). Return(nil) @@ -86,6 +88,7 @@ func TestGetYourIndependentWitnessAddressManual(t *testing.T) { Action: "manual", Address: &place.Address{}, }, + TitleKeys: testTitleKeys, }). Return(nil) @@ -107,6 +110,7 @@ func TestGetYourIndependentWitnessAddressWhenTemplateErrors(t *testing.T) { ActorLabel: "independentWitness", FullName: " ", Form: &form.AddressForm{}, + TitleKeys: testTitleKeys, }). Return(expectedError) @@ -247,7 +251,8 @@ func TestPostYourIndependentWitnessAddressManualWhenValidationError(t *testing.T Country: "GB", }, }, - Errors: validation.With("address-line-1", validation.EnterError{Label: "addressLine1"}), + Errors: validation.With("address-line-1", validation.EnterError{Label: "addressLine1"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -287,6 +292,7 @@ func TestPostYourIndependentWitnessAddressSelect(t *testing.T) { LookupPostcode: "NG1", Address: expectedAddress, }, + TitleKeys: testTitleKeys, }). Return(nil) @@ -328,6 +334,7 @@ func TestPostYourIndependentWitnessAddressSelectWhenValidationError(t *testing.T }, Addresses: addresses, Errors: validation.With("select-address", validation.SelectError{Label: "anAddressFromTheList"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -368,6 +375,7 @@ func TestPostYourIndependentWitnessAddressLookup(t *testing.T) { LookupPostcode: "NG1", }, Addresses: addresses, + TitleKeys: testTitleKeys, }). Return(nil) @@ -409,6 +417,7 @@ func TestPostYourIndependentWitnessAddressLookupError(t *testing.T) { }, Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "couldNotLookupPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -455,6 +464,7 @@ func TestPostYourIndependentWitnessAddressInvalidPostcodeError(t *testing.T) { }, Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.EnterError{Label: "invalidPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -495,6 +505,7 @@ func TestPostYourIndependentWitnessAddressValidPostcodeNoAddresses(t *testing.T) }, Addresses: []place.Address{}, Errors: validation.With("lookup-postcode", validation.CustomError{Label: "noAddressesFound"}), + TitleKeys: testTitleKeys, }). Return(nil) @@ -523,7 +534,8 @@ func TestPostYourIndependentWitnessAddressLookupWhenValidationError(t *testing.T Form: &form.AddressForm{ Action: "postcode", }, - Errors: validation.With("lookup-postcode", validation.EnterError{Label: "aPostcode"}), + Errors: validation.With("lookup-postcode", validation.EnterError{Label: "aPostcode"}), + TitleKeys: testTitleKeys, }). Return(nil) diff --git a/internal/page/fixtures/fixtures.go b/internal/page/fixtures/fixtures.go index c3e300f693..98d249812c 100644 --- a/internal/page/fixtures/fixtures.go +++ b/internal/page/fixtures/fixtures.go @@ -115,7 +115,7 @@ func makeCertificateProvider() actor.CertificateProvider { Email: testEmail, Mobile: testMobile, Relationship: actor.Personally, - RelationshipLength: "gte-2-years", + RelationshipLength: actor.GreaterThanEqualToTwoYears, CarryOutBy: actor.Online, Address: place.Address{ Line1: "5 RICHMOND PLACE", diff --git a/lang/cy.json b/lang/cy.json index c5dc3aaebc..d15ce9799f 100644 --- a/lang/cy.json +++ b/lang/cy.json @@ -269,6 +269,7 @@ "donor": "Rhoddwr", "name": "Enw", "address": "Cyfeiriad", + "workAddress": "Welsh", "certificateProvider": "Darparwr tystysgrif", "certificateProviderMobile": "Welsh", "attorneys": "Atwrneiod", @@ -611,8 +612,11 @@ "useAnAddressYouAlreadyEntered": "Defnyddiwch gyfeiriad rydych chi eisoes wedi’i roi", "enterNewAddress": "Rhowch gyfeiriad newydd", "whatIsPersonsPostcode": "Beth yw cod post {{.FullNamePossessive}}?", + "whatIsPersonsWorkPostcode": "Welsh {{.FullNamePossessive}} Welsh", "selectAnAddressForPerson": "Dewiswch gyfeiriad ar gyfer {{.FullName}}", + "selectPersonsWorkAddress": "Welsh {{.FullNamePossessive}} Welsh", "personsAddress": "Cyfeiriad {{.FullName}}", + "personsWorkAddress": "{{.FullNamePossessive}} Welsh", "personToNotify": "Welsh", "thisIsAnImportantDecision": "Welsh", "lifeSustainingTreatmentContent": "

Welsh

Welsh

Welsh

", diff --git a/lang/en.json b/lang/en.json index ebef8af383..f4ddd0811f 100644 --- a/lang/en.json +++ b/lang/en.json @@ -250,6 +250,7 @@ "donor": "Donor", "name": "Name", "address": "Address", + "workAddress": "Work address", "certificateProvider": "Certificate provider", "certificateProviderMobile": "certificate provider mobile", "attorneys": "Attorneys", @@ -561,8 +562,11 @@ "useAnAddressYouAlreadyEntered": "Use an address you’ve already entered", "enterNewAddress": "Enter a new address", "whatIsPersonsPostcode": "What is {{.FullNamePossessive}} postcode?", + "whatIsPersonsWorkPostcode": "What is {{.FullNamePossessive}} work postcode?", "selectAnAddressForPerson": "Select an address for {{.FullName}}", + "selectPersonsWorkAddress": "Select {{.FullNamePossessive}} work address", "personsAddress": "{{.FullNamePossessive}} address", + "personsWorkAddress": "{{.FullNamePossessive}} work address", "personToNotify": "Person to notify", "thisIsAnImportantDecision": "This is an important decision and should be thought about carefully.", "lifeSustainingTreatmentContent": "

You must choose whether your attorneys can give or refuse consent to life-sustaining treatment on your behalf.

Life-sustaining treatment means care, surgery, medicine or other help from doctors that’s needed to keep you alive.

Decisions about life-sustaining treatment can be needed in unexpected circumstances, such as a routine operation that did not go as planned

", diff --git a/web/template/choose_address.gohtml b/web/template/choose_address.gohtml index a2bad730b4..c0003f617d 100644 --- a/web/template/choose_address.gohtml +++ b/web/template/choose_address.gohtml @@ -2,15 +2,15 @@ {{ define "pageTitle" }} {{ if eq .Form.Action "manual" }} - {{ trFormat .App "personsAddress" "FullNamePossessive" (tr .App .ActorLabel | possessive .App) "FullName" (tr .App .ActorLabel) }} + {{ trFormat .App .TitleKeys.Manual "FullNamePossessive" (tr .App .ActorLabel | possessive .App) "FullName" (tr .App .ActorLabel) }} {{ else if eq .Form.Action "postcode-select" "postcode-lookup" }} - {{ trFormat .App "selectAnAddressForPerson" "FullName" (tr .App .ActorLabel | lowerFirst) }} + {{ trFormat .App .TitleKeys.PostcodeSelectAndPostcodeLookup "FullNamePossessive" (tr .App .ActorLabel | possessive .App | lowerFirst) "FullName" (tr .App .ActorLabel | lowerFirst) }} {{ else if eq .Form.Action "postcode" }} - {{ trFormat .App "whatIsPersonsPostcode" "FullNamePossessive" (tr .App .ActorLabel | possessive .App | lowerFirst) }} + {{ trFormat .App .TitleKeys.Postcode "FullNamePossessive" (tr .App .ActorLabel | possessive .App | lowerFirst) }} {{ else if eq .Form.Action "reuse" "reuse-select" }} - {{ trFormat .App "selectAnAddressForPerson" "FullName" (tr .App .ActorLabel | lowerFirst) }} + {{ trFormat .App .TitleKeys.ReuseAndReuseSelect "FullName" (tr .App .ActorLabel | lowerFirst) }} {{ else }} - {{ trFormat .App "addPersonsAddress" "FullNamePossessive" (tr .App .ActorLabel | possessive .App | lowerFirst) }} + {{ trFormat .App .TitleKeys.ReuseOrNew "FullNamePossessive" (tr .App .ActorLabel | possessive .App | lowerFirst) }} {{ end }} {{ end }} @@ -23,7 +23,7 @@

{{ if .FullName }} - {{ trFormat .App "personsAddress" "FullNamePossessive" (possessive .App .FullName) "FullName" .FullName }} + {{ trFormat .App .TitleKeys.Manual "FullNamePossessive" (possessive .App .FullName) "FullName" .FullName }} {{ else }} {{ template "pageTitle" . }} {{ end }} @@ -55,7 +55,7 @@

{{ if .FullName }} - {{ trFormat .App "selectAnAddressForPerson" "FullName" .FullName }} + {{ trFormat .App .TitleKeys.PostcodeSelectAndPostcodeLookup "FullNamePossessive" (possessive .App .FullName) "FullName" .FullName }} {{ else }} {{ template "pageTitle" . }} {{ end }} @@ -66,7 +66,7 @@ {{ tr .App "selectAnAddress" }} {{ template "error-message" (errorMessage . "select-address") }} - + @@ -142,7 +142,7 @@

{{ if .FullName }} - {{ trFormat .App "selectAnAddressForPerson" "FullName" .FullName }} + {{ trFormat .App .TitleKeys.ReuseAndReuseSelect "FullName" .FullName }} {{ else }} {{ template "pageTitle" . }} {{ end }} @@ -165,25 +165,25 @@ {{ template "save-and-return-buttons" . }} - + {{ else }}

{{ if .FullName }} - {{ trFormat .App "addPersonsAddress" "FullNamePossessive" (possessive .App .FullName) }} + {{ trFormat .App .TitleKeys.ReuseOrNew "FullNamePossessive" (possessive .App .FullName) }} {{ else }} {{ template "pageTitle" . }} {{ end }}

{{ template "error-message" (errorMessage . "action") }} - + {{ template "radios" (items . "action" .Form.Action (item "reuse" "useAnAddressYouAlreadyEntered") (item "postcode" "enterNewAddress") - ) }} + ) }}
diff --git a/web/template/how_long_have_you_known_certificate_provider.gohtml b/web/template/how_long_have_you_known_certificate_provider.gohtml index 71d3b11b35..e8e5c4741b 100644 --- a/web/template/how_long_have_you_known_certificate_provider.gohtml +++ b/web/template/how_long_have_you_known_certificate_provider.gohtml @@ -6,7 +6,7 @@
-
+

@@ -14,11 +14,11 @@

- {{ template "error-message" (errorMessage . "how-long") }} + {{ template "error-message" (errorMessage . "relationship-length") }} - {{ template "radios" (items . "how-long" .HowLong - (item "gte-2-years" "twoYearsOrMore") - (item "lt-2-years" "lessThanTwoYears") + {{ template "radios" (items . "relationship-length" .RelationshipLength.String + (item .Options.GreaterThanEqualToTwoYears.String "twoYearsOrMore") + (item .Options.LessThanTwoYears.String "lessThanTwoYears") ) }}
diff --git a/web/template/layout/certificate-provider-details.gohtml b/web/template/layout/certificate-provider-details.gohtml index b2b4b96834..b0300f11a2 100644 --- a/web/template/layout/certificate-provider-details.gohtml +++ b/web/template/layout/certificate-provider-details.gohtml @@ -3,7 +3,7 @@ {{ $detailsLink := printf "%s?from=%s" (link .App (.App.Paths.CertificateProviderDetails.Format .App.LpaID)) .App.Page }} {{ $carryOutByLink := printf "%s?from=%s" (link .App (.App.Paths.HowWouldCertificateProviderPreferToCarryOutTheirRole.Format .App.LpaID)) .App.Page }} {{ $addressLink := printf "%s?from=%s" (link .App (.App.Paths.CertificateProviderAddress.Format .App.LpaID)) .App.Page }} - +

{{ .Lpa.CertificateProvider.FullName }}

@@ -61,7 +61,7 @@ {{ end }}
-
{{ tr .App "address" }}
+
{{ if .Lpa.CertificateProvider.Relationship.IsProfessionally }} {{ tr .App "workAddress" }} {{ else }} {{ tr .App "address" }} {{ end }}
{{ template "address-lines" .Lpa.CertificateProvider.Address }}
{{ if $canChange }}