Skip to content

Commit

Permalink
chore: [IOBP-564] Update payment's validation failure mapping (#5694)
Browse files Browse the repository at this point in the history
> [!WARNING]
> This PR depends on
pagopa/io-dev-api-server#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](pagopa/io-dev-api-server#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
  • Loading branch information
mastro993 authored Apr 18, 2024
1 parent a36b832 commit 8bc70f5
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 57 deletions.
28 changes: 14 additions & 14 deletions locales/de/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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:
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -50,75 +48,68 @@ 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"),
subtitle: I18n.t("wallet.payment.failure.DOMAIN_UNKNOWN.subtitle"),
action: closeAction,
secondaryAction: contactSupportAction
};
case FaultCategoryEnum.PAYMENT_ONGOING:
case "PAYMENT_ONGOING":
return {
pictogram: "timing",
title: I18n.t("wallet.payment.failure.PAYMENT_ONGOING.title"),
subtitle: I18n.t("wallet.payment.failure.PAYMENT_ONGOING.subtitle"),
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"),
subtitle: I18n.t("wallet.payment.failure.PAYMENT_CANCELED.subtitle"),
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand Down Expand Up @@ -82,8 +81,8 @@ const WalletPaymentDetailScreen = () => {
O.fromEither,
// NetworkError is transformed to GENERIC_ERROR only for display purposes
O.getOrElse<WalletPaymentFailure>(() => ({
faultCodeCategory: FaultCategoryEnum.GENERIC_ERROR,
faultCodeDetail: GatewayFaultEnum.GENERIC_ERROR
faultCodeCategory: FaultCodeCategoryEnum.GENERIC_ERROR,
faultCodeDetail: ""
}))
);
return <WalletPaymentFailureDetail failure={failure} />;
Expand Down
20 changes: 14 additions & 6 deletions ts/features/payments/checkout/types/WalletPaymentFailure.ts
Original file line number Diff line number Diff line change
@@ -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<typeof WalletPaymentFailure>;
export const WalletPaymentFailure = t.union([
ValidationFaultPaymentProblemJson,
PaymentStatusFaultPaymentProblemJson,
GatewayFaultPaymentProblemJson,
PartyConfigurationFaultPaymentProblemJson,
PartyTimeoutFaultPaymentProblemJson
ValidationFaultPaymentUnknownProblemJson,
ValidationFaultPaymentDataErrorProblemJson,
PaymentExpiredStatusFaultPaymentProblemJson,
PaymentOngoingStatusFaultPaymentProblemJson,
PaymentCanceledStatusFaultPaymentProblemJson,
ValidationFaultPaymentUnavailableProblemJson,
PaymentDuplicatedStatusFaultPaymentProblemJson
]);

0 comments on commit 8bc70f5

Please sign in to comment.