diff --git a/service-front/module/Application/src/Controller/VouchingFlowController.php b/service-front/module/Application/src/Controller/VouchingFlowController.php index 3fe421ef..383e3a5d 100644 --- a/service-front/module/Application/src/Controller/VouchingFlowController.php +++ b/service-front/module/Application/src/Controller/VouchingFlowController.php @@ -399,7 +399,7 @@ public function enterAddressManualAction(): ViewModel|Response return $view->setTemplate('application/pages/vouching/enter_address_manual'); } - public function confirmDonorsAction(): ViewModel + public function confirmDonorsAction(): ViewModel|Response { $uuid = $this->params()->fromRoute("uuid"); @@ -412,7 +412,9 @@ public function confirmDonorsAction(): ViewModel $lpaData = $this->siriusApiService->getLpaByUid($lpa, $this->request); $donorName = AddDonorFormHelper::getDonorNameFromSiriusResponse($lpaData); - $type = LpaTypes::fromName($lpaData['opg.poas.lpastore']['lpaType'] ?? ''); + $type = LpaTypes::fromName( + $lpaData['opg.poas.lpastore']['lpaType'] ?? $lpaData['opg.poas.sirius']['caseSubtype'] + ); $lpaDetails[$lpa] = [ 'name' => $donorName, diff --git a/service-front/module/Application/src/Helpers/AddDonorFormHelper.php b/service-front/module/Application/src/Helpers/AddDonorFormHelper.php index f756eec0..e25fcd55 100644 --- a/service-front/module/Application/src/Helpers/AddDonorFormHelper.php +++ b/service-front/module/Application/src/Helpers/AddDonorFormHelper.php @@ -119,9 +119,10 @@ public function checkLpaStatus(array $lpaData): array "problem" => false, "message" => "" ]; - /** @psalm-suppress PossiblyNullArgument */ + if ( array_key_exists('opg.poas.lpastore', $lpaData) && + ! is_null($lpaData['opg.poas.lpastore']) && array_key_exists('status', $lpaData['opg.poas.lpastore']) ) { $status = $lpaData['opg.poas.lpastore']['status']; diff --git a/service-front/module/Application/test/Controller/VouchingFlowControllerTest.php b/service-front/module/Application/test/Controller/VouchingFlowControllerTest.php index 699df558..334ba997 100755 --- a/service-front/module/Application/test/Controller/VouchingFlowControllerTest.php +++ b/service-front/module/Application/test/Controller/VouchingFlowControllerTest.php @@ -923,8 +923,10 @@ public function testConfirmDonors(): void 'opg.poas.lpastore' => ['lpaType' => 'personal-welfare'] ], $lpa === 'M-AAAA-1234-5678' => [ - 'opg.poas.sirius' => ['donor' => ['firstname' => 'another', 'surname' => 'name']], - 'opg.poas.lpastore' => ['lpaType' => 'property-and-affairs'] + 'opg.poas.sirius' => [ + 'donor' => ['firstname' => 'another', 'surname' => 'name'], + 'caseSubtype' => 'property-and-affairs' + ], ], }); @@ -935,7 +937,9 @@ public function testConfirmDonors(): void $this->assertControllerClass('VouchingFlowController'); $this->assertMatchedRouteName('root/voucher_confirm_donors'); + $this->assertQueryContentContains('span[id=lpaType]', 'PW'); $this->assertQueryContentContains('span[id=lpaId]', 'M-XYXY-YAGA-35G3'); + $this->assertQueryContentContains('span[id=lpaType]', 'PA'); $this->assertQueryContentContains('span[id=lpaId]', 'M-AAAA-1234-5678'); } diff --git a/service-front/module/Application/test/Helpers/AddDonorFormHelperTest.php b/service-front/module/Application/test/Helpers/AddDonorFormHelperTest.php index a5907ac0..26d34fe6 100644 --- a/service-front/module/Application/test/Helpers/AddDonorFormHelperTest.php +++ b/service-front/module/Application/test/Helpers/AddDonorFormHelperTest.php @@ -110,7 +110,7 @@ public function testGetDonorDobFromSiriusResponse(): void /** * @dataProvider statusData */ - public function testCheckLpaStatus(array $lpaStoreData, array $expectedResult): void + public function testCheckLpaStatus(?array $lpaStoreData, array $expectedResult): void { $lpaData = self::getLpa([ 'opg.poas.lpastore' => $lpaStoreData @@ -122,6 +122,10 @@ public function testCheckLpaStatus(array $lpaStoreData, array $expectedResult): public static function statusData(): array { return [ + [ + null, + ['problem' => true, 'message' => 'No LPA Found.'] + ], [ [], ['problem' => true, 'message' => 'No LPA Found.'] diff --git a/service-front/module/Application/view/application/pages/vouching/confirm_donors.twig b/service-front/module/Application/view/application/pages/vouching/confirm_donors.twig index 20200df6..be0b5550 100644 --- a/service-front/module/Application/view/application/pages/vouching/confirm_donors.twig +++ b/service-front/module/Application/view/application/pages/vouching/confirm_donors.twig @@ -39,9 +39,7 @@ {% for index, datum in lpa_details %}
- - {{ datum['type'] }} - + {{ datum['type'] }} {{ index }}