Skip to content

Commit

Permalink
UML-2987 Pushing up spike changes to check pipeline failures
Browse files Browse the repository at this point in the history
  • Loading branch information
MishNajam authored and Sam Ainsworth committed Oct 26, 2023
1 parent 4b2086c commit 12d5693
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 8 deletions.
12 changes: 12 additions & 0 deletions mock-integrations/image-request-handler/mock-openapi-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,15 @@ paths:
'iap-700000136361-instructions': 'http://localhost:4010/iap-700000136361-instructions.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAAAAAAAAAAA%2F20230110%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20230110T170414Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FwoGZXIvqfrfffffqB8ObHF9iK0Ae6ydwSr1R7ho%2BkIqn%2FOYVShw77vHhp5XuM945Z5uuqFQTUP128xAiCqgERWsuT7BSLhPeazeR6QjAm0jjH8JTa9YQ1OqBlF6BSY3o6oOvnagVxDwx1SzfEQK%2FMdoPpwOgPQ1qIN714YJfGe0Qp%2FbdAv%2F5tLGG5rgBX98CCuWTszpsWQnaFtfEWhfTG%2BvqUsjavsusT7TmPbHMv7gFqvSoU8Aos7LDt8vgUuA8TrD%2FQs9ZjkxyiOtfadBjItlHw%2BOq8%2BVp29uq0r4r4r22r424r24rkjxnisGe4K9cMD0hNr5PjCXa3c1QRo&X-Amz-Signature=fd5ec81d49482cc2b26aac02ffe94e9d82d3e29b00c368fb1bad707f6066ecf0',
'iap-700000136361-preferences': 'http://localhost:4010/iap-700000136361-preferences.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAAAAAAAAAAA%2F20230110%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20230110T170414Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FwoGZXIvYXdzEEsaDA9nffwerfrfrffqiK0Ae6ydwSr1R7ho%2BkIqn%2FOYVShw77vHhp5XuM945Z5uuqFQTUP128xAiCqgERWsuT7BSLhPeazeR6QjAm0jjH8JTa9YQ1OqBlF6BSY3o6oOvnagVxDwx1SzfEQK%2FMdoPpwOgPQ1qIN714YJfGe0Qp%2FbdAv%2F5tLGG5rgBX98CCuWTszpsWQnaFtfEWhfTG%2BvqUsjavsusT7TmPbHMv7gFqvSoU8Aos7LDt8vgUuA8TrD%2FQs9ZjkxyiOtfadBjItlHw%2BOq8%2BVpd24d24d24d24d42dZufWkjxnisGe4K9cMD0hNr5PjCXa3c1QRo&X-Amz-Signature=fd5ec81d49482cc2b26aac02ffe94e9d82d3e29b00c368fb1bad707f83929392'
}
'500':
content:
application/json:
examples:
lpa0138:
value:
errors:
- {
'code': 'OPGDATA-API-SERVERERROR',
'title': 'Internal server error',
}

10 changes: 5 additions & 5 deletions mock-integrations/image-request-handler/mock-openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ paths:
uId: 700000000047
status: 'COLLECTION_NOT_STARTED'
signedUrls: {'iap-700000000047-instructions': 'https://my-bucket.s3.amazonaws.com/iap-700000000047-instructions.jpg4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAAAAAAAAAAA%2F20230110%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20230110T170414Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FwoGZXIvqfrfffffqB8ObHF9iK0Ae6ydwSr1R7ho%2BkIqn%2FOYVShw77vHhp5XuM945Z5uuqFQTUP128xAiCqgERWsuT7BSLhPeazeR6QjAm0jjH8JTa9YQ1OqBlF6BSY3o6oOvnagVxDwx1SzfEQK%2FMdoPpwOgPQ1qIN714YJfGe0Qp%2FbdAv%2F5tLGG5rgBX98CCuWTszpsWQnaFtfEWhfTG%2BvqUsjavsusT7TmPbHMv7gFqvSoU8Aos7LDt8vgUuA8TrD%2FQs9ZjkxyiOtfadBjItlHw%2BOq8%2BVp29uq0r4r4r22r424r24rkjxnisGe4K9cMD0hNr5PjCXa3c1QRo&X-Amz-Signature=fd5ec81d49482cc2b26aac02ffe94e9d82d3e29b00c368fb1bad707f6066ecf0', 'iap-700000000047-preferences': 'https://my-bucket.s3.amazonaws.com/iap-700000000047-preferences.jpg4?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAAAAAAAAAAA%2F20230110%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20230110T170414Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FwoGZXIvYXdzEEsaDA9nffwerfrfrffqiK0Ae6ydwSr1R7ho%2BkIqn%2FOYVShw77vHhp5XuM945Z5uuqFQTUP128xAiCqgERWsuT7BSLhPeazeR6QjAm0jjH8JTa9YQ1OqBlF6BSY3o6oOvnagVxDwx1SzfEQK%2FMdoPpwOgPQ1qIN714YJfGe0Qp%2FbdAv%2F5tLGG5rgBX98CCuWTszpsWQnaFtfEWhfTG%2BvqUsjavsusT7TmPbHMv7gFqvSoU8Aos7LDt8vgUuA8TrD%2FQs9ZjkxyiOtfadBjItlHw%2BOq8%2BVpd24d24d24d24d42dZufWkjxnisGe4K9cMD0hNr5PjCXa3c1QRo&X-Amz-Signature=fd5ec81d49482cc2b26aac02ffe94e9d82d3e29b00c368fb1bad707f83929392'}
lpa0138:
value:
uId: 700000000138
status: 'COLLECTION_COMPLETE'
signedUrls: {'iap-700000000138-instructions': 'http://localhost:4010/iap-700000000138-instructions.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAAAAAAAAAAA%2F20230110%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20230110T170414Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FwoGZXIvqfrfffffqB8ObHF9iK0Ae6ydwSr1R7ho%2BkIqn%2FOYVShw77vHhp5XuM945Z5uuqFQTUP128xAiCqgERWsuT7BSLhPeazeR6QjAm0jjH8JTa9YQ1OqBlF6BSY3o6oOvnagVxDwx1SzfEQK%2FMdoPpwOgPQ1qIN714YJfGe0Qp%2FbdAv%2F5tLGG5rgBX98CCuWTszpsWQnaFtfEWhfTG%2BvqUsjavsusT7TmPbHMv7gFqvSoU8Aos7LDt8vgUuA8TrD%2FQs9ZjkxyiOtfadBjItlHw%2BOq8%2BVp29uq0r4r4r22r424r24rkjxnisGe4K9cMD0hNr5PjCXa3c1QRo&X-Amz-Signature=fd5ec81d49482cc2b26aac02ffe94e9d82d3e29b00c368fb1bad707f6066ecf0', 'iap-700000000138-preferences': 'http://localhost:4010/iap-700000000138-preferences.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AAAAAAAAAAAAA%2F20230110%2Feu-west-1%2Fs3%2Faws4_request&X-Amz-Date=20230110T170414Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FwoGZXIvYXdzEEsaDA9nffwerfrfrffqiK0Ae6ydwSr1R7ho%2BkIqn%2FOYVShw77vHhp5XuM945Z5uuqFQTUP128xAiCqgERWsuT7BSLhPeazeR6QjAm0jjH8JTa9YQ1OqBlF6BSY3o6oOvnagVxDwx1SzfEQK%2FMdoPpwOgPQ1qIN714YJfGe0Qp%2FbdAv%2F5tLGG5rgBX98CCuWTszpsWQnaFtfEWhfTG%2BvqUsjavsusT7TmPbHMv7gFqvSoU8Aos7LDt8vgUuA8TrD%2FQs9ZjkxyiOtfadBjItlHw%2BOq8%2BVpd24d24d24d24d42dZufWkjxnisGe4K9cMD0hNr5PjCXa3c1QRo&X-Amz-Signature=fd5ec81d49482cc2b26aac02ffe94e9d82d3e29b00c368fb1bad707f83929392'}
lpa7237:
value:
uId: 700000137237
Expand Down Expand Up @@ -173,6 +168,11 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/Error500'
examples:
lpa0138:
value:
errors:
- {'code': 'OPGDATA-API-SERVERERROR', 'title': 'Internal server error'}
'502':
description: Error pushing to upstream SQS queue or s3 bucket
content:
Expand Down
7 changes: 6 additions & 1 deletion mock-integrations/image-request-handler/mock-responses.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
var lpa = "lpa" + context.request.pathParams.uid.slice(-4);

switch (lpa) {
case 'lpa0138':
case 'lpa6361':
case 'lpa7237':
case 'lpa0252':
respond().withExampleName(lpa);
break;
case 'lpa0138':
respond()
.withStatusCode(500)
.withFile("responses/lpa0138.json").template()
.usingDefaultBehaviour();
break;
case 'lpa0344':
var lpaStore = stores.open('lpa0344');

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"code": "OPGDATA-API-SERVERERROR",
"title": "Internal server error"
}
6 changes: 5 additions & 1 deletion service-api/app/src/App/src/Service/Lpa/LpaService.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@ public function getByViewerCode(string $viewerCode, string $donorSurname, ?strin
(($lpaData['applicationHasGuidance'] ?? false) || ($lpaData['applicationHasRestrictions'] ?? false))
) {
$this->logger->info('The LPA has instructions and/or preferences. Fetching images');
$result['iap'] = $this->iapRepository->getInstructionsAndPreferencesImages((int) $lpaData['uId']);

try {
$result['iap'] = $this->iapRepository->getInstructionsAndPreferencesImages((int) $lpaData['uId']);
} catch (\Exception) {

Check warning on line 244 in service-api/app/src/App/src/Service/Lpa/LpaService.php

View check run for this annotation

Codecov / codecov/patch

service-api/app/src/App/src/Service/Lpa/LpaService.php#L244

Added line #L244 was not covered by tests
}
}

if (!is_null($organisation)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ public function handle(ServerRequestInterface $request): ResponseInterface
($lpaData->lpa->getApplicationHasRestrictions() ?? false)
)
) {
$renderData['iap_images'] = $this->instAndPrefImagesService->getImagesById($identity, $actorLpaToken);
try {
$renderData['iap_images'] = $this->instAndPrefImagesService->getImagesById($identity, $actorLpaToken);
} catch (\Exception) {
// maybe return a flag to say whether it should have returned images
}
}

return new HtmlResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
{% if lpa.applicationHasGuidance %}
{% if feature_enabled("instructions_and_preferences") and iap_images is defined %}
{% trans %}Yes, the donor made preferences on their LPA.{% endtrans %}
{% elseif feature_enabled("instructions_and_preferences") %}
{% trans %}Sorry{% endtrans %}
{% else %}
{% trans %}Yes, the donor made preferences on their LPA.{% endtrans %}
<br>{% trans %}To view these, ask to see the paper LPA.{% endtrans %}
Expand Down

0 comments on commit 12d5693

Please sign in to comment.