diff --git a/docs/example-lpa.json b/docs/example-lpa.json index 171fac80..ddd82528 100644 --- a/docs/example-lpa.json +++ b/docs/example-lpa.json @@ -58,6 +58,7 @@ }, "lifeSustainingTreatmentOption": "option-a", "signedAt": "2024-01-10T23:00:00Z", + "witnessedByCertificateProviderAt": "2024-01-11T01:00:00Z", "certificateProviderNotRelatedConfirmedAt": "2024-01-11T22:00:00Z", "howAttorneysMakeDecisions": "jointly" } diff --git a/docs/schemas/2024-10/donor-details.json b/docs/schemas/2024-10/donor-details.json index 6fc15dd3..2d49ca16 100644 --- a/docs/schemas/2024-10/donor-details.json +++ b/docs/schemas/2024-10/donor-details.json @@ -177,6 +177,14 @@ "type": "string", "format": "date-time" }, + "witnessedByCertificateProviderAt": { + "type": "string", + "format": "date-time" + }, + "witnessedByIndependentWitnessAt": { + "type": "string", + "format": "date-time" + }, "certificateProviderNotRelatedConfirmedAt": { "type": "string", "format": "date-time" diff --git a/internal/shared/lpa.go b/internal/shared/lpa.go index 1d075e59..1e5bd7fb 100644 --- a/internal/shared/lpa.go +++ b/internal/shared/lpa.go @@ -25,6 +25,8 @@ type LpaInit struct { RestrictionsAndConditions string `json:"restrictionsAndConditions,omitempty"` RestrictionsAndConditionsImages []FileUpload `json:"restrictionsAndConditionsImages,omitempty"` SignedAt time.Time `json:"signedAt"` + WitnessedByCertificateProviderAt time.Time `json:"witnessedByCertificateProviderAt"` + WitnessedByIndependentWitnessAt *time.Time `json:"witnessedByIndependentWitnessAt,omitempty"` CertificateProviderNotRelatedConfirmedAt *time.Time `json:"certificateProviderNotRelatedConfirmedAt,omitempty"` } diff --git a/internal/shared/lpa_test.go b/internal/shared/lpa_test.go index 4cb2e1a2..3c582f50 100644 --- a/internal/shared/lpa_test.go +++ b/internal/shared/lpa_test.go @@ -13,7 +13,7 @@ func TestLpaInitMarshalJSON(t *testing.T) { "donor":{"uid":"","firstNames":"","lastName":"","address":{"line1":"","country":""},"dateOfBirth":"","email":"","contactLanguagePreference":""}, "attorneys":null, "certificateProvider":{"uid":"","firstNames":"","lastName":"","address":{"line1":"","country":""},"email":"","phone":"","channel":""}, -"signedAt":"0001-01-01T00:00:00Z" +"signedAt":"0001-01-01T00:00:00Z","witnessedByCertificateProviderAt":"0001-01-01T00:00:00Z" }` data, _ := json.Marshal(LpaInit{}) diff --git a/lambda/create/main_test.go b/lambda/create/main_test.go index ba995041..c99abdb9 100644 --- a/lambda/create/main_test.go +++ b/lambda/create/main_test.go @@ -67,8 +67,9 @@ var ( Phone: "0777777777", ContactLanguagePreference: shared.LangEn, }, - WhenTheLpaCanBeUsed: shared.CanUseWhenHasCapacity, - SignedAt: testNow, + WhenTheLpaCanBeUsed: shared.CanUseWhenHasCapacity, + SignedAt: testNow, + WitnessedByCertificateProviderAt: testNow, } ) diff --git a/lambda/create/validate.go b/lambda/create/validate.go index f9bcda86..1cfe0c61 100644 --- a/lambda/create/validate.go +++ b/lambda/create/validate.go @@ -73,6 +73,8 @@ func Validate(lpa shared.LpaInit) []shared.FieldError { validate.IsValid("/whenTheLpaCanBeUsed", lpa.WhenTheLpaCanBeUsed), validate.Unset("/lifeSustainingTreatmentOption", lpa.LifeSustainingTreatmentOption))), validate.Time("/signedAt", lpa.SignedAt), + // validate.Time("/witnessedByCertificateProviderAt", lpa.WitnessedByCertificateProviderAt), + // validate.OptionalTime("/witnessedByIndependentWitnessAt", lpa.WitnessedByIndependentWitnessAt), validate.OptionalTime("/certificateProviderNotRelatedConfirmedAt", lpa.CertificateProviderNotRelatedConfirmedAt), ) } diff --git a/lambda/create/validate_test.go b/lambda/create/validate_test.go index e1fbff28..92983997 100644 --- a/lambda/create/validate_test.go +++ b/lambda/create/validate_test.go @@ -89,10 +89,11 @@ func makeLpaWithDonorAndActors() shared.LpaInit { ContactLanguagePreference: shared.LangEn, DateOfBirth: newDate("1956-08-08"), }, - CertificateProvider: makeCertificateProvider(), - Attorneys: []shared.Attorney{makeAttorney()}, - SignedAt: time.Now(), - WhenTheLpaCanBeUsed: shared.CanUseWhenHasCapacity, + CertificateProvider: makeCertificateProvider(), + Attorneys: []shared.Attorney{makeAttorney()}, + SignedAt: time.Now(), + WitnessedByCertificateProviderAt: time.Now(), + WhenTheLpaCanBeUsed: shared.CanUseWhenHasCapacity, } } @@ -212,6 +213,7 @@ func TestValidateLpaInvalid(t *testing.T) { {Source: "/certificateProvider/phone", Detail: "field is required"}, {Source: "/attorneys", Detail: "at least one attorney is required"}, {Source: "/signedAt", Detail: "field is required"}, + // {Source: "/witnessedByCertificateProviderAt", Detail: "field is required"}, }, }, "online certificate provider missing email": {