page

package
v0.0.0-...-897bb11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 31 Imported by: 0

Documentation

Overview

Package page contains the core code and business logic of Make and Register a Lasting Power of Attorney (MRLPA)

Useful links:

Code generated by "enumerator -type ApplicationReason -linecomment -empty"; DO NOT EDIT.

Code generated by "enumerator -type CanBeUsedWhen -linecomment -trimprefix -empty"; DO NOT EDIT.

Code generated by "enumerator -type FeeType"; DO NOT EDIT.

Code generated by "enumerator -type LifeSustainingTreatment -linecomment -trimprefix -empty"; DO NOT EDIT.

Code generated by "enumerator -type LpaType -linecomment -trimprefix -empty"; DO NOT EDIT.

Code generated by "enumerator -type ReplacementAttorneysStepIn -linecomment -trimprefix -empty"; DO NOT EDIT.

Modified from io/multi.go which carries the following licence:

Copyright 2009 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Index

Constants

View Source
const FormUrlEncoded = "application/x-www-form-urlencoded"

Variables

View Source
var ApplicationReasonValues = ApplicationReasonOptions{
	NewApplication:             NewApplication,
	RemakeOfInvalidApplication: RemakeOfInvalidApplication,
	AdditionalApplication:      AdditionalApplication,
}
View Source
var CanBeUsedWhenValues = CanBeUsedWhenOptions{
	CapacityLost: CanBeUsedWhenCapacityLost,
	HasCapacity:  CanBeUsedWhenHasCapacity,
}
View Source
var ErrCsrfInvalid = errors.New("CSRF token not valid")
View Source
var FeeTypeValues = FeeTypeOptions{
	FullFee:     FullFee,
	HalfFee:     HalfFee,
	NoFee:       NoFee,
	HardshipFee: HardshipFee,
}
View Source
var LpaTypeValues = LpaTypeOptions{
	HealthWelfare:   LpaTypeHealthWelfare,
	PropertyFinance: LpaTypePropertyFinance,
}
View Source
var Paths = AppPaths{
	CertificateProvider: CertificateProviderPaths{
		Login:                "/certificate-provider-login",
		LoginCallback:        "/certificate-provider-login-callback",
		EnterReferenceNumber: "/certificate-provider-enter-reference-number",
		WhoIsEligible:        "/certificate-provider-who-is-eligible",

		CertificateProvided:                  "/certificate-provided",
		ConfirmYourDetails:                   "/confirm-your-details",
		EnterDateOfBirth:                     "/enter-date-of-birth",
		IdentityWithBiometricResidencePermit: "/id/brp",
		IdentityWithDrivingLicencePaper:      "/id/dlpaper",
		IdentityWithDrivingLicencePhotocard:  "/id/dlphoto",
		IdentityWithOneLogin:                 "/identity-with-one-login",
		IdentityWithOneLoginCallback:         "/identity-with-one-login-callback",
		IdentityWithOnlineBankAccount:        "/id/bank",
		IdentityWithPassport:                 "/id/passport",
		IdentityWithYoti:                     "/identity-with-yoti",
		IdentityWithYotiCallback:             "/identity-with-yoti-callback",
		ProvideCertificate:                   "/provide-certificate",
		ReadTheLpa:                           "/read-the-lpa",
		SelectYourIdentityOptions1:           "/select-identity-document",
		SelectYourIdentityOptions2:           "/select-identity-document-2",
		SelectYourIdentityOptions:            "/select-your-identity-options",
		TaskList:                             "/task-list",
		WhatHappensNext:                      "/what-happens-next",
		WhatYoullNeedToConfirmYourIdentity:   "/what-youll-need-to-confirm-your-identity",
		YourChosenIdentityOptions:            "/your-chosen-identity-options",
		YourRole:                             "/your-role",
	},

	Attorney: AttorneyPaths{
		EnterReferenceNumber:      "/attorney-enter-reference-number",
		Login:                     "/attorney-login",
		LoginCallback:             "/attorney-login-callback",
		Start:                     "/attorney-start",
		CodeOfConduct:             "/code-of-conduct",
		ConfirmYourDetails:        "/confirm-your-details",
		MobileNumber:              "/mobile-number",
		ReadTheLpa:                "/read-the-lpa",
		RightsAndResponsibilities: "/legal-rights-and-responsibilities",
		Sign:                      "/sign",
		TaskList:                  "/task-list",
		WhatHappensNext:           "/what-happens-next",
		WhatHappensWhenYouSign:    "/what-happens-when-you-sign-the-lpa",
		WouldLikeSecondSignatory:  "/would-like-second-signatory",
	},

	HealthCheck: HealthCheckPaths{
		Service:    "/health-check/service",
		Dependency: "/health-check/dependency",
	},

	AboutPayment:                                               "/about-payment",
	ApplicationReason:                                          "/application-reason",
	AreYouApplyingForADifferentFeeType:                         "/are-you-applying-for-a-different-fee-type",
	AreYouHappyIfOneAttorneyCantActNoneCan:                     "/are-you-happy-if-one-attorney-cant-act-none-can",
	AreYouHappyIfOneReplacementAttorneyCantActNoneCan:          "/are-you-happy-if-one-replacement-attorney-cant-act-none-can",
	AreYouHappyIfRemainingAttorneysCanContinueToAct:            "/are-you-happy-if-remaining-attorneys-can-continue-to-act",
	AreYouHappyIfRemainingReplacementAttorneysCanContinueToAct: "/are-you-happy-if-remaining-replacement-attorneys-can-continue-to-act",
	AuthRedirect:                                         "/auth/redirect",
	CanEvidenceBeUploaded:                                "/can-evidence-be-uploaded",
	CertificateProviderAddress:                           "/certificate-provider-address",
	CertificateProviderDetails:                           "/certificate-provider-details",
	CertificateProviderOptOut:                            "/certificate-provider-opt-out",
	CertificateProviderStart:                             "/certificate-provider-start",
	CheckYourLpa:                                         "/check-your-lpa",
	ChooseAttorneys:                                      "/choose-attorneys",
	ChooseAttorneysAddress:                               "/choose-attorneys-address",
	ChooseAttorneysGuidance:                              "/choose-attorneys-guidance",
	ChooseAttorneysSummary:                               "/choose-attorneys-summary",
	ChoosePeopleToNotify:                                 "/choose-people-to-notify",
	ChoosePeopleToNotifyAddress:                          "/choose-people-to-notify-address",
	ChoosePeopleToNotifySummary:                          "/choose-people-to-notify-summary",
	ChooseReplacementAttorneys:                           "/choose-replacement-attorneys",
	ChooseReplacementAttorneysAddress:                    "/choose-replacement-attorneys-address",
	ChooseReplacementAttorneysSummary:                    "/choose-replacement-attorneys-summary",
	ChooseYourCertificateProvider:                        "/choose-your-certificate-provider",
	CookiesConsent:                                       "/cookies-consent",
	Dashboard:                                            "/dashboard",
	DoYouWantReplacementAttorneys:                        "/do-you-want-replacement-attorneys",
	DoYouWantToNotifyPeople:                              "/do-you-want-to-notify-people",
	EnterTrustCorporation:                                "/enter-trust-corporation",
	EnterTrustCorporationAddress:                         "/enter-trust-corporation-address",
	EvidenceRequired:                                     "/evidence-required",
	Fixtures:                                             "/fixtures",
	HowDoYouKnowYourCertificateProvider:                  "/how-do-you-know-your-certificate-provider",
	HowLongHaveYouKnownCertificateProvider:               "/how-long-have-you-known-certificate-provider",
	HowShouldAttorneysMakeDecisions:                      "/how-should-attorneys-make-decisions",
	HowShouldReplacementAttorneysMakeDecisions:           "/how-should-replacement-attorneys-make-decisions",
	HowShouldReplacementAttorneysStepIn:                  "/how-should-replacement-attorneys-step-in",
	HowToConfirmYourIdentityAndSign:                      "/how-to-confirm-your-identity-and-sign",
	HowToPrintAndSendEvidence:                            "/how-to-print-and-send-evidence",
	HowToSendEvidence:                                    "/how-to-send-evidence",
	HowWouldCertificateProviderPreferToCarryOutTheirRole: "/how-would-certificate-provider-prefer-to-carry-out-their-role",
	IdentityConfirmed:                                    "/identity-confirmed",
	IdentityWithBiometricResidencePermit:                 "/id/biometric-residence-permit",
	IdentityWithDrivingLicencePaper:                      "/id/driving-licence-paper",
	IdentityWithDrivingLicencePhotocard:                  "/id/driving-licence-photocard",
	IdentityWithOneLogin:                                 "/id/one-login",
	IdentityWithOneLoginCallback:                         "/id/one-login/callback",
	IdentityWithOnlineBankAccount:                        "/id/online-bank-account",
	IdentityWithPassport:                                 "/id/passport",
	IdentityWithYoti:                                     "/id/yoti",
	IdentityWithYotiCallback:                             "/id/yoti/callback",
	LifeSustainingTreatment:                              "/life-sustaining-treatment",
	Login:                                                "/login",
	LoginCallback:                                        "/login-callback",
	LpaDetailsSaved:                                      "/lpa-details-saved",
	LpaType:                                              "/lpa-type",
	LpaYourLegalRightsAndResponsibilities:                "/your-legal-rights-and-responsibilities",
	PaymentConfirmation:                                  "/payment-confirmation",
	PreviousApplicationNumber:                            "/previous-application-number",
	PrintEvidenceForm:                                    "/print-evidence-form",
	Progress:                                             "/progress",
	ProvideAddressToSendEvidenceForm:                     "/provide-address-to-send-evidence-form",
	ReadYourLpa:                                          "/read-your-lpa",
	RemoveAttorney:                                       "/remove-attorney",
	RemovePersonToNotify:                                 "/remove-person-to-notify",
	RemoveReplacementAttorney:                            "/remove-replacement-attorney",
	ResendWitnessCode:                                    "/resend-witness-code",
	Restrictions:                                         "/restrictions",
	Root:                                                 "/",
	SelectYourIdentityOptions1:                           "/select-identity-document",
	SelectYourIdentityOptions2:                           "/select-identity-document-2",
	SelectYourIdentityOptions:                            "/select-your-identity-options",
	SignOut:                                              "/sign-out",
	SignYourLpa:                                          "/sign-your-lpa",
	Start:                                                "/start",
	TaskList:                                             "/task-list",
	TestingStart:                                         "/testing-start",
	UploadEvidence:                                       "/upload-evidence",
	UseExistingAddress:                                   "/use-existing-address",
	WhatACertificateProviderDoes:                         "/what-a-certificate-provider-does",
	WhatHappensAfterNoFee:                                "/what-happens-after-no-fee",
	WhatYoullNeedToConfirmYourIdentity:                   "/what-youll-need-to-confirm-your-identity",
	WhenCanTheLpaBeUsed:                                  "/when-can-the-lpa-be-used",
	WhichFeeTypeAreYouApplyingFor:                        "/which-fee-type-are-you-applying-for",
	WhoIsTheLpaFor:                                       "/who-is-the-lpa-for",
	WitnessingAsCertificateProvider:                      "/witnessing-as-certificate-provider",
	WitnessingYourSignature:                              "/witnessing-your-signature",
	YotiRedirect:                                         "/yoti/redirect",
	YouHaveSubmittedYourLpa:                              "/you-have-submitted-your-lpa",
	YourAddress:                                          "/your-address",
	YourChosenIdentityOptions:                            "/your-chosen-identity-options",
	YourDetails:                                          "/your-details",
	YourLegalRightsAndResponsibilities:                   "/your-legal-rights-and-responsibilities",
}

