From 171503eef80f78280c67cca0ee883d3441406d0a Mon Sep 17 00:00:00 2001 From: Alice Di Rico Date: Mon, 4 Nov 2024 16:46:24 +0100 Subject: [PATCH 1/6] add logic to pass the errorMessage and not only the error code --- assets/html/login.html | 5 ++++- src/payloads/login.ts | 3 ++- src/routers/public.ts | 20 ++++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/assets/html/login.html b/assets/html/login.html index 1b8aad1a..1bc35db1 100644 --- a/assets/html/login.html +++ b/assets/html/login.html @@ -62,11 +62,14 @@ ["29", "29 - Identità non erogata"], ["1001", "1001 - Cittadino minore di 14 anni"], ["1002", "1002 - Utente con identità bloccata da ioapp.it"], - ["CIEID_OPERATION_CANCEL", "CIEID_OPERATION_CANCEL"] + ["CIEID_OPERATION_CANCEL", "CIEID_OPERATION_CANCEL - Operazione annullata"], + ["errorMessage:Missing SAMLResponse in ACS", "SAML_RESPONSE_ERROR_MESSAGE - Missing SAMLResponse in ACS"], + ["errorMessage:MISSING_IDP_ISSUER", "MISSING_IDP_ISSUER - Error: Missing idpIssuer inside configuration"] ]; const simulateSpidError = () => { const container = document.getElementById("spidSelect"); + console.log(container) window.location.href = `/idp-login?authorized=0&error=${container.value}`; return false; } diff --git a/src/payloads/login.ts b/src/payloads/login.ts index 79b7dfe1..c0ccf7bd 100644 --- a/src/payloads/login.ts +++ b/src/payloads/login.ts @@ -1,6 +1,7 @@ export const loginLolliPopRedirect: string = "/idp-login"; export const redirectUrl: string = "/profile.html?token="; -export const errorRedirectUrl: string = "/error.html?errorCode="; +export const errorCodeRedirectUrl: string = "/error.html?errorCode="; +export const errorMessageRedirectUrl: string = "/error.html?errorMessage="; export enum AppUrlLoginScheme { native = "iologin", diff --git a/src/routers/public.ts b/src/routers/public.ts index e5f91b31..34d07a91 100644 --- a/src/routers/public.ts +++ b/src/routers/public.ts @@ -13,7 +13,8 @@ import { WALLET_PAYMENT_PATH } from "../features/payments/utils/payment"; import { backendInfo } from "../payloads/backend"; import { AppUrlLoginScheme, - errorRedirectUrl, + errorCodeRedirectUrl, + errorMessageRedirectUrl, loginLolliPopRedirect, redirectUrl } from "../payloads/login"; @@ -95,7 +96,22 @@ addHandler(publicRouter, "get", "/idp-login", (req, res) => { return; } if (req.query.error) { - const url = `${urlLoginScheme}://${req.headers.host}${errorRedirectUrl}${req.query.error}`; + // eslint-disable-next-line functional/no-let + let redirectUrl; + // eslint-disable-next-line functional/no-let + let errorCodeOrMessage; + if ( + req.query.error && + typeof req.query.error === "string" && + req.query.error.includes("errorMessage:") + ) { + redirectUrl = errorMessageRedirectUrl; + errorCodeOrMessage = req.query.error.split(":")[1]; + } else { + redirectUrl = errorCodeRedirectUrl; + errorCodeOrMessage = req.query.error; + } + const url = `${urlLoginScheme}://${req.headers.host}${redirectUrl}${errorCodeOrMessage}`; res.redirect(url); return; } From feaa606981a67f96a54ee48e2c3295d4725a4ee1 Mon Sep 17 00:00:00 2001 From: Alice Di Rico Date: Mon, 4 Nov 2024 17:20:37 +0100 Subject: [PATCH 2/6] delete unsed code --- assets/html/login.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/assets/html/login.html b/assets/html/login.html index 1bc35db1..4d81a976 100644 --- a/assets/html/login.html +++ b/assets/html/login.html @@ -64,12 +64,10 @@ ["1002", "1002 - Utente con identità bloccata da ioapp.it"], ["CIEID_OPERATION_CANCEL", "CIEID_OPERATION_CANCEL - Operazione annullata"], ["errorMessage:Missing SAMLResponse in ACS", "SAML_RESPONSE_ERROR_MESSAGE - Missing SAMLResponse in ACS"], - ["errorMessage:MISSING_IDP_ISSUER", "MISSING_IDP_ISSUER - Error: Missing idpIssuer inside configuration"] ]; const simulateSpidError = () => { const container = document.getElementById("spidSelect"); - console.log(container) window.location.href = `/idp-login?authorized=0&error=${container.value}`; return false; } From 711307e6601238fc8413e6d0f67568f9b4d64fc2 Mon Sep 17 00:00:00 2001 From: Alice Di Rico Date: Tue, 12 Nov 2024 09:49:57 +0100 Subject: [PATCH 3/6] add correct logic to return errorMessage or errorCode --- src/routers/public.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/routers/public.ts b/src/routers/public.ts index 34d07a91..f4e63ec9 100644 --- a/src/routers/public.ts +++ b/src/routers/public.ts @@ -95,16 +95,12 @@ addHandler(publicRouter, "get", "/idp-login", (req, res) => { res.redirect(url); return; } - if (req.query.error) { + if (req.query.error && typeof req.query.error === "string") { // eslint-disable-next-line functional/no-let let redirectUrl; // eslint-disable-next-line functional/no-let let errorCodeOrMessage; - if ( - req.query.error && - typeof req.query.error === "string" && - req.query.error.includes("errorMessage:") - ) { + if (req.query.error.includes("errorMessage:")) { redirectUrl = errorMessageRedirectUrl; errorCodeOrMessage = req.query.error.split(":")[1]; } else { From ab8e66070b036551acadabff1959536c479e3a16 Mon Sep 17 00:00:00 2001 From: Alice Di Rico Date: Tue, 12 Nov 2024 10:31:32 +0100 Subject: [PATCH 4/6] add collaborators as codeowners --- CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODEOWNERS b/CODEOWNERS index 5a0c7f83..b0bcedcf 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,3 +1,3 @@ # see https://help.github.com/en/articles/about-code-owners#example-of-a-codeowners-file -* @pagopa/io-app +* @pagopa/io-app @ChrisMattew @gispada @freddi301 From db5f6c5c761bc7a4f0291cd6481de4e9a5dc751b Mon Sep 17 00:00:00 2001 From: Emanuele Dall'Ara <71103219+LeleDallas@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:20:47 +0100 Subject: [PATCH 5/6] feat(wallet): add new payment outcome (#436) --- assets/wallet/wallet_payment.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/assets/wallet/wallet_payment.html b/assets/wallet/wallet_payment.html index a9216086..2c36f5d1 100644 --- a/assets/wallet/wallet_payment.html +++ b/assets/wallet/wallet_payment.html @@ -23,6 +23,9 @@ ["17", "WAITING_CONFIRMATION_EMAIL"], ["18", "PAYMENT_REVERSED"], ["19", "PAYPAL_REMOVED_ERROR"], + ["116", "INSUFFICIENT_AVAILABILITY_ERROR"], + ["117", "CVV_ERROR"], + ["121", "PLAFOND_LIMIT_ERROR"] ]; const simulateOutcome = () => { From 75aa57265b4f7694ac73456183461ad952091df2 Mon Sep 17 00:00:00 2001 From: Frederik Batuna Date: Tue, 12 Nov 2024 14:23:36 +0100 Subject: [PATCH 6/6] feat: [PE-763] CGN partner search (#432) * add: cgn partner search endpoint * update: api definitions * add: cgn partners count * format * fix: package.json --------- Co-authored-by: Emanuele Dall'Ara <71103219+LeleDallas@users.noreply.github.com> --- package.json | 4 ++-- src/routers/features/cgn/merchants.ts | 34 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ac9f6ea3..ef84747f 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "io_session_manager_api": "https://raw.githubusercontent.com/pagopa/io-auth-n-identity-domain/io-session-manager@1.0.0/apps/io-session-manager/api/internal.yaml", "io_session_manager_public_api": "https://raw.githubusercontent.com/pagopa/io-auth-n-identity-domain/io-session-manager@1.0.0/apps/io-session-manager/api/public.yaml", "api_public_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v14.3.0-RELEASE/api_public.yaml", - "api_cgn": "https://raw.githubusercontent.com/pagopa/io-backend/v14.3.0-RELEASE/api_cgn.yaml", - "api_cgn_merchants": "https://raw.githubusercontent.com/pagopa/io-backend/v14.3.0-RELEASE/api_cgn_operator_search.yaml", + "api_cgn": "https://raw.githubusercontent.com/pagopa/io-backend/v16.2.0-RELEASE/api_cgn.yaml", + "api_cgn_merchants": "https://raw.githubusercontent.com/pagopa/io-backend/v16.2.0-RELEASE/api_cgn_operator_search.yaml", "api_cgn_geo": "https://raw.githubusercontent.com/pagopa/io-backend/here_geoapi_integration/api_geo.yaml", "content_specs": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.45/definitions.yml", "api_pagopa_walletv2": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.44/bonus/specs/bpd/pm/walletv2.json", diff --git a/src/routers/features/cgn/merchants.ts b/src/routers/features/cgn/merchants.ts index 6c57dd0f..c830e682 100644 --- a/src/routers/features/cgn/merchants.ts +++ b/src/routers/features/cgn/merchants.ts @@ -22,6 +22,7 @@ import { addHandler } from "../../../payloads/response"; import { sendFileFromRootPath } from "../../../utils/file"; import { addApiV1Prefix } from "../../../utils/strings"; import { publicRouter } from "../../public"; +import { SearchRequest } from "../../../../generated/definitions/cgn/merchants/SearchRequest"; export const cgnMerchantsRouter = Router(); @@ -74,6 +75,39 @@ addHandler( } ); +addHandler(cgnMerchantsRouter, "get", addPrefix("/count"), (req, res) => { + if (SearchRequest.is(req.body)) { + return res.status(200).json({ + count: merchantsAll.length + }); + } + return res.status(500); +}); + +addHandler(cgnMerchantsRouter, "post", addPrefix("/search"), (req, res) => { + if (SearchRequest.is(req.body)) { + return res.status(200).json({ + items: merchantsAll + .filter( + merchant => + merchant.name + .toLowerCase() + .includes(req.body.token.toLowerCase()) || + merchant.description + ?.toLowerCase() + .includes(req.body.token.toLowerCase()) + ) + .map(merchant => ({ + id: merchant.id, + name: merchant.name, + description: merchant.description, + newDiscounts: faker.datatype.boolean() + })) + }); + } + return res.status(500); +}); + addHandler( cgnMerchantsRouter, "post",