diff --git a/internal/donor/donorpage/payment_confirmation.go b/internal/donor/donorpage/payment_confirmation.go index 09e9162614..1b9c0d9606 100644 --- a/internal/donor/donorpage/payment_confirmation.go +++ b/internal/donor/donorpage/payment_confirmation.go @@ -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 { diff --git a/internal/donor/donorpage/payment_confirmation_test.go b/internal/donor/donorpage/payment_confirmation_test.go index 0ae15aa8f3..aaf7196c51 100644 --- a/internal/donor/donorpage/payment_confirmation_test.go +++ b/internal/donor/donorpage/payment_confirmation_test.go @@ -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: "certificateprovider@example.com", + }, + 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: "certificateprovider@example.com", + }, + 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) { diff --git a/lang/cy.json b/lang/cy.json index 33fd43b73a..952de761b0 100644 --- a/lang/cy.json +++ b/lang/cy.json @@ -927,11 +927,14 @@ "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": "

Byddwn yn adolygu’ch cais am LPA a’ch tystiolaeth ategol.

Beth fydd yn digwydd nesaf

Llofnodi’ch LPA

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.

Fodd bynnag, ni fyddwn yn cysylltu â’ch darparwr tystysgrif ynghylch darparu ei dystysgrif nes bydd eich {{.Application}} wedi cael ei gymeradwyo.

Os bydd eich cais yn llwyddiannus

Unwaith y byddwn wedi cymeradwyo’ch taliad, byddwn yn cysylltu â’ch darparwr tystysgrif er mwyn iddo ddarparu ei dystysgrif.

Os na fydd eich cais yn llwyddiannus

Byddwn yn cysylltu â chi os bydd arnom angen mwy o wybodaeth neu os nad oedd eich cais yn llwyddiannus.

", + "referenceNumberStored": "Welsh", + "weWillReviewYourLpaApplicationAndSupportingEvidence": "Byddwn yn adolygu’ch cais am LPA a’ch tystiolaeth ategol.", + "weWillReviewYourLpaApplication": "Welsh", "youCanStillSignYourLpa": "

Welsh

Welsh

Welsh {{ .Application }} Welsh

", "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", diff --git a/lang/en.json b/lang/en.json index 6ba90d1332..db268e0df1 100644 --- a/lang/en.json +++ b/lang/en.json @@ -874,11 +874,14 @@ "nothingHardship": "Nothing - I paid no fee because I got a hardship fee waiver", "howMuchYouPreviouslyPaid": "how much you previously paid", "evidenceSuccessfullyUploaded": "Evidence successfully uploaded", - "weWillReviewYourLpaApplicationAndSupportingEvidence": "

We will review your LPA application and supporting evidence.

What happens next

", + "referenceNumberStored": "Reference number stored", + "weWillReviewYourLpaApplicationAndSupportingEvidence": "We will review your LPA application and supporting evidence.", + "weWillReviewYourLpaApplication": "We will review your LPA application.", "youCanStillSignYourLpa": "

Sign your LPA

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.

However, we will not contact your certificate provider to provide their certificate until your {{ .Application }} has been approved.

", "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", diff --git a/web/template/donor/evidence_successfully_uploaded.gohtml b/web/template/donor/evidence_successfully_uploaded.gohtml index 1f64de70e3..8bb7dedf58 100644 --- a/web/template/donor/evidence_successfully_uploaded.gohtml +++ b/web/template/donor/evidence_successfully_uploaded.gohtml @@ -6,10 +6,24 @@
-

{{ tr .App "evidenceSuccessfullyUploaded" }}

+

+ {{ if and .Donor.FeeType.IsRepeatApplicationFee (or .Donor.PreviousFee.IsPreviousFeeFull .Donor.PreviousFee.Empty) }} + {{ tr .App "referenceNumberStored" }} + {{ else }} + {{ tr .App "evidenceSuccessfullyUploaded" }} + {{ end }} +

- {{ trHtml .App "weWillReviewYourLpaApplicationAndSupportingEvidence" }} +

+ {{ if and .Donor.FeeType.IsRepeatApplicationFee (or .Donor.PreviousFee.IsPreviousFeeFull .Donor.PreviousFee.Empty) }} + {{ tr .App "weWillReviewYourLpaApplication" }} + {{ else }} + {{ tr .App "weWillReviewYourLpaApplicationAndSupportingEvidence" }} + {{ end }} +

+ +

{{ tr .App "whatHappensNext" }}

{{ if .Donor.SignedAt.IsZero }} {{ trFormatHtml .App "youCanStillSignYourLpa" "Application" (printf "application%s" .Donor.FeeType.String | tr .App) }} @@ -19,6 +33,8 @@

{{ if .Donor.FeeType.IsNoFee }} {{ tr .App "onceWeHaveApprovedYourRequest" }} + {{ else if and .Donor.FeeType.IsRepeatApplicationFee }} + {{ tr .App "onceWeHaveApprovedYourRepeatApplication" }} {{ else }} {{ tr .App "onceWeHaveApprovedYourPayment" }} {{ end }} diff --git a/web/template/donor/what_happens_next_post_evidence.gohtml b/web/template/donor/what_happens_next_post_evidence.gohtml index 68db88a211..ef2e9f84d9 100644 --- a/web/template/donor/what_happens_next_post_evidence.gohtml +++ b/web/template/donor/what_happens_next_post_evidence.gohtml @@ -13,6 +13,8 @@

{{ if .Donor.FeeType.IsNoFee }} {{ tr .App "onceWeHaveApprovedYourRequest" }} + {{ else if and .Donor.FeeType.IsRepeatApplicationFee }} + {{ tr .App "onceWeHaveApprovedYourRepeatApplication" }} {{ else }} {{ tr .App "onceWeHaveApprovedYourPayment" }} {{ end }}