Skip to content

Commit

Permalink
Merge ff76f1e into d9f22c7
Browse files Browse the repository at this point in the history
  • Loading branch information
hawx authored Jan 14, 2025
2 parents d9f22c7 + ff76f1e commit 232b070
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
1 change: 1 addition & 0 deletions internal/page/paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const (
PathVoucherLoginCallback = Path("/voucher-login-callback")
PathVoucherEnterReferenceNumber = Path("/voucher-enter-reference-number")
PathVoucherUnableToConfirmIdentity = Path("/voucher-unable-to-confirm-identity")
PathVoucherDonorDetailsDoNotMatch = Path("/voucher-donor-details-do-not-match")

PathAttorneyFixtures = Path("/fixtures/attorney")
PathAuthRedirect = Path("/auth/redirect")
Expand Down
1 change: 0 additions & 1 deletion internal/voucher/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const (
PathConfirmAllowedToVouch = Path("/confirm-allowed-to-vouch")
PathConfirmYourIdentity = Path("/confirm-your-identity")
PathConfirmYourName = Path("/confirm-your-name")
PathDonorDetailsDoNotMatch = Path("/donor-details-do-not-match")
PathHowWillYouConfirmYourIdentity = Path("/how-will-you-confirm-your-identity")
PathIdentityWithOneLogin = Path("/identity-with-one-login")
PathIdentityWithOneLoginCallback = Path("/identity-with-one-login-callback")
Expand Down
4 changes: 2 additions & 2 deletions internal/voucher/voucherpage/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ func Register(
EnterReferenceNumber(tmpls.Get("enter_reference_number.gohtml"), shareCodeStore, sessionStore, voucherStore))
handleRoot(page.PathVoucherUnableToConfirmIdentity, None,
page.Guidance(tmpls.Get("unable_to_confirm_identity.gohtml")))
handleRoot(page.PathVoucherDonorDetailsDoNotMatch, None,
page.Guidance(tmpls.Get("donor_details_do_not_match.gohtml")))

handleVoucher := makeVoucherHandle(rootMux, sessionStore, errorHandler, voucherStore)

Expand All @@ -139,8 +141,6 @@ func Register(

handleVoucher(voucher.PathVerifyDonorDetails, None,
VerifyDonorDetails(tmpls.Get("verify_donor_details.gohtml"), lpaStoreResolvingService, voucherStore, vouchFailed))
handleVoucher(voucher.PathDonorDetailsDoNotMatch, None,
Guidance(tmpls.Get("donor_details_do_not_match.gohtml"), lpaStoreResolvingService))

handleVoucher(voucher.PathConfirmYourIdentity, None,
ConfirmYourIdentity(tmpls.Get("confirm_your_identity.gohtml"), voucherStore, lpaStoreResolvingService))
Expand Down
7 changes: 6 additions & 1 deletion internal/voucher/voucherpage/verify_donor_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package voucherpage

import (
"net/http"
"net/url"

"github.com/ministryofjustice/opg-go-common/template"
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext"
"github.com/ministryofjustice/opg-modernising-lpa/internal/form"
"github.com/ministryofjustice/opg-modernising-lpa/internal/lpastore/lpadata"
"github.com/ministryofjustice/opg-modernising-lpa/internal/page"
"github.com/ministryofjustice/opg-modernising-lpa/internal/task"
"github.com/ministryofjustice/opg-modernising-lpa/internal/validation"
"github.com/ministryofjustice/opg-modernising-lpa/internal/voucher"
Expand Down Expand Up @@ -49,7 +51,10 @@ func VerifyDonorDetails(tmpl template.Template, lpaStoreResolvingService LpaStor
return err
}

return voucher.PathDonorDetailsDoNotMatch.Redirect(w, r, appData, appData.LpaID)
return page.PathVoucherDonorDetailsDoNotMatch.RedirectQuery(w, r, appData, url.Values{
"donorFullName": {lpa.Donor.FullName()},
"donorFirstNames": {lpa.Donor.FirstNames},
})
}

return voucher.PathTaskList.Redirect(w, r, appData, appData.LpaID)
Expand Down
4 changes: 2 additions & 2 deletions internal/voucher/voucherpage/verify_donor_details_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func TestPostVerifyDonorDetailsWhenNo(t *testing.T) {
w := httptest.NewRecorder()
r.Header.Add("Content-Type", page.FormUrlEncoded)

lpa := &lpadata.Lpa{Donor: lpadata.Donor{LastName: "Smith"}}
lpa := &lpadata.Lpa{Donor: lpadata.Donor{FirstNames: "John", LastName: "Smith"}}
provided := &voucherdata.Provided{
LpaID: "lpa-id",
DonorDetailsMatch: form.No,
Expand All @@ -148,7 +148,7 @@ func TestPostVerifyDonorDetailsWhenNo(t *testing.T) {

assert.Nil(t, err)
assert.Equal(t, http.StatusFound, resp.StatusCode)
assert.Equal(t, voucher.PathDonorDetailsDoNotMatch.Format("lpa-id"), resp.Header.Get("Location"))
assert.Equal(t, page.PathVoucherDonorDetailsDoNotMatch.Format()+"?donorFirstNames=John&donorFullName=John+Smith", resp.Header.Get("Location"))
}

func TestPostVerifyDonorDetailsWhenStoreErrors(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions web/template/voucher/donor_details_do_not_match.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
{{ template "notification-banner" (notificationBanner .App "important"
(trFormatHtml .App "youHaveToldUsDetailsDoNotMatchIdentity" "DonorFullName" .Lpa.Donor.FullName)
(trFormatHtml .App "youHaveToldUsDetailsDoNotMatchIdentity" "DonorFullName" (.App.Query.Get "donorFullName"))
"heading") }}

{{ trFormatHtml .App "youHaveToldUsDetailsDoNotMatchIdentityContent" "DonorFirstNames" .Lpa.Donor.FirstNames }}
{{ trFormatHtml .App "youHaveToldUsDetailsDoNotMatchIdentityContent" "DonorFirstNames" (.App.Query.Get "donorFirstNames") }}
</div>
</div>
{{ end }}

0 comments on commit 232b070

Please sign in to comment.