-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MLPAB-1907 Add page for voucher to confirm own name (#1426)
- Loading branch information
Showing
20 changed files
with
404 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package lpadata | ||
|
||
import "github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid" | ||
|
||
type Voucher struct { | ||
UID actoruid.UID | ||
FirstNames string | ||
LastName string | ||
Email string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package voucherpage | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/ministryofjustice/opg-go-common/template" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/appcontext" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/lpastore/lpadata" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/task" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/validation" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/voucher" | ||
"github.com/ministryofjustice/opg-modernising-lpa/internal/voucher/voucherdata" | ||
) | ||
|
||
type confirmYourNameData struct { | ||
App appcontext.Data | ||
Errors validation.List | ||
Lpa *lpadata.Lpa | ||
} | ||
|
||
func ConfirmYourName(tmpl template.Template, lpaStoreResolvingService LpaStoreResolvingService, voucherStore VoucherStore) Handler { | ||
return func(appData appcontext.Data, w http.ResponseWriter, r *http.Request, provided *voucherdata.Provided) error { | ||
if r.Method == http.MethodPost { | ||
if provided.Tasks.ConfirmYourName.NotStarted() { | ||
provided.Tasks.ConfirmYourName = task.StateInProgress | ||
|
||
if err := voucherStore.Put(r.Context(), provided); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return voucher.PathTaskList.Redirect(w, r, appData, appData.LpaID) | ||
} | ||
|
||
lpa, err := lpaStoreResolvingService.Get(r.Context()) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return tmpl(w, &confirmYourNameData{ | ||
App: appData, | ||
Lpa: lpa, | ||
}) | ||
} | ||
} |
Oops, something went wrong.