shared

package
v1.18.1-0...-06edac9 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LpaTypePersonalWelfare    = LpaType("personal-welfare")
	LpaTypePropertyAndAffairs = LpaType("property-and-affairs")
)
View Source
const (
	LpaStatusInProgress             = LpaStatus("in-progress")
	LpaStatusStatutoryWaitingPeriod = LpaStatus("statutory-waiting-period")
	LpaStatusRegistered             = LpaStatus("registered")
	LpaStatusCannotRegister         = LpaStatus("cannot-register")
	LpaStatusWithdrawn              = LpaStatus("withdrawn")
)
View Source
const (
	ChannelOnline = Channel("online")
	ChannelPaper  = Channel("paper")
)
View Source
const (
	AttorneyStatusActive      = AttorneyStatus("active")
	AttorneyStatusReplacement = AttorneyStatus("replacement")
	AttorneyStatusRemoved     = AttorneyStatus("removed")
)
View Source
const (
	IdentityCheckTypeOneLogin   = IdentityCheckType("one-login")
	IdentityCheckTypeOpgPaperId = IdentityCheckType("opg-paper-id")
)
View Source
const (
	HowMakeDecisionsUnset                            = HowMakeDecisions("")
	HowMakeDecisionsJointly                          = HowMakeDecisions("jointly")
	HowMakeDecisionsJointlyAndSeverally              = HowMakeDecisions("jointly-and-severally")
	HowMakeDecisionsJointlyForSomeSeverallyForOthers = HowMakeDecisions("jointly-for-some-severally-for-others")
)
View Source
const (
	HowStepInUnset             = HowStepIn("")
	HowStepInAllCanNoLongerAct = HowStepIn("all-can-no-longer-act")
	HowStepInOneCanNoLongerAct = HowStepIn("one-can-no-longer-act")
	HowStepInAnotherWay        = HowStepIn("another-way")
)
View Source
const (
	CanUseUnset            = CanUse("")
	CanUseWhenCapacityLost = CanUse("when-capacity-lost")
	CanUseWhenHasCapacity  = CanUse("when-has-capacity")
)
View Source
const (
	LifeSustainingTreatmentUnset   = LifeSustainingTreatment("")
	LifeSustainingTreatmentOptionA = LifeSustainingTreatment("option-a")
	LifeSustainingTreatmentOptionB = LifeSustainingTreatment("option-b")
)

Variables

View Source
var (
	LangCy = Lang("cy")
	LangEn = Lang("en")
)
View Source
var (
	ProblemInternalServerError = Problem{
		StatusCode: 500,
		Code:       "INTERNAL_SERVER_ERROR",
		Detail:     "Internal server error",
	}
	ProblemInvalidRequest = Problem{
		StatusCode: 400,
		Code:       "INVALID_REQUEST",
		Detail:     "Invalid request",
	}
	ProblemUnauthorisedRequest = Problem{
		StatusCode: 401,
		Code:       "UNAUTHORISED",
		Detail:     "Invalid JWT",
	}
	ProblemNotFoundRequest = Problem{
		StatusCode: 404,
		Code:       "NOT_FOUND",
		Detail:     "Record not found",
	}
)

Functions

func GetEventHeader

func GetEventHeader(headerName string, event events.APIGatewayProxyRequest) []string

Types

type Address

type Address struct {
	Line1    string `json:"line1"`
	Line2    string `json:"line2,omitempty"`
	Line3    string `json:"line3,omitempty"`
	Town     string `json:"town,omitempty"`
	Postcode string `json:"postcode,omitempty"`
	Country  string `json:"country"`
}

func (Address) IsZero

func (a Address) IsZero() bool

type Attorney

type Attorney struct {
	Person
	DateOfBirth               Date           `json:"dateOfBirth"`
	Email                     string         `json:"email,omitempty"`
	Status                    AttorneyStatus `json:"status"`
	Mobile                    string         `json:"mobile,omitempty"`
	SignedAt                  *time.Time     `json:"signedAt,omitempty"`
	ContactLanguagePreference Lang           `json:"contactLanguagePreference,omitempty"`
	Channel                   Channel        `json:"channel"`
}

type AttorneyStatus

type AttorneyStatus string

func (AttorneyStatus) IsValid

func (a AttorneyStatus) IsValid() bool

type AuthorDetails

type AuthorDetails struct {
	UID     string
	Service string
}

type CanUse

type CanUse string

func (CanUse) IsValid

