-
Notifications
You must be signed in to change notification settings - Fork 2
/
check_your_details.go
37 lines (29 loc) · 1017 Bytes
/
check_your_details.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package donor
import (
"net/http"
"github.com/ministryofjustice/opg-go-common/template"
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor"
"github.com/ministryofjustice/opg-modernising-lpa/internal/page"
"github.com/ministryofjustice/opg-modernising-lpa/internal/validation"
)
type checkYourDetailsData struct {
App page.AppData
Errors validation.List
Donor *actor.DonorProvidedDetails
}
func CheckYourDetails(tmpl template.Template) Handler {
return func(appData page.AppData, w http.ResponseWriter, r *http.Request, donor *actor.DonorProvidedDetails) error {
if r.Method == http.MethodPost {
if !donor.Tasks.PayForLpa.IsCompleted() {
return page.Paths.WeHaveReceivedVoucherDetails.Redirect(w, r, appData, donor)
}
// TODO: MLPAB-1897 send code to donor and MLPAB-1899 contact voucher
return page.Paths.WeHaveContactedVoucher.Redirect(w, r, appData, donor)
}
data := &checkYourDetailsData{
App: appData,
Donor: donor,
}
return tmpl(w, data)
}
}