Skip to content

Commit

Permalink
Merge pull request #1703 from ministryofjustice/MLPAB-2727-more-evide…
Browse files Browse the repository at this point in the history
…nce-required-banner

MLPAB-2727: Add more evidence required banner
  • Loading branch information
acsauk authored Jan 8, 2025
2 parents 7079b63 + 3ee6e6a commit d888f9f
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ emit-reduced-fee-declined: ##@events emits a reduced-fee-declined event with the
--payload '{"Records": [{"messageId": "19dd0b57-b21e-4ac1-bd88-01bbb068cb78", "body": "$(BODY)"}]}'


emit-more-evidence-required: ##@events emits a more-evidence-required event with the given LpaUID e.g. emit-more-evidence-required uid=abc-123
$(eval BODY := $(shell echo '{"version":"0","id":"63eb7e5f-1f10-4744-bba9-e16d327c3b98","detail-type":"more-evidence-required","source":"opg.poas.sirius","account":"653761790766","time":"2023-08-30T13:40:30Z","region":"eu-west-1","resources":[],"detail":{"UID":"$(uid)"}}' | sed 's/"/\\"/g'))
emit-further-info-requested: ##@events emits a further-info-requested event with the given LpaUID e.g. emit-further-info-requested uid=abc-123
$(eval BODY := $(shell echo '{"version":"0","id":"63eb7e5f-1f10-4744-bba9-e16d327c3b98","detail-type":"further-info-requested","source":"opg.poas.sirius","account":"653761790766","time":"2023-08-30T13:40:30Z","region":"eu-west-1","resources":[],"detail":{"UID":"$(uid)"}}' | sed 's/"/\\"/g'))

docker compose -f docker/docker-compose.yml exec localstack awslocal lambda invoke \
--endpoint-url=http://localhost:4566 \
Expand Down
1 change: 1 addition & 0 deletions cmd/event-received/sirius_event_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ func handleFurtherInfoRequested(ctx context.Context, client dynamodbClient, even
}

donor.Tasks.PayForLpa = task.PaymentStateMoreEvidenceRequired
donor.MoreEvidenceRequiredAt = now()

if err := putDonor(ctx, donor, now, client); err != nil {
return fmt.Errorf("failed to update LPA task status: %w", err)
Expand Down
16 changes: 14 additions & 2 deletions cmd/event-received/sirius_event_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,13 @@ func TestHandleFurtherInfoRequested(t *testing.T) {
Detail: json.RawMessage(`{"uid":"M-1111-2222-3333"}`),
}

updated := &donordata.Provided{PK: dynamo.LpaKey("123"), SK: dynamo.LpaOwnerKey(dynamo.DonorKey("456")), Tasks: donordata.Tasks{PayForLpa: task.PaymentStateMoreEvidenceRequired}, UpdatedAt: testNow}
updated := &donordata.Provided{
PK: dynamo.LpaKey("123"),
SK: dynamo.LpaOwnerKey(dynamo.DonorKey("456")),
Tasks: donordata.Tasks{PayForLpa: task.PaymentStateMoreEvidenceRequired},
UpdatedAt: testNow,
MoreEvidenceRequiredAt: testNow,
}
updated.UpdateHash()

client := newMockDynamodbClient(t)
Expand Down Expand Up @@ -744,7 +750,13 @@ func TestHandleFurtherInfoRequestedWhenPutError(t *testing.T) {
Detail: json.RawMessage(`{"uid":"M-1111-2222-3333"}`),
}

updated := &donordata.Provided{PK: dynamo.LpaKey("123"), SK: dynamo.LpaOwnerKey(dynamo.DonorKey("456")), Tasks: donordata.Tasks{PayForLpa: task.PaymentStateMoreEvidenceRequired}, UpdatedAt: testNow}
updated := &donordata.Provided{
PK: dynamo.LpaKey("123"),
SK: dynamo.LpaOwnerKey(dynamo.DonorKey("456")),
Tasks: donordata.Tasks{PayForLpa: task.PaymentStateMoreEvidenceRequired},
UpdatedAt: testNow,
MoreEvidenceRequiredAt: testNow,
}
updated.UpdateHash()

client := newMockDynamodbClient(t)
Expand Down
12 changes: 12 additions & 0 deletions cypress/e2e/donor/progress.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,16 @@ describe('Progress', () => {
cy.contains('1 notification from OPG');
cy.contains('You’ve submitted your LPA to the Office of the Public Guardian');
});

it('shows a notification when more evidence is required', () => {
cy.visit('/fixtures?redirect=/progress&progress=signTheLpa&paymentTaskProgress=MoreEvidenceRequired');
cy.checkA11yApp();
cy.contains('Important:')
cy.contains('2 notifications from OPG');

cy.contains('You’ve submitted your LPA to the Office of the Public Guardian');

cy.contains('We need some more evidence to make a decision about your LPA fee');
cy.contains('We contacted you on 2 April 2023 at 3:04am with guidance about what to do next.');
});
});
5 changes: 4 additions & 1 deletion internal/donor/donordata/provided.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ type Provided struct {
// VoucherInvitedAt records when the invite is sent to the voucher to vouch.
VoucherInvitedAt time.Time `checkhash:"-"`

// MoreEvidenceRequiredAt records when a request for further information on an exemption/remission was received.
MoreEvidenceRequiredAt time.Time `checkhash:"-"`

HasSentApplicationUpdatedEvent bool `hash:"-" checkhash:"-"`
}

