Skip to content

Commit

Permalink
Add legal representative contact when trying to close account from (#954
Browse files Browse the repository at this point in the history
)

another membership
  • Loading branch information
bloodyowl authored Oct 8, 2024
1 parent 2a3d2e6 commit 40a56c5
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 2 deletions.
23 changes: 21 additions & 2 deletions clients/banking/src/components/AccountClose.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { useEffect, useState } from "react";
import { StyleSheet, View } from "react-native";
import { match, P } from "ts-pattern";
import { AccountClosingDocument, AccountCountry, CloseAccountDocument } from "../graphql/partner";
import { NotFoundPage } from "../pages/NotFoundPage";
import { env } from "../utils/env";
import { formatNestedMessage, t } from "../utils/i18n";
import { Router } from "../utils/routes";
Expand Down Expand Up @@ -358,6 +359,17 @@ export const AccountClose = ({ accountId, resourceId, status }: Props) => {
: Option.None(),
);

const legalRepresentativeName = Option.fromNullable(
account.legalRepresentativeMembership.user,
)
.flatMap(user =>
Option.allFromDict({
firstName: Option.fromNullable(user.firstName),
lastName: Option.fromNullable(user.lastName),
}),
)
.map(({ firstName, lastName }) => `${firstName} ${lastName}`);

const balance = Number(account.balances?.available.value);