func (e CanUse) IsValid() bool

func (CanUse) Unset

func (e CanUse) Unset() bool

type CertificateProvider

type CertificateProvider struct {
	Person
	Email                     string         `json:"email"`
	Phone                     string         `json:"phone"`
	Channel                   Channel        `json:"channel"`
	SignedAt                  *time.Time     `json:"signedAt,omitempty"`
	ContactLanguagePreference Lang           `json:"contactLanguagePreference,omitempty"`
	IdentityCheck             *IdentityCheck `json:"identityCheck,omitempty"`
}

type Change

type Change struct {
	Key string          `json:"key"`
	Old json.RawMessage `json:"old"`
	New json.RawMessage `json:"new"`
}

type Channel

type Channel string

func (Channel) IsValid

func (e Channel) IsValid() bool

type Date

type Date struct {
	IsMalformed bool
	// contains filtered or unexported fields
}

func (Date) IsZero

func (d Date) IsZero() bool

func (Date) MarshalDynamoDBAttributeValue

func (d Date) MarshalDynamoDBAttributeValue() (types.AttributeValue, error)

func (Date) MarshalText

func (d Date) MarshalText() ([]byte, error)

func (*Date) UnmarshalDynamoDBAttributeValue

func (d *Date) UnmarshalDynamoDBAttributeValue(av types.AttributeValue) error

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) error

func (*Date) UnmarshalText

func (d *Date) UnmarshalText(data []byte) error

type Donor

type Donor struct {
	Person
	DateOfBirth               Date           `json:"dateOfBirth"`
	Email                     string         `json:"email"`
	OtherNamesKnownBy         string         `json:"otherNamesKnownBy,omitempty"`
	ContactLanguagePreference Lang           `json:"contactLanguagePreference"`
	IdentityCheck             *IdentityCheck `json:"identityCheck,omitempty"`
}

type FieldError

type FieldError struct {
	Source string `json:"source"`
	Detail string `json:"detail"`
}

type File

type File struct {
	Path string `json:"path"`
	Hash string `json:"hash"`
}

type FileUpload

type FileUpload struct {
	Filename string `json:"filename"`
	Data     string `json:"data"`
}

type HowMakeDecisions

type HowMakeDecisions string

func (HowMakeDecisions) IsValid

func (e HowMakeDecisions) IsValid() bool

func (HowMakeDecisions) Unset

func (e HowMakeDecisions) Unset() bool

type HowStepIn

type HowStepIn string

func (HowStepIn) IsValid

func (e HowStepIn) IsValid() bool

type IdentityCheck

type IdentityCheck struct {
	CheckedAt time.Time         `json:"checkedAt"`
	Type      IdentityCheckType `json:"type"`
}

type IdentityCheckType

type IdentityCheckType string

func (IdentityCheckType) IsValid

func (e IdentityCheckType) IsValid() bool

type JWTVerifier

type JWTVerifier struct {
	Logger logger
	// contains filtered or unexported fields
}

func NewJWTVerifier

func NewJWTVerifier(cfg aws.Config, logger logger) JWTVerifier

func (JWTVerifier) VerifyHeader

func (v JWTVerifier) VerifyHeader(event events.APIGatewayProxyRequest) (*LpaStoreClaims, error)

verify JWT from event header returns true if verified, false otherwise

type Lang

type Lang string

func (Lang) IsValid

func (l Lang) IsValid() bool

type LifeSustainingTreatment

type LifeSustainingTreatment string

func (LifeSustainingTreatment) IsValid

func (e LifeSustainingTreatment) IsValid() bool

func (LifeSustainingTreatment) Unset

func (e LifeSustainingTreatment) Unset() bool

type LogEvent

type LogEvent struct {
	Timestamp   time.Time `json:"time"`
	Level       string    `json:"level"`
	Message     string    `json:"msg"`
	ServiceName string    `json:"service_name"`
	Status      int       `json:"status"`
	Problem     Problem   `json:"problem"`
	ErrorString string    `json:"error_string,omitempty"`
}

type Lpa

type Lpa struct {
	LpaInit
	Uid                             string     `json:"uid"`
	Status                          LpaStatus  `json:"status"`
	RegistrationDate                *time.Time `json:"registrationDate,omitempty"`
	UpdatedAt                       time.Time  `json:"updatedAt"`
	RestrictionsAndConditionsImages []File     `json:"restrictionsAndConditionsImages,omitempty"`
}

type LpaInit

type LpaInit struct {
	LpaType                                     LpaType                 `json:"lpaType"`
	Channel                                     Channel                 `json:"channel"`
	Donor                                       Donor                   `json:"donor"`
	Attorneys                                   []Attorney              `json:"attorneys"`
	TrustCorporations                           []TrustCorporation      `json:"trustCorporations,omitempty"`
	CertificateProvider                         CertificateProvider     `json:"certificateProvider"`
	PeopleToNotify                              []PersonToNotify        `json:"peopleToNotify,omitempty"`
	HowAttorneysMakeDecisions                   HowMakeDecisions        `json:"howAttorneysMakeDecisions,omitempty"`
	HowAttorneysMakeDecisionsDetails            string                  `json:"howAttorneysMakeDecisionsDetails,omitempty"`
	HowReplacementAttorneysMakeDecisions        HowMakeDecisions        `json:"howReplacementAttorneysMakeDecisions,omitempty"`
	HowReplacementAttorneysMakeDecisionsDetails string                  `json:"howReplacementAttorneysMakeDecisionsDetails,omitempty"`
	HowReplacementAttorneysStepIn               HowStepIn               `json:"howReplacementAttorneysStepIn,omitempty"`
	HowReplacementAttorneysStepInDetails        string                  `json:"howReplacementAttorneysStepInDetails,omitempty"`
	WhenTheLpaCanBeUsed                         CanUse                  `json:"whenTheLpaCanBeUsed,omitempty"`
	LifeSustainingTreatmentOption               LifeSustainingTreatment `json:"lifeSustainingTreatmentOption,omitempty"`
	RestrictionsAndConditions                   string                  `json:"restrictionsAndConditions,omitempty"`
	RestrictionsAndConditionsImages             []FileUpload            `json:"restrictionsAndConditionsImages,omitempty"`
	SignedAt                                    time.Time               `json:"signedAt"`
	CertificateProviderNotRelatedConfirmedAt    *time.Time              `json:"certificateProviderNotRelatedConfirmedAt,omitempty"`
}

type LpaStatus

type LpaStatus string

type LpaStoreClaims

type LpaStoreClaims struct {
	jwt.RegisteredClaims
}

func (LpaStoreClaims) Validate

func (l LpaStoreClaims) Validate() error

note that default validation for RegisteredClaims checks exp is in the future

type LpaType

type LpaType string

func (LpaType) IsValid

func (e LpaType) IsValid() bool

type Person

type Person struct {
	UID        string  `json:"uid"`
	FirstNames string  `json:"firstNames"`
	LastName   string  `json:"lastName"`
	Address    Address `json:"address"`
}

type PersonToNotify

type PersonToNotify struct {
	Person
}

type Problem

type Problem struct {
	StatusCode int          `json:"-"`
	Code       string       `json:"code"`
	Detail     string       `json:"detail"`
	Errors     []FieldError `json:"errors,omitempty"`
}

func (Problem) Respond

func (problem Problem) Respond() (events.APIGatewayProxyResponse, error)

type Signatory

type Signatory struct {
	FirstNames        string    `json:"firstNames"`
	LastName          string    `json:"lastName"`
	ProfessionalTitle string    `json:"professionalTitle"`
	SignedAt          time.Time `json:"signedAt"`
}

func (Signatory) IsZero

func (s Signatory) IsZero() bool

type TrustCorporation

type TrustCorporation struct {
	UID                       string         `json:"uid"`
	Name                      string         `json:"name"`
	CompanyNumber             string         `json:"companyNumber"`
	Email                     string         `json:"email,omitempty"`
	Address                   Address        `json:"address"`
	Status                    AttorneyStatus `json:"status"`
	Mobile                    string         `json:"mobile,omitempty"`
	Signatories               []Signatory    `json:"signatories,omitempty"`
	ContactLanguagePreference Lang           `json:"contactLanguagePreference,omitempty"`
	Channel                   Channel        `json:"channel"`
}

type URN

type URN string

func (URN) Details

func (u URN) Details() AuthorDetails

type Update

type Update struct {
	Id      string   `json:"id"`      // UUID for the update
	Uid     string   `json:"uid"`     // UID of the changed LPA
	Applied string   `json:"applied"` // RFC3339 datetime
	Author  URN      `json:"author"`
	Type    string   `json:"type"`
	Changes []Change `json:"changes"`
}

Jump to

Keyboard shortcuts

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