Expand Down Expand Up @@ -237,7 +240,7 @@ func (p *Provided) CheckedHashChanged() bool {
return hash != p.CheckedHash
}

// UpdatedCheckedHash will generate a value that can be compared to check if any
// UpdateCheckedHash will generate a value that can be compared to check if any
// fields containing LPA data have changed. Fields that do not contain LPA data,
// so should be ignored for this calculation, are tagged with `checkhash:"-"`.
func (p *Provided) UpdateCheckedHash() (err error) {
Expand Down
4 changes: 2 additions & 2 deletions internal/donor/donordata/provided_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ func TestGenerateHash(t *testing.T) {
}

// DO change this value to match the updates
const modified uint64 = 0x88bad809bb9c1575
const modified uint64 = 0xef6373725eb03255

// DO NOT change these initial hash values. If a field has been added/removed
// you will need to handle the version gracefully by modifying
// (*Provided).HashInclude and adding another testcase for the new
// version.
testcases := map[uint8]uint64{
0: 0xb23345a21655d556,
0: 0xfed6c63ddcd6312f,
}

for version, initial := range testcases {
Expand Down
12 changes: 12 additions & 0 deletions internal/donor/donorpage/progress.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,18 @@ func Progress(tmpl template.Template, lpaStoreResolvingService LpaStoreResolving
}
}

if donor.Tasks.PayForLpa.IsMoreEvidenceRequired() {
body := appData.Localizer.Format(
"weContactedYouOnWithGuidanceAboutWhatToDoNext",
map[string]any{"MoreEvidenceRequiredAt": appData.Localizer.FormatDateTime(donor.MoreEvidenceRequiredAt)},
)

data.InfoNotifications = append(data.InfoNotifications, progressNotification{
Heading: "weNeedMoreEvidenceToMakeADecisionAboutYourLPAFee",
Body: body,
})
}

return tmpl(w, data)
}
}
33 changes: 33 additions & 0 deletions internal/donor/donorpage/progress_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func TestGetProgress(t *testing.T) {
setupCertificateProviderStore func(*mockCertificateProviderStore_GetAny_Call)
lpa *lpadata.Lpa
infoNotifications []progressNotification
setupLocalizer func() *mockLocalizer
}{
"none": {
donor: &donordata.Provided{LpaUID: "lpa-uid"},
Expand Down Expand Up @@ -101,6 +102,34 @@ func TestGetProgress(t *testing.T) {
},
},
},
"more evidence required": {
donor: &donordata.Provided{
Tasks: donordata.Tasks{PayForLpa: task.PaymentStateMoreEvidenceRequired},
MoreEvidenceRequiredAt: testNow,
},
lpa: &lpadata.Lpa{LpaUID: "lpa-uid"},
infoNotifications: []progressNotification{
{
Heading: "weNeedMoreEvidenceToMakeADecisionAboutYourLPAFee",
Body: "translated body",
},
},
setupLocalizer: func() *mockLocalizer {
l := newMockLocalizer(t)
l.EXPECT().
Format(
"weContactedYouOnWithGuidanceAboutWhatToDoNext",
map[string]any{"MoreEvidenceRequiredAt": "translated date time"},
).
Return("translated body")

l.EXPECT().
FormatDateTime(testNow).
Return("translated date time")

return l
},
},
}