Functions

func AuthRedirect

func AuthRedirect(logger Logger, store sesh.Store) http.HandlerFunc

func CacheControlHeaders

func CacheControlHeaders(h http.Handler) http.Handler

func ChooseAttorneysState

func ChooseAttorneysState(attorneys actor.Attorneys, decisions actor.AttorneyDecisions) actor.TaskState

func ChooseReplacementAttorneysState

func ChooseReplacementAttorneysState(lpa *Lpa) actor.TaskState

func ContextWithAppData

func ContextWithAppData(ctx context.Context, appData AppData) context.Context

func ContextWithSessionData

func ContextWithSessionData(ctx context.Context, data *SessionData) context.Context

func CookieConsent

func CookieConsent(paths AppPaths) http.HandlerFunc

func DependencyHealthCheck

func DependencyHealthCheck(logger Logger, uidClient UidClient) http.HandlerFunc

func MultiReadCloser

func MultiReadCloser(readClosers ...io.ReadCloser) io.ReadCloser

MultiReadCloser returns a io.ReadCloser that's the logical concatenation of the provided input readClosers. They're read sequentially. Once all inputs have returned EOF, Read will return EOF. If any of the readClosers return a non-nil, non-EOF error, Read will return that error.

func PostFormReferenceNumber

func PostFormReferenceNumber(r *http.Request, name string) string

