Skip to content

Commit

Permalink
Merge branch 'master' into IOPAE-1100-1282-1285
Browse files Browse the repository at this point in the history
  • Loading branch information
adelloste committed Jul 4, 2024
2 parents 3d31fae + 8542d6d commit 45da8dd
Show file tree
Hide file tree
Showing 24 changed files with 500 additions and 145 deletions.
128 changes: 128 additions & 0 deletions assets/FimsSwager.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
openapi: 3.0.0
info:
title: IO (FIMS)
version: 1.0.0

security:
- Bearer: []

paths:
/api/v1/fims/consents:
get:
operationId: getConsents
parameters:
- $ref: "#/components/parameters/continuationToken"
responses:
200:
description: "OK"
content:
application/json:
schema:
$ref: "#/components/schemas/ConsentsResponseDTO"
401:
description: Bearer token null or expired.
502:
description: Bad gateway.
504:
description: Gateway timeout.
500:
description: Service unavailable.
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemJson"

/api/v1/fims/exports:
post:
operationId: exports
requestBody:
$ref: "#/components/requestBodies/Export"
responses:
202:
description: Accepted
409:
description: Conflict
401:
description: Bearer token null or expired.
502:
description: Bad gateway.
504:
description: Gateway timeout.
500:
description: Service unavailable.
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemJson"


components:
securitySchemes:
Bearer:
type: http
scheme: bearer
bearerFormat: JWT

parameters:
continuationToken:
name: continuationToken
in: query
required: false
schema:
type: string

requestBodies:
Export:
description: Require an export
required: true
content:
application/json:
schema:
type: object
properties:
type:
type: string
enum: ["consent"]
required:
- type

schemas:
ConsentsResponseDTO:
type: object
properties:
items:
type: array
items:
$ref: "#/components/schemas/Consent"
continuationToken:
type: string
required:
- items
- continuationToken

ProblemJson:
$ref: "https://raw.githubusercontent.com/pagopa/io-functions-commons/v26.3.0/openapi/definitions.yaml#/ProblemJson"

