From 8bc70f5c370deca18d70bde911b6511ae152fa0e Mon Sep 17 00:00:00 2001 From: Federico Mastrini Date: Thu, 18 Apr 2024 17:19:33 +0200 Subject: [PATCH] chore: [IOBP-564] Update payment's validation failure mapping (#5694) > [!WARNING] > This PR depends on https://github.com/pagopa/io-dev-api-server/pull/368 ## Short description This PR updates the pagoPA API definitions to update the payment's verification/validation failures mappings ## List of changes proposed in this pull request - Updated pagoPA API definitions - Updated `WalletPaymentFailure` type - Added missing mappings in payment's failure screen ## How to test Checkout [this PR](https://github.com/pagopa/io-dev-api-server/pull/368) on the `io-dev-api-server`. Add the following piece of configuration in the` config.json` file and play around with fault category codes, trying to reproduce the error screens. ```json "features": { "wallet": { "verificationFailure": { "faultCodeCategory": "PAYMENT_UNKNOWN", "faultCodeDetail": "PAA_PAGAMENTO_SCONOSCIUTO" } } } ``` ## Preview https://github.com/pagopa/io-app/assets/6160324/7efaee4f-cb79-46ba-99a6-f62d25fa40fe --- locales/de/index.yml | 28 ++++++------ locales/en/index.yml | 4 +- locales/it/index.yml | 4 +- package.json | 4 +- .../components/WalletPaymentFailureDetail.tsx | 43 ++++++++----------- .../screens/WalletPaymentDetailScreen.tsx | 9 ++-- .../checkout/types/WalletPaymentFailure.ts | 20 ++++++--- 7 files changed, 55 insertions(+), 57 deletions(-) diff --git a/locales/de/index.yml b/locales/de/index.yml index 622bd60b71e..227446423ba 100644 --- a/locales/de/index.yml +++ b/locales/de/index.yml @@ -214,7 +214,7 @@ tablet: rooted: title: "Es sieht so aus, als ob die Sicherheit deines Geräts kompromittiert ist!" body: "Wenn du auf “Weiter” klickst, erklärst du dich damit einverstanden, auf eigene Gefahr fortzufahren, andernfalls schließe die App." - learnMoreButton: + learnMoreButton: title: "Was bedeutet das?" learnMoreBottomsheet: title: "Sicherheit deines Geräts" @@ -1655,7 +1655,7 @@ wallet: failure: PAYMENT_UNAVAILABLE: title: "Es gibt ein technisches Problem mit dieser Zahlungsmitteilung." - PAYMENT_UNKNOWN: + PAYMENT_DATA_ERROR: title: "Die Daten der Zahlungsmitteilung sind falsch" DOMAIN_UNKNOWN: title: "Die ausstellende Körperschaft hat Probleme bei der Bearbeitung" @@ -1674,7 +1674,7 @@ wallet: GENERIC_ERROR: title: "Ein unerwarteter Fehler ist aufgetreten" subtitle: "Versuche es erneut oder wende dich an den Support." - PAA_PAGAMENTO_SCONOSCIUTO: + PAYMENT_UNKNOWN: title: "Wir können die Zahlungsmitteilung nicht finden" subtitle: "Die Zahlungsmitteilung kann bereits bezahlt worden sein. Wende dich bitte an den ausstellende Körperschaft." outcome: @@ -2034,7 +2034,7 @@ services: fiscalCode: "Steuernummer Körperschaft" address: "Adresse" serviceId: "Dienst ID" - tosAndPrivacy: + tosAndPrivacy: title: "Nutzungsbedingungen und Datenschutzbestimmungen" tosLink: "Nutzungsbedingungen" privacyLink: "Datenschutzerklärung" @@ -2056,20 +2056,20 @@ serviceDetail: notValidated: "Um die E-Mail-Weiterleitung zu aktivieren, musst du deine E-Mail-Adresse bestätigen." identification: instructions: - unlockCode: "Entsperrcode" - unlockCodepPrefix: "Benutze deinen" - fingerprint: "Fingerabdruck" - fingerprintPrefix: "benutze deinen" - faceId: "Gesicht" - faceIdPrefix: "benutze dein" - congiunction: "oder" + unlockCode: "Entsperrcode" + unlockCodepPrefix: "Benutze deinen" + fingerprint: "Fingerabdruck" + fingerprintPrefix: "benutze deinen" + faceId: "Gesicht" + faceIdPrefix: "benutze dein" + congiunction: "oder" title: "Hallo {{name}}!" titleProfileName: "Hallo {{profileName}}!" titleValidation: "Bestätige den Vorgang" logout: "Abmelden" logoutProfileName: "Du bist nicht {{profileName}}?" logoutDescription: "Du kannst dich mit deinem SPID oder deiner CIE anmelden. Diese Sitzung wird abgemeldet." - logoutDescriptionProfileName: "Du kannst dich mit deinem SPID oder deiner CIE anmelden. Die Sitzung von {{profileName}} wird abgemeldet." + logoutDescriptionProfileName: "Du kannst dich mit deinem SPID oder deiner CIE anmelden. Die Sitzung von {{profileName}} wird abgemeldet." biometric: fingerprintType: "Fingerabdruck" title: "Biometrische Identifikation" @@ -2438,9 +2438,9 @@ features: cgn: "Nationale Jugendkarte" itw: "IT Wallet" payment: "Zahlungsmethoden" - onboarding: + onboarding: title: "Was möchtest du deinem Konto hinzufügen?" - options: + options: cgn: "Nationale Jugendkarte" welfare: "Initiativen für das Gemeinwohl" payments: "Zahlungsmethoden" diff --git a/locales/en/index.yml b/locales/en/index.yml index 158bef54d6e..aa99c239d13 100644 --- a/locales/en/index.yml +++ b/locales/en/index.yml @@ -1711,7 +1711,7 @@ wallet: failure: PAYMENT_UNAVAILABLE: title: "C’è un problema tecnico con questo avviso" - PAYMENT_UNKNOWN: + PAYMENT_DATA_ERROR: title: "I dati dell’avviso non sono corretti" DOMAIN_UNKNOWN: title: "L’Ente Creditore sta avendo problemi nella risposta" @@ -1730,7 +1730,7 @@ wallet: GENERIC_ERROR: title: "Si è verificato un errore imprevisto" subtitle: "Riprova, oppure contatta l’assistenza." - PAA_PAGAMENTO_SCONOSCIUTO: + PAYMENT_UNKNOWN: title: "Non riusciamo a trovare l’avviso" subtitle: "L’avviso potrebbe essere stato già pagato. Per ricevere assistenza, contatta l’Ente Creditore che lo ha emesso." outcome: diff --git a/locales/it/index.yml b/locales/it/index.yml index 8559d354b21..92f07affc75 100644 --- a/locales/it/index.yml +++ b/locales/it/index.yml @@ -1711,7 +1711,7 @@ wallet: failure: PAYMENT_UNAVAILABLE: title: "C’è un problema tecnico con questo avviso" - PAYMENT_UNKNOWN: + PAYMENT_DATA_ERROR: title: "I dati dell’avviso non sono corretti" DOMAIN_UNKNOWN: title: "L’Ente Creditore sta avendo problemi nella risposta" @@ -1730,7 +1730,7 @@ wallet: GENERIC_ERROR: title: "Si è verificato un errore imprevisto" subtitle: "Riprova, oppure contatta l’assistenza." - PAA_PAGAMENTO_SCONOSCIUTO: + PAYMENT_UNKNOWN: title: "Non riusciamo a trovare l’avviso" subtitle: "L’avviso potrebbe essere stato già pagato. Per ricevere assistenza, contatta l’Ente Creditore che lo ha emesso." outcome: diff --git a/package.json b/package.json index 30796656b99..eb9e1a4d812 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ "idpay_api": "https://raw.githubusercontent.com/pagopa/cstar-infrastructure/v6.9.1/src/domains/idpay-app/api/idpay_appio_full/openapi.appio.full.yml", "lollipop_api": "https://raw.githubusercontent.com/pagopa/io-backend/v13.32.1-RELEASE/api_lollipop_first_consumer.yaml", "fast_login_api": "https://raw.githubusercontent.com/pagopa/io-backend/v13.32.1-RELEASE/openapi/generated/api_fast_login.yaml", - "pagopa_api_walletv3": "https://raw.githubusercontent.com/pagopa/pagopa-infra/fe1a6780a8589c0f160d668bcaf592b1a3442084/src/domains/wallet-app/api/payment-wallet/v1/_openapi.json.tpl", - "pagopa_api_ecommerce": "https://raw.githubusercontent.com/pagopa/pagopa-infra/fe1a6780a8589c0f160d668bcaf592b1a3442084/src/domains/ecommerce-app/api/ecommerce-io/v1/_openapi.json.tpl", + "pagopa_api_walletv3": "https://raw.githubusercontent.com/pagopa/pagopa-infra/8b8a5b0c3ebc007d9b8f1a8dc4ae9b88b63b5794/src/domains/wallet-app/api/payment-wallet/v1/_openapi.json.tpl", + "pagopa_api_ecommerce": "https://raw.githubusercontent.com/pagopa/pagopa-infra/8b8a5b0c3ebc007d9b8f1a8dc4ae9b88b63b5794/src/domains/ecommerce-app/api/ecommerce-io/v1/_openapi.json.tpl", "private": true, "scripts": { "start": "react-native start", diff --git a/ts/features/payments/checkout/components/WalletPaymentFailureDetail.tsx b/ts/features/payments/checkout/components/WalletPaymentFailureDetail.tsx index 8e0c21a706f..060acd8b90d 100644 --- a/ts/features/payments/checkout/components/WalletPaymentFailureDetail.tsx +++ b/ts/features/payments/checkout/components/WalletPaymentFailureDetail.tsx @@ -1,7 +1,5 @@ import { useNavigation } from "@react-navigation/native"; import React from "react"; -import { FaultCategoryEnum } from "../../../../../definitions/pagopa/ecommerce/FaultCategory"; -import { ValidationFaultEnum } from "../../../../../definitions/pagopa/ecommerce/ValidationFault"; import { OperationResultScreenContent, OperationResultScreenContentProps @@ -50,25 +48,24 @@ const WalletPaymentFailureDetail = ({ failure }: Props) => { }; const getPropsFromFailure = ({ - faultCodeCategory, - faultCodeDetail + faultCodeCategory }: WalletPaymentFailure): OperationResultScreenContentProps => { switch (faultCodeCategory) { - case FaultCategoryEnum.PAYMENT_UNAVAILABLE: + case "PAYMENT_UNAVAILABLE": return { pictogram: "fatalError", title: I18n.t("wallet.payment.failure.PAYMENT_UNAVAILABLE.title"), action: contactSupportAction, secondaryAction: closeAction }; - case FaultCategoryEnum.PAYMENT_UNKNOWN: + case "PAYMENT_DATA_ERROR": return { pictogram: "attention", - title: I18n.t("wallet.payment.failure.PAYMENT_UNKNOWN.title"), + title: I18n.t("wallet.payment.failure.PAYMENT_DATA_ERROR.title"), action: closeAction, secondaryAction: contactSupportAction }; - case FaultCategoryEnum.DOMAIN_UNKNOWN: + case "DOMAIN_UNKNOWN": return { pictogram: "comunicationProblem", title: I18n.t("wallet.payment.failure.DOMAIN_UNKNOWN.title"), @@ -76,7 +73,7 @@ const WalletPaymentFailureDetail = ({ failure }: Props) => { action: closeAction, secondaryAction: contactSupportAction }; - case FaultCategoryEnum.PAYMENT_ONGOING: + case "PAYMENT_ONGOING": return { pictogram: "timing", title: I18n.t("wallet.payment.failure.PAYMENT_ONGOING.title"), @@ -84,14 +81,14 @@ const WalletPaymentFailureDetail = ({ failure }: Props) => { action: closeAction, secondaryAction: contactSupportAction }; - case FaultCategoryEnum.PAYMENT_EXPIRED: + case "PAYMENT_EXPIRED": return { pictogram: "time", title: I18n.t("wallet.payment.failure.PAYMENT_EXPIRED.title"), subtitle: I18n.t("wallet.payment.failure.PAYMENT_EXPIRED.subtitle"), action: closeAction }; - case FaultCategoryEnum.PAYMENT_CANCELED: + case "PAYMENT_CANCELED": return { pictogram: "stopSecurity", title: I18n.t("wallet.payment.failure.PAYMENT_CANCELED.title"), @@ -99,26 +96,20 @@ const WalletPaymentFailureDetail = ({ failure }: Props) => { action: closeAction, secondaryAction: contactSupportAction }; - case FaultCategoryEnum.PAYMENT_DUPLICATED: + case "PAYMENT_DUPLICATED": return { pictogram: "moneyCheck", title: I18n.t("wallet.payment.failure.PAYMENT_DUPLICATED.title"), action: closeAction }; - case FaultCategoryEnum.GENERIC_ERROR: - if (faultCodeDetail === ValidationFaultEnum.PAA_PAGAMENTO_SCONOSCIUTO) { - return { - pictogram: "searchLens", - title: I18n.t( - "wallet.payment.failure.PAA_PAGAMENTO_SCONOSCIUTO.title" - ), - subtitle: I18n.t( - "wallet.payment.failure.PAA_PAGAMENTO_SCONOSCIUTO.subtitle" - ), - action: closeAction - }; - } - return genericErrorProps; + case "PAYMENT_UNKNOWN": + return { + pictogram: "searchLens", + title: I18n.t("wallet.payment.failure.PAYMENT_UNKNOWN.title"), + subtitle: I18n.t("wallet.payment.failure.PAYMENT_UNKNOWN.subtitle"), + action: closeAction + }; + default: return genericErrorProps; } diff --git a/ts/features/payments/checkout/screens/WalletPaymentDetailScreen.tsx b/ts/features/payments/checkout/screens/WalletPaymentDetailScreen.tsx index cd6a435a15a..ca56e22cb2f 100644 --- a/ts/features/payments/checkout/screens/WalletPaymentDetailScreen.tsx +++ b/ts/features/payments/checkout/screens/WalletPaymentDetailScreen.tsx @@ -25,8 +25,7 @@ import { pipe } from "fp-ts/lib/function"; import React, { ComponentProps, useLayoutEffect } from "react"; import { SafeAreaView, StyleSheet } from "react-native"; import { OrganizationFiscalCode } from "../../../../../definitions/backend/OrganizationFiscalCode"; -import { FaultCategoryEnum } from "../../../../../definitions/pagopa/ecommerce/FaultCategory"; -import { GatewayFaultEnum } from "../../../../../definitions/pagopa/ecommerce/GatewayFault"; +import { FaultCodeCategoryEnum } from "../../../../../definitions/pagopa/ecommerce/GatewayFaultPaymentProblemJson"; import { PaymentRequestsGetResponse } from "../../../../../definitions/pagopa/ecommerce/PaymentRequestsGetResponse"; import { RptId } from "../../../../../definitions/pagopa/ecommerce/RptId"; import { useHeaderSecondLevel } from "../../../../hooks/useHeaderSecondLevel"; @@ -45,13 +44,13 @@ import { centsToAmount, formatNumberAmount } from "../../../../utils/stringBuilder"; +import { storeNewPaymentAttemptAction } from "../../history/store/actions"; import { WalletPaymentFailureDetail } from "../components/WalletPaymentFailureDetail"; import { PaymentsCheckoutParamsList } from "../navigation/params"; import { PaymentsCheckoutRoutes } from "../navigation/routes"; import { paymentsGetPaymentDetailsAction } from "../store/actions/networking"; import { walletPaymentDetailsSelector } from "../store/selectors"; import { WalletPaymentFailure } from "../types/WalletPaymentFailure"; -import { storeNewPaymentAttemptAction } from "../../history/store/actions"; type WalletPaymentDetailScreenNavigationParams = { rptId: RptId; @@ -82,8 +81,8 @@ const WalletPaymentDetailScreen = () => { O.fromEither, // NetworkError is transformed to GENERIC_ERROR only for display purposes O.getOrElse(() => ({ - faultCodeCategory: FaultCategoryEnum.GENERIC_ERROR, - faultCodeDetail: GatewayFaultEnum.GENERIC_ERROR + faultCodeCategory: FaultCodeCategoryEnum.GENERIC_ERROR, + faultCodeDetail: "" })) ); return ; diff --git a/ts/features/payments/checkout/types/WalletPaymentFailure.ts b/ts/features/payments/checkout/types/WalletPaymentFailure.ts index a14488a90b5..d8e5cd94a63 100644 --- a/ts/features/payments/checkout/types/WalletPaymentFailure.ts +++ b/ts/features/payments/checkout/types/WalletPaymentFailure.ts @@ -1,15 +1,23 @@ import * as t from "io-ts"; import { GatewayFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/GatewayFaultPaymentProblemJson"; import { PartyConfigurationFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/PartyConfigurationFaultPaymentProblemJson"; -import { PartyTimeoutFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/PartyTimeoutFaultPaymentProblemJson"; -import { PaymentStatusFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/PaymentStatusFaultPaymentProblemJson"; -import { ValidationFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/ValidationFaultPaymentProblemJson"; +import { ValidationFaultPaymentUnknownProblemJson } from "../../../../../definitions/pagopa/ecommerce/ValidationFaultPaymentUnknownProblemJson"; +import { ValidationFaultPaymentDataErrorProblemJson } from "../../../../../definitions/pagopa/ecommerce/ValidationFaultPaymentDataErrorProblemJson"; +import { PaymentExpiredStatusFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/PaymentExpiredStatusFaultPaymentProblemJson"; +import { PaymentOngoingStatusFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/PaymentOngoingStatusFaultPaymentProblemJson"; +import { PaymentCanceledStatusFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/PaymentCanceledStatusFaultPaymentProblemJson"; +import { ValidationFaultPaymentUnavailableProblemJson } from "../../../../../definitions/pagopa/ecommerce/ValidationFaultPaymentUnavailableProblemJson"; +import { PaymentDuplicatedStatusFaultPaymentProblemJson } from "../../../../../definitions/pagopa/ecommerce/PaymentDuplicatedStatusFaultPaymentProblemJson"; export type WalletPaymentFailure = t.TypeOf; export const WalletPaymentFailure = t.union([ - ValidationFaultPaymentProblemJson, - PaymentStatusFaultPaymentProblemJson, GatewayFaultPaymentProblemJson, PartyConfigurationFaultPaymentProblemJson, - PartyTimeoutFaultPaymentProblemJson + ValidationFaultPaymentUnknownProblemJson, + ValidationFaultPaymentDataErrorProblemJson, + PaymentExpiredStatusFaultPaymentProblemJson, + PaymentOngoingStatusFaultPaymentProblemJson, + PaymentCanceledStatusFaultPaymentProblemJson, + ValidationFaultPaymentUnavailableProblemJson, + PaymentDuplicatedStatusFaultPaymentProblemJson ]);