Skip to content

Commit

Permalink
Merge branch 'main' into UML-3394-combined-lpa-manager
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdavis2001 committed Dec 19, 2024
2 parents c7a53fa + 6b2ef66 commit eb2a372
Show file tree
Hide file tree
Showing 26 changed files with 525 additions and 253 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/_build-and-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
- name: ecr login
id: login_ecr
uses: aws-actions/amazon-ecr-login@b06ccd195086ba5254c95c627ee1cbeab86c7432 # [email protected]
uses: aws-actions/amazon-ecr-login@292c88581676a2a6d95f1312c0517f24577eca53 # [email protected]
with:
registries: 311462405659
if: |
Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
(inputs.specific_path == 'all' || inputs.specific_path == matrix.svc_prefix)
- name: archive test results
uses: actions/upload-artifact@184d73b71b93c222403b2e7f1ffebe4508014249
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b
with:
name: service-${{ matrix.svc_prefix }}
path: build/service-${{ matrix.svc_prefix }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/_node-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb # pin@v3
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # [email protected]
- uses: actions/setup-node@48b90677b6048efbc723b11a94acb950d3f1ac36 # [email protected]
with:
node-version-file: '.nvmrc'
- name: cache node modules
Expand All @@ -33,7 +33,7 @@ jobs:
cd service-front/web/
npm run build
- name: archive dist
uses: actions/upload-artifact@184d73b71b93c222403b2e7f1ffebe4508014249 # [email protected]
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # [email protected]
with:
name: dist-web
path: service-front/web/dist/
2 changes: 1 addition & 1 deletion .github/workflows/_node-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@cbb722410c2e876e24abbe8de2cc27693e501dcb # pin@v3
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # [email protected]
- uses: actions/setup-node@48b90677b6048efbc723b11a94acb950d3f1ac36 # [email protected]
with:
node-version-file: '.nvmrc'
- name: cache node modules
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_run-behat-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
vendor/bin/behat
- name: archive failed test screenshots
uses: actions/upload-artifact@184d73b71b93c222403b2e7f1ffebe4508014249 # [email protected]
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # [email protected]
with:
name: behat-screenshots
path: tests/smoke/failed_step_screenshots
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_run-terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ jobs:

- name: upload environment cluster config file
if: inputs.terraform_path == 'environment'
uses: actions/upload-artifact@184d73b71b93c222403b2e7f1ffebe4508014249 # [email protected]
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # [email protected]
with:
name: environment_config_file_${{ inputs.workspace }}
path: terraform/environment/cluster_config.json
2 changes: 1 addition & 1 deletion .github/workflows/path-to-live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

- name: get changed docs files in any folder
id: changed-files-docs
uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f
uses: tj-actions/changed-files@515a6b35d1d0948f7da6d5cdb347ed1600859795
with:
files: |
**/*.md
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pull-request-path.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ jobs:

- name: get changed files in the admin folder
id: changed-files-admin
uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f
uses: tj-actions/changed-files@515a6b35d1d0948f7da6d5cdb347ed1600859795
with:
files: |
service-admin/**
- name: get changed files in the terraform folder
id: changed-files-terraform
uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f
uses: tj-actions/changed-files@515a6b35d1d0948f7da6d5cdb347ed1600859795
with:
files: |
terraform/**
- name: get changed docs files in any folder
id: changed-files-docs
uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f
uses: tj-actions/changed-files@515a6b35d1d0948f7da6d5cdb347ed1600859795
with:
files: |
**/*.md
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/workflow-deploy-ref-to-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ jobs:

- name: get changed files in the admin folder
id: changed-files-admin
uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f
uses: tj-actions/changed-files@515a6b35d1d0948f7da6d5cdb347ed1600859795
with:
files: |
service-admin/**
- name: get changed files in the terraform folder
id: changed-files-terraform
uses: tj-actions/changed-files@ac47125d2d05ea616734c7e19a125149a325d43f
uses: tj-actions/changed-files@515a6b35d1d0948f7da6d5cdb347ed1600859795
with:
files: |
terraform/**
Expand Down
140 changes: 59 additions & 81 deletions service-api/app/features/context/Integration/LpaContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use App\Service\Lpa\FindActorInLpa\ActorMatch;
use App\Service\Lpa\GetInstructionsAndPreferencesImages;
use App\Service\Lpa\RemoveLpa;
use App\Service\Lpa\SiriusLpa;
use App\Service\Lpa\SiriusLpaManager;
use App\Service\Lpa\SiriusPerson;
use App\Service\ViewerCodes\ViewerCodeService;
Expand All @@ -41,6 +42,7 @@
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\ExpectationFailedException;
use Psr\Http\Message\RequestInterface;
use Psr\Log\LoggerInterface;
use stdClass;

use function PHPUnit\Framework\assertEquals;
Expand Down Expand Up @@ -386,13 +388,22 @@ public function iProvideTheAttorneyDetailsFromAValidPaperLPADocument(): void
$lpaMatchResponse = $addOlderLpa->validateRequest($this->userId, $data);

$expectedLpaArray = json_decode(json_encode($this->lpa), true);
$expectedLpa = new \App\Service\Lpa\SiriusLpa($expectedLpaArray);
$expectedLpa = new SiriusLpa($expectedLpaArray, $this->container->get(LoggerInterface::class));
$expectedResponse = new AccessForAllValidation(
new ActorMatch(
new SiriusPerson(json_decode(json_encode($this->lpa->attorneys[0]), true)),
new SiriusPerson(
json_decode(
json_encode(
$this->lpa->attorneys[0]
),
true
),
$this->container->get(LoggerInterface::class),
),
'attorney',
$this->lpa->uId),
$expectedLpa,
$this->lpa->uId,
),
$expectedLpa,
null,
);

Expand Down Expand Up @@ -1594,13 +1605,20 @@ public function iConfirmDetailsShownToMeOfTheFoundLPAAreCorrect(): void
$lpaMatchResponse = $addOlderLpa->validateRequest($this->userId, $data);

$expectedLpaArray = json_decode(json_encode($this->lpa), true);
$expectedLpa = new \App\Service\Lpa\SiriusLpa($expectedLpaArray);
$expectedLpa = new SiriusLpa($expectedLpaArray, $this->container->get(LoggerInterface::class));
$expectedResponse = new AccessForAllValidation(
new ActorMatch(
new SiriusPerson(json_decode(json_encode($lpa->donor), true)),
new SiriusPerson(
json_decode(
json_encode($lpa->donor),
true
),
$this->container->get(LoggerInterface::class),
),
'donor',
$lpa->uId),
$expectedLpa,
$lpa->uId,
),
$expectedLpa,
null,
);

Expand Down Expand Up @@ -1823,68 +1841,6 @@ public function iProvideDetailsThatDoNotMatchThePaperDocument($firstnames, $last
throw new ExpectationFailedException('LPA should not have matched data provided');
}

/**
* @When /^I provide details "([^"]*)" "([^"]*)" "([^"]*)" "([^"]*)" that match a valid paper document$/
*/
public function iProvideDetailsThatMatchAValidPaperDocument($firstnames, $lastname, $postcode, $dob)
{
$this->lpa = json_decode(file_get_contents(__DIR__ . '../../../../test/fixtures/test_lpa.json'));

$this->lpa->donor->firstname = 'Rachel';
$this->lpa->donor->surname = 'S’anderson';

$data = [
'reference_number' => (int) $this->lpaUid,
'dob' => $dob,
'postcode' => $postcode,
'first_names' => $firstnames,
'last_name' => $lastname,
'force_activation_key' => false,
];

//UserLpaActorMap: getAllForUser
$this->awsFixtures->append(
new Result([])
);

$this->pactGetInteraction(
$this->apiGatewayPactProvider,
'/v1/use-an-lpa/lpas/' . $this->lpaUid,
StatusCodeInterface::STATUS_OK,
$this->lpa
);

$codeExists = new stdClass();
$codeExists->Created = null;

$this->pactPostInteraction(
$this->codesApiPactProvider,
'/v1/exists',
[
'lpa' => $this->lpa->uId,
'actor' => $this->lpa->donor->uId,
],
StatusCodeInterface::STATUS_OK,
$codeExists
);

$addAccessForAllLpa = $this->container->get(AddAccessForAllLpa::class);
$lpaMatchResponse = $addAccessForAllLpa->validateRequest($this->userId, $data);

$expectedLpaArray = json_decode(json_encode($this->lpa), true);
$expectedLpa = new \App\Service\Lpa\SiriusLpa($expectedLpaArray);
$expectedResponse = new AccessForAllValidation(
new ActorMatch(
new SiriusPerson(json_decode(json_encode($this->lpa->donor), true)),
'donor',
$this->lpa->uId),
$expectedLpa,
null
);

Assert::assertEquals($expectedResponse, $lpaMatchResponse);
}

/**
* @When /^I provide the details from a valid paper LPA document$/
*/
Expand Down Expand Up @@ -1932,13 +1888,20 @@ public function iProvideTheDetailsFromAValidPaperLPADocument(): void
$lpaMatchResponse = $addOlderLpa->validateRequest($this->userId, $data);

$expectedLpaArray = json_decode(json_encode($this->lpa), true);
$expectedLpa = new \App\Service\Lpa\SiriusLpa($expectedLpaArray);
$expectedLpa = new SiriusLpa($expectedLpaArray, $this->container->get(LoggerInterface::class));
$expectedResponse = new AccessForAllValidation(
new ActorMatch(
new SiriusPerson(json_decode(json_encode($this->lpa->donor), true)),
new SiriusPerson(
json_decode(
json_encode($this->lpa->donor),
true
),
$this->container->get(LoggerInterface::class)
),
'donor',
$this->lpa->uId),
$expectedLpa,
$this->lpa->uId,
),
$expectedLpa,
null
);