Consent:
type: object
properties:
id:
type: string
format: ulid
service_id:
type: string
format: ulid
redirect:
type: object
properties:
uri:
type: string
format: uri
display_name:
type: string
timestamp:
$ref: "https://raw.githubusercontent.com/pagopa/io-functions-commons/v26.3.0/openapi/definitions.yaml#/Timestamp"
required:
- id
- service_id
- timestamp
13 changes: 4 additions & 9 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,24 +462,19 @@ profile:
idpay:
idpayTest: IDPay
idpayTestAlert: This change requires app reboot
itWallet:
itWalletTest: IT Wallet
designSystemEnvironment: Experimental Design System
newWalletSection: New wallet section
newHomeSection: New messages home
appVersion: Version
backendVersion: Backend Version
debugMode: Debug mode
designSystem: Design System
addCard:
titleSection: Add test card
warning:
title: Warning
message: To add a new test card, you must enable the pagoPA test environment from the settings.
closeButton: Close
trial:
titleSection: Join a trial
itWallet:
itWalletTest: IT Wallet
itWalletTestDescription: Enable the IT Wallet test environment
addTestCard:
title: Add test card
banner:
title: Do you want to display your fiscal code?
action: Go to "Your data" section
Expand Down
17 changes: 6 additions & 11 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,24 +462,19 @@ profile:
idpay:
idpayTest: IDPay
idpayTestAlert: La modifica richiede il riavvio dell'app
itWallet:
itWalletTest: IT Wallet
trial:
titleSection: Partecipa alla sperimentazione
designSystemEnvironment: Design System sperimentale
newWalletSection: Nuova sezione portafoglio
newHomeSection: Nuova home messaggi
appVersion: Versione
backendVersion: Versione Backend
debugMode: Modalità debug
designSystem: Design System
addCard:
titleSection: Aggiungi carta di test
warning:
title: Attenzione
message: Per aggiungere una nuova carta di test, devi abilitare l'ambiente pagoPA di test dalle impostazioni.
closeButton: Chiudi
trial:
titleSection: Partecipa alla sperimentazione
itWallet:
itWalletTest: IT Wallet
itWalletTestDescription: Abilita ambiente di test per IT Wallet
addTestCard:
title: Aggiungi carta di test
banner:
title: Vuoi visualizzare il tuo Codice Fiscale?
action: Vai alla sezione “I tuoi dati”
Expand Down
10 changes: 6 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2.63.0-rc.5",
"io_backend_api": "https://raw.githubusercontent.com/pagopa/io-backend/v13.39.1-RELEASE/api_backend.yaml",
"io_public_api": "https://raw.githubusercontent.com/pagopa/io-backend/v13.39.1-RELEASE/api_public.yaml",
"io_content_specs": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.33/definitions.yml",
"io_content_specs": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.34/definitions.yml",
"io_cgn_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.39.1-RELEASE/api_cgn.yaml",
"io_cgn_merchants_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.39.1-RELEASE/api_cgn_operator_search.yaml",
"api_fci": "https://raw.githubusercontent.com/pagopa/io-backend/v13.39.1-RELEASE/api_io_sign.yaml",
Expand All @@ -13,9 +13,10 @@
"io_consumed_pn_specs": "https://raw.githubusercontent.com/pagopa/io-backend/v13.39.1-RELEASE/openapi/consumed/api-piattaforma-notifiche.yaml",
"api_cdc": "assets/CdcSwagger.yml",
"pagopa_api": "assets/paymentManager/spec.json",
"pagopa_api_walletv2": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.32/bonus/specs/bpd/pm/walletv2.json",
"pagopa_cobadge_configuration": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.32/pagopa/cobadge/abi_definitions.yml",
"pagopa_privative_configuration": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.32/pagopa/privative/definitions.yml",
"fims_swagger": "assets/FimsSwager.yml",
"pagopa_api_walletv2": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.34/bonus/specs/bpd/pm/walletv2.json",
"pagopa_cobadge_configuration": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.34/pagopa/cobadge/abi_definitions.yml",
"pagopa_privative_configuration": "https://raw.githubusercontent.com/pagopa/io-services-metadata/1.0.34/pagopa/privative/definitions.yml",
"idpay_api": "https://raw.githubusercontent.com/pagopa/cstar-infrastructure/v6.9.1/src/domains/idpay-app/api/idpay_appio_full/openapi.appio.full.yml",
"services_api": "https://raw.githubusercontent.com/pagopa/io-backend/v13.39.1-RELEASE/api_services_app_backend.yaml",
"lollipop_api": "https://raw.githubusercontent.com/pagopa/io-backend/v13.39.1-RELEASE/api_lollipop_first_consumer.yaml",
Expand Down Expand Up @@ -86,6 +87,7 @@
"generate:pagopa-ecommerce-api": "rimraf definitions/pagopa/ecommerce && mkdir -p definitions/pagopa/ecommerce && gen-api-models --api-spec $npm_package_pagopa_api_ecommerce --out-dir ./definitions/pagopa/ecommerce --no-strict --response-decoders --request-types --client",
"generate:pagopa-biz-events-api": "rimraf definitions/pagopa/biz-events && mkdir -p definitions/pagopa/biz-events && gen-api-models --api-spec $npm_package_pagopa_api_biz_events --out-dir ./definitions/pagopa/biz-events --no-strict --response-decoders --request-types --client",
"generate:pagopa-platform-api": "rimraf definitions/pagopa/platform && mkdir -p definitions/pagopa/platform && gen-api-models --api-spec $npm_package_pagopa_api_platform --out-dir ./definitions/pagopa/platform --no-strict --response-decoders --request-types --client",
"generate:fims": "rimraf definitions/fims && mkdir -p definitions/fims && gen-api-models --api-spec $npm_package_fims_swagger --out-dir ./definitions/fims --no-strict --response-decoders --request-types --client",
"generate:payments": "npm-run-all generate:pagopa-walletv3-api generate:pagopa-ecommerce-api generate:pagopa-biz-events-api generate:pagopa-platform-api",
"generate": "npm-run-all generate:*",
"locales_unused": "ts-node --skip-project -O '{\"lib\":[\"es2015\"]}' scripts/unused-locales.ts",
Expand Down
6 changes: 3 additions & 3 deletions ts/features/design-system/core/DSFooterActionsSticky.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ export const DSFooterActionsSticky = () => {

const scrollY = useSharedValue<number>(0);

/* We can't just use `screenHeight` from `Dimensions` because
/* We can't just use `windowHeight` from `Dimensions` because
it doesn't count the fixed block used by `react-navigation`
for the header */
const { height: screenHeight } = Dimensions.get("screen");
const { height: windowHeight } = Dimensions.get("window");
const headerHeight = useHeaderHeight();
const activeScreenHeight = screenHeight - headerHeight;
const activeScreenHeight = windowHeight - headerHeight;

/* Disambiguation:
actionBlock: Block element fixed at the bottom of the screen
Expand Down
37 changes: 37 additions & 0 deletions ts/features/fims/common/navigation/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { createStackNavigator } from "@react-navigation/stack";
import * as React from "react";
import { FimsHistoryScreen } from "../../history/screens/HistoryScreen";
import {
FimsFlowHandlerScreen,
FimsFlowHandlerScreenRouteParams
} from "../../singleSignOn/screens/FimsFlowHandlerScreen";

export const FIMS_ROUTES = {
MAIN: "FIMS_MAIN",
CONSENTS: "FIMS_SSO_CONSENTS",
HISTORY: "FIMS_HISTORY"
} as const;

export type FimsParamsList = {
[FIMS_ROUTES.MAIN]: undefined;
[FIMS_ROUTES.CONSENTS]: FimsFlowHandlerScreenRouteParams;
[FIMS_ROUTES.HISTORY]: undefined;
};

const Stack = createStackNavigator<FimsParamsList>();

export const FimsNavigator = () => (
<Stack.Navigator
initialRouteName={FIMS_ROUTES.MAIN}
// Make sure to disable gestures in order to prevent
// the user from going back by swiping and thus not
// calling the custom cancel logic
screenOptions={{ gestureEnabled: false, headerShown: true }}
>
<Stack.Screen
name={FIMS_ROUTES.CONSENTS}
component={FimsFlowHandlerScreen}
/>
<Stack.Screen name={FIMS_ROUTES.HISTORY} component={FimsHistoryScreen} />
</Stack.Navigator>
);
16 changes: 15 additions & 1 deletion ts/features/fims/common/saga/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
import { SagaIterator } from "redux-saga";
import { fork } from "typed-redux-saga/macro";
import { fork, select } from "typed-redux-saga/macro";
import { apiUrlPrefix } from "../../../../config";
import { sessionTokenSelector } from "../../../../store/reducers/authentication";
import { createFimsClient } from "../../history/api/client";
import { watchFimsHistorySaga } from "../../history/saga";
import { watchFimsSSOSaga } from "../../singleSignOn/saga";

const FIMS_DEV_ENV_TOKEN = "";

export function* watchFimsSaga(): SagaIterator {
const fimsClient = createFimsClient(apiUrlPrefix);

const sessionToken = yield* select(sessionTokenSelector);
yield* fork(watchFimsSSOSaga);
yield* fork(
watchFimsHistorySaga,
fimsClient,
sessionToken ?? FIMS_DEV_ENV_TOKEN
);
}
3 changes: 2 additions & 1 deletion ts/features/fims/common/store/actions.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { FimsHistoryActions } from "../../history/store/actions";
import { FimsSSOActions } from "../../singleSignOn/store/actions";

export type FimsActions = FimsSSOActions;
export type FimsActions = FimsSSOActions | FimsHistoryActions;
9 changes: 7 additions & 2 deletions ts/features/fims/common/store/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@ import { combineReducers } from "redux";
import fimsSSOReducer, {
FimsSSOState
} from "../../singleSignOn/store/reducers/index";
import fimsHistoryReducer, {
FimsHistoryState
} from "../../history/store/reducer";

export type FimsState = {
SSO: FimsSSOState;
sso: FimsSSOState;
history: FimsHistoryState;
};

const fimsReducer = combineReducers({
SSO: fimsSSOReducer
sso: fimsSSOReducer,
history: fimsHistoryReducer
});

export default fimsReducer;
10 changes: 10 additions & 0 deletions ts/features/fims/history/api/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { createClient } from "../../../../../definitions/fims/client";
import { defaultRetryingFetch } from "../../../../utils/fetch";

export const createFimsClient = (baseUrl: string) =>
createClient({
baseUrl,
fetchApi: defaultRetryingFetch()
});

export type FimsHistoryClient = ReturnType<typeof createFimsClient>;
49 changes: 49 additions & 0 deletions ts/features/fims/history/saga/handleGetFimsHistorySaga.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import * as E from "fp-ts/lib/Either";
import { pipe } from "fp-ts/lib/function";
import { call, put } from "typed-redux-saga/macro";
import { ActionType } from "typesafe-actions";
import { SagaCallReturnType } from "../../../../types/utils";
import { withRefreshApiCall } from "../../../fastLogin/saga/utils";
import { FimsHistoryClient } from "../api/client";
import { fimsHistoryGet } from "../store/actions";

export function* handleGetFimsHistorySaga(
getFimsHistory: FimsHistoryClient["getConsents"],
bearerToken: string,
action: ActionType<typeof fimsHistoryGet.request>
) {
const getHistoryRequest = getFimsHistory({
Bearer: bearerToken,
continuationToken: action.payload.continuationToken
});

try {
const getHistoryResult = (yield* call(
withRefreshApiCall,
getHistoryRequest,
action
)) as SagaCallReturnType<typeof getFimsHistory>;

const resultAction = yield* call(
extractFimsHistoryResponseAction,
getHistoryResult
);
yield* put(resultAction);
} catch (e) {
yield* put(fimsHistoryGet.failure((e as Error).toString()));
}
}

const extractFimsHistoryResponseAction = (
historyResult: SagaCallReturnType<FimsHistoryClient["getConsents"]>
) =>
pipe(
historyResult,
E.fold(
error => fimsHistoryGet.failure(error.toString()),
response =>
response.status === 200
? fimsHistoryGet.success(response.value)
: fimsHistoryGet.failure("GENERIC_NON_200")
)
);
Loading

0 comments on commit 45da8dd

Please sign in to comment.