Skip to content

Commit

Permalink
Merge branch 'master' into IOCOM-1886_fimsHistorySpec
Browse files Browse the repository at this point in the history
  • Loading branch information
Vangaorth authored Nov 13, 2024
2 parents 87f53bb + 75aa572 commit 7d708ee
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion assets/html/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
["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"],
];

const simulateSpidError = () => {
Expand Down
3 changes: 3 additions & 0 deletions assets/wallet/wallet_payment.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"io_session_manager_api": "https://raw.githubusercontent.com/pagopa/io-auth-n-identity-domain/[email protected]/apps/io-session-manager/api/internal.yaml",
"io_session_manager_public_api": "https://raw.githubusercontent.com/pagopa/io-auth-n-identity-domain/[email protected]/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",
Expand Down
3 changes: 2 additions & 1 deletion src/payloads/login.ts
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
34 changes: 34 additions & 0 deletions src/routers/features/cgn/merchants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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",
Expand Down
18 changes: 15 additions & 3 deletions src/routers/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -94,8 +95,19 @@ addHandler(publicRouter, "get", "/idp-login", (req, res) => {
res.redirect(url);
return;
}
if (req.query.error) {
const url = `${urlLoginScheme}://${req.headers.host}${errorRedirectUrl}${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.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;
}
Expand Down

0 comments on commit 7d708ee

Please sign in to comment.