Expand Down Expand Up @@ -1971,7 +1934,7 @@ public function iProvideTheDetailsFromAValidPaperDocumentThatAlreadyHasAnActivat
$this->lpa
);

$codeExists = new stdClass();
$codeExists = new stdClass();
$createdDate = (new DateTime())->modify('-14 days');

$activationKeyDueDate = DateTimeImmutable::createFromMutable($createdDate);
Expand Down Expand Up @@ -2001,11 +1964,19 @@ public function iProvideTheDetailsFromAValidPaperDocumentThatAlreadyHasAnActivat
Assert::assertEquals('LPA has an activation key already', $ex->getMessage());
Assert::assertEquals(
[
'donor' => new SiriusPerson(json_decode(json_encode($this->lpa->donor), true)),
'donor' => new SiriusPerson(
json_decode(
json_encode(
$this->lpa->donor
),
true
),
$this->container->get(LoggerInterface::class),
),
'caseSubtype' => $this->lpa->caseSubtype,
'activationKeyDueDate' => $activationKeyDueDate,
],
$ex->getAdditionalData()
$ex->getAdditionalData(),
);
return;
}
Expand Down Expand Up @@ -2733,13 +2704,20 @@ public function iRequestForANewActivationKeyAgain(): void
$response = $addOlderLpa->validateRequest($this->userId, $data);