func PostFormString

func PostFormString(r *http.Request, name string) string

func Recover

func Recover(tmpl template.Template, logger Logger, bundle Bundle, next http.Handler) http.HandlerFunc

func RouteToPrefix

func RouteToPrefix(prefix string, mux http.Handler, notFoundHandler Handler) http.HandlerFunc

func TestingStart

func TestingStart(store sesh.Store, donorStore DonorStore, randomString func(int) string, shareCodeSender shareCodeSender, localizer Localizer, certificateProviderStore CertificateProviderStore, attorneyStore AttorneyStore, logger *logging.Logger, now func() time.Time) http.HandlerFunc

func ValidateCsrf

func ValidateCsrf(next http.Handler, store sessions.Store, randomString func(int) string, errorHandler ErrorHandler) http.HandlerFunc

func YotiRedirect

func YotiRedirect(logger Logger, store sesh.Store) http.HandlerFunc

Types

type AddressDetail

type AddressDetail struct {
	Name    string
	Role    actor.Type
	Address place.Address
	ID      string
}

type AppData

type AppData struct {
	Page             string
	Path             string
	Query            string
	Localizer        Localizer
	Lang             localize.Lang
	CookieConsentSet bool
	CanGoBack        bool
	SessionID        string
	RumConfig        RumConfig
	StaticHash       string
	Paths            AppPaths
	LpaID            string
	CsrfToken        string
	ActorTypes       actor.Types
	ActorType        actor.Type
	AttorneyID       string
	OneloginURL      string
}

func AppDataFromContext

func AppDataFromContext(ctx context.Context) AppData

func (AppData) BuildUrl

func (d AppData) BuildUrl(url string) string

func (AppData) IsCertificateProvider

func (d AppData) IsCertificateProvider() bool

func (AppData) IsDonor

func (d AppData) IsDonor() bool

func (AppData) IsReplacementAttorney

func (d AppData) IsReplacementAttorney() bool

func (AppData) IsTrustCorporation

func (d AppData) IsTrustCorporation() bool

func (AppData) Redirect

func (d AppData) Redirect(w http.ResponseWriter, r *http.Request, lpa *Lpa, url string) error

type AppPaths