const accentColor = projectInfo.accentColor ?? invariantColors.defaultAccentColor;
Expand Down Expand Up @@ -514,7 +526,14 @@ export const AccountClose = ({ accountId, resourceId, status }: Props) => {
borderedIcon={true}
borderedIconPadding={20}
title={t("accountClose.notLegalRepresentative.title")}
subtitle={t("accountClose.notLegalRepresentative.description")}
subtitle={match(legalRepresentativeName)
.with(Option.P.Some(P.select()), legalRepresentativeName =>
t("accountClose.notLegalRepresentative.description.withName", {
legalRepresentativeName,
legalRepresentativeEmail: account.legalRepresentativeMembership.email,
}),
)
.otherwise(() => t("accountClose.notLegalRepresentative.description"))}
>
{userMembershipIdOnCurrentAccount
.map(accountMembershipId => {
Expand All @@ -537,5 +556,5 @@ export const AccountClose = ({ accountId, resourceId, status }: Props) => {
);
},
)
.otherwise(() => null);
.otherwise(() => <NotFoundPage />);
};
3 changes: 3 additions & 0 deletions clients/banking/src/graphql/partner.gql
Original file line number Diff line number Diff line change
Expand Up @@ -2220,8 +2220,11 @@ query AccountClosing($accountId: ID!, $after: String, $first: Int!) {
}
legalRepresentativeMembership {
id
email
user {
id
firstName
lastName
}
}
balances {
Expand Down
1 change: 1 addition & 0 deletions clients/banking/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"accountClose.negativeBalance.title": "Ihr Konto kann nicht geschlossen werden",
"accountClose.nextSteps": "Was kommt als Nächstes?",
"accountClose.notLegalRepresentative.description": "Kontaktieren Sie den gesetzlichen Vertreter des Kontos, um den Schließungsprozess fortzusetzen.",
"accountClose.notLegalRepresentative.description.withName": "Senden Sie diesen Link an den gesetzlichen Vertreter des Kontos, um den Kündigungsprozess des Kontos fortzusetzen\n({legalRepresentativeName}, {legalRepresentativeEmail}).",
"accountClose.notLegalRepresentative.title": "Sie sind nicht der gesetzliche Vertreter dieses Kontos.",
"accountClose.reason.NotSatisfied": "Ich bin nicht zufrieden",
"accountClose.reason.NotUsingAccountAnymore": "Ich nutze das Konto nicht mehr",
Expand Down
1 change: 1 addition & 0 deletions clients/banking/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"accountClose.negativeBalance.title": "Your account can't be closed",
"accountClose.nextSteps": "What's next?",
"accountClose.notLegalRepresentative.description": "Contact legal representative of the account to continue the account closure process.",
"accountClose.notLegalRepresentative.description.withName": "Send this link to the legal representative of the account to continue the account closure process\n({legalRepresentativeName}, {legalRepresentativeEmail}).",
"accountClose.notLegalRepresentative.title": "You are not the legal representative of this account.",
"accountClose.reason.NotSatisfied": "I'm not satisfied",
"accountClose.reason.NotUsingAccountAnymore": "I'm not using the account anymore",
Expand Down
1 change: 1 addition & 0 deletions clients/banking/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"accountClose.negativeBalance.title": "Tu cuenta no puede cerrarse",
"accountClose.nextSteps": "¿Qué sigue?",
"accountClose.notLegalRepresentative.description": "Contacta al representante legal de la cuenta para continuar con el proceso de cierre de cuenta.",
"accountClose.notLegalRepresentative.description.withName": "Envía este enlace al representante legal de la cuenta para continuar con el proceso de cierre de la cuenta\n({legalRepresentativeName}, {legalRepresentativeEmail}).",
"accountClose.notLegalRepresentative.title": "No eres el representante legal de esta cuenta",
"accountClose.reason.NotSatisfied": "No estoy satisfecho",
"accountClose.reason.NotUsingAccountAnymore": "Ya no uso la cuenta",
Expand Down
1 change: 1 addition & 0 deletions clients/banking/src/locales/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"accountClose.negativeBalance.title": "Tiliäsi ei voida sulkea",
"accountClose.nextSteps": "Mitä seuraavaksi?",
"accountClose.notLegalRepresentative.description": "Ota yhteyttä tilin lailliseen edustajaan jatkaaksesi tilin sulkemisprosessia.",
"accountClose.notLegalRepresentative.description.withName": "Lähetä tämä linkki tilin lailliselle edustajalle jatkaaksesi tilin sulkemisprosessia\n({legalRepresentativeName}, {legalRepresentativeEmail}).",
"accountClose.notLegalRepresentative.title": "Et ole tämän tilin laillinen edustaja",
"accountClose.reason.NotSatisfied": "En ole tyytyväinen",
"accountClose.reason.NotUsingAccountAnymore": "En käytä tiliä enää",
Expand Down
1 change: 1 addition & 0 deletions clients/banking/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"accountClose.negativeBalance.title": "Votre compte ne peut pas être fermé",
"accountClose.nextSteps": "Quelles sont les prochaines étapes ?",
"accountClose.notLegalRepresentative.description": "Contactez le représentant légal du compte pour poursuivre le processus de fermeture du compte.",
"accountClose.notLegalRepresentative.description.withName": "Envoyez ce lien au représentant légal du compte pour poursuivre le processus de fermeture du compte\n({legalRepresentativeName}, {legalRepresentativeEmail}).",
"accountClose.notLegalRepresentative.title": "Vous n'êtes pas le représentant légal de ce compte.",
"accountClose.reason.NotSatisfied": "Je ne suis pas satisfait",
"accountClose.reason.NotUsingAccountAnymore": "Je n'utilise plus ce compte",
Expand Down
1 change: 1 addition & 0 deletions clients/banking/src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"accountClose.negativeBalance.title": "Il suo conto non può essere chiuso",
"accountClose.nextSteps": "Quali sono i prossimi passi?",
"accountClose.notLegalRepresentative.description": "Contattare il rappresentante legale del conto per continuare il processo di chiusura del conto.",
"accountClose.notLegalRepresentative.description.withName": "Invia questo link al legale rappresentante del conto per continuare il processo di chiusura del conto\n({legalRepresentativeName}, {legalRepresentativeEmail}).",
"accountClose.notLegalRepresentative.title": "Non è il rappresentante legale di questo conto.",
"accountClose.reason.NotSatisfied": "Non sono soddisfatto",
"accountClose.reason.NotUsingAccountAnymore": "Non utilizzo più il conto",
Expand Down
1 change: 1 addition & 0 deletions clients/banking/src/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"accountClose.negativeBalance.title": "Uw rekening kan niet worden gesloten",
"accountClose.nextSteps": "Wat is de volgende stap?",
"accountClose.notLegalRepresentative.description": "Neem contact op met de wettelijke vertegenwoordiger van de rekening om het sluitingsproces voort te zetten.",
"accountClose.notLegalRepresentative.description.withName": "Stuur deze link naar de wettelijke vertegenwoordiger van de rekening om het proces van rekeningafsluiting voort te zetten\n({legalRepresentativeName}, {legalRepresentativeEmail}).",
"accountClose.notLegalRepresentative.title": "U bent niet de wettelijke vertegenwoordiger van deze rekening.",
"accountClose.reason.NotSatisfied": "Ik ben niet tevreden",
"accountClose.reason.NotUsingAccountAnymore": "Ik gebruik de rekening niet meer",
Expand Down
1 change: 1 addition & 0 deletions clients/banking/src/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"accountClose.negativeBalance.title": "Sua conta não pode ser fechada",
"accountClose.nextSteps": "Próximos passos",
"accountClose.notLegalRepresentative.description": "Contate o representante legal da conta para continuar o processo de fechamento da conta.",
"accountClose.notLegalRepresentative.description.withName": "Envie este link para o representante legal da conta para continuar o processo de encerramento da conta\n({legalRepresentativeName}, {legalRepresentativeEmail}).",
"accountClose.notLegalRepresentative.title": "Você não é o representante legal desta conta.",
"accountClose.reason.NotSatisfied": "Não estou satisfeito",
"accountClose.reason.NotUsingAccountAnymore": "Não estou mais usando a conta",
Expand Down

0 comments on commit 40a56c5

Please sign in to comment.