Skip to content

Commit

Permalink
chore: [IOBP-982] Add outcome 99 screen into payment flow (#6424)
Browse files Browse the repository at this point in the history
## Short description
This PR adds outcome 99 inside the payment screen when receiving it from
the backend.

## List of changes proposed in this pull request
- Created a custom `BE_NODE_KO` that's equals to outcome `99`;
- Mapped the new outcome inside the labels and the screen to show into
the `WalletPaymentOutcomeScreen.tsx` file;
- Added missing outcomes to keep track on mixpanel inside the
`getPaymentAnalyticsEventFromFailureOutcome` function

## How to test
- Checkout and run the dev-server with this PR:
pagopa/io-dev-api-server#438;
- Complete the payment flow and choose from the dropdown the BE_NODE_KO;

## Preview


https://github.com/user-attachments/assets/a062456d-44a1-4f9f-ae3e-a9fb45644d98
  • Loading branch information
Hantex9 authored Nov 20, 2024
1 parent 795040d commit 3c211b6
Show file tree
Hide file tree
Showing 6 changed files with 2,431 additions and 140 deletions.
3 changes: 3 additions & 0 deletions locales/en/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1982,6 +1982,9 @@ wallet:
PLAFOND_LIMIT_ERROR:
title: Hai superato il limite di spesa della tua carta
subtitle: Non è stato addebitato alcun importo. Prima di riprovare, modifica il limite di spesa o usa un altro metodo di pagamento.
BE_NODE_KO:
title: Stiamo riscontrando alcuni problemi sui sistemi di pagamento
subtitle: Verifica l’esito del pagamento nella sezione Pagamenti, altrimenti attendi qualche minuto prima di riprovare.
support:
button: "Contatta l'assistenza"
supportTitle: Contatta l'assistenza
Expand Down
3 changes: 3 additions & 0 deletions locales/it/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1983,6 +1983,9 @@ wallet:
PLAFOND_LIMIT_ERROR:
title: Hai superato il limite di spesa della tua carta
subtitle: Non è stato addebitato alcun importo. Prima di riprovare, modifica il limite di spesa o usa un altro metodo di pagamento.
BE_NODE_KO:
title: Stiamo riscontrando alcuni problemi sui sistemi di pagamento
subtitle: Verifica l’esito del pagamento nella sezione Pagamenti, altrimenti attendi qualche minuto prima di riprovare.
support:
button: "Contatta l'assistenza"
supportTitle: Contatta l'assistenza
Expand Down
15 changes: 15 additions & 0 deletions ts/features/payments/checkout/analytics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type PaymentAnalyticsProps = {
editing: PaymentAnalyticsEditingType;
};

// eslint-disable-next-line complexity
export const getPaymentAnalyticsEventFromFailureOutcome = (
outcome: WalletPaymentOutcomeEnum
) => {
Expand Down Expand Up @@ -68,6 +69,20 @@ export const getPaymentAnalyticsEventFromFailureOutcome = (
return "PAYMENT_WEBVIEW_USER_CANCELLATION";
case WalletPaymentOutcomeEnum.PAYPAL_REMOVED_ERROR:
return "PAYMENT_METHOD_AUTHORIZATION_ERROR";
case WalletPaymentOutcomeEnum.BE_NODE_KO:
return "PAYMENT_SLOWDOWN_ERROR";
case WalletPaymentOutcomeEnum.INSUFFICIENT_AVAILABILITY_ERROR:
return "PAYMENT_INSUFFICIENT_AVAILABILITY_ERROR";
case WalletPaymentOutcomeEnum.CVV_ERROR:
return "PAYMENT_CVV_ERROR";
case WalletPaymentOutcomeEnum.PLAFOND_LIMIT_ERROR:
return "PAYMENT_PLAFOND_LIMIT_ERROR";
case WalletPaymentOutcomeEnum.KO_RETRIABLE:
return "PAYMENT_KO_RETRIABLE";
case WalletPaymentOutcomeEnum.ORDER_NOT_PRESENT:
return "PAYMENT_ORDER_NOT_PRESENT";
case WalletPaymentOutcomeEnum.DUPLICATE_ORDER:
return "PAYMENT_DUPLICATE_ORDER";
default:
return outcome;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,7 @@ const WalletPaymentOutcomeScreen = () => {
"wallet.payment.outcome.PAYMENT_METHODS_NOT_AVAILABLE.subtitle"
),
action: onboardPaymentMethodAction,
secondaryAction: onboardPaymentMethodCloseAction,
isHeaderVisible: true
secondaryAction: onboardPaymentMethodCloseAction
};
case WalletPaymentOutcomeEnum.PAYMENT_REVERSED:
return {
Expand Down Expand Up @@ -429,8 +428,7 @@ const WalletPaymentOutcomeScreen = () => {
subtitle: I18n.t(
"wallet.payment.outcome.IN_APP_BROWSER_CLOSED_BY_USER.subtitle"
),
action: closeFailureAction,
isHeaderVisible: true
action: closeFailureAction
};
case WalletPaymentOutcomeEnum.INSUFFICIENT_AVAILABILITY_ERROR:
return {
Expand Down Expand Up @@ -459,14 +457,22 @@ const WalletPaymentOutcomeScreen = () => {
),
action: closeFailureAction
};
case WalletPaymentOutcomeEnum.BE_NODE_KO:
return {
pictogram: "umbrellaNew",
title: I18n.t("wallet.payment.outcome.BE_NODE_KO.title"),
subtitle: I18n.t("wallet.payment.outcome.BE_NODE_KO.subtitle"),
action: closeFailureAction,
secondaryAction: contactSupportAction
};
}
};

const requiresFeedback = outcome === WalletPaymentOutcomeEnum.SUCCESS;

return (
<>
<OperationResultScreenContent {...getPropsForOutcome()}>
<OperationResultScreenContent isHeaderVisible {...getPropsForOutcome()}>
{requiresFeedback && <WalletPaymentFeebackBanner />}
</OperationResultScreenContent>
{supportModal.bottomSheet}
Expand Down
Loading

0 comments on commit 3c211b6

Please sign in to comment.