type AppPaths struct {
	Attorney            AttorneyPaths
	CertificateProvider CertificateProviderPaths
	HealthCheck         HealthCheckPaths

	AuthRedirect                       Path
	Login                              Path
	LoginCallback                      Path
	Root                               Path
	SignOut                            Path
	Fixtures                           Path
	YourLegalRightsAndResponsibilities Path
	CertificateProviderStart           Path
	Start                              Path
	TestingStart                       Path
	Dashboard                          Path
	YotiRedirect                       Path
	CookiesConsent                     Path

	AboutPayment                                               LpaPath
	ApplicationReason                                          LpaPath
	AreYouApplyingForADifferentFeeType                         LpaPath
	AreYouHappyIfOneAttorneyCantActNoneCan                     LpaPath
	AreYouHappyIfOneReplacementAttorneyCantActNoneCan          LpaPath
	AreYouHappyIfRemainingAttorneysCanContinueToAct            LpaPath
	AreYouHappyIfRemainingReplacementAttorneysCanContinueToAct LpaPath
	CanEvidenceBeUploaded                                      LpaPath
	CertificateProviderAddress                                 LpaPath
	CertificateProviderDetails                                 LpaPath
	CertificateProviderOptOut                                  LpaPath
	CheckYourLpa                                               LpaPath
	ChooseAttorneys                                            LpaPath
	ChooseAttorneysAddress                                     LpaPath
	ChooseAttorneysGuidance                                    LpaPath
	ChooseAttorneysSummary                                     LpaPath
	ChoosePeopleToNotify                                       LpaPath
	ChoosePeopleToNotifyAddress                                LpaPath
	ChoosePeopleToNotifySummary                                LpaPath
	ChooseReplacementAttorneys                                 LpaPath
	ChooseReplacementAttorneysAddress                          LpaPath
	ChooseReplacementAttorneysSummary                          LpaPath
	ChooseYourCertificateProvider                              LpaPath
	DoYouWantReplacementAttorneys                              LpaPath
	DoYouWantToNotifyPeople                                    LpaPath
	EnterTrustCorporation                                      LpaPath
	EnterTrustCorporationAddress                               LpaPath
	EvidenceRequired                                           LpaPath
	HowDoYouKnowYourCertificateProvider                        LpaPath
	HowLongHaveYouKnownCertificateProvider                     LpaPath
	HowShouldAttorneysMakeDecisions                            LpaPath
	HowShouldReplacementAttorneysMakeDecisions                 LpaPath
	HowShouldReplacementAttorneysStepIn                        LpaPath
	HowToConfirmYourIdentityAndSign                            LpaPath
	HowToPrintAndSendEvidence                                  LpaPath
	HowToSendEvidence                                          LpaPath
	HowWouldCertificateProviderPreferToCarryOutTheirRole       LpaPath
	IdentityConfirmed                                          LpaPath
	IdentityWithBiometricResidencePermit                       LpaPath
	IdentityWithDrivingLicencePaper                            LpaPath
	IdentityWithDrivingLicencePhotocard                        LpaPath
	IdentityWithOneLogin                                       LpaPath
	IdentityWithOneLoginCallback                               LpaPath
	IdentityWithOnlineBankAccount                              LpaPath
	IdentityWithPassport                                       LpaPath
	IdentityWithYoti                                           LpaPath
	IdentityWithYotiCallback                                   LpaPath
	LifeSustainingTreatment                                    LpaPath
	LpaDetailsSaved                                            LpaPath
	LpaType                                                    LpaPath
	LpaYourLegalRightsAndResponsibilities                      LpaPath
	PaymentConfirmation                                        LpaPath
	PreviousApplicationNumber                                  LpaPath
	PrintEvidenceForm                                          LpaPath
	Progress                                                   LpaPath
	ProvideAddressToSendEvidenceForm                           LpaPath
	ReadYourLpa                                                LpaPath
	RemoveAttorney                                             LpaPath
	RemovePersonToNotify                                       LpaPath
	RemoveReplacementAttorney                                  LpaPath
	ResendWitnessCode                                          LpaPath
	Restrictions                                               LpaPath
	SelectYourIdentityOptions                                  LpaPath
	SelectYourIdentityOptions1                                 LpaPath
	SelectYourIdentityOptions2                                 LpaPath
	SignYourLpa                                                LpaPath
	TaskList                                                   LpaPath
	UploadEvidence                                             LpaPath
	UseExistingAddress                                         LpaPath
	WhatACertificateProviderDoes                               LpaPath
	WhatHappensAfterNoFee                                      LpaPath
	WhatYoullNeedToConfirmYourIdentity                         LpaPath
	WhenCanTheLpaBeUsed                                        LpaPath
	WhichFeeTypeAreYouApplyingFor                              LpaPath
	WhoIsTheLpaFor                                             LpaPath
	WitnessingAsCertificateProvider                            LpaPath
	WitnessingYourSignature                                    LpaPath
	YouHaveSubmittedYourLpa                                    LpaPath
	YourAddress                                                LpaPath
	YourChosenIdentityOptions                                  LpaPath
	YourDetails                                                LpaPath
}

type ApplicationReason

type ApplicationReason uint8
const (
	NewApplication             ApplicationReason = iota + 1 // new-application
	RemakeOfInvalidApplication                              // remake
	AdditionalApplication                                   // additional-application
)

