Skip to content

Commit

Permalink
Merge branch 'main' into update_readme
Browse files Browse the repository at this point in the history
  • Loading branch information
acsauk authored Nov 4, 2024
2 parents 1fca1fc + bc98619 commit 46f37a5
Show file tree
Hide file tree
Showing 2 changed files with 479 additions and 5 deletions.
167 changes: 163 additions & 4 deletions service-front/app/src/Common/src/Service/Lpa/ParseLpaData.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Common\Service\Lpa;

use ArrayObject;
use Common\Service\Features\FeatureEnabled;
use Exception;
use Common\Service\Lpa\Factory\LpaDataFormatter;

Expand All @@ -21,6 +22,7 @@ public function __construct(
private LpaFactory $lpaFactory,
private InstAndPrefImagesFactory $imagesFactory,
private LpaDataFormatter $lpaDataFormatter,
private FeatureEnabled $featureEnabled,
) {
}

Expand All @@ -46,10 +48,10 @@ public function __invoke(array $data): ArrayObject
case 'lpa':
//introduce feature flag here #3551
//the lpaData array converted to object using hydrator
if ($this->featureFlags['support_datastore_lpas'] ?? false) {
$data['lpa'] = ($this->lpaDataFormatter)($dataItem);
}
else {
if (($this->featureEnabled)('support_datastore_lpas')) {
$mockedCombinedLpa = $this->getMockedCombinedFormat();
$data['lpa'] = ($this->lpaDataFormatter)($mockedCombinedLpa);
} else {
$data['lpa'] = $this->lpaFactory->createLpaFromData($dataItem);
}
break;
Expand All @@ -68,4 +70,161 @@ public function __invoke(array $data): ArrayObject

return new ArrayObject($data, ArrayObject::ARRAY_AS_PROPS);
}

private function getMockedCombinedFormat(): 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' => '[email protected]',
'salutation' => 'Mr',
'firstname' => 'Rachel',
'middlenames' => 'Emma',
'surname' => 'Sanderson',
'addresses' => [
[
'id' => 7,
'town' => '',
'county' => '',
'postcode' => 'DN37 5SH',
'country' => '',
'type' => 'Primary',
'addressLine1' => '81 Front Street',
'addressLine2' => 'LACEBY',
'addressLine3' => '',
],
],
'companyName' => null,
],
'applicationType' => 'Classic',
'caseSubtype' => 'hw',
'status' => 'Registered',
'lpaIsCleansed' => true,
'caseAttorneySingular' => false,
'caseAttorneyJointlyAndSeverally' => true,
'caseAttorneyJointly' => false,
'caseAttorneyJointlyAndJointlyAndSeverally' => false,
'onlineLpaId' => 'A33718377316',
'cancellationDate' => null,
'attorneys' => [
[
'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' => '',
'addressLine3' => '',
],
],
'systemStatus' => true,
'companyName' => '',
],
[
'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' => '',
'addressLine3' => '',
],
],
'systemStatus' => true,
'companyName' => '',
],
],
'replacementAttorneys' => [],
'trustCorporations' => [
[
'addresses' => [
[
'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,
'systemStatus' => true,
'companyName' => 'trust corporation',
],
],
'certificateProviders' => [
[
'id' => 11,
'uId' => '7000-0000-0831',
'dob' => null,
'email' => null,
'salutation' => 'Miss',
'firstname' => 'Danielle',
'middlenames' => null,
'surname' => 'Hart ',
'addresses' => [
[
'id' => 11,
'town' => '',
'county' => '',
'postcode' => 'SK14 0RH',
'country' => '',
'type' => 'Primary',
'addressLine1' => '50 Fordham Rd',
'addressLine2' => 'HADFIELD',
'addressLine3' => '',
],
],
],
],
'attorneyActDecisions' => null,
'applicationHasRestrictions' => false,
'applicationHasGuidance' => false,
'lpaDonorSignatureDate' => '2012-12-12',
'lifeSustainingTreatment' => 'Option A',
];
}
}
Loading

0 comments on commit 46f37a5

Please sign in to comment.