diff --git a/service-api/app/src/App/src/Service/ActorCodes/ActorCodeService.php b/service-api/app/src/App/src/Service/ActorCodes/ActorCodeService.php index e91af0577d..e621d7856e 100644 --- a/service-api/app/src/App/src/Service/ActorCodes/ActorCodeService.php +++ b/service-api/app/src/App/src/Service/ActorCodes/ActorCodeService.php @@ -48,7 +48,6 @@ public function validateDetails(string $code, string $uid, string $dob): ?array $actor = ($this->resolveActor)($lpa->getData(), $actorUid); $lpaData = $lpa->getData(); - unset($lpaData['original_attorneys']); return [ 'actor' => $actor, diff --git a/service-api/app/src/App/src/Service/Lpa/SiriusLpa.php b/service-api/app/src/App/src/Service/Lpa/SiriusLpa.php index 6dd0bbd18a..1abe5cb3f2 100644 --- a/service-api/app/src/App/src/Service/Lpa/SiriusLpa.php +++ b/service-api/app/src/App/src/Service/Lpa/SiriusLpa.php @@ -29,9 +29,6 @@ public function __construct(private array $lpa) } $this->transformArrayToSiriusPersons('attorneys'); - $this->transformArrayToSiriusPersons('original_attorneys'); - $this->transformArrayToSiriusPersons('inactiveAttorneys'); - $this->transformArrayToSiriusPersons('activeAttorneys'); $this->transformArrayToSiriusPersons('trustCorporations'); } diff --git a/service-api/app/src/App/src/Service/Lpa/SiriusLpaManager.php b/service-api/app/src/App/src/Service/Lpa/SiriusLpaManager.php index 66c9ec4930..9358af140d 100644 --- a/service-api/app/src/App/src/Service/Lpa/SiriusLpaManager.php +++ b/service-api/app/src/App/src/Service/Lpa/SiriusLpaManager.php @@ -48,23 +48,13 @@ public function getByUid(string $uid): ?LpaInterface $lpaData = $lpa->getData(); if ($lpaData['attorneys'] !== null) { - $lpaData['original_attorneys'] = $lpaData['attorneys']; - $lpaData['activeAttorneys'] = array_values( + $lpaData['attorneys'] = array_values( array_filter($lpaData['attorneys'], function ($attorney) { return ($this->getAttorneyStatus)($attorney) === AttorneyStatus::ACTIVE_ATTORNEY; }) ); } - if ($lpaData['attorneys'] !== null) { - $lpaData['original_attorneys'] = $lpaData['attorneys']; - $lpaData['inactiveAttorneys'] = array_values( - array_filter($lpaData['attorneys'], function ($attorney) { - return ($this->getAttorneyStatus)($attorney) === AttorneyStatus::INACTIVE_ATTORNEY; - }) - ); - } - if ($lpaData['trustCorporations'] !== null) { $lpaData['trustCorporations'] = array_values( array_filter($lpaData['trustCorporations'], function ($trustCorporation) { @@ -93,7 +83,6 @@ public function getByUserLpaActorToken(string $token, string $userId): ?array } $lpaData = $lpa->getData(); - unset($lpaData['original_attorneys']); $result = [ 'user-lpa-actor-token' => $map['Id'], @@ -183,7 +172,6 @@ public function getByViewerCode(string $viewerCode, string $donorSurname, ?strin } $lpaData = $lpa->getData(); - unset($lpaData['original_attorneys']); $result = [ 'date' => $lpa->getLookupTime()->format('c'), @@ -241,7 +229,6 @@ private function lookupAndFormatLpas(array $lpaActorMaps): array $actor = ($this->resolveActor)($lpaData, (string) $item['ActorId']); $added = $item['Added']->format('Y-m-d H:i:s'); - unset($lpaData['original_attorneys']); //Extract and return only LPA's where status is Registered or Cancelled if (($this->isValidLpa)($lpaData)) { diff --git a/service-api/app/test/AppTest/Service/Lpa/SiriusLpaManagerTest.php b/service-api/app/test/AppTest/Service/Lpa/SiriusLpaManagerTest.php index 8fc74eb260..43d69873e2 100644 --- a/service-api/app/test/AppTest/Service/Lpa/SiriusLpaManagerTest.php +++ b/service-api/app/test/AppTest/Service/Lpa/SiriusLpaManagerTest.php @@ -115,17 +115,8 @@ public function can_get_by_id(): void [ 'attorneys' => [ ['id' => 1, 'firstname' => 'A', 'surname' => 'B', 'systemStatus' => true], - ['id' => 2, 'firstname' => 'A', 'surname' => 'B', 'systemStatus' => false], - ['id' => 3, 'firstname' => 'A', 'systemStatus' => true], - ['id' => 4, 'surname' => 'B', 'systemStatus' => true], - ['id' => 5, 'systemStatus' => true], - ], - 'original_attorneys' => [ - ['id' => 1, 'firstname' => 'A', 'surname' => 'B', 'systemStatus' => true], - ['id' => 2, 'firstname' => 'A', 'surname' => 'B', 'systemStatus' => false], ['id' => 3, 'firstname' => 'A', 'systemStatus' => true], ['id' => 4, 'surname' => 'B', 'systemStatus' => true], - ['id' => 5, 'systemStatus' => true], ], 'trustCorporations' => [ new SiriusPerson( @@ -135,14 +126,6 @@ public function can_get_by_id(): void 'systemStatus' => true, ]), ], - 'inactiveAttorneys' => [ - ['id' => 2, 'firstname' => 'A', 'surname' => 'B', 'systemStatus' => false], - ], - 'activeAttorneys' => [ - ['id' => 1, 'firstname' => 'A', 'surname' => 'B', 'systemStatus' => true], - ['id' => 3, 'firstname' => 'A', 'systemStatus' => true], - ['id' => 4, 'surname' => 'B', 'systemStatus' => true], - ], ], ), $lpaResponse->getLookupTime() 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 36e8af6464..84cd835fb4 100644 --- a/service-front/app/src/Common/src/Service/Lpa/ParseLpaData.php +++ b/service-front/app/src/Common/src/Service/Lpa/ParseLpaData.php @@ -49,9 +49,8 @@ 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(); - $CombinedLpa = ($this->lpaDataFormatter)($mockedCombinedLpa); - $CombinedLpa->activeAttorneys = $CombinedLpa->attorneys; + $mockedCombinedLpa = $this->getMockedCombinedFormat(); + $CombinedLpa = ($this->lpaDataFormatter)($mockedCombinedLpa); $data['lpa'] = $CombinedLpa; } else { diff --git a/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-attorney-details.html.twig b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-attorney-details.html.twig index d2f73fcad0..3ad84a20af 100644 --- a/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-attorney-details.html.twig +++ b/service-front/app/src/Common/templates/partials/lpa-summary-details/lpa-attorney-details.html.twig @@ -32,42 +32,84 @@ +{% if not feature_enabled("support_datastore_lpas") %} + {% 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 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 %}
+
+
+
{% trans %}Address{% endtrans %}
+
{{ actor_address(tc) }}
+
+
+ {% endfor %} +{% endif %} + +{% if feature_enabled("support_datastore_lpas") %} + {% for attorney in lpa.attorneys %} +

{% 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 %}
-
-
-
{% trans %}Address{% endtrans %}
-
{{ actor_address(tc) }}
-
-
-{% endfor %} \ No newline at end of file + {% for tc in lpa.trustCorporations %} + {% set i = loop.index + lpa.attorneys | length %} +

{% trans count i with {'%attorneyOrdinal%': i | ordinal } %}%attorneyOrdinal% attorney|%attorneyOrdinal% attorney{% endtrans %}

+
+
+
{% trans %}Name{% endtrans %}
+
{{ tc.companyName }} {% trans %}(Trust corporation){% endtrans %}
+
+
+
{% trans %}Address{% endtrans %}
+
{{ actor_address(tc) }}
+
+
+ {% endfor %} +{% endif %} diff --git a/service-front/app/test/CommonTest/Service/Lpa/ParseLpaDataTest.php b/service-front/app/test/CommonTest/Service/Lpa/ParseLpaDataTest.php index a408e4e894..bbd1d8ded8 100644 --- a/service-front/app/test/CommonTest/Service/Lpa/ParseLpaDataTest.php +++ b/service-front/app/test/CommonTest/Service/Lpa/ParseLpaDataTest.php @@ -129,7 +129,6 @@ public function it_correctly_parses_an_combined_lpa_api_response(): void { $combinedFormat = $this->getMockedCombinedFormat(); $expectedSiriusLpa = $this->expectedSiriusLpa(); - $expectedSiriusLpa->activeAttorneys = $this->expectedAttorneys(); $this->lpaFactory->createLpaFromData($this->lpaData['lpa'])->willReturn($combinedFormat); $this->lpaFactory->createCaseActorFromData($this->lpaData['actor']['details'])->willReturn($this->actor);