func ParseApplicationReason

func ParseApplicationReason(s string) (ApplicationReason, error)

func (ApplicationReason) Empty

func (i ApplicationReason) Empty() bool

func (ApplicationReason) IsAdditionalApplication

func (i ApplicationReason) IsAdditionalApplication() bool

func (ApplicationReason) IsNewApplication

func (i ApplicationReason) IsNewApplication() bool

func (ApplicationReason) IsRemakeOfInvalidApplication

func (i ApplicationReason) IsRemakeOfInvalidApplication() bool

func (ApplicationReason) String

func (i ApplicationReason) String() string

type ApplicationReasonOptions

type ApplicationReasonOptions struct {
	NewApplication             ApplicationReason
	RemakeOfInvalidApplication ApplicationReason
	AdditionalApplication      ApplicationReason
}

type AttorneyPath

type AttorneyPath string

func (AttorneyPath) Format

func (p AttorneyPath) Format(id string) string

func (AttorneyPath) String

func (p AttorneyPath) String() string

type AttorneyPaths

type AttorneyPaths struct {
	EnterReferenceNumber Path
	Login                Path
	LoginCallback        Path
	Start                Path

	CodeOfConduct             AttorneyPath
	ConfirmYourDetails        AttorneyPath
	MobileNumber              AttorneyPath
	ReadTheLpa                AttorneyPath
	RightsAndResponsibilities AttorneyPath
	Sign                      AttorneyPath
	TaskList                  AttorneyPath
	WhatHappensNext           AttorneyPath
	WhatHappensWhenYouSign    AttorneyPath
	WouldLikeSecondSignatory  AttorneyPath
}

type Bundle

type Bundle interface {
	For(lang localize.Lang) *localize.Localizer
}

type CanBeUsedWhen

type CanBeUsedWhen uint8
const (
	CanBeUsedWhenCapacityLost CanBeUsedWhen = iota + 1 // when-capacity-lost
	CanBeUsedWhenHasCapacity                           // when-has-capacity
)

func ParseCanBeUsedWhen

func ParseCanBeUsedWhen(s string) (CanBeUsedWhen, error)

func (CanBeUsedWhen) Empty

func (i CanBeUsedWhen) Empty() bool

func (CanBeUsedWhen) IsCapacityLost

func (i CanBeUsedWhen) IsCapacityLost() bool

func (CanBeUsedWhen) IsHasCapacity

func (i CanBeUsedWhen) IsHasCapacity() bool

func (CanBeUsedWhen) String

func (i CanBeUsedWhen) String() string

type CanBeUsedWhenOptions

type CanBeUsedWhenOptions struct {
	CapacityLost CanBeUsedWhen
	HasCapacity  CanBeUsedWhen
}

type CertificateProviderPath

type CertificateProviderPath string

func (CertificateProviderPath) Format

func (p CertificateProviderPath) Format(id string) string

func (CertificateProviderPath) String

func (p CertificateProviderPath) String() string

type CertificateProviderPaths

type CertificateProviderPaths struct {
	Login                Path
	LoginCallback        Path
	EnterReferenceNumber Path

	CertificateProvided                  CertificateProviderPath
	ConfirmYourDetails                   CertificateProviderPath
	EnterDateOfBirth                     CertificateProviderPath
	IdentityWithBiometricResidencePermit CertificateProviderPath
	IdentityWithDrivingLicencePaper      CertificateProviderPath
	IdentityWithDrivingLicencePhotocard  CertificateProviderPath
	IdentityWithOneLogin                 CertificateProviderPath
	IdentityWithOneLoginCallback         CertificateProviderPath
	IdentityWithOnlineBankAccount        CertificateProviderPath
	IdentityWithPassport                 CertificateProviderPath
	IdentityWithYoti                     CertificateProviderPath
	IdentityWithYotiCallback             CertificateProviderPath
	ProvideCertificate                   CertificateProviderPath
	ReadTheLpa                           CertificateProviderPath
	SelectYourIdentityOptions            CertificateProviderPath
	SelectYourIdentityOptions1           CertificateProviderPath
	SelectYourIdentityOptions2           CertificateProviderPath
	TaskList                             CertificateProviderPath
	WhatHappensNext                      CertificateProviderPath
	WhatYoullNeedToConfirmYourIdentity   CertificateProviderPath
	WhoIsEligible                        CertificateProviderPath
	YourChosenIdentityOptions            CertificateProviderPath
	YourRole                             CertificateProviderPath
}

type DashboardStore

type DashboardStore interface {
	GetAll(ctx context.Context) (donor, attorney, certificateProvider []LpaAndActorTasks, err error)
}

type DonorStore

type DonorStore interface {
	Create(context.Context) (*Lpa, error)
	Put(context.Context, *Lpa) error
	GetAll(context.Context) ([]*Lpa, error)
	GetAny(context.Context) (*Lpa, error)
}

type ErrorHandler

type ErrorHandler func(http.ResponseWriter, *http.Request, error)

func Error

func Error(tmpl template.Template, logger Logger) ErrorHandler

type FeeType

type FeeType uint8
const (
	FullFee FeeType = iota
	HalfFee
	NoFee
	HardshipFee
)

