Skip to content

Commit

Permalink
Merge pull request #1544 from ministryofjustice/MLPAB-2218-what-happe…
Browse files Browse the repository at this point in the history
…ns-next-exemption

MLPAB-2218 Vary end content after exemption/repeat application
  • Loading branch information
hawx authored Oct 10, 2024
2 parents 4bddaa9 + 5980cb5 commit a24f837
Show file tree
Hide file tree
Showing 6 changed files with 166 additions and 9 deletions.
2 changes: 2 additions & 0 deletions internal/donor/donorpage/payment_confirmation.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ func PaymentConfirmation(logger Logger, tmpl template.Template, payClient PayCli
nextPage = donor.PathEvidenceSuccessfullyUploaded
} else if provided.EvidenceDelivery.IsPost() {
nextPage = donor.PathWhatHappensNextPostEvidence
} else if provided.FeeType.IsRepeatApplicationFee() {
nextPage = donor.PathEvidenceSuccessfullyUploaded
}

switch provided.Tasks.PayForLpa {
Expand Down
101 changes: 101 additions & 0 deletions internal/donor/donorpage/payment_confirmation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,107 @@ func TestGetPaymentConfirmationHalfFee(t *testing.T) {
assert.Equal(t, http.StatusOK, resp.StatusCode)
}

func TestGetPaymentConfirmationRepeatApplicationFee(t *testing.T) {
testcases := map[string]struct {
evidenceDelivery pay.EvidenceDelivery
nextPage donor.Path
}{
"empty": {
nextPage: donor.PathEvidenceSuccessfullyUploaded,
},
"upload": {
evidenceDelivery: pay.Upload,
nextPage: donor.PathEvidenceSuccessfullyUploaded,
},
"post": {
evidenceDelivery: pay.Post,
nextPage: donor.PathWhatHappensNextPostEvidence,
},
}

for name, tc := range testcases {
t.Run(name, func(t *testing.T) {
w := httptest.NewRecorder()
r, _ := http.NewRequest(http.MethodGet, "/payment-confirmation", nil)

payClient := newMockPayClient(t).
withASuccessfulPayment(8200, r.Context())

localizer := newMockLocalizer(t).
withEmailLocalizations()

testAppData.Localizer = localizer

template := newMockTemplate(t)
template.EXPECT().
Execute(w, &paymentConfirmationData{
App: testAppData,
PaymentReference: "123456789012",
FeeType: pay.RepeatApplicationFee,
NextPage: tc.nextPage,
EvidenceDelivery: tc.evidenceDelivery,
}).
Return(nil)

sessionStore := newMockSessionStore(t).
withPaySession(r).
withExpiredPaySession(r, w)

donorStore := newMockDonorStore(t)
donorStore.EXPECT().
Put(r.Context(), &donordata.Provided{
Type: lpadata.LpaTypePersonalWelfare,
Donor: donordata.Donor{FirstNames: "a", LastName: "b"},
LpaUID: "lpa-uid",
FeeType: pay.RepeatApplicationFee,
EvidenceDelivery: tc.evidenceDelivery,
CertificateProvider: donordata.CertificateProvider{
Email: "[email protected]",
},
PaymentDetails: []donordata.Payment{{
PaymentId: "abc123",
PaymentReference: "123456789012",
Amount: 8200,
}},
Tasks: donordata.Tasks{
PayForLpa: task.PaymentStatePending,
},
}).
Return(nil)

eventClient := newMockEventClient(t)
eventClient.EXPECT().
SendPaymentReceived(r.Context(), event.PaymentReceived{
UID: "lpa-uid",
PaymentID: "abc123",
Amount: 8200,
}).
Return(nil)

notifyClient := newMockNotifyClient(t).
withEmailPersonalizations(r.Context(), "£82")

err := PaymentConfirmation(newMockLogger(t), template.Execute, payClient, donorStore, sessionStore, nil, nil, eventClient, notifyClient)(testAppData, w, r, &donordata.Provided{
LpaUID: "lpa-uid",
FeeType: pay.RepeatApplicationFee,
EvidenceDelivery: tc.evidenceDelivery,
CertificateProvider: donordata.CertificateProvider{
Email: "[email protected]",
},
Tasks: donordata.Tasks{
PayForLpa: task.PaymentStateInProgress,
},
Donor: donordata.Donor{FirstNames: "a", LastName: "b"},
Type: lpadata.LpaTypePersonalWelfare,
})
resp := w.Result()

assert.Nil(t, err)
assert.Equal(t, http.StatusOK, resp.StatusCode)
})
}
}

func TestGetPaymentConfirmationApprovedOrDenied(t *testing.T) {
for _, taskState := range []task.PaymentState{task.PaymentStateApproved, task.PaymentStateDenied} {
t.Run(taskState.String(), func(t *testing.T) {
Expand Down
13 changes: 10 additions & 3 deletions lang/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -927,9 +927,16 @@
"nothingHardship": "Dim - ni dalais am fy mod wedi cael hepgoriad oherwydd caledi",
"howMuchYouPreviouslyPaid": "y swm wnaethoch dalu o’r blaen",
"evidenceSuccessfullyUploaded": "Mae’r dystiolaeth wedi’i huwchlwytho’n llwyddiannus",
"weWillReviewYourLpaApplicationAndSupportingEvidence": "<p class=\"govuk-body\">Byddwn yn adolygu’ch cais am LPA a’ch tystiolaeth ategol.</p><h2 class=\"govuk-heading-m\">Beth fydd yn digwydd nesaf</h2><h3 class=\"govuk-heading-s\">Llofnodi’ch LPA</h3><p class=\"govuk-body\">Gallwch lofnodi’ch LPA tra byddwn ni yn adolygu’ch cais. Rhaid i’ch darparwr tystysgrif fod yn bresennol fel tyst pan fyddwch yn ei llofnodi.</p><p class=\"govuk-body\">Fodd bynnag, ni fyddwn yn cysylltu â’ch darparwr tystysgrif ynghylch darparu ei dystysgrif nes bydd eich {{.Application}} wedi cael ei gymeradwyo.</p><h3 class=\"govuk-heading-s\">Os bydd eich cais yn llwyddiannus</h3><p class=\"govuk-body\">Unwaith y byddwn wedi cymeradwyo’ch taliad, byddwn yn cysylltu â’ch darparwr tystysgrif er mwyn iddo ddarparu ei dystysgrif.</p><h3 class=\"govuk-heading-s\">Os na fydd eich cais yn llwyddiannus</h3><p class=\"govuk-body\">Byddwn yn cysylltu â chi os bydd arnom angen mwy o wybodaeth neu os nad oedd eich cais yn llwyddiannus.</p>",
"referenceNumberStored": "Welsh",
"weWillReviewYourLpaApplicationAndSupportingEvidence": "Byddwn yn adolygu’ch cais am LPA a’ch tystiolaeth ategol.",
"weWillReviewYourLpaApplication": "Welsh",
"youCanStillSignYourLpa": "<h3 class=\"govuk-heading-s\">Welsh</h3><p class=\"govuk-body\">Welsh</p><p class=\"govuk-body\">Welsh {{ .Application }} Welsh</p>",
"ifYourApplicationIsSuccessful": "<h3 class=\"govuk-heading-s\">Welsh</h3><p class=\"govuk-body\">Welsh</p><h3 class=\"govuk-heading-s\">Welsh</h3><p class=\"govuk-body\">Welsh</p>",
"ifYourApplicationIsSuccessful": "Os bydd eich cais yn llwyddiannus",
"onceWeHaveApprovedYourPayment": "Unwaith y byddwn wedi cymeradwyo’ch taliad, byddwn yn cysylltu â’ch darparwr tystysgrif er mwyn iddo ddarparu ei dystysgrif.",
"onceWeHaveApprovedYourRequest": "Welsh",
"onceWeHaveApprovedYourRepeatApplication": "Welsh",
"ifYourApplicationIsNotSuccessful": "Os na fydd eich cais yn llwyddiannus",
"weWillContactYouIfWeNeedMoreInformation": "Byddwn yn cysylltu â chi os bydd arnom angen mwy o wybodaeth neu os nad oedd eich cais yn llwyddiannus.",
"applicationNoFee": "cais i beidio â thalu ffi",
"applicationHalfFee": "cais i dalu hanner y ffi",
"applicationHardshipFee": "cais oherwydd caledi",
Expand All @@ -941,7 +948,7 @@
"sendUsYourEvidenceByPost": "Anfonwch eich tystiolaeth atom drwy’r post",
"sendUsYourEvidenceByPostContent": "<p class=\"govuk-body\">Gallwch anfon eich tystiolaeth i’n cyfeiriad post:</p><p class=\"govuk-body\">Office of the Public Guardian<br/>PO Box 16185</br>Birmingham</br>B2 2WH</p><p class=\"govuk-body\">Rhaid i’r llythyr gynnwys llythyr eglurhaol sydd â’ch cyfeirnod arno.</p><p class=\"govuk-body\">Os ydych yn gwneud dwy LPA yr un pryd, nid oes angen i chi anfon eich tystiolaeth ddwywaith. Gallwch ei hanfon unwaith a chynnwys cyfeirnodau’r ddwy LPA yn eich llythyr eglurhaol.</p>",
"youMustIncludeYourReferenceNumberWarning": "Rhaid i chi gynnwys eich cyfeirnod fel y gallwn gysylltu’ch tystiolaeth â’ch cais . Byddai peidio â’i ddarparu yn gallu achosi oedi a byddai cyfnod eich cais am LPA yn gallu dod i ben.",
"whatHappensNextPostEvidenceContent": "<p class=\"govuk-body\">Nawr dylech anfon eich tystiolaeth atom drwy’r post. Byddwn yn ei hadolygu ynghyd â’ch cais am LPA.</p><h2 class=\"govuk-heading-m\">Llofnodi’ch LPA</h2><p class=\"govuk-body\"> Gallwch lofnodi’ch LPA tra byddwn ni’n adolygu’ch cais. Rhaid i’ch darparwr tystysgrif fod yn bresennol fel tyst pan fyddwch yn ei llofnodi.</p><p class=\"govuk-body\"> Fodd bynnag, ni fyddwn yn cysylltu â’ch darparwr tystysgrif ynghylch darparu ei dystysgrif nes bydd eich {{.Application}} wedi cael ei gymeradwyo.</p><h2 class=\"govuk-heading-m\"> Os bydd eich cais yn llwyddiannus </h2><p class=\"govuk-body\"> Unwaith y byddwn wedi cymeradwyo’ch taliad, byddwn yn cysylltu â’ch darparwr tystysgrif er mwyn iddo ddarparu ei dystysgrif.</p><h2 class=\"govuk-heading-m\"> Os na fydd eich cais yn llwyddiannus</h2><p class=\"govuk-body\"> Byddwn yn cysylltu â chi os bydd arnom angen mwy o wybodaeth neu os nad oedd eich cais yn llwyddiannus.</p>",
"whatHappensNextPostEvidenceContent": "<p class=\"govuk-body\">Nawr dylech anfon eich tystiolaeth atom drwy’r post. Byddwn yn ei hadolygu ynghyd â’ch cais am LPA.</p><h2 class=\"govuk-heading-m\">Llofnodi’ch LPA</h2><p class=\"govuk-body\"> Gallwch lofnodi’ch LPA tra byddwn ni’n adolygu’ch cais. Rhaid i’ch darparwr tystysgrif fod yn bresennol fel tyst pan fyddwch yn ei llofnodi.</p><p class=\"govuk-body\"> Fodd bynnag, ni fyddwn yn cysylltu â’ch darparwr tystysgrif ynghylch darparu ei dystysgrif nes bydd eich {{.Application}} wedi cael ei gymeradwyo.</p>",
"appealingTheDecision": "Apelio yn erbyn y penderfyniad",
"appealingTheDecisionDetails": "<p class=\"govuk-body\">Os nad oedd eich cais yn llwyddiannus, gallwch apelio o fewn 4 wythnos ar ôl y penderfyniad drwy ysgrifennu at y Pennaeth Gwasanaethau Corfforaethol.</p><p class=\"govuk-body\">Os bydd y penderfyniad gwreiddiol yn cael ei ategu, bydd yn cael ei gyfeirio i sylw’r Gwarcheidwad Cyhoeddus i’w gadarnhau.</p>",
"removeTrustCorporation": "Dileu corfforaeth ymddiriedolaeth",
Expand Down
13 changes: 10 additions & 3 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -874,9 +874,16 @@
"nothingHardship": "Nothing - I paid no fee because I got a hardship fee waiver",
"howMuchYouPreviouslyPaid": "how much you previously paid",
"evidenceSuccessfullyUploaded": "Evidence successfully uploaded",
"weWillReviewYourLpaApplicationAndSupportingEvidence": "<p class=\"govuk-body\">We will review your LPA application and supporting evidence.</p><h2 class=\"govuk-heading-m\">What happens next</h2>",
"referenceNumberStored": "Reference number stored",
"weWillReviewYourLpaApplicationAndSupportingEvidence": "We will review your LPA application and supporting evidence.",
"weWillReviewYourLpaApplication": "We will review your LPA application.",
"youCanStillSignYourLpa": "<h3 class=\"govuk-heading-s\">Sign your LPA</h3><p class=\"govuk-body\">You can still sign your LPA while we’re reviewing your application. Your certificate provider must be there as a witness when you sign it.</p><p class=\"govuk-body\">However, we will not contact your certificate provider to provide their certificate until your {{ .Application }} has been approved.</p>",
"ifYourApplicationIsSuccessful": "<h3 class=\"govuk-heading-s\">If your application is successful</h3><p class=\"govuk-body\">Once we have approved your payment, we will contact your certificate provider to provide their certificate.</p><h3 class=\"govuk-heading-s\">If your application is not successful</h3><p class=\"govuk-body\">We will contact you if we need more information or if your application is unsuccessful.</p>",
"ifYourApplicationIsSuccessful": "If your application is successful",
"onceWeHaveApprovedYourPayment": "Once we have approved your payment, we will contact your certificate provider to provide their certificate.",
"onceWeHaveApprovedYourRequest": "Once we have approved your request, we will contact your certificate provider to provide their certificate.",
"onceWeHaveApprovedYourRepeatApplication": "Once we have approved your repeat application, we will contact your certificate provider to provide their certificate.",
"ifYourApplicationIsNotSuccessful": "If your application is not successful",
"weWillContactYouIfWeNeedMoreInformation": "We will contact you if we need more information or if your application is unsuccessful.",
"applicationNoFee": "application to pay no fee",
"applicationHalfFee": "application to pay a half fee",
"applicationHardshipFee": "hardship application",
Expand All @@ -888,7 +895,7 @@
"sendUsYourEvidenceByPost": "Send us your evidence by post",
"sendUsYourEvidenceByPostContent": "<p class=\"govuk-body\">You can send your evidence to our postal address:</p><p class=\"govuk-body\">Office of the Public Guardian<br/>PO Box 16185</br>Birmingham</br>B2 2WH</p><p class=\"govuk-body\">Your letter must include a cover letter with your reference number on it.</p><p class=\"govuk-body\">If you are making two LPAs at the same time, you do not need to send your evidence twice. You can send it once and include both LPA reference numbers on your cover letter.</p>",
"youMustIncludeYourReferenceNumberWarning": "You must include your reference number so we can link your evidence to your application. Not providing it could cause a delay and your LPA application could expire.",
"whatHappensNextPostEvidenceContent": "<p class=\"govuk-body\">You should now send us your evidence by post. We will review it along with your LPA application.</p><h2 class=\"govuk-heading-m\">Sign your LPA</h2><p class=\"govuk-body\">You can still sign your LPA while we’re reviewing your application. Your certificate provider must be there as a witness when you sign it.</p><p class=\"govuk-body\">However, we will not contact your certificate provider to provide their certificate until your {{.Application}} has been approved.</p><h2 class=\"govuk-heading-m\">If your application is successful</h2><p class=\"govuk-body\">Once we have approved your payment, we will contact your certificate provider to provide their certificate.</p><h2 class=\"govuk-heading-m\">If your application is not successful</h2><p class=\"govuk-body\">We will contact you if we need more information or if your application is unsuccessful.</p>",
"whatHappensNextPostEvidenceContent": "<p class=\"govuk-body\">You should now send us your evidence by post. We will review it along with your LPA application.</p><h2 class=\"govuk-heading-m\">Sign your LPA</h2><p class=\"govuk-body\">You can still sign your LPA while we’re reviewing your application. Your certificate provider must be there as a witness when you sign it.</p><p class=\"govuk-body\">However, we will not contact your certificate provider to provide their certificate until your {{.Application}} has been approved.</p>",
"appealingTheDecision": "Appealing the decision",
"appealingTheDecisionDetails": "<p class=\"govuk-body\">If your application is unsuccessful, you can appeal within 4 weeks of the decision by writing to the Head of Corporate Services.</p><p class=\"govuk-body\">If the original decision is upheld, it will be referred to the Public Guardian for confirmation.</p>",
"removeTrustCorporation": "Remove trust corporation",
Expand Down
32 changes: 29 additions & 3 deletions web/template/donor/evidence_successfully_uploaded.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,42 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<div class="govuk-panel govuk-panel--confirmation">
<h1 class="govuk-panel__title">{{ tr .App "evidenceSuccessfullyUploaded" }}</h1>
<h1 class="govuk-panel__title">
{{ if and .Donor.FeeType.IsRepeatApplicationFee (or .Donor.PreviousFee.IsPreviousFeeFull .Donor.PreviousFee.Empty) }}
{{ tr .App "referenceNumberStored" }}
{{ else }}
{{ tr .App "evidenceSuccessfullyUploaded" }}
{{ end }}
</h1>
</div>

{{ trHtml .App "weWillReviewYourLpaApplicationAndSupportingEvidence" }}
<p class="govuk-body">
{{ if and .Donor.FeeType.IsRepeatApplicationFee (or .Donor.PreviousFee.IsPreviousFeeFull .Donor.PreviousFee.Empty) }}
{{ tr .App "weWillReviewYourLpaApplication" }}
{{ else }}
{{ tr .App "weWillReviewYourLpaApplicationAndSupportingEvidence" }}
{{ end }}
</p>

<h2 class="govuk-heading-m">{{ tr .App "whatHappensNext" }}</h2>

{{ if .Donor.SignedAt.IsZero }}
{{ trFormatHtml .App "youCanStillSignYourLpa" "Application" (printf "application%s" .Donor.FeeType.String | tr .App) }}
{{ end }}

{{ trHtml .App "ifYourApplicationIsSuccessful" }}
<h3 class="govuk-heading-s">{{ tr .App "ifYourApplicationIsSuccessful" }}</h3>
<p class="govuk-body">
{{ if .Donor.FeeType.IsNoFee }}
{{ tr .App "onceWeHaveApprovedYourRequest" }}
{{ else if and .Donor.FeeType.IsRepeatApplicationFee }}
{{ tr .App "onceWeHaveApprovedYourRepeatApplication" }}
{{ else }}
{{ tr .App "onceWeHaveApprovedYourPayment" }}
{{ end }}
</p>

<h3 class="govuk-heading-s">{{ tr .App "ifYourApplicationIsNotSuccessful" }}</h3>
<p class="govuk-body">{{ tr .App "weWillContactYouIfWeNeedMoreInformation" }}</p>

{{ if not .Donor.FeeType.IsRepeatApplicationFee }}
{{ template "details" (details . "appealingTheDecision" "appealingTheDecisionDetails" false) }}
Expand Down
14 changes: 14 additions & 0 deletions web/template/donor/what_happens_next_post_evidence.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@

{{ trFormatHtml .App "whatHappensNextPostEvidenceContent" "Application" (printf "application%s" .Donor.FeeType.String | tr .App) }}

<h2 class="govuk-heading-m">{{ tr .App "ifYourApplicationIsSuccessful" }}</h2>
<p class="govuk-body">
{{ if .Donor.FeeType.IsNoFee }}
{{ tr .App "onceWeHaveApprovedYourRequest" }}
{{ else if and .Donor.FeeType.IsRepeatApplicationFee }}
{{ tr .App "onceWeHaveApprovedYourRepeatApplication" }}
{{ else }}
{{ tr .App "onceWeHaveApprovedYourPayment" }}
{{ end }}
</p>

<h2 class="govuk-heading-m">{{ tr .App "ifYourApplicationIsNotSuccessful" }}</h2>
<p class="govuk-body">{{ tr .App "weWillContactYouIfWeNeedMoreInformation" }}</p>

{{ if not .Donor.FeeType.IsRepeatApplicationFee }}
{{ template "details" (details . "appealingTheDecision" "appealingTheDecisionDetails" false) }}
{{ end }}
Expand Down

0 comments on commit a24f837

Please sign in to comment.