Skip to content

Commit

Permalink
Vega 2656 add appointment type and new status (#277)
Browse files Browse the repository at this point in the history
* VEGA-2656 add appointment type and new status to Attorney struct

* Update unit tests

* make appointmentType optional

* Revert counting attorneys by appointmentType
  • Loading branch information
MishNajam authored Nov 18, 2024
1 parent 8949811 commit ca27962
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 19 deletions.
1 change: 1 addition & 0 deletions docs/example-lpa.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"dateOfBirth": "1982-07-24",
"status": "active",
"appointmentType": "original",
"channel": "paper"
}
],
Expand Down
8 changes: 8 additions & 0 deletions docs/schemas/2024-10/lpa.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@
"signedAt": {
"type": "string",
"format": "date-time"
},
"status": {
"type": "string",
"enum": ["active", "inactive", "replacement", "removed"]
},
"appointmentType": {
"type": "string",
"enum": ["original", "replacement"]
}
}
}
Expand Down
31 changes: 22 additions & 9 deletions internal/shared/person.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,37 @@ type AttorneyStatus string

const (
AttorneyStatusActive = AttorneyStatus("active")
AttorneyStatusInactive = AttorneyStatus("inactive")
AttorneyStatusReplacement = AttorneyStatus("replacement")
AttorneyStatusRemoved = AttorneyStatus("removed")
)

func (a AttorneyStatus) IsValid() bool {
return a == AttorneyStatusActive || a == AttorneyStatusReplacement || a == AttorneyStatusRemoved
return a == AttorneyStatusActive || a == AttorneyStatusReplacement || a == AttorneyStatusRemoved || a == AttorneyStatusInactive
}

type AppointmentType string

const (
AppointmentTypeOriginal = AppointmentType("original")
AppointmentTypeReplacement = AppointmentType("replacement")
)

func (a AppointmentType) IsValid() bool {
return true
}

type Attorney struct {
Person
Address Address `json:"address"`
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"`
Address Address `json:"address"`
DateOfBirth Date `json:"dateOfBirth"`
Email string `json:"email,omitempty"`
Status AttorneyStatus `json:"status"`
AppointmentType AppointmentType `json:"appointmentType"`
Mobile string `json:"mobile,omitempty"`
SignedAt *time.Time `json:"signedAt,omitempty"`
ContactLanguagePreference Lang `json:"contactLanguagePreference,omitempty"`
Channel Channel `json:"channel"`
}

type TrustCorporation struct {
Expand Down
1 change: 1 addition & 0 deletions lambda/create/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var (
Line1: "attorney-line1",
Country: "GB",
},
AppointmentType: shared.AppointmentTypeOriginal,
DateOfBirth: makeDate("2020-02-03"),
ContactLanguagePreference: shared.LangEn,
Status: shared.AttorneyStatusActive,
Expand Down
22 changes: 12 additions & 10 deletions lambda/create/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ func makeAttorney() shared.Attorney {
FirstNames: "Sharonda",
LastName: "Graciani",
},
Address: validAddress,
Email: "[email protected]",
Channel: shared.ChannelOnline,
DateOfBirth: newDate("1977-10-30"),
Status: shared.AttorneyStatusActive,
Address: validAddress,
AppointmentType: shared.AppointmentTypeOriginal,
Email: "[email protected]",
Channel: shared.ChannelOnline,
DateOfBirth: newDate("1977-10-30"),
Status: shared.AttorneyStatusActive,
}
}

Expand All @@ -41,11 +42,12 @@ func makeReplacementAttorney() shared.Attorney {
FirstNames: "Sharonda",
LastName: "Graciani",
},
Address: validAddress,
Email: "[email protected]",
Channel: shared.ChannelOnline,
DateOfBirth: newDate("1977-10-30"),
Status: shared.AttorneyStatusReplacement,
Address: validAddress,
AppointmentType: shared.AppointmentTypeReplacement,
Email: "[email protected]",
Channel: shared.ChannelOnline,
DateOfBirth: newDate("1977-10-30"),
Status: shared.AttorneyStatusReplacement,
}
}

Expand Down
1 change: 1 addition & 0 deletions mock-apigw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ func handlePactState(r *http.Request) error {
"lastName": "Vallar",
"dateOfBirth": "2001-01-17",
"status": "active",
"appointmentType": "original",
"address": {
"line1": "71 South Western Terrace",
"town": "Milton",
Expand Down

0 comments on commit ca27962

Please sign in to comment.