func ParseFeeType

func ParseFeeType(s string) (FeeType, error)

func (FeeType) Cost

func (i FeeType) Cost() int

func (FeeType) IsFullFee

func (i FeeType) IsFullFee() bool

func (FeeType) IsHalfFee

func (i FeeType) IsHalfFee() bool

func (FeeType) IsHardshipFee

func (i FeeType) IsHardshipFee() bool

func (FeeType) IsNoFee

func (i FeeType) IsNoFee() bool

func (FeeType) String

func (i FeeType) String() string

type FeeTypeOptions

type FeeTypeOptions struct {
	FullFee     FeeType
	HalfFee     FeeType
	NoFee       FeeType
	HardshipFee FeeType
}

type Handler

type Handler func(data AppData, w http.ResponseWriter, r *http.Request) error

func Dashboard

func Dashboard(tmpl template.Template, donorStore DonorStore, dashboardStore DashboardStore) Handler

func Fixtures

func Fixtures(tmpl template.Template) Handler

func Guidance

func Guidance(tmpl template.Template) Handler

func Login

func Login(logger LoginLogger, oneLoginClient LoginOneLoginClient, store sesh.Store, randomString func(int) string, redirect Path) Handler

func LoginCallback

func LoginCallback(oneLoginClient LoginCallbackOneLoginClient, sessionStore sesh.Store, redirect Path) Handler

func Root

func Root(tmpl template.Template, logger Logger) Handler

func SignOut

func SignOut(logger Logger, sessionStore sesh.Store, oneLoginClient OneLoginClient, appPublicURL string) Handler

type HealthCheckPaths

type HealthCheckPaths struct {
	Service    Path
	Dependency Path
}

type LifeSustainingTreatment

type LifeSustainingTreatment uint8
const (
	LifeSustainingTreatmentOptionA LifeSustainingTreatment = iota + 1 // option-a
	LifeSustainingTreatmentOptionB                                    // option-b
)

func ParseLifeSustainingTreatment

func ParseLifeSustainingTreatment(s string) (LifeSustainingTreatment, error)

func (LifeSustainingTreatment) Empty

func (i LifeSustainingTreatment) Empty() bool

func (LifeSustainingTreatment) IsOptionA

func (i LifeSustainingTreatment) IsOptionA() bool

func (LifeSustainingTreatment) IsOptionB

func (i LifeSustainingTreatment) IsOptionB() bool

func (LifeSustainingTreatment) String

func (i LifeSustainingTreatment) String() string

type LifeSustainingTreatmentOptions

type LifeSustainingTreatmentOptions struct {
	OptionA LifeSustainingTreatment
	OptionB LifeSustainingTreatment
}

type Limiter

type Limiter struct {
	TokenPer  time.Duration
	MaxTokens float64

	Tokens   float64
	TokensAt time.Time
	// contains filtered or unexported fields
}

Limiter is a basic rate limiter that can be serialised.

func NewLimiter

func NewLimiter(tokenPer time.Duration, initialTokens, maxTokens float64) *Limiter

func (*Limiter) Allow

func (l *Limiter) Allow(now time.Time) bool

type Localizer

type Localizer interface {
	Format(string, map[string]any) string
	T(string) string
	Count(messageID string, count int) string
	FormatCount(messageID string, count int, data map[string]interface{}) string
	ShowTranslationKeys() bool
	SetShowTranslationKeys(s bool)
	Possessive(s string) string
	Concat([]string, string) string
}

type Logger

type Logger interface {
	Print(v ...interface{})
	Request(*http.Request, error)
}

type LoginCallbackOneLoginClient

type LoginCallbackOneLoginClient interface {
	Exchange(ctx context.Context, code, nonce string) (idToken, accessToken string, err error)
	UserInfo(ctx context.Context, accessToken string) (onelogin.UserInfo, error)
}

type LoginLogger

type LoginLogger interface {
	Print(v ...interface{})
}

type LoginOneLoginClient

type LoginOneLoginClient interface {
	AuthCodeURL(state, nonce, locale string, identity bool) string
}

type Lpa

