diff --git a/docker-compose.yml b/docker-compose.yml
index 4c4e667a78..67ea6bfbfe 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -66,6 +66,7 @@ services:
XDEBUG_MODE: develop,debug,coverage
SESSION_EXPIRES: 30 # session expiry length to support timeout message.
COOKIE_EXPIRES: 1440 # cookie expiry for complete logout - initial value to be 24 hours.
+ SUPPORT_DATASTORE_LPAS: "false"
depends_on:
- api-web
diff --git a/service-front/app/src/Common/src/Entity/Address.php b/service-front/app/src/Common/src/Entity/Address.php
index 74bdb876a9..a90f36da11 100644
--- a/service-front/app/src/Common/src/Entity/Address.php
+++ b/service-front/app/src/Common/src/Entity/Address.php
@@ -6,7 +6,7 @@
class Address
{
- protected int $id;
+ protected ?int $id = null;
protected ?string $town = null;
protected ?string $county = null;
protected ?string $postcode = null;
@@ -16,14 +16,15 @@ class Address
protected ?string $addressLine2 = null;
protected ?string $addressLine3 = null;
- public function getId(): int
+ public function getId(): ?int
{
return $this->id;
}
- public function setId(int $id): void
+ public function setId(int $id): self
{
$this->id = $id;
+ return $this;
}
public function getTown(): ?string
@@ -31,9 +32,10 @@ public function getTown(): ?string
return $this->town;
}
- public function setTown(string $town): void
+ public function setTown(string $town): self
{
$this->town = $town;
+ return $this;
}
public function getCounty(): ?string
@@ -41,9 +43,10 @@ public function getCounty(): ?string
return $this->county;
}
- public function setCounty(string $county): void
+ public function setCounty(?string $county): self
{
$this->county = $county;
+ return $this;
}
public function getPostcode(): ?string
@@ -51,9 +54,10 @@ public function getPostcode(): ?string
return $this->postcode;
}
- public function setPostcode(string $postcode): void
+ public function setPostcode(string $postcode): self
{
$this->postcode = $postcode;
+ return $this;
}
public function getCountry(): ?string
@@ -61,9 +65,10 @@ public function getCountry(): ?string
return $this->country;
}
- public function setCountry(string $country): void
+ public function setCountry(?string $country): self
{
$this->country = $country;
+ return $this;
}
public function getType(): ?string
@@ -71,9 +76,10 @@ public function getType(): ?string
return $this->type;
}
- public function setType(string $type): void
+ public function setType(string $type): self
{
$this->type = $type;
+ return $this;
}
public function getAddressLine1(): ?string
@@ -81,9 +87,10 @@ public function getAddressLine1(): ?string
return $this->addressLine1;
}
- public function setAddressLine1(string $addressLine1): void
+ public function setAddressLine1(string $addressLine1): self
{
$this->addressLine1 = $addressLine1;
+ return $this;
}
public function getAddressLine2(): ?string
@@ -91,9 +98,10 @@ public function getAddressLine2(): ?string
return $this->addressLine2;
}
- public function setAddressLine2(string $addressLine2): void
+ public function setAddressLine2(?string $addressLine2): self
{
$this->addressLine2 = $addressLine2;
+ return $this;
}
public function getAddressLine3(): ?string
@@ -101,8 +109,9 @@ public function getAddressLine3(): ?string
return $this->addressLine3;
}
- public function setAddressLine3(string $addressLine3): void
+ public function setAddressLine3(?string $addressLine3): self
{
$this->addressLine3 = $addressLine3;
+ return $this;
}
}
diff --git a/service-front/app/src/Common/src/Entity/Casters/CastToCaseSubtype.php b/service-front/app/src/Common/src/Entity/Casters/CastToCaseSubtype.php
index e2e8492b26..fde91da5d6 100644
--- a/service-front/app/src/Common/src/Entity/Casters/CastToCaseSubtype.php
+++ b/service-front/app/src/Common/src/Entity/Casters/CastToCaseSubtype.php
@@ -12,8 +12,12 @@
#[Attribute(Attribute::TARGET_PARAMETER)]
class CastToCaseSubtype implements PropertyCaster
{
- public function cast(mixed $value, ObjectMapper $hydrator): string
+ public function cast(mixed $value, ObjectMapper $hydrator): ?string
{
- return LpaType::fromShortName($value)->value;
+ if (is_null(LpaType::tryFrom($value))) {
+ return LpaType::fromShortName($value)->value;
+ }
+
+ return LpaType::from($value)->value;
}
}
diff --git a/service-front/app/src/Common/src/Entity/Casters/CastToHowAttorneysMakeDecisions.php b/service-front/app/src/Common/src/Entity/Casters/CastToHowAttorneysMakeDecisions.php
new file mode 100644
index 0000000000..803ae9b490
--- /dev/null
+++ b/service-front/app/src/Common/src/Entity/Casters/CastToHowAttorneysMakeDecisions.php
@@ -0,0 +1,20 @@
+value;
+ }
+}
diff --git a/service-front/app/src/Common/src/Entity/Casters/CastToLifeSustainingTreatment.php b/service-front/app/src/Common/src/Entity/Casters/CastToLifeSustainingTreatment.php
index 11b6704220..1237a5d015 100644
--- a/service-front/app/src/Common/src/Entity/Casters/CastToLifeSustainingTreatment.php
+++ b/service-front/app/src/Common/src/Entity/Casters/CastToLifeSustainingTreatment.php
@@ -6,6 +6,7 @@
use Common\Enum\LifeSustainingTreatment;
use Attribute;
+use Common\Enum\LpaType;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;
@@ -14,6 +15,10 @@ class CastToLifeSustainingTreatment implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): mixed
{
+ if (is_null(LifeSustainingTreatment::tryFrom($value))) {
+ return LifeSustainingTreatment::fromShortName($value)->value;
+ }
+
return LifeSustainingTreatment::from($value)->value;
}
}
diff --git a/service-front/app/src/Common/src/Entity/Casters/CastToWhenTheLpaCanBeUsed.php b/service-front/app/src/Common/src/Entity/Casters/CastToWhenTheLpaCanBeUsed.php
index e9407be681..adc5df7566 100644
--- a/service-front/app/src/Common/src/Entity/Casters/CastToWhenTheLpaCanBeUsed.php
+++ b/service-front/app/src/Common/src/Entity/Casters/CastToWhenTheLpaCanBeUsed.php
@@ -4,8 +4,8 @@
namespace Common\Entity\Casters;
-use Common\Enum\HowAttorneysMakeDecisions;
use Attribute;
+use Common\Enum\WhenTheLpaCanBeUsed;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;
@@ -14,6 +14,14 @@ class CastToWhenTheLpaCanBeUsed implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): ?string
{
- return HowAttorneysMakeDecisions::from($value)->value;
+ if (is_null(WhenTheLpaCanBeUsed::tryFrom($value))) {
+ $value = match ($value) {
+ 'when registered' => WhenTheLpaCanBeUsed::WHEN_HAS_CAPACITY->value,
+ 'loss of capacity' => WhenTheLpaCanBeUsed::WHEN_CAPACITY_LOST->value,
+ default => '',
+ };
+ }
+
+ return WhenTheLpaCanBeUsed::from($value)->value;
}
}
diff --git a/service-front/app/src/Common/src/Entity/Casters/ExtractPostcodeFromLpaStore.php b/service-front/app/src/Common/src/Entity/Casters/ExtractPostcodeFromLpaStore.php
new file mode 100644
index 0000000000..06027f9962
--- /dev/null
+++ b/service-front/app/src/Common/src/Entity/Casters/ExtractPostcodeFromLpaStore.php
@@ -0,0 +1,22 @@
+format('Y-m-d H:i:s.uO');
- }
- });
-
- return $data;
- }
-
public function getLpaDonorSignatureDate(): ?DateTimeImmutable
{
return $this->lpaDonorSignatureDate;
@@ -84,4 +76,59 @@ public function getCaseSubtype(): string
{
return $this->caseSubtype->value;
}
+
+ public function getStatus(): ?string
+ {
+ return $this->status;
+ }
+
+ public function getLifeSustainingTreatment(): string
+ {
+ return $this->lifeSustainingTreatment->value;
+ }
+
+ public function getHowAttorneysMakeDecisions(): HowAttorneysMakeDecisions
+ {
+ return $this->howAttorneysMakeDecisions;
+ }
+
+ public function getCaseAttorneySingular(): bool
+ {
+ return $this->howAttorneysMakeDecisions === HowAttorneysMakeDecisions::SINGULAR;
+ }
+
+ public function getCaseAttorneyJointly(): bool
+ {
+ return $this->howAttorneysMakeDecisions === HowAttorneysMakeDecisions::JOINTLY;
+ }
+
+ public function getCaseAttorneyJointlyAndSeverally(): bool
+ {
+ return $this->howAttorneysMakeDecisions === HowAttorneysMakeDecisions::JOINTLY_AND_SEVERALLY;
+ }
+
+ public function getCaseAttorneyJointlyAndJointlyAndSeverally(): bool
+ {
+ return $this->howAttorneysMakeDecisions === HowAttorneysMakeDecisions::JOINTLY_FOR_SOME_SEVERALLY_FOR_OTHERS;
+ }
+
+ public function getActiveAttorneys(): ?array
+ {
+ return $this->attorneys;
+ }
+
+ public function getTrustCorporations(): ?array
+ {
+ return $this->trustCorporations;
+ }
+
+ public function getWhenTheLpaCanBeUsed(): WhenTheLpaCanBeUsed
+ {
+ return $this->whenTheLpaCanBeUsed;
+ }
+
+ public function getLpaType(): LpaType
+ {
+ return LpaType::from($this->getCaseSubtype());
+ }
}
diff --git a/service-front/app/src/Common/src/Entity/LpaStore/LpaStore.php b/service-front/app/src/Common/src/Entity/LpaStore/LpaStore.php
index b442ded1a2..f58d77040f 100644
--- a/service-front/app/src/Common/src/Entity/LpaStore/LpaStore.php
+++ b/service-front/app/src/Common/src/Entity/LpaStore/LpaStore.php
@@ -6,27 +6,24 @@
use Common\Entity\Casters\CastSingleDonor;
use Common\Entity\Casters\CastToCaseSubtype;
+use Common\Entity\Casters\CastToHowAttorneysMakeDecisions;
use Common\Entity\Casters\CastToLifeSustainingTreatment;
use Common\Entity\Casters\CastToWhenTheLpaCanBeUsed;
use Common\Entity\CombinedLpa;
use Common\Enum\HowAttorneysMakeDecisions;
use Common\Enum\LifeSustainingTreatment;
use Common\Enum\LpaType;
+use Common\Enum\WhenTheLpaCanBeUsed;
use DateTimeImmutable;
-use EventSauce\ObjectHydrator\DoNotSerialize;
use EventSauce\ObjectHydrator\MapFrom;
use EventSauce\ObjectHydrator\PropertyCasters\CastListToType;
-use JsonSerializable;
-class LpaStore extends CombinedLpa implements JsonSerializable
+class LpaStore extends CombinedLpa
{
public function __construct(
?bool $applicationHasGuidance,
?bool $applicationHasRestrictions,
?string $applicationType,
- #[MapFrom('howAttorneysMakeDecisions')]
- #[CastToWhenTheLpaCanBeUsed]
- ?HowAttorneysMakeDecisions $attorneyActDecisions,
#[CastListToType(LpaStoreAttorney::class)]
?array $attorneys,
#[MapFrom('lpaType')]
@@ -37,6 +34,9 @@ public function __construct(
#[CastSingleDonor]
?object $donor,
?bool $hasSeveranceWarning,
+ #[MapFrom('howAttorneysMakeDecisions')]
+ #[CastToHowAttorneysMakeDecisions]
+ ?HowAttorneysMakeDecisions $howAttorneysMakeDecisions,
?DateTimeImmutable $invalidDate,
#[MapFrom('lifeSustainingTreatmentOption')]
#[CastToLifeSustainingTreatment]
@@ -56,18 +56,21 @@ public function __construct(
#[MapFrom('uid')]
?string $uId,
?DateTimeImmutable $withdrawnDate,
+ #[MapFrom('whenTheLpaCanBeUsed')]
+ #[CastToWhenTheLpaCanBeUsed]
+ ?WhenTheLpaCanBeUsed $whenTheLpaCanBeUsed,
) {
parent::__construct(
$applicationHasGuidance,
$applicationHasRestrictions,
$applicationType,
- $attorneyActDecisions,
$attorneys,
$caseSubtype,
$channel,
$dispatchDate,
$donor,
$hasSeveranceWarning,
+ $howAttorneysMakeDecisions,
$invalidDate,
$lifeSustainingTreatment,
$lpaDonorSignatureDate,
@@ -81,21 +84,8 @@ public function __construct(
$statusDate,
$trustCorporations,
$uId,
- $withdrawnDate
+ $withdrawnDate,
+ $whenTheLpaCanBeUsed
);
}
-
- #[DoNotSerialize]
- public function jsonSerialize(): mixed
- {
- $data = get_object_vars($this);
-
- array_walk($data, function (&$value) {
- if ($value instanceof DateTimeImmutable) {
- $value = $value->format('Y-m-d H:i:s.uO');
- }
- });
-
- return $data;
- }
}
diff --git a/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreAttorney.php b/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreAttorney.php
index 5b5fc2790e..cd0b593ede 100644
--- a/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreAttorney.php
+++ b/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreAttorney.php
@@ -6,21 +6,20 @@
use Common\Entity\Casters\ExtractAddressLine1FromLpaStore;
use Common\Entity\Casters\ExtractCountryFromLpaStore;
+use Common\Entity\Casters\ExtractPostcodeFromLpaStore;
use Common\Entity\Casters\ExtractTownFromLpaStore;
use Common\Entity\Person;
use DateTimeImmutable;
-use EventSauce\ObjectHydrator\DoNotSerialize;
use EventSauce\ObjectHydrator\MapFrom;
-use JsonSerializable;
-class LpaStoreAttorney extends Person implements JsonSerializable
+class LpaStoreAttorney extends Person
{
public function __construct(
#[MapFrom('address')]
#[ExtractAddressLine1FromLpaStore]
- ?string $addressLine1,
- ?string $addressLine2,
- ?string $addressLine3,
+ ?string $line1,
+ ?string $line2,
+ ?string $line3,
#[MapFrom('address')]
#[ExtractCountryFromLpaStore]
?string $country,
@@ -34,6 +33,8 @@ public function __construct(
?string $firstnames,
?string $name,
?string $otherNames,
+ #[MapFrom('address')]
+ #[ExtractPostcodeFromLpaStore]
?string $postcode,
#[MapFrom('lastName')]
?string $surname,
@@ -47,9 +48,9 @@ public function __construct(
?string $uId,
) {
parent::__construct(
- $addressLine1,
- $addressLine2,
- $addressLine3,
+ $line1,
+ $line2,
+ $line3,
$country,
$county,
$dob,
@@ -66,18 +67,4 @@ public function __construct(
$uId,
);
}
-
- #[DoNotSerialize]
- public function jsonSerialize(): mixed
- {
- $data = get_object_vars($this);
-
- array_walk($data, function (&$value) {
- if ($value instanceof DateTimeImmutable) {
- $value = $value->format('Y-m-d H:i:s.uO');
- }
- });
-
- return $data;
- }
}
diff --git a/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreDonor.php b/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreDonor.php
index 016751441a..17be4bd4b3 100644
--- a/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreDonor.php
+++ b/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreDonor.php
@@ -6,21 +6,20 @@
use Common\Entity\Casters\ExtractAddressLine1FromLpaStore;
use Common\Entity\Casters\ExtractCountryFromLpaStore;
+use Common\Entity\Casters\ExtractPostcodeFromLpaStore;
use Common\Entity\Casters\ExtractTownFromLpaStore;
use Common\Entity\Person;
use DateTimeImmutable;
-use EventSauce\ObjectHydrator\DoNotSerialize;
use EventSauce\ObjectHydrator\MapFrom;
-use JsonSerializable;
-class LpaStoreDonor extends Person implements JsonSerializable
+class LpaStoreDonor extends Person
{
public function __construct(
#[MapFrom('address')]
#[ExtractAddressLine1FromLpaStore]
- ?string $addressLine1,
- ?string $addressLine2,
- ?string $addressLine3,
+ ?string $line1,
+ ?string $line2,
+ ?string $line3,
#[MapFrom('address')]
#[ExtractCountryFromLpaStore]
?string $country,
@@ -33,6 +32,8 @@ public function __construct(
?string $firstnames,
?string $name,
?string $otherNames,
+ #[MapFrom('address')]
+ #[ExtractPostcodeFromLpaStore]
?string $postcode,
#[MapFrom('lastName')]
?string $surname,
@@ -46,9 +47,9 @@ public function __construct(
?string $uId,
) {
parent::__construct(
- $addressLine1,
- $addressLine2,
- $addressLine3,
+ $line1,
+ $line2,
+ $line3,
$country,
$county,
$dob,
@@ -65,18 +66,4 @@ public function __construct(
$uId,
);
}
-
- #[DoNotSerialize]
- public function jsonSerialize(): mixed
- {
- $data = get_object_vars($this);
-
- array_walk($data, function (&$value) {
- if ($value instanceof DateTimeImmutable) {
- $value = $value->format('Y-m-d H:i:s.uO');
- }
- });
-
- return $data;
- }
}
diff --git a/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreTrustCorporations.php b/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreTrustCorporations.php
index b53dfea21f..10e83d3a13 100644
--- a/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreTrustCorporations.php
+++ b/service-front/app/src/Common/src/Entity/LpaStore/LpaStoreTrustCorporations.php
@@ -6,6 +6,7 @@
use Common\Entity\Casters\ExtractAddressLine1FromLpaStore;
use Common\Entity\Casters\ExtractCountryFromLpaStore;
+use Common\Entity\Casters\ExtractPostcodeFromLpaStore;
use Common\Entity\Casters\ExtractTownFromLpaStore;
use Common\Entity\Person;
use DateTimeImmutable;
@@ -16,9 +17,9 @@ class LpaStoreTrustCorporations extends Person
public function __construct(
#[MapFrom('address')]
#[ExtractAddressLine1FromLpaStore]
- ?string $addressLine1,
- ?string $addressLine2,
- ?string $addressLine3,
+ ?string $line1,
+ ?string $line2,
+ ?string $line3,
#[MapFrom('name')]
public readonly ?string $companyName,
#[MapFrom('address')]
@@ -32,6 +33,8 @@ public function __construct(
?string $firstnames,
?string $name,
?string $otherNames,
+ #[MapFrom('address')]
+ #[ExtractPostcodeFromLpaStore]
?string $postcode,
?string $surname,
#[MapFrom('status')]
@@ -44,9 +47,9 @@ public function __construct(
?string $uId,
) {
parent::__construct(
- $addressLine1,
- $addressLine2,
- $addressLine3,
+ $line1,
+ $line2,
+ $line3,
$country,
$county,
$dob,
diff --git a/service-front/app/src/Common/src/Entity/Person.php b/service-front/app/src/Common/src/Entity/Person.php
index 4ef7eba0af..35f71c6eaa 100644
--- a/service-front/app/src/Common/src/Entity/Person.php
+++ b/service-front/app/src/Common/src/Entity/Person.php
@@ -5,6 +5,7 @@
namespace Common\Entity;
use DateTimeImmutable;
+use EventSauce\ObjectHydrator\DoNotSerialize;
class Person
{
@@ -49,9 +50,63 @@ public function getSurname(): ?string
return $this->surname;
}
- public function getDob(): DateTimeImmutable|null
+ public function getDob(): ?DateTimeImmutable
{
return $this->dob;
}
+ public function getLine1(): ?string
+ {
+ return $this->addressLine1;
+ }
+
+ public function getLine2(): ?string
+ {
+ return $this->addressLine2;
+ }
+
+ public function getLine3(): ?string
+ {
+ return $this->addressLine3;
+ }
+
+ public function getTown(): ?string
+ {
+ return $this->town;
+ }
+
+ public function getCounty(): ?string
+ {
+ return $this->county;
+ }
+
+ public function getPostCode(): ?string
+ {
+ return $this->postcode;
+ }
+
+ public function getCountry(): ?string
+ {
+ return $this->country;
+ }
+
+
+ public function getCompanyName(): ?string
+ {
+ return $this->name;
+ }
+
+ public function getAddresses(): array
+ {
+ return [
+ (new Address())
+ ->setAddressLine1($this->getLine1())
+ ->setAddressLine2($this->getLine2())
+ ->setAddressLine3($this->getLine3())
+ ->setTown($this->getTown())
+ ->setCounty($this->getCounty())
+ ->setPostcode($this->getPostCode())
+ ->setCountry($this->getCountry()),
+ ];
+ }
}
diff --git a/service-front/app/src/Common/src/Entity/Sirius/SiriusLpa.php b/service-front/app/src/Common/src/Entity/Sirius/SiriusLpa.php
index e6aa758825..402e699395 100644
--- a/service-front/app/src/Common/src/Entity/Sirius/SiriusLpa.php
+++ b/service-front/app/src/Common/src/Entity/Sirius/SiriusLpa.php
@@ -4,12 +4,16 @@
namespace Common\Entity\Sirius;
+use Common\Entity\Casters\CastToCaseSubtype;
+use Common\Entity\Casters\CastToHowAttorneysMakeDecisions;
use Common\Entity\Casters\CastToWhenTheLpaCanBeUsed;
use Common\Entity\CombinedLpa;
use Common\Enum\HowAttorneysMakeDecisions;
use Common\Enum\LifeSustainingTreatment;
use Common\Enum\LpaType;
+use Common\Enum\WhenTheLpaCanBeUsed;
use DateTimeImmutable;
+use EventSauce\ObjectHydrator\MapFrom;
use EventSauce\ObjectHydrator\PropertyCasters\CastListToType;
use Common\Entity\Casters\CastSiriusDonor;
use Common\Entity\Casters\CastToSiriusLifeSustainingTreatment;
@@ -20,16 +24,17 @@ public function __construct(
?bool $applicationHasGuidance,
?bool $applicationHasRestrictions,
?string $applicationType,
- #[CastToWhenTheLpaCanBeUsed]
- ?HowAttorneysMakeDecisions $attorneyActDecisions,
#[CastListToType(SiriusLpaAttorney::class)]
?array $attorneys,
+ #[CastToCaseSubtype]
?LpaType $caseSubtype,
?string $channel,
?DateTimeImmutable $dispatchDate,
#[CastSiriusDonor]
?object $donor,
?bool $hasSeveranceWarning,
+ #[CastToHowAttorneysMakeDecisions]
+ ?HowAttorneysMakeDecisions $howAttorneysMakeDecisions,
?DateTimeImmutable $invalidDate,
#[CastToSiriusLifeSustainingTreatment]
?LifeSustainingTreatment $lifeSustainingTreatment,
@@ -47,18 +52,21 @@ public function __construct(
?array $trustCorporations,
?string $uId,
?DateTimeImmutable $withdrawnDate,
+ #[MapFrom('whenTheLpaCanBeUsed')]
+ #[CastToWhenTheLpaCanBeUsed]
+ ?WhenTheLpaCanBeUsed $whenTheLpaCanBeUsed,
) {
parent::__construct(
$applicationHasGuidance,
$applicationHasRestrictions,
$applicationType,
- $attorneyActDecisions,
$attorneys,
$caseSubtype,
$channel,
$dispatchDate,
$donor,
$hasSeveranceWarning,
+ $howAttorneysMakeDecisions,
$invalidDate,
$lifeSustainingTreatment,
$lpaDonorSignatureDate,
@@ -72,7 +80,8 @@ public function __construct(
$statusDate,
$trustCorporations,
$uId,
- $withdrawnDate
+ $withdrawnDate,
+ $whenTheLpaCanBeUsed
);
}
}
diff --git a/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaAttorney.php b/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaAttorney.php
index 222e6ad0c3..a7bb50936e 100644
--- a/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaAttorney.php
+++ b/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaAttorney.php
@@ -4,7 +4,6 @@
namespace Common\Entity\Sirius;
-use EventSauce\ObjectHydrator\DoNotSerialize;
use Common\Entity\Casters\{
ExtractAddressLine1FromSiriusLpa,
ExtractAddressLine2FromSiriusLpa,
@@ -19,9 +18,8 @@
use EventSauce\ObjectHydrator\MapFrom;
use DateTimeImmutable;
use EventSauce\ObjectHydrator\PropertyCasters\CastToType;
-use JsonSerializable;
-class SiriusLpaAttorney extends Person implements JsonSerializable
+class SiriusLpaAttorney extends Person
{
public function __construct(
#[MapFrom('addresses')]
@@ -81,18 +79,4 @@ public function __construct(
$uId,
);
}
-
- #[DoNotSerialize]
- public function jsonSerialize(): mixed
- {
- $data = get_object_vars($this);
-
- array_walk($data, function (&$value) {
- if ($value instanceof DateTimeImmutable) {
- $value = $value->format('Y-m-d H:i:s.uO');
- }
- });
-
- return $data;
- }
}
diff --git a/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaDonor.php b/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaDonor.php
index 587fd55661..c4ee4a2d31 100644
--- a/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaDonor.php
+++ b/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaDonor.php
@@ -5,7 +5,6 @@
namespace Common\Entity\Sirius;
use Common\Entity\Person;
-use EventSauce\ObjectHydrator\DoNotSerialize;
use Common\Entity\Casters\{ExtractAddressLine1FromSiriusLpa,
ExtractAddressLine2FromSiriusLpa,
ExtractAddressLine3FromSiriusLpa,
@@ -18,9 +17,8 @@
use DateTimeImmutable;
use EventSauce\ObjectHydrator\MapFrom;
use EventSauce\ObjectHydrator\PropertyCasters\CastToType;
-use JsonSerializable;
-class SiriusLpaDonor extends Person implements JsonSerializable
+class SiriusLpaDonor extends Person
{
public function __construct(
#[MapFrom('addresses')]
@@ -83,18 +81,4 @@ public function __construct(
$uId,
);
}
-
- #[DoNotSerialize]
- public function jsonSerialize(): mixed
- {
- $data = get_object_vars($this);
-
- array_walk($data, function (&$value) {
- if ($value instanceof DateTimeImmutable) {
- $value = $value->format('Y-m-d H:i:s.uO');
- }
- });
-
- return $data;
- }
}
diff --git a/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaTrustCorporations.php b/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaTrustCorporations.php
index 8f0b07b2f0..719dcb221d 100644
--- a/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaTrustCorporations.php
+++ b/service-front/app/src/Common/src/Entity/Sirius/SiriusLpaTrustCorporations.php
@@ -5,7 +5,6 @@
namespace Common\Entity\Sirius;
use Common\Entity\Person;
-use EventSauce\ObjectHydrator\DoNotSerialize;
use Common\Entity\Casters\{
ExtractAddressLine1FromSiriusLpa,
ExtractAddressLine2FromSiriusLpa,
@@ -19,9 +18,8 @@
use EventSauce\ObjectHydrator\MapFrom;
use EventSauce\ObjectHydrator\PropertyCasters\CastToType;
use DateTimeImmutable;
-use JsonSerializable;
-class SiriusLpaTrustCorporations extends Person implements JsonSerializable
+class SiriusLpaTrustCorporations extends Person
{
public function __construct(
#[MapFrom('addresses')]
@@ -82,17 +80,8 @@ public function __construct(
);
}
- #[DoNotSerialize]
- public function jsonSerialize(): mixed
+ public function getCompanyName(): ?string
{
- $data = get_object_vars($this);
-
- array_walk($data, function (&$value) {
- if ($value instanceof DateTimeImmutable) {
- $value = $value->format('Y-m-d H:i:s.uO');
- }
- });
-
- return $data;
+ return $this->name;
}
}
diff --git a/service-front/app/src/Common/src/Enum/HowAttorneysMakeDecisions.php b/service-front/app/src/Common/src/Enum/HowAttorneysMakeDecisions.php
index d41f397a8e..cf06f8f4b4 100644
--- a/service-front/app/src/Common/src/Enum/HowAttorneysMakeDecisions.php
+++ b/service-front/app/src/Common/src/Enum/HowAttorneysMakeDecisions.php
@@ -10,4 +10,24 @@ enum HowAttorneysMakeDecisions: string
case JOINTLY = 'jointly';
case JOINTLY_AND_SEVERALLY = 'jointly-and-severally';
case JOINTLY_FOR_SOME_SEVERALLY_FOR_OTHERS = 'jointly-for-some-severally-for-others';
+
+ public function isSingular(): bool
+ {
+ return $this === HowAttorneysMakeDecisions::SINGULAR;
+ }
+
+ public function isJointly(): bool
+ {
+ return $this === HowAttorneysMakeDecisions::JOINTLY;
+ }
+
+ public function isJointlyAndSeverally(): bool
+ {
+ return $this === HowAttorneysMakeDecisions::JOINTLY_AND_SEVERALLY;
+ }
+
+ public function isJointlyForSomeSeverallyForOthers(): bool
+ {
+ return $this === HowAttorneysMakeDecisions::JOINTLY_FOR_SOME_SEVERALLY_FOR_OTHERS;
+ }
}
diff --git a/service-front/app/src/Common/src/Enum/LifeSustainingTreatment.php b/service-front/app/src/Common/src/Enum/LifeSustainingTreatment.php
index 633b8c5b28..e575b4ce8f 100644
--- a/service-front/app/src/Common/src/Enum/LifeSustainingTreatment.php
+++ b/service-front/app/src/Common/src/Enum/LifeSustainingTreatment.php
@@ -19,4 +19,14 @@ public static function fromShortName(string $shortName): self
default => throw new InvalidArgumentException('Invalid shorthand name: ' . $shortName),
};
}
+
+ public function isOptionA(): bool
+ {
+ return $this === self::OPTION_A;
+ }
+
+ public function isOptionB(): bool
+ {
+ return $this === self::OPTION_B;
+ }
}
diff --git a/service-front/app/src/Common/src/Enum/LpaType.php b/service-front/app/src/Common/src/Enum/LpaType.php
index e29f90c66c..0cd0ef3c8b 100644
--- a/service-front/app/src/Common/src/Enum/LpaType.php
+++ b/service-front/app/src/Common/src/Enum/LpaType.php
@@ -19,4 +19,14 @@ public static function fromShortName(string $shortName): self
default => throw new InvalidArgumentException('Invalid shorthand name: ' . $shortName),
};
}
+
+ public function isPersonalWelfare(): bool
+ {
+ return $this === self::PERSONAL_WELFARE;
+ }
+
+ public function isPropertyAndAffairs(): bool
+ {
+ return $this === self::PROPERTY_AND_AFFAIRS;
+ }
}
diff --git a/service-front/app/src/Common/src/Enum/WhenTheLpaCanBeUsed.php b/service-front/app/src/Common/src/Enum/WhenTheLpaCanBeUsed.php
new file mode 100644
index 0000000000..6c6c505bdb
--- /dev/null
+++ b/service-front/app/src/Common/src/Enum/WhenTheLpaCanBeUsed.php
@@ -0,0 +1,27 @@
+hydrateObject($lpa);
-
- return $lpaObject;
+ return $this->hydrateObject($lpa);
}
/**
diff --git a/service-front/app/src/Common/src/Service/Lpa/ParseLpaData.php b/service-front/app/src/Common/src/Service/Lpa/ParseLpaData.php
index c650081c6c..e72031d7b4 100644
--- a/service-front/app/src/Common/src/Service/Lpa/ParseLpaData.php
+++ b/service-front/app/src/Common/src/Service/Lpa/ParseLpaData.php
@@ -33,7 +33,7 @@ public function __construct(
* Currently, fairly naive in its assumption that the data types are stored under explicit keys, which
* may change.
*
- * @param array{
+ * @param array{
* lpa: array,
* actor?: array,
* iap?: array,
@@ -49,7 +49,9 @@ public function __invoke(array $data): ArrayObject
//introduce feature flag here #3551
//the lpaData array converted to object using hydrator
if (($this->featureEnabled)('support_datastore_lpas')) {
- $mockedCombinedLpa = $this->getMockedCombinedFormat();
+ // Set asLpaStoreLpa to toggle the format of the response (but ensure
+ // its set to false before running tests)
+ $mockedCombinedLpa = self::getMockedCombinedFormat(false);
$data['lpa'] = ($this->lpaDataFormatter)($mockedCombinedLpa);
} else {
$data['lpa'] = $this->lpaFactory->createLpaFromData($dataItem);
@@ -71,32 +73,35 @@ public function __invoke(array $data): ArrayObject
return new ArrayObject($data, ArrayObject::ARRAY_AS_PROPS);
}
- private function getMockedCombinedFormat(): array
+ /**
+ * @codeCoverageIgnore
+ */
+ public static function getMockedCombinedFormat(bool $asLpaStoreLpa): array
{
- return [
- 'id' => 2,
- 'uId' => '700000000047',
- 'receiptDate' => '2014-09-26',
- 'registrationDate' => '2019-10-10',
- 'rejectedDate' => null,
- 'donor' => [
- 'id' => 7,
- 'uId' => '700000000799',
- 'linked' => [['id' => 7, 'uId' => '700000000799']],
- 'dob' => '1948-11-01',
- 'email' => 'RachelSanderson@opgtest.com',
- 'salutation' => 'Mr',
- 'firstname' => 'Rachel',
+ $lpa = [
+ 'id' => 2,
+ 'uId' => '700000000047',
+ 'receiptDate' => '2014-09-26',
+ 'registrationDate' => '2019-10-10',
+ 'rejectedDate' => null,
+ 'donor' => [
+ 'id' => 7,
+ 'uId' => '700000000799',
+ 'linked' => [['id' => 7, 'uId' => '700000000799']],
+ 'dob' => '1948-11-01',
+ 'email' => 'RachelSanderson@opgtest.com',
+ 'salutation' => 'Mr',
+ 'firstname' => 'Rachel',
'middlenames' => 'Emma',
- 'surname' => 'Sanderson',
- 'addresses' => [
+ 'surname' => 'Sanderson',
+ 'addresses' => [
[
- 'id' => 7,
- 'town' => '',
- 'county' => '',
- 'postcode' => 'DN37 5SH',
- 'country' => '',
- 'type' => 'Primary',
+ 'id' => 7,
+ 'town' => 'Townville',
+ 'county' => 'Countyville',
+ 'postcode' => 'DN37 5SH',
+ 'country' => '',
+ 'type' => 'Primary',
'addressLine1' => '81 Front Street',
'addressLine2' => 'LACEBY',
'addressLine3' => '',
@@ -104,115 +109,115 @@ private function getMockedCombinedFormat(): array
],
'companyName' => null,
],
- 'applicationType' => 'Classic',
- 'caseSubtype' => 'hw',
- 'status' => 'Registered',
- 'lpaIsCleansed' => true,
- 'caseAttorneySingular' => false,
- 'caseAttorneyJointlyAndSeverally' => true,
- 'caseAttorneyJointly' => false,
+ 'applicationType' => 'Classic',
+ 'caseSubtype' => 'pfa',
+ 'status' => 'Registered',
+ 'lpaIsCleansed' => true,
+ 'caseAttorneySingular' => false,
+ 'caseAttorneyJointlyAndSeverally' => true,
+ 'caseAttorneyJointly' => false,
'caseAttorneyJointlyAndJointlyAndSeverally' => false,
- 'onlineLpaId' => 'A33718377316',
- 'cancellationDate' => null,
- 'attorneys' => [
+ 'onlineLpaId' => 'A33718377316',
+ 'cancellationDate' => null,
+ 'attorneys' => [
[
- 'id' => 9,
- 'uId' => '700000000815',
- 'dob' => '1990-05-04',
- 'email' => '',
- 'salutation' => '',
- 'firstname' => 'jean',
- 'middlenames' => '',
- 'surname' => 'sanderson',
- 'addresses' => [
+ 'id' => 9,
+ 'uId' => '700000000815',
+ 'dob' => '1990-05-04',
+ 'email' => '',
+ 'salutation' => '',
+ 'firstname' => 'Jean',
+ 'middlenames' => '',
+ 'surname' => 'Sanderson',
+ 'addresses' => [
[
- 'id' => 9,
- 'town' => '',
- 'county' => '',
- 'postcode' => 'DN37 5SH',
- 'country' => '',
- 'type' => 'Primary',
- 'addressLine1' => '9 high street',
- 'addressLine2' => '',
+ 'id' => 9,
+ 'town' => 'Pretendham',
+ 'county' => 'Countyville',
+ 'postcode' => 'DN37 5SH',
+ 'country' => '',
+ 'type' => 'Primary',
+ 'addressLine1' => '9 High street',
+ 'addressLine2' => 'Pretendville',
'addressLine3' => '',
],
],
'systemStatus' => true,
- 'companyName' => '',
+ 'companyName' => '',
],
[
- 'id' => 12,
- 'uId' => '7000-0000-0849',
- 'dob' => '1975-10-05',
- 'email' => 'XXXXX',
- 'salutation' => 'Mrs',
- 'firstname' => 'Ann',
- 'middlenames' => '',
- 'surname' => 'Summers',
- 'addresses' => [
+ 'id' => 12,
+ 'uId' => '7000-0000-0849',
+ 'dob' => '1975-10-05',
+ 'email' => 'XXXXX',
+ 'salutation' => 'Mrs',
+ 'firstname' => 'Ann',
+ 'middlenames' => '',
+ 'surname' => 'Summers',
+ 'addresses' => [
[
- 'id' => 12,
- 'town' => '',
- 'county' => '',
- 'postcode' => '',
- 'country' => '',
- 'type' => 'Primary',
- 'addressLine1' => '',
- 'addressLine2' => '',
+ 'id' => 12,
+ 'town' => 'Hannerton',
+ 'county' => 'Countyville',
+ 'postcode' => 'HA1 4GH',
+ 'country' => '',
+ 'type' => 'Primary',
+ 'addressLine1' => '47 Armington Way',
+ 'addressLine2' => 'Hansville',
'addressLine3' => '',
],
],
'systemStatus' => true,
- 'companyName' => '',
+ 'companyName' => '',
],
],
- 'replacementAttorneys' => [],
- 'trustCorporations' => [
+ 'replacementAttorneys' => [],
+ 'trustCorporations' => [
[
- 'addresses' => [
+ 'addresses' => [
[
- 'id' => 3207,
- 'town' => 'Town',
- 'county' => 'County',
- 'postcode' => 'ABC 123',
- 'country' => 'GB',
- 'type' => 'Primary',
+ 'id' => 3207,
+ 'town' => 'Town',
+ 'county' => 'County',
+ 'postcode' => 'ABC 123',
+ 'country' => 'GB',
+ 'type' => 'Primary',
'addressLine1' => 'Street 1',
'addressLine2' => 'Street 2',
'addressLine3' => 'Street 3',
],
],
- 'id' => 3485,
- 'uId' => '7000-0015-1998',
- 'dob' => null,
- 'email' => null,
- 'salutation' => null,
- 'firstname' => 'trust',
- 'middlenames' => null,
- 'surname' => 'test',
- 'otherNames' => null,
+ 'id' => 3485,
+ 'uId' => '7000-0015-1998',
+ 'dob' => null,
+ 'email' => null,
+ 'salutation' => null,
+ 'firstname' => 'trust',
+ 'middlenames' => null,
+ 'surname' => 'test',
+ 'otherNames' => null,
'systemStatus' => true,
- 'companyName' => 'trust corporation',
+ 'name' => 'Trust Us Corporation Ltd.',
],
],
- 'certificateProviders' => [
+ 'certificateProviders' => [
[
- 'id' => 11,
- 'uId' => '7000-0000-0831',
- 'dob' => null,
- 'email' => null,
- 'salutation' => 'Miss',
- 'firstname' => 'Danielle',
+ 'id' => 11,
+ 'uId' => '7000-0000-0831',
+ 'dob' => null,
+ 'email' => null,
+ 'salutation' => 'Miss',
+ 'firstname' => 'Danielle',
'middlenames' => null,
- 'surname' => 'Hart ',
- 'addresses' => [
+ 'surname' => 'Hart ',
+ 'addresses' => [
[
- 'id' => 11,
- 'town' => '',
- 'county' => '',
- 'postcode' => 'SK14 0RH',
- 'country' => '',
- 'type' => 'Primary',
+ 'id' => 11,
+ 'town' => 'Townville',
+ 'county' => '',
+ 'postcode' => 'SK14 0RH',
+ 'country' => '',
+ 'type' => 'Primary',
'addressLine1' => '50 Fordham Rd',
'addressLine2' => 'HADFIELD',
'addressLine3' => '',
@@ -220,11 +225,68 @@ private function getMockedCombinedFormat(): array
],
],
],
- 'attorneyActDecisions' => null,
- 'applicationHasRestrictions' => false,
- 'applicationHasGuidance' => false,
- 'lpaDonorSignatureDate' => '2012-12-12',
- 'lifeSustainingTreatment' => 'Option A',
+ 'whenTheLpaCanBeUsed' => 'when-has-capacity',
+ 'applicationHasRestrictions' => false,
+ 'applicationHasGuidance' => false,
+ 'lpaDonorSignatureDate' => '2012-12-12',
+ 'lifeSustainingTreatment' => 'Option A',
+ 'howAttorneysMakeDecisions' => 'jointly',
];
+
+ if ($asLpaStoreLpa) {
+ $lpa['uId'] = 'M-123412341234';
+ $lpa['howAttorneysMakeDecisions'] = 'jointly-and-severally';
+ $lpa['lpaType'] = 'property-and-affairs';
+ $lpa['lifeSustainingTreatment'] = 'option-a';
+ $lpa['whenTheLpaCanBeUsed'] = 'when-has-capacity';
+
+ $lpa['donor']['address']['line1'] = $lpa['donor']['addresses'][0]['addressLine1'];
+ $lpa['donor']['address']['line2'] = $lpa['donor']['addresses'][0]['addressLine2'];
+ $lpa['donor']['address']['line3'] = $lpa['donor']['addresses'][0]['addressLine3'];
+ $lpa['donor']['address']['town'] = $lpa['donor']['addresses'][0]['town'];
+ $lpa['donor']['address']['postcode'] = $lpa['donor']['addresses'][0]['postcode'];
+ $lpa['donor']['address']['county'] = $lpa['donor']['addresses'][0]['county'];
+ $lpa['donor']['address']['country'] = $lpa['donor']['addresses'][0]['country'];
+ $lpa['donor']['dateOfBirth'] = $lpa['donor']['dob'];
+
+ unset($lpa['donor']['addresses']);
+ unset($lpa['donor']['dob']);
+
+ $lpa['attorneys'][0]['address']['line1'] = $lpa['attorneys'][0]['addresses'][0]['addressLine1'];
+ $lpa['attorneys'][0]['address']['line2'] = $lpa['attorneys'][0]['addresses'][0]['addressLine2'];
+ $lpa['attorneys'][0]['address']['line3'] = $lpa['attorneys'][0]['addresses'][0]['addressLine3'];
+ $lpa['attorneys'][0]['address']['town'] = $lpa['attorneys'][0]['addresses'][0]['town'];
+ $lpa['attorneys'][0]['address']['postcode'] = $lpa['attorneys'][0]['addresses'][0]['postcode'];
+ $lpa['attorneys'][0]['address']['county'] = $lpa['attorneys'][0]['addresses'][0]['county'];
+ $lpa['attorneys'][0]['address']['country'] = $lpa['attorneys'][0]['addresses'][0]['country'];
+ $lpa['attorneys'][0]['dateOfBirth'] = $lpa['attorneys'][0]['dob'];
+
+ unset($lpa['attorneys'][0]['addresses']);
+ unset($lpa['attorneys'][0]['dob']);
+
+ $lpa['attorneys'][1]['address']['line1'] = $lpa['attorneys'][1]['addresses'][0]['addressLine1'];
+ $lpa['attorneys'][1]['address']['line2'] = $lpa['attorneys'][1]['addresses'][0]['addressLine2'];
+ $lpa['attorneys'][1]['address']['line3'] = $lpa['attorneys'][1]['addresses'][0]['addressLine3'];
+ $lpa['attorneys'][1]['address']['town'] = $lpa['attorneys'][1]['addresses'][0]['town'];
+ $lpa['attorneys'][1]['address']['postcode'] = $lpa['attorneys'][1]['addresses'][0]['postcode'];
+ $lpa['attorneys'][1]['address']['county'] = $lpa['attorneys'][1]['addresses'][0]['county'];
+ $lpa['attorneys'][1]['address']['country'] = $lpa['attorneys'][1]['addresses'][0]['country'];
+ $lpa['attorneys'][1]['dateOfBirth'] = $lpa['attorneys'][1]['dob'];
+
+ unset($lpa['attorneys'][1]['addresses']);
+ unset($lpa['attorneys'][1]['dob']);
+
+ $lpa['trustCorporations'][0]['address']['line1'] = $lpa['trustCorporations'][0]['addresses'][0]['addressLine1'];
+ $lpa['trustCorporations'][0]['address']['line2'] = $lpa['trustCorporations'][0]['addresses'][0]['addressLine2'];
+ $lpa['trustCorporations'][0]['address']['line3'] = $lpa['trustCorporations'][0]['addresses'][0]['addressLine3'];
+ $lpa['trustCorporations'][0]['address']['town'] = $lpa['trustCorporations'][0]['addresses'][0]['town'];
+ $lpa['trustCorporations'][0]['address']['postcode'] = $lpa['trustCorporations'][0]['addresses'][0]['postcode'];
+ $lpa['trustCorporations'][0]['address']['county'] = $lpa['trustCorporations'][0]['addresses'][0]['county'];
+ $lpa['trustCorporations'][0]['address']['country'] = $lpa['trustCorporations'][0]['addresses'][0]['country'];
+
+ unset($lpa['trustCorporations'][0]['addresses']);
+ }
+
+ return $lpa;
}
}
diff --git a/service-front/app/src/Common/src/Service/Pdf/PdfService.php b/service-front/app/src/Common/src/Service/Pdf/PdfService.php
index 4f9de2cfa0..555b176205 100644
--- a/service-front/app/src/Common/src/Service/Pdf/PdfService.php
+++ b/service-front/app/src/Common/src/Service/Pdf/PdfService.php
@@ -4,8 +4,10 @@
namespace Common\Service\Pdf;
+use Common\Entity\CombinedLpa;
use Common\Entity\InstructionsAndPreferences\Images;
use Common\Entity\Lpa;
+use Common\Entity\Sirius\SiriusLpa;
use Common\Exception\ApiException;
use Common\Service\Log\EventCodes;
use Common\Service\Log\RequestTracing;
@@ -31,14 +33,14 @@ public function __construct(
) {
}
- public function getLpaAsPdf(Lpa $lpa, ?Images $images = null): StreamInterface
+ public function getLpaAsPdf(Lpa|SiriusLpa|CombinedLpa $lpa, ?Images $images = null): StreamInterface
{
$renderedLpa = $this->renderLpaAsHtml($lpa, $images);
return $this->requestPdfFromService($renderedLpa);
}
- private function renderLpaAsHtml(Lpa $lpa, ?Images $images): string
+ private function renderLpaAsHtml(Lpa|SiriusLpa|CombinedLpa $lpa, ?Images $images): string
{
$renderData = [
'lpa' => $lpa,
@@ -49,14 +51,19 @@ private function renderLpaAsHtml(Lpa $lpa, ?Images $images): string
$renderData['iap_images'] = $images;
}
+ $template = 'viewer::download-lpa-combined-lpa';
+ if ($lpa instanceof Lpa) {
+ $template = 'viewer::download-lpa';
+ }
+
return $this->renderer->render(
- 'viewer::download-lpa',
+ $template,
$renderData,
);
}
/**
- * @param string $htmlToRender
+ * @param string $htmlToRender
* @return StreamInterface
* @throws ApiException
*/
@@ -79,8 +86,8 @@ private function requestPdfFromService(string $htmlToRender): StreamInterface
$this->logger->notice(
'Successfully generated PDF and presented for download {code}',
[
- 'event_code' => EventCodes::DOWNLOAD_SUMMARY,
- 'code' => $response->getStatusCode(),
+ 'event_code' => EventCodes::DOWNLOAD_SUMMARY,
+ 'code' => $response->getStatusCode(),
]
);
diff --git a/service-front/app/src/Common/src/View/Twig/LpaExtension.php b/service-front/app/src/Common/src/View/Twig/LpaExtension.php
index 5a81d4b15e..048c3d4439 100644
--- a/service-front/app/src/Common/src/View/Twig/LpaExtension.php
+++ b/service-front/app/src/Common/src/View/Twig/LpaExtension.php
@@ -6,8 +6,8 @@
use Common\Entity\Person;
use Common\Entity\CaseActor;
-use Common\Entity\Lpa;
use Common\Entity\CombinedLpa;
+use Common\Entity\Lpa;
use DateTime;
use DateTimeInterface;
use Exception;
@@ -38,21 +38,26 @@ public function getFunctions(): array
];
}
- public function actorAddress(CaseActor $actor): string
+ public function actorAddress(CaseActor|Person $actor): string
{
// Multiple addresses can appear for an actor - just use the first one
if (count($actor->getAddresses()) > 0) {
$address = $actor->getAddresses()[0];
- return implode(', ', array_filter([
- $address->getAddressLine1(),
- $address->getAddressLine2(),
- $address->getAddressLine3(),
- $address->getTown(),
- $address->getCounty(),
- $address->getPostcode(),
- $address->getCountry(),
- ]));
+ return implode(
+ ', ',
+ array_filter(
+ [
+ $address->getAddressLine1(),
+ $address->getAddressLine2(),
+ $address->getAddressLine3(),
+ $address->getTown(),
+ $address->getCounty(),
+ $address->getPostcode(),
+ $address->getCountry(),
+ ]
+ )
+ );
}
return '';
@@ -61,7 +66,7 @@ public function actorAddress(CaseActor $actor): string
/**
* Removes the dob from the string and returns just donor name
*
- * @param string $donorNameAndDob
+ * @param string $donorNameAndDob
* @return string
*/
public function donorNameWithDobRemoved(string $donorNameAndDob): string
@@ -71,8 +76,8 @@ public function donorNameWithDobRemoved(string $donorNameAndDob): string
}
/**
- * @param CaseActor|Person $actor
- * @param bool $withSalutation Prepend salutation?
+ * @param CaseActor|Person $actor
+ * @param bool $withSalutation Prepend salutation?
* @return string
*/
public function actorName(CaseActor|Person $actor, bool $withSalutation = true): string
@@ -94,7 +99,7 @@ public function actorName(CaseActor|Person $actor, bool $withSalutation = true):
* Takes an input date, whether as a string (relative or absolute - in the format 2020-11-27)
* or as a Datetime and converts it for displaying on pages
*
- * @param DateTimeInterface|string|null $date
+ * @param DateTimeInterface|string|null $date
* @return string
*/
public function lpaDate(DateTimeInterface|string|null $date): string
@@ -106,8 +111,8 @@ public function lpaDate(DateTimeInterface|string|null $date): string
* Takes an input date, whether as a string (relative or absolute) or as a Datetime
* and converts it for displaying on pages
*
- * @param DateTimeInterface|string|null $date
- * @param string $parseFormat A PHP Datetime format string that should be used to parse $date
+ * @param DateTimeInterface|string|null $date
+ * @param string $parseFormat A PHP Datetime format string that should be used to parse $date
* @return string
*/
public function formatDate(DateTimeInterface|string|null $date, string $parseFormat = 'Y-m-d\TH:i:sP'): string
@@ -132,7 +137,7 @@ public function formatDate(DateTimeInterface|string|null $date, string $parseFor
/**
* Calculates the days remaining until the viewer code expires
*
- * @param string|null $expiryDate
+ * @param string|null $expiryDate
* @return string
* @throws Exception
*/
@@ -152,7 +157,7 @@ public function daysRemaining(?string $expiryDate): string
/**
* Checks whether the code has been cancelled
*
- * @param array $code
+ * @param array $code
* @return bool|null
*/
public function isCodeCancelled(array $code): ?bool
@@ -167,7 +172,7 @@ public function isCodeCancelled(array $code): ?bool
/**
* Checks whether the code has expired or not
*
- * @param string|null $expiryDate
+ * @param string|null $expiryDate
* @return bool|null
* @throws Exception
*/
@@ -184,7 +189,7 @@ public function hasCodeExpired(?string $expiryDate): ?bool
/**
* Create a hyphenated viewer code
*
- * @param string $viewerCode
+ * @param string $viewerCode
* @return string
*/
public function formatViewerCode(string $viewerCode): string
@@ -209,7 +214,7 @@ public function isDonorSignatureDateOld(Lpa|CombinedLpa $lpa): bool
/**
* Creates an international date formatter that is capable of doing locale based dates.
*
- * @param string $locale
+ * @param string $locale
* @return IntlDateFormatter
*/
private function getDateFormatter(string $locale): IntlDateFormatter
diff --git a/service-front/app/src/Common/templates/partials/full-lpa-display-combined-lpa.html.twig b/service-front/app/src/Common/templates/partials/full-lpa-display-combined-lpa.html.twig
new file mode 100644
index 0000000000..ba62b47403
--- /dev/null
+++ b/service-front/app/src/Common/templates/partials/full-lpa-display-combined-lpa.html.twig
@@ -0,0 +1,160 @@
+
+
+
+
+ {% if is_lpa_cancelled(lpa) %}
+
+ {% if lpa.lpaType.propertyAndAffairs %}
+ {% trans %}This property and finance LPA has been cancelled{% endtrans %}
+ {% else %}
+ {% trans %}This health and welfare LPA has been cancelled{% endtrans %}
+ {% endif %}
+
+
+ {% if lpa.cancellationDate is not null %}
+ {% trans with {'%cancellationDate%': lpa_date(lpa.cancellationDate)} %}Cancelled on %cancellationDate%{% endtrans %}
+ {% endif %}
+ {% else %}
+
+ {% if lpa.lpaType.propertyAndAffairs and lpa.whenTheLpaCanBeUsed.whenHasCapacity %}
+ {% trans %}This property and finance LPA is valid and can be used now{% endtrans %}
+ {% else %}
+ {% if lpa.lpaType.propertyAndAffairs %}
+ {% trans %}This property and finance LPA is valid{% endtrans %}
+ {% else %}
+ {% trans %}This health and welfare LPA is valid{% endtrans %}
+ {% endif %}
+ {% endif %}
+
+
+
+ {% if lpa.lpaType.propertyAndAffairs %}
+ {% if lpa.whenTheLpaCanBeUsed.whenCapacityLost %}
+ {% trans %}This LPA can only be used when the donor has lost capacity{% endtrans %}
+ {% elseif lpa.whenTheLpaCanBeUsed.unknown %}
+ {% trans %}This LPA can be used as soon as it's registered unless instructions say otherwise{% endtrans %}
+ {% endif %}
+ {% else %}
+ {% if lpa.lifeSustainingTreatment.OptionA %}
+ {% trans %}The attorneys have the authority to make decisions about life-sustaining treatment{% endtrans %}
+ {% elseif lpa.lifeSustainingTreatment.OptionB %}
+ {% trans %}The attorneys do NOT have the authority to make decisions about life-sustaining treatment{% endtrans %}
+ {% endif %}
+ {% endif %}
+
+ {% endif %}
+
+ {% if lpa.applicationHasGuidance or lpa.applicationHasRestrictions %}
+
+ {% if is_donor_signature_date_too_old(lpa) %}
+ {% trans %}This LPA has instructions and/or preferences{% endtrans %}
+ {% elseif lpa.applicationHasGuidance and lpa.applicationHasRestrictions %}
+ {% trans %}This LPA has instructions and preferences{% endtrans %}
+ {% elseif lpa.applicationHasGuidance %}
+ {% trans %}This LPA has preferences{% endtrans %}
+ {% elseif lpa.applicationHasRestrictions %}
+ {% trans %}This LPA has instructions{% endtrans %}
+ {% endif %}
+
+ {% endif %}
+
+
+
+
+
+ {% if lpa.lpaType.propertyAndAffairs %}
+ {% set type = "Property and finance" %}
+ {% else %}
+ {% set type = "Health and welfare" %}
+ {% endif %}
+
+
+ {% trans %}You should download and save this LPA summary. You can use it as evidence that you viewed the LPA summary before acting on it.{% endtrans %}
+
+
+ {% if feature_enabled("instructions_and_preferences") %}
+ {% include '@partials/lpa-summary-details/iap-images-components.html.twig' %}
+
+ {% endif %}
+
+ {% include '@partials/lpa-summary-details/lpa-details-combined-lpa.html.twig' %}
+
+ {% if feature_enabled("instructions_and_preferences") and iap_images is defined %}
+ {% if iap_images.status is not constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %}
+
+ {% trans %}If any scanned images are not readable, ask the person who gave you the access
+ code to show you the paper LPA.{% endtrans %}
+
diff --git a/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-attorney-details-combined-lpa.html.twig b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-attorney-details-combined-lpa.html.twig
new file mode 100644
index 0000000000..7295bce707
--- /dev/null
+++ b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-attorney-details-combined-lpa.html.twig
@@ -0,0 +1,57 @@
+
{% trans %}The attorneys{% endtrans %}
+
+
+
{% trans %}How decisions are made{% endtrans %}
+
+ {% if lpa.howAttorneysMakeDecisions.singular %}
+ {% trans %}Decisions are made by one attorney{% endtrans %}
+ {% elseif lpa.howAttorneysMakeDecisions.jointly %}
+ {% trans %}Attorneys must make decisions jointly (together){% endtrans %}
+ {% elseif lpa.howAttorneysMakeDecisions.jointlyAndSeverally %}
+ {% trans %}Attorneys can make decisions jointly (together) and severally (separately){% endtrans %}
+ {% elseif lpa.howAttorneysMakeDecisions.jointlyForSomeSeverallyForOthers %}
+ {% trans %}Attorneys must make some decisions jointly (together) and can make some decisions severally (separately). Check the paper
+ LPA to find out what decisions must be made jointly.{% endtrans %}
+ {% endif %}
+
+
+
+
+{% for attorney in lpa.activeAttorneys %}
+
{% trans count loop.index with {'%attorneyOrdinal%': loop.index | ordinal} %}%attorneyOrdinal% attorney|%attorneyOrdinal% attorney{% endtrans %}
+
+
+
{% trans %}Name{% endtrans %}
+
{{ actor_name(attorney) }}
+
+ {% if attorney.otherNames %}
+
+
{% trans %}Also known as{% endtrans %}
+
{{ attorney.otherNames }}
+
+ {% endif %}
+
+
{% trans %}Date of birth{% endtrans %}
+
{{ lpa_date(attorney.dob) }}
+
+
+
{% trans %}Address{% endtrans %}
+
{{ actor_address(attorney) }}
+
+
+{% endfor %}
+
+{% for tc in lpa.trustCorporations %}
+ {% set i = loop.index + lpa.activeAttorneys | length %}
+
{% trans count i with {'%attorneyOrdinal%': i | ordinal } %}%attorneyOrdinal% attorney|%attorneyOrdinal% attorney{% endtrans %}
+
+
+
{% trans %}Name{% endtrans %}
+
{{ tc.companyName }} {% trans %}(Trust corporation){% endtrans %}
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details-combined-lpa.html.twig b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details-combined-lpa.html.twig
new file mode 100644
index 0000000000..f6f1358782
--- /dev/null
+++ b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-details-combined-lpa.html.twig
@@ -0,0 +1,175 @@
+{% import "@partials/lpa-summary-details/iap-macros.html.twig" as iap %}
+
+
+ {% if lpa.caseSubtype.propertyAndAffairs %}
+
+
{% trans %}When can the LPA be used?{% endtrans %}
+
+ {% if lpa.whenTheLpaCanBeUsed.whenHasCapacity %}
+ {% if actor is defined and actor.type == 'donor' %}
+ {% trans %}You have said that this LPA can be used now. While you have mental capacity, your attorneys can only use the
+ LPA if you allow them to.{% endtrans %}
+ {% else %}
+ {% trans %}The donor has said that this LPA can be used now. While the donor has mental capacity, you can only use the
+ LPA if the donor allows you to.{% endtrans %}
+ {% endif %}
+ {% elseif lpa.whenTheLpaCanBeUsed.whenHasLostCapacity %}
+ {% trans %}This LPA can only be used when the donor has lost capacity{% endtrans %}
+ {% elseif lpa.whenTheLpaCanBeUsed.unknown %}
+ {% trans %}This LPA can be used as soon as it's registered unless instructions say otherwise.{% endtrans %}
+ {% endif %}
+
+
+ {% else %}
+
+
{% trans %}Life-sustaining
+ treatment{% endtrans %}
+
+ {% if lpa.lifeSustainingTreatment.OptionA %}
+ {% trans %}The attorneys have the authority to make decisions about life-sustaining treatment{% endtrans %}
+ {% elseif lpa.lifeSustainingTreatment.OptionB %}
+ {% trans %}The attorneys do not have the authority to make decisions about life-sustaining treatment{% endtrans %}
+ {% else %}
+ {% trans %}To view this, ask to see the paper LPA{% endtrans %}
+ {% endif %}
+
+
+ {% endif %}
+
+
+
{% trans %}Date donor signed LPA{% endtrans %}
+
{{ lpa_date(lpa.lpaDonorSignatureDate) }}
+
+
+
+
{% trans %}Registration date{% endtrans %}
+
{{ lpa_date(lpa.registrationDate) }}
+
+
+
+
{% trans %}LPA reference number{% endtrans %}
+
{{ lpa.uId }}
+
+
+ {% if is_donor_signature_date_too_old(lpa) and (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) and not feature_enabled("instructions_and_preferences") %}
+
+
{% trans %}Instructions and preferences{% endtrans %}
+
+ {% trans %}Yes, the donor made instructions and/or preferences on their LPA.{% endtrans %}
+ {% trans %}To view these, ask to see the paper LPA.{% endtrans %}
+
+
+ {% elseif is_donor_signature_date_too_old(lpa) and not (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) and not feature_enabled("instructions_and_preferences") %}
+
+
{% trans %}Instructions and preferences{% endtrans %}
+
+ {% trans %}No{% endtrans %}
+
+
+ {% else %} {# Instructions and Preferences are split OR I&P images are enabled #}
+
+
+ {% if feature_enabled('instructions_and_preferences') and (lpa.applicationHasGuidance or lpa.applicationHasRestrictions) %}
+ {% if lpa.hasSeveranceWarning %}
+
+ !
+
+ {% trans %}Warning{% endtrans %}
+ {% trans %}
+ Some words in these instructions or preferences have been removed by the court of
+ protection. To check which words have been removed, please ask to see the paper
+ LPA or the court order.
+ {% endtrans %}
+
+
+ {% endif %}
+ {% endif %}
+
+
+
+
+
{% trans %}Preferences{% endtrans %}
+
+ {% if lpa.applicationHasGuidance %}
+ {% if feature_enabled("instructions_and_preferences") and iap_images is defined %}
+ {% trans %}Yes, the donor made preferences on their LPA.{% endtrans %}
+ {% else %}
+ {% trans %}Yes, the donor made preferences on their LPA.{% endtrans %}
+ {% trans %}To view these, ask to see the paper LPA.{% endtrans %}
+ {% endif %}
+ {% else %}
+ {% trans %}No{% endtrans %}
+ {% endif %}
+
+
+
+
+ {% if feature_enabled("instructions_and_preferences") and lpa.applicationHasGuidance and iap_images is defined %}
+ {% if iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %}
+ {{ iap.preferences_error() }}
+ {% elseif ((iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_IN_PROGRESS'))
+ or (iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_NOT_STARTED'))) %}
+ {{ iap.preferences_static_wait() }}
+ {% elseif iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_COMPLETE') %}
+ {% set prefs_images = iap_images.getPreferencesImageUrls %}
+ {% if (prefs_images | length) > 0 %}
+ {{ iap.images("preferences", prefs_images) }}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+
+
+
+
+
+
{% trans %}Instructions{% endtrans %}
+
+ {% if lpa.applicationHasRestrictions %}
+ {% if feature_enabled("instructions_and_preferences") and iap_images is defined %}
+ {% trans %}Yes, the donor set instructions on their LPA.{% endtrans %}
+ {% else %}
+ {% trans %}Yes, the donor set instructions on their LPA.{% endtrans %}
+ {% trans %}To view these, ask to see the paper LPA.{% endtrans %}
+ {% endif %}
+ {% else %}
+ {% trans %}No{% endtrans %}
+ {% endif %}
+
+
+
+
+ {% if feature_enabled("instructions_and_preferences") and lpa.applicationHasRestrictions and iap_images is defined %}
+ {% if iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_ERROR') %}
+ {{ iap.instructions_error() }}
+ {% elseif ((iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_IN_PROGRESS'))
+ or (iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_NOT_STARTED'))) %}
+ {{ iap.instructions_static_wait() }}
+ {% elseif iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_COMPLETE') %}
+ {% set insts_images = iap_images.getInstructionsImageUrls %}
+ {% if (insts_images | length) > 0 %}
+ {{ iap.images("instructions", insts_images) }}
+ {% endif %}
+ {% endif %}
+ {% endif %}
+
+
+
+ {% if feature_enabled("instructions_and_preferences") and iap_images is defined and
+ iap_images.status is constant('\\Common\\Entity\\InstructionsAndPreferences\\ImagesStatus::COLLECTION_COMPLETE') %}
+ {% set unknown_images = iap_images.getUnknownImageUrls %}
+ {% if (unknown_images | length) > 0 %}
+ {{ iap.unknown_section() }}
+
+ {{ iap.images("unknown", unknown_images) }}
+ {% endif %}
+ {% endif %}
+
+ {% endif %}
diff --git a/service-front/app/src/Viewer/src/Handler/CheckCodeHandler.php b/service-front/app/src/Viewer/src/Handler/CheckCodeHandler.php
index 5f44bc927c..f41b45f7c0 100644
--- a/service-front/app/src/Viewer/src/Handler/CheckCodeHandler.php
+++ b/service-front/app/src/Viewer/src/Handler/CheckCodeHandler.php
@@ -12,6 +12,7 @@
use Common\Handler\Traits\Session as SessionTrait;
use Common\Middleware\Security\UserIdentificationMiddleware;
use Common\Middleware\Session\SessionTimeoutException;
+use Common\Service\Features\FeatureEnabled;
use Common\Service\Lpa\LpaService;
use Common\Service\Security\RateLimitService;
use DateTime;
@@ -36,12 +37,13 @@ public function __construct(
UrlHelper $urlHelper,
private LpaService $lpaService,
private RateLimitService $failureRateLimiter,
+ private FeatureEnabled $featureEnabled,
) {
parent::__construct($renderer, $urlHelper);
}
/**
- * @param ServerRequestInterface $request
+ * @param ServerRequestInterface $request
* @return ResponseInterface
* @throws \Http\Client\Exception|\Exception
*/
@@ -68,15 +70,23 @@ public function handle(ServerRequestInterface $request): ResponseInterface
// Then we found a LPA for the given code
$expires = new DateTime($lpa->expires);
$status = strtolower($lpa->lpa->getStatus());
+
+ $templateName = 'viewer::check-code-found';
+ if (($this->featureEnabled)('support_datastore_lpas')) {
+ $templateName = 'viewer::check-code-found-combined-lpa';
+ }
+
if ($this->canDisplayLPA($status)) {
- return new HtmlResponse($this->renderer->render(
- 'viewer::check-code-found',
- [
+ return new HtmlResponse(
+ $this->renderer->render(
+ $templateName,
+ [
'lpa' => $lpa->lpa,
'expires' => $expires->format('Y-m-d'),
'form' => $form,
- ]
- ));
+ ]
+ )
+ );
}
}
} catch (ApiException $apiEx) {
@@ -90,13 +100,15 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}
$this->failureRateLimiter->limit($request->getAttribute(UserIdentificationMiddleware::IDENTIFY_ATTRIBUTE));
- return new HtmlResponse($this->renderer->render(
- 'viewer::check-code-not-found',
- [
+ return new HtmlResponse(
+ $this->renderer->render(
+ 'viewer::check-code-not-found',
+ [
'donor_last_name' => $surname,
'lpa_access_code' => $code,
- ]
- ));
+ ]
+ )
+ );
}
// We don't have a code so the session has timed out
diff --git a/service-front/app/src/Viewer/src/Handler/Factory/CheckCodeHandlerFactory.php b/service-front/app/src/Viewer/src/Handler/Factory/CheckCodeHandlerFactory.php
index 9d37d56bc7..a531506b0b 100644
--- a/service-front/app/src/Viewer/src/Handler/Factory/CheckCodeHandlerFactory.php
+++ b/service-front/app/src/Viewer/src/Handler/Factory/CheckCodeHandlerFactory.php
@@ -4,6 +4,7 @@
namespace Viewer\Handler\Factory;
+use Common\Service\Features\FeatureEnabled;
use Common\Service\Lpa\LpaService;
use Common\Service\Security\RateLimitServiceFactory;
use Mezzio\Helper\UrlHelper;
@@ -21,7 +22,8 @@ public function __invoke(ContainerInterface $container)
$container->get(TemplateRendererInterface::class),
$container->get(UrlHelper::class),
$container->get(LpaService::class),
- $rateLimitFactory->factory('viewer_code_failure')
+ $rateLimitFactory->factory('viewer_code_failure'),
+ $container->get(FeatureEnabled::class),
);
}
}
diff --git a/service-front/app/src/Viewer/src/Handler/ViewLpaHandler.php b/service-front/app/src/Viewer/src/Handler/ViewLpaHandler.php
index 98692175a6..9a3b30dd36 100644
--- a/service-front/app/src/Viewer/src/Handler/ViewLpaHandler.php
+++ b/service-front/app/src/Viewer/src/Handler/ViewLpaHandler.php
@@ -36,7 +36,7 @@ public function __construct(
}
/**
- * @param ServerRequestInterface $request
+ * @param ServerRequestInterface $request
* @return ResponseInterface
* @throws \Exception
*/
@@ -86,6 +86,11 @@ public function handle(ServerRequestInterface $request): ResponseInterface
}
}
- return new HtmlResponse($this->renderer->render('viewer::view-lpa', $renderData));
+ $templateName = 'viewer::view-lpa';
+ if (($this->featureEnabled)('support_datastore_lpas')) {
+ $templateName = 'viewer::view-lpa-combined-lpa';
+ }
+
+ return new HtmlResponse($this->renderer->render($templateName, $renderData));
}
}
diff --git a/service-front/app/src/Viewer/templates/viewer/check-code-found-combined-lpa.html.twig b/service-front/app/src/Viewer/templates/viewer/check-code-found-combined-lpa.html.twig
new file mode 100644
index 0000000000..2f1a13348c
--- /dev/null
+++ b/service-front/app/src/Viewer/templates/viewer/check-code-found-combined-lpa.html.twig
@@ -0,0 +1,83 @@
+{% extends '@viewer/layout.html.twig' %}
+
+{% block html_title %}{% trans %}We’ve found this LPA{% endtrans %} - {{ parent() }} {% endblock %}
+
+{% block content %}
+
{% trans with {'%firstname%': lpa.donor.firstname, '%surname%': lpa.donor.surname} %}We’ve found %firstname% %surname%'s LPA{% endtrans %}
+
+
+
+
{% trans %}Type of LPA{% endtrans %}
+
{{ lpa.caseSubtype.propertyAndAffairs ? 'Property and finance' | trans : 'Health and welfare' | trans }}
+
+
+
{% trans %}Code expires{% endtrans %}
+
{% trans count days_remaining_to_expiry(expires) with {'%date%': lpa_date(expires)} %}in %count% day, on %date%|in %count% days, on %date%{% endtrans %}
+
+
+
+
+
+ !
+
+ {% trans %}Warning{% endtrans %}
+ {% trans %}If this is not the right LPA, ask the donor or attorney to check the access code.{% endtrans %}
+
+
+
+
+
+
+ {% trans with {'%date%': lpa_date(expires)} %}If you need to see this LPA after %date%{% endtrans %}
+
+
+
+
+ {% trans with {'%date%': lpa_date(expires)} %}You can see an online summary of this LPA until %date%. After this date, the access code will expire.{% endtrans %}
+
+
{% trans %}Ask the donor or attorney for a new access code if your organisation:{% endtrans %}
+
+
{% trans %}needs more time to process this LPA{% endtrans %}
+
{% trans %}need to see this LPA at a later date{% endtrans %}
+
+
+
+
+
+ {{ govuk_form_element(form.get('__csrf')) }}
+
+ {{ govuk_form_element(form.get('organisation'),
+ {
+ 'label': 'Your organisation name' | trans,
+ 'hint': 'This will be displayed to the attorneys and donor on the LPA' | trans
+ }
+ ) }}
+
+
+
+