Skip to content

Commit

Permalink
MLPAB-1572: Allow setting certificate provider email and mobile in do…
Browse files Browse the repository at this point in the history
…nor fixtures (#869)
  • Loading branch information
acsauk authored Nov 22, 2023
1 parent e01e317 commit 239fc4c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
34 changes: 22 additions & 12 deletions internal/page/fixtures/donor.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,20 @@ func Donor(

return func(appData page.AppData, w http.ResponseWriter, r *http.Request) error {
var (
lpaType = r.FormValue("lpa-type")
progress = slices.Index(progressValues, r.FormValue("progress"))
redirect = r.FormValue("redirect")
donor = r.FormValue("donor")
certificateProvider = r.FormValue("certificateProvider")
attorneys = r.FormValue("attorneys")
peopleToNotify = r.FormValue("peopleToNotify")
replacementAttorneys = r.FormValue("replacementAttorneys")
feeType = r.FormValue("feeType")
paymentTaskProgress = r.FormValue("paymentTaskProgress")
withVirus = r.FormValue("withVirus") == "1"
useRealUID = r.FormValue("uid") == "real"
lpaType = r.FormValue("lpa-type")
progress = slices.Index(progressValues, r.FormValue("progress"))
redirect = r.FormValue("redirect")
donor = r.FormValue("donor")
certificateProvider = r.FormValue("certificateProvider")
attorneys = r.FormValue("attorneys")
peopleToNotify = r.FormValue("peopleToNotify")
replacementAttorneys = r.FormValue("replacementAttorneys")
feeType = r.FormValue("feeType")
paymentTaskProgress = r.FormValue("paymentTaskProgress")
withVirus = r.FormValue("withVirus") == "1"
useRealUID = r.FormValue("uid") == "real"
certificateProviderEmail = r.FormValue("certificateProviderEmail")
certificateProviderMobile = r.FormValue("certificateProviderMobile")
)

if r.Method != http.MethodPost && !r.URL.Query().Has("redirect") {
Expand Down Expand Up @@ -199,6 +201,14 @@ func Donor(
donorDetails.CertificateProvider.CarryOutBy = actor.Paper
}

if certificateProviderEmail != "" {
donorDetails.CertificateProvider.Email = certificateProviderEmail
}

if certificateProviderMobile != "" {
donorDetails.CertificateProvider.Mobile = certificateProviderMobile
}

donorDetails.Tasks.CertificateProvider = actor.TaskCompleted
}

Expand Down
6 changes: 6 additions & 0 deletions web/template/fixtures.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
</div>
</div>

{{ template "input" (input . "certificateProviderEmail" "Certificate provider email" "" "classes" "govuk-input--width-20" "type" "email" "spellcheck" "false" "autocomplete" "email") }}
{{ template "input" (input . "certificateProviderMobile" "Certificate provider mobile" "" "classes" "govuk-input--width-20" "type" "tel" "spellcheck" "false" "autocomplete" "tel") }}
<div class="govuk-hint govuk-!-padding-bottom-2">
Email and mobile are set when selecting <span class="govuk-!-font-weight-bold">Choose your certificate provider</span> progress or later
</div>

<div class="govuk-form-group">
<fieldset class="govuk-fieldset">
<legend class="govuk-fieldset__legend">Progress</legend>
Expand Down

0 comments on commit 239fc4c

Please sign in to comment.