type Lpa struct {
	PK, SK string
	// Identifies the LPA being drafted
	ID string
	// A unique identifier created after sending basic LPA details to the UID service
	UID string `dynamodbav:",omitempty"`
	// Tracking when the LPA is updated
	UpdatedAt time.Time
	// The donor the LPA relates to
	Donor actor.Donor
	// Attorneys named in the LPA
	Attorneys actor.Attorneys
	// Information on how the applicant wishes their attorneys to act
	AttorneyDecisions actor.AttorneyDecisions
	// The certificate provider named in the LPA
	CertificateProvider actor.CertificateProvider
	// Who the LPA is being drafted for (set, but not used)
	WhoFor string
	// Type of LPA being drafted
	Type LpaType
	// ApplicationReason is why the application is being made
	ApplicationReason ApplicationReason
	// PreviousApplicationNumber if the application is related to an existing application
	PreviousApplicationNumber string
	// Whether the applicant wants to add replacement attorneys
	WantReplacementAttorneys form.YesNo
	// When the LPA can be used
	WhenCanTheLpaBeUsed CanBeUsedWhen
	// Preferences on life sustaining treatment (applicable to personal welfare LPAs only)
	LifeSustainingTreatmentOption LifeSustainingTreatment
	// Restrictions on attorneys actions
	Restrictions string
	// Used to show the task list
	Tasks Tasks
	// Whether the applicant has checked the LPA and is happy to share the LPA with the certificate provider
	CheckedAndHappy bool
	// Used as part of GOV.UK Pay
	PaymentDetails PaymentDetails
	// Which option has been used to complete applicant identity checks
	DonorIdentityOption identity.Option
	// Information returned by the identity service related to the applicant
	DonorIdentityUserData identity.UserData
	// Replacement attorneys named in the LPA
	ReplacementAttorneys actor.Attorneys
	// Information on how the applicant wishes their replacement attorneys to act
	ReplacementAttorneyDecisions actor.AttorneyDecisions
	// How to bring in replacement attorneys, if set
	HowShouldReplacementAttorneysStepIn ReplacementAttorneysStepIn
	// Details on how replacement attorneys must step in if HowShouldReplacementAttorneysStepIn is set to "other"
	HowShouldReplacementAttorneysStepInDetails string
	// Whether the applicant wants to notify people about the application
	DoYouWantToNotifyPeople form.YesNo
	// People to notify about the application
	PeopleToNotify actor.PeopleToNotify
	// Codes used for the certificate provider to witness signing
	WitnessCodes WitnessCodes
	// Confirmation that the applicant wants to apply to register the LPA
	WantToApplyForLpa bool
	// Confirmation that the applicant wants to sign the LPA
	WantToSignLpa bool
	// When the Lpa was signed
	Submitted time.Time
	// Whether the signing was witnessed by the certificate provider
	CPWitnessCodeValidated bool
	// Used to rate limit witnessing requests
	WitnessCodeLimiter *Limiter
	// FeeType is the type of fee the user is applying for
	FeeType FeeType
	// EvidenceFormAddress is where the form to provide evidence for a fee reduction will be sent
	EvidenceFormAddress place.Address
	// EvidenceKey is the S3 key for uploaded evidence
	EvidenceKey string

	HasSentPreviousApplicationLinkedEvent bool
	HasSentEvidenceFormRequiredEvent      bool
	HasSentReducedFeeRequestedEvent       bool
}

Lpa contains all the data related to the LPA application

func (*Lpa) ActorAddresses

func (l *Lpa) ActorAddresses() []place.Address

func (*Lpa) AttorneysAndCpSigningDeadline

func (l *Lpa) AttorneysAndCpSigningDeadline() time.Time

func (*Lpa) CanGoTo

func (l *Lpa) CanGoTo(url string) bool

func (*Lpa) DonorIdentityConfirmed

func (l *Lpa) DonorIdentityConfirmed() bool

func (*Lpa) Progress

func (l *Lpa) Progress(certificateProvider *actor.CertificateProviderProvidedDetails) Progress

type LpaAndActorTasks

type LpaAndActorTasks struct {
	Lpa                      *Lpa
	CertificateProviderTasks actor.CertificateProviderTasks
	AttorneyTasks            actor.AttorneyTasks
}

type LpaPath

type LpaPath string

func (LpaPath) Format

func (p LpaPath) Format(id string) string

func (LpaPath) String

func (p LpaPath) String() string

type LpaType

type LpaType uint8
const (
	LpaTypeHealthWelfare   LpaType = iota + 1 // hw
	LpaTypePropertyFinance                    // pfa
)

func ParseLpaType

func ParseLpaType(s string) (LpaType, error)

func (LpaType) Empty

func (i LpaType) Empty() bool

func (LpaType) IsHealthWelfare

func (i LpaType) IsHealthWelfare() bool

func (LpaType) IsPropertyFinance

func (i LpaType) IsPropertyFinance() bool

func (LpaType) LegalTermTransKey

func (e LpaType) LegalTermTransKey() string

func (LpaType) String

func (i LpaType) String() string

type LpaTypeOptions

type LpaTypeOptions struct {
	HealthWelfare   LpaType
	PropertyFinance LpaType
}

type NotifyClient

type NotifyClient interface {
	Email(ctx context.Context, email notify.Email) (string, error)
	Sms(ctx context.Context, sms notify.Sms) (string, error)
	TemplateID(id notify.Template) string
}

type OneLoginClient

type OneLoginClient interface {
	AuthCodeURL(state, nonce, locale string, identity bool) string
	EndSessionURL(idToken, postLogoutURL string) string
	Exchange(ctx context.Context, code, nonce string) (idToken, accessToken string, err error)
	UserInfo(ctx context.Context, accessToken string) (onelogin.UserInfo, error)
}

type Path

type Path string

func (Path) Format

func (p Path) Format() string

func (Path) String

func (p Path) String() string

type PaymentDetails

type PaymentDetails struct {
	// Reference generated for the payment
	PaymentReference string
	// ID returned from GOV.UK Pay
	PaymentId string
	// Amount is the amount paid in pence
	Amount int
}

type Progress