$expectedLpaArray = json_decode(json_encode($this->lpa), true);
$expectedLpa = new \App\Service\Lpa\SiriusLpa($expectedLpaArray);
$expectedLpa = new SiriusLpa($expectedLpaArray, $this->container->get(LoggerInterface::class));
$expectedResponse = new AccessForAllValidation(
new ActorMatch(
new SiriusPerson(json_decode(json_encode($this->lpa->donor), true)),
new SiriusPerson(
json_decode(
json_encode($this->lpa->donor),
true
),
$this->container->get(LoggerInterface::class)
),
'donor',
$this->lpa->uId),
$expectedLpa,
$this->lpa->uId,
),
$expectedLpa,
null
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public function lookup(array $uids): array
$results[$uid] = new Lpa(
new SiriusLpa(
$this->sanitiser->sanitise($response),
$this->logger,
),
new DateTimeImmutable($result->getHeaderLine('Date'))
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace App\Exception;

use Fig\Http\Message\StatusCodeInterface;
use Throwable;

class ActorDateOfBirthNotSetException extends AbstractApiException
{
public const MESSAGE = 'Actor date of birth is not set';
public const TITLE = 'DOB Not Found';
public const CODE = StatusCodeInterface::STATUS_NOT_FOUND;

public function __construct(?string $message = null, array $additionalData = [], ?Throwable $previous = null)
{
parent::__construct(self::TITLE, $message, self::CODE, $additionalData, $previous);
}
}
Loading

0 comments on commit eb2a372

Please sign in to comment.