for name, tc := range testCases {
Expand All @@ -123,6 +152,10 @@ func TestGetProgress(t *testing.T) {
tc.setupCertificateProviderStore(certificateProviderStore.EXPECT().GetAny(r.Context()))
}

if tc.setupLocalizer != nil {
testAppData.Localizer = tc.setupLocalizer()
}

template := newMockTemplate(t)
template.EXPECT().
Execute(w, &progressData{
Expand Down
4 changes: 4 additions & 0 deletions internal/page/fixtures/donor.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,10 @@ func updateLPAProgress(

donorDetails.EvidenceDelivery = pay.Upload
donorDetails.Tasks.PayForLpa = taskState

if taskState.IsMoreEvidenceRequired() {
donorDetails.MoreEvidenceRequiredAt = testNow
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions internal/page/fixtures/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"net/http"
"strings"
"time"

"github.com/ministryofjustice/opg-modernising-lpa/internal/actor"
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid"
Expand Down Expand Up @@ -86,6 +87,7 @@ var (
Firstnames: "Simone",
Lastname: "Sutherland",
}
testNow = time.Date(2023, time.April, 2, 3, 4, 5, 6, time.UTC)
)

func makeAttorney(name Name) donordata.Attorney {
Expand Down
4 changes: 3 additions & 1 deletion lang/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1506,5 +1506,7 @@
"youveSubmittedYourLpaToOpg": "Welsh",
"opgIsCheckingYourLpa": "Welsh",
"weHaveSentAnEmailYouProvidedCertificate": "<p class=\"govuk-body\">Welsh {{.CertificateProviderEmail}}</p>",
"certificateProviderNowConfirmYourIdentityContent": "<h2 class=\"govuk-heading-m\">Welsh {{.DonorFullName}} {{.DonorFirstNames}} {{.Deadline}}</h2>"
"certificateProviderNowConfirmYourIdentityContent": "<h2 class=\"govuk-heading-m\">Welsh {{.DonorFullName}} {{.DonorFirstNames}} {{.Deadline}}</h2>",
"weNeedMoreEvidenceToMakeADecisionAboutYourLPAFee": "Welsh",
"weContactedYouOnWithGuidanceAboutWhatToDoNext": "Welsh {{.MoreEvidenceRequiredAt}} Welsh"
}
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1402,5 +1402,7 @@
"youveSubmittedYourLpaToOpg": "You’ve submitted your LPA to the Office of the Public Guardian (OPG)",
"opgIsCheckingYourLpa": "OPG is checking your LPA. We will contact you if there is anything you need to do.",
"weHaveSentAnEmailYouProvidedCertificate": "<p class=\"govuk-body\">We have sent an email confirming that you provided your certificate for this LPA to <span class=\"govuk-!-font-weight-bold\">{{.CertificateProviderEmail}}</span>.</p><p class=\"govuk-body\">If you would like a paper record, you can also print a copy of this page.</p>",
"certificateProviderNowConfirmYourIdentityContent": "<h2 class=\"govuk-heading-m\">Confirm your identity</h2><p class=\"govuk-body\">Your role as {{possessive .DonorFullName}} certificate provider will not be finalized until you confirm your identity.</p><ol class=\"govuk-list govuk-list--number\"><li>Visit the Post Office to confirm your identity. When you have done so, you’ll get an email from the Post Office and GOV.UK One Login will be updated.</li><li>Log back into your LPA account. Select ‘Confirm identity’ from the task list and follow the prompts to return to GOV.UK One Login.</li><li>Your GOV.UK One Login identity confirmation will then be connected to your LPA account.</li></ol><div class=\"govuk-inset-text\"><p class=\"govuk-body\">Now that you have provided the certificate for this LPA, you must confirm your identity and connect it to your LPA account by:</p><p class=\"govuk-body govuk-!-font-weight-bold\">{{.Deadline}}</p></div><h2 class=\"govuk-heading-m\">When you have confirmed your identity</h2><p class=\"govuk-body\">When you have confirmed your identity, you will no longer be able to view or access this LPA from your dashboard.</p><p class=\"govuk-body\">If the Office of the Public Guardian ever has any concerns about {{possessive .DonorFirstNames}} LPA in future, we may contact you.</p><p class=\"govuk-body\">If you ever need to report a concern, you can do this at any time using the <a href=\"#\" class=\"govuk-link\">report a concern about an LPA service</a>.</p>"
"certificateProviderNowConfirmYourIdentityContent": "<h2 class=\"govuk-heading-m\">Confirm your identity</h2><p class=\"govuk-body\">Your role as {{possessive .DonorFullName}} certificate provider will not be finalized until you confirm your identity.</p><ol class=\"govuk-list govuk-list--number\"><li>Visit the Post Office to confirm your identity. When you have done so, you’ll get an email from the Post Office and GOV.UK One Login will be updated.</li><li>Log back into your LPA account. Select ‘Confirm identity’ from the task list and follow the prompts to return to GOV.UK One Login.</li><li>Your GOV.UK One Login identity confirmation will then be connected to your LPA account.</li></ol><div class=\"govuk-inset-text\"><p class=\"govuk-body\">Now that you have provided the certificate for this LPA, you must confirm your identity and connect it to your LPA account by:</p><p class=\"govuk-body govuk-!-font-weight-bold\">{{.Deadline}}</p></div><h2 class=\"govuk-heading-m\">When you have confirmed your identity</h2><p class=\"govuk-body\">When you have confirmed your identity, you will no longer be able to view or access this LPA from your dashboard.</p><p class=\"govuk-body\">If the Office of the Public Guardian ever has any concerns about {{possessive .DonorFirstNames}} LPA in future, we may contact you.</p><p class=\"govuk-body\">If you ever need to report a concern, you can do this at any time using the <a href=\"#\" class=\"govuk-link\">report a concern about an LPA service</a>.</p>",
"weNeedMoreEvidenceToMakeADecisionAboutYourLPAFee": "We need some more evidence to make a decision about your LPA fee",
"weContactedYouOnWithGuidanceAboutWhatToDoNext": "We contacted you on {{.MoreEvidenceRequiredAt}} with guidance about what to do next."
}

0 comments on commit d888f9f

Please sign in to comment.