type Progress struct {
	LpaSigned                   actor.TaskState
	CertificateProviderDeclared actor.TaskState
	AttorneysDeclared           actor.TaskState
	LpaSubmitted                actor.TaskState
	StatutoryWaitingPeriod      actor.TaskState
	LpaRegistered               actor.TaskState
}

type ReplacementAttorneysStepIn

type ReplacementAttorneysStepIn uint8
const (
	ReplacementAttorneysStepInWhenAllCanNoLongerAct ReplacementAttorneysStepIn = iota + 1 // all
	ReplacementAttorneysStepInWhenOneCanNoLongerAct                                       // one
	ReplacementAttorneysStepInAnotherWay                                                  // other
)

func ParseReplacementAttorneysStepIn

func ParseReplacementAttorneysStepIn(s string) (ReplacementAttorneysStepIn, error)

func (ReplacementAttorneysStepIn) Empty

func (i ReplacementAttorneysStepIn) Empty() bool

func (ReplacementAttorneysStepIn) IsAnotherWay

func (i ReplacementAttorneysStepIn) IsAnotherWay() bool

func (ReplacementAttorneysStepIn) IsWhenAllCanNoLongerAct

func (i ReplacementAttorneysStepIn) IsWhenAllCanNoLongerAct() bool

func (ReplacementAttorneysStepIn) IsWhenOneCanNoLongerAct

func (i ReplacementAttorneysStepIn) IsWhenOneCanNoLongerAct() bool

func (ReplacementAttorneysStepIn) String

type ReplacementAttorneysStepInOptions

type ReplacementAttorneysStepInOptions struct {
	WhenAllCanNoLongerAct ReplacementAttorneysStepIn
	WhenOneCanNoLongerAct ReplacementAttorneysStepIn
	AnotherWay            ReplacementAttorneysStepIn
}

type RumConfig

type RumConfig struct {
	GuestRoleArn      string
	Endpoint          string
	ApplicationRegion string
	IdentityPoolID    string
	ApplicationID     string
}

type SessionData

type SessionData struct {
	SessionID string
	LpaID     string
}

func SessionDataFromContext

func SessionDataFromContext(ctx context.Context) (*SessionData, error)

type SessionMissingError

type SessionMissingError struct{}

func (SessionMissingError) Error

func (s SessionMissingError) Error() string

type SessionStore

type SessionStore interface {
	Get(r *http.Request, name string) (*sessions.Session, error)
	New(r *http.Request, name string) (*sessions.Session, error)
	Save(r *http.Request, w http.ResponseWriter, s *sessions.Session) error
}

type ShareCodeSender

type ShareCodeSender struct {
	// contains filtered or unexported fields
}

func NewShareCodeSender

func NewShareCodeSender(shareCodeStore ShareCodeStore, notifyClient NotifyClient, appPublicURL string, randomString func(int) string) *ShareCodeSender

func (*ShareCodeSender) SendAttorneys

func (s *ShareCodeSender) SendAttorneys(ctx context.Context, appData AppData, lpa *Lpa) error

func (*ShareCodeSender) SendCertificateProvider

func (s *ShareCodeSender) SendCertificateProvider(ctx context.Context, template notify.Template, appData AppData, identity bool, lpa *Lpa) error

func (*ShareCodeSender) UseTestCode

func (s *ShareCodeSender) UseTestCode()

type ShareCodeStore

type ShareCodeStore interface {
	Get(ctx context.Context, actorType actor.Type, shareCode string) (actor.ShareCodeData, error)
	Put(ctx context.Context, actorType actor.Type, shareCode string, data actor.ShareCodeData) error
}

type Tasks

type Tasks struct {
	YourDetails                actor.TaskState
	ChooseAttorneys            actor.TaskState
	ChooseReplacementAttorneys actor.TaskState
	WhenCanTheLpaBeUsed        actor.TaskState // pfa only
	LifeSustainingTreatment    actor.TaskState // hw only
	Restrictions               actor.TaskState
	CertificateProvider        actor.TaskState
	CheckYourLpa               actor.TaskState
	PayForLpa                  actor.PaymentTask
	ConfirmYourIdentityAndSign actor.TaskState
	PeopleToNotify             actor.TaskState
}

type Template

type Template func(io.Writer, interface{}) error

type UidClient

type UidClient interface {
	CreateCase(context.Context, *uid.CreateCaseRequestBody) (uid.CreateCaseResponse, error)
	Health(context.Context) (*http.Response, error)
}

type WitnessCode

type WitnessCode struct {
	Code    string
	Created time.Time
}

func (WitnessCode) HasExpired

func (w WitnessCode) HasExpired() bool

type WitnessCodeSender

type WitnessCodeSender struct {
	// contains filtered or unexported fields
}

func NewWitnessCodeSender

func NewWitnessCodeSender(donorStore DonorStore, notifyClient NotifyClient) *WitnessCodeSender

func (*WitnessCodeSender) Send

func (s *WitnessCodeSender) Send(ctx context.Context, lpa *Lpa, localizer Localizer) error

type WitnessCodes

type WitnessCodes []WitnessCode

func (WitnessCodes) CanRequest

func (ws WitnessCodes) CanRequest(now time.Time) bool

func (WitnessCodes) Find

func (ws WitnessCodes) Find(code string) (WitnessCode, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL