-
Notifications
You must be signed in to change notification settings - Fork 2
/
certificate_provider_provided.go
62 lines (55 loc) · 2.34 KB
/
certificate_provider_provided.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package actor
import (
"time"
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid"
"github.com/ministryofjustice/opg-modernising-lpa/internal/date"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
"github.com/ministryofjustice/opg-modernising-lpa/internal/identity"
"github.com/ministryofjustice/opg-modernising-lpa/internal/localize"
"github.com/ministryofjustice/opg-modernising-lpa/internal/place"
)
// CertificateProviderProvidedDetails contains details about the certificate provider, provided by the certificate provider
type CertificateProviderProvidedDetails struct {
PK dynamo.LpaKeyType
SK dynamo.CertificateProviderKeyType
// UID of the actor
UID actoruid.UID
// The identifier of the LPA the certificate provider is providing a certificate for
LpaID string
// Tracking when CertificateProviderProvidedDetails is updated
UpdatedAt time.Time
// Date of birth of the certificate provider
DateOfBirth date.Date
// HomeAddress is the personal address of the certificate provider
HomeAddress place.Address
// Data returned from an identity check
IdentityUserData identity.UserData
// Details of the certificate provided to the applicant
Certificate Certificate
// Tasks the certificate provider will complete
Tasks CertificateProviderTasks
// ContactLanguagePreference is the language the certificate provider prefers to receive notifications in
ContactLanguagePreference localize.Lang
// Email is the email address returned from OneLogin when the certificate provider logged in
Email string
}
func (c CertificateProviderProvidedDetails) Signed(after time.Time) bool {
return c.Certificate.Agreed.After(after)
}
func (c *CertificateProviderProvidedDetails) CertificateProviderIdentityConfirmed(firstNames, lastName string) bool {
return c.IdentityUserData.OK &&
c.IdentityUserData.MatchName(firstNames, lastName) &&
c.IdentityUserData.DateOfBirth.Equals(c.DateOfBirth)
}
type Certificate struct {
// Confirmation the certificate provider agrees to the 'provide a certificate' statement and that ticking box is a legal signature
AgreeToStatement bool
// Date and time the certificate provider provided the certificate
Agreed time.Time
}
type CertificateProviderTasks struct {
ConfirmYourDetails TaskState
ConfirmYourIdentity TaskState
ReadTheLpa TaskState
ProvideTheCertificate TaskState
}