-
Notifications
You must be signed in to change notification settings - Fork 2
/
attorney_provided.go
79 lines (72 loc) · 2.74 KB
/
attorney_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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package actor
import (
"time"
"github.com/ministryofjustice/opg-modernising-lpa/internal/actor/actoruid"
"github.com/ministryofjustice/opg-modernising-lpa/internal/dynamo"
"github.com/ministryofjustice/opg-modernising-lpa/internal/form"
"github.com/ministryofjustice/opg-modernising-lpa/internal/localize"
)
// AttorneyProvidedDetails contains details about an attorney or replacement
// attorney, provided by the attorney or replacement attorney
type AttorneyProvidedDetails struct {
PK dynamo.LpaKeyType
SK dynamo.AttorneyKeyType
// The identifier of the attorney or replacement attorney being edited
UID actoruid.UID
// The identifier of the LPA the attorney or replacement attorney is named in
LpaID string
// Tracking when AttorneyProvidedDetails is updated
UpdatedAt time.Time
// IsReplacement is true when the details relate to an attorney appointed as a
// replacement
IsReplacement bool
// IsTrustCorporation is true when the details relate to a trust corporation
IsTrustCorporation bool
// Mobile number of the attorney or replacement attorney
Mobile string
// SignedAt is when the attorney or replacement attorney submitted their
// signature
SignedAt time.Time
// WouldLikeSecondSignatory captures whether two signatories will be used for
// a trust corporation
WouldLikeSecondSignatory form.YesNo
// AuthorisedSignatories captures the details of the person who signed on
// behalf of a trust corporation, if one is acting as an attorney
AuthorisedSignatories [2]TrustCorporationSignatory
// Used to show attorney task list
Tasks AttorneyTasks
// ContactLanguagePreference is the language the attorney or replacement
// attorney prefers to receive notifications in
ContactLanguagePreference localize.Lang
// Email is the email address returned from OneLogin when the attorney logged in
Email string
}
// Signed checks whether the attorney has confirmed and if that confirmation is
// still valid by checking that it was made for the donor's current signature.
func (d AttorneyProvidedDetails) Signed() bool {
if d.IsTrustCorporation {
switch d.WouldLikeSecondSignatory {
case form.Yes:
return !d.AuthorisedSignatories[0].SignedAt.IsZero() &&
!d.AuthorisedSignatories[1].SignedAt.IsZero()
case form.No:
return !d.AuthorisedSignatories[0].SignedAt.IsZero()
default:
return false
}
}
return !d.SignedAt.IsZero()
}
type AttorneyTasks struct {
ConfirmYourDetails TaskState
ReadTheLpa TaskState
SignTheLpa TaskState
SignTheLpaSecond TaskState
}
// TrustCorporationSignatory contains the details of a person who signed the LPA on behalf of a trust corporation
type TrustCorporationSignatory struct {
FirstNames string
LastName string
ProfessionalTitle string
SignedAt time.Time
}