Skip to content

Commit

Permalink
[SIW-1446] return integrity check error (#1145)
Browse files Browse the repository at this point in the history
  • Loading branch information
silvicir authored Aug 5, 2024
1 parent 35124e6 commit b9593b1
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
11 changes: 11 additions & 0 deletions api_io_wallet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ paths:
$ref: "#/components/responses/BadRequest"
"403":
$ref: "#/components/responses/Forbidden"
"409":
$ref: "#/components/responses/Conflict"
"422":
$ref: "#/components/responses/UnprocessableContent"
"500":
Expand Down Expand Up @@ -67,6 +69,8 @@ paths:
$ref: "#/components/responses/Forbidden"
"404":
$ref: "#/components/responses/Forbidden"
"409":
$ref: "#/components/responses/Conflict"
"422":
$ref: "#/components/responses/UnprocessableContent"
"500":
Expand Down Expand Up @@ -108,6 +112,13 @@ components:
schema:
$ref: "#/components/schemas/ProblemDetail"

Conflict:
description: There has been a conflict
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetail"

Unexpected:
description: Unexpected error
content:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"generate:proxy:api-session": "rimraf generated/session && gen-api-models --api-spec api_session.yaml --out-dir generated/session",
"generate:lollipop-definitions": "rimraf generated/lollipop && gen-api-models --api-spec openapi/lollipop_definitions.yaml --out-dir generated/lollipop",
"generate:lollipop-first-sign": "rimraf generated/lollipop-first-consumer && gen-api-models --api-spec openapi/consumed/lollipop_first_consumer.yaml --out-dir generated/lollipop-first-consumer --request-types --response-decoders --client",
"generate:api:io-wallet": "rimraf generated/io-wallet-api && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/io-wallet/io-wallet-user-func@0.1.26/apps/io-wallet-user-func/openapi.yaml --no-strict --out-dir generated/io-wallet-api --request-types --response-decoders --client",
"generate:api:io-wallet": "rimraf generated/io-wallet-api && gen-api-models --api-spec https://raw.githubusercontent.com/pagopa/io-wallet/io-wallet-user-func@1.1.0/apps/io-wallet-user-func/openapi.yaml --no-strict --out-dir generated/io-wallet-api --request-types --response-decoders --client",
"generate:proxy:io-wallet-models": "rimraf generated/io-wallet && gen-api-models --api-spec api_io_wallet.yaml --out-dir generated/io-wallet",
"postversion": "git push && git push --tags",
"dist:modules": "modclean -r -n default:safe && yarn install --production",
Expand Down
16 changes: 16 additions & 0 deletions src/services/ioWalletService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ import { WalletAttestationView } from "../../generated/io-wallet-api/WalletAttes
const unprocessableContentError = "Unprocessable Content";
const invalidRequest = "Your request didn't validate";

// TODO SIW-1482
const conflictErrorTitle = "Conflict";
const conflictErrorDetail = "There has been a conflict";

export default class IoWalletService {
constructor(
private readonly ioWalletApiClient: ReturnType<IoWalletAPIClient>,
Expand Down Expand Up @@ -127,6 +131,12 @@ export default class IoWalletService {
switch (response.status) {
case 204:
return ResponseSuccessNoContent();
case 409:
return ResponseErrorGeneric(
response.status,
conflictErrorTitle,
conflictErrorDetail
);
case 422:
return ResponseErrorGeneric(
response.status,
Expand Down Expand Up @@ -178,6 +188,12 @@ export default class IoWalletService {
"Not Found",
"Wallet instance not found"
);
case 409:
return ResponseErrorGeneric(
response.status,
conflictErrorTitle,
conflictErrorDetail
);
case 422:
return ResponseErrorGeneric(
response.status,
Expand Down

0 comments on commit b9593b1

Please sign in to comment.