Skip to content

Commit

Permalink
Handle account holder rejection (#473)
Browse files Browse the repository at this point in the history
* Handle account holder rejection

Closes FRONT-765

* Add translations
  • Loading branch information
bloodyowl authored Dec 1, 2023
1 parent 576e31e commit bbc37e0
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 91 deletions.
4 changes: 2 additions & 2 deletions clients/banking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"@sentry/react": "7.81.1",
"@swan-io/boxed": "1.2.0",
"@swan-io/chicane": "1.4.1",
"@swan-io/lake": "4.0.2",
"@swan-io/shared-business": "4.0.2",
"@swan-io/lake": "4.0.3",
"@swan-io/shared-business": "4.0.3",
"@urql/exchange-graphcache": "6.3.3",
"core-js": "3.33.3",
"dayjs": "1.11.10",
Expand Down
130 changes: 74 additions & 56 deletions clients/banking/src/components/AccountArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,15 @@ export const AccountArea = ({ accountMembershipId }: Props) => {
hasTransactions,
identificationStatus,
accountHolderType: account?.holder.info.__typename,
verificationStatus: account?.holder.verificationStatus,
isIndividual,
requireFirstTransfer,
isLegalRepresentative: accountMembership?.legalRepresentative ?? false,
account,
})
.returnType<AccountActivationTag>()
// if payment level limitations have been lifted, no need for activation
.with({ verificationStatus: "Refused", isLegalRepresentative: true }, () => "refused")
.with(
{ account: { paymentLevel: "Unlimited", paymentAccountType: "PaymentService" } },
() => "none",
Expand Down Expand Up @@ -402,54 +404,57 @@ export const AccountArea = ({ accountMembershipId }: Props) => {
paymentMenuIsVisible,
cardMenuIsVisible,
memberMenuIsVisible,
}) => [
{
matchRoutes: ["AccountTransactionsArea"],
iconActive: "apps-list-filled",
icon: "apps-list-regular",
name: t("navigation.history"),
to: Router.AccountTransactionsListRoot({ accountMembershipId }),
hidden: !historyMenuIsVisible,
},
{
matchRoutes: ["AccountDetailsArea"],
iconActive: "building-bank-filled",
icon: "building-bank-regular",
name: t("navigation.account"),
to: Router.AccountDetailsIban({ accountMembershipId }),
hidden: !detailsMenuIsVisible,
},
{
matchRoutes: ["AccountPaymentsArea"],
iconActive: "arrow-swap-filled",
icon: "arrow-swap-regular",
name: t("navigation.transfer"),
to: Router.AccountPaymentsRoot({ accountMembershipId }),
hidden: !paymentMenuIsVisible,
},
{
matchRoutes: ["AccountCardsArea"],
iconActive: "payment-filled",
icon: "payment-regular",
name: t("navigation.cards"),
to: Router.AccountCardsList({ accountMembershipId }),
hidden: !cardMenuIsVisible,
},
{
matchRoutes: ["AccountMembersArea"],
iconActive: "people-filled",
icon: "people-regular",
name: t("navigation.members"),
to: Router.AccountMembersList({ accountMembershipId }),
hidden: !memberMenuIsVisible,
hasNotifications: Option.fromNullable(accountMembership.account)
.map(
({ accountMembershipsWithBindingUserError }) =>
accountMembershipsWithBindingUserError.totalCount > 0,
)
.getWithDefault(false),
},
],
}) =>
holder?.verificationStatus === "Refused"
? []
: [
{
matchRoutes: ["AccountTransactionsArea"],
iconActive: "apps-list-filled",
icon: "apps-list-regular",
name: t("navigation.history"),
to: Router.AccountTransactionsListRoot({ accountMembershipId }),
hidden: !historyMenuIsVisible,
},
{
matchRoutes: ["AccountDetailsArea"],
iconActive: "building-bank-filled",
icon: "building-bank-regular",
name: t("navigation.account"),
to: Router.AccountDetailsIban({ accountMembershipId }),
hidden: !detailsMenuIsVisible,
},
{
matchRoutes: ["AccountPaymentsArea"],
iconActive: "arrow-swap-filled",
icon: "arrow-swap-regular",
name: t("navigation.transfer"),
to: Router.AccountPaymentsRoot({ accountMembershipId }),
hidden: !paymentMenuIsVisible,
},
{
matchRoutes: ["AccountCardsArea"],
iconActive: "payment-filled",
icon: "payment-regular",
name: t("navigation.cards"),
to: Router.AccountCardsList({ accountMembershipId }),
hidden: !cardMenuIsVisible,
},
{
matchRoutes: ["AccountMembersArea"],
iconActive: "people-filled",
icon: "people-regular",
name: t("navigation.members"),
to: Router.AccountMembersList({ accountMembershipId }),
hidden: !memberMenuIsVisible,
hasNotifications: Option.fromNullable(accountMembership.account)
.map(
({ accountMembershipsWithBindingUserError }) =>
accountMembershipsWithBindingUserError.totalCount > 0,
)
.getWithDefault(false),
},
],
)
.getWithDefault([]);

Expand Down Expand Up @@ -673,14 +678,14 @@ export const AccountArea = ({ accountMembershipId }: Props) => {
const indexUrl: string = historyMenuIsVisible
? Router.AccountTransactionsListRoot({ accountMembershipId })
: detailsMenuIsVisible
? Router.AccountDetailsIban({ accountMembershipId })
: paymentMenuIsVisible
? Router.AccountPaymentsRoot({ accountMembershipId })
: cardMenuIsVisible
? Router.AccountCardsList({ accountMembershipId })
: memberMenuIsVisible
? Router.AccountMembersList({ accountMembershipId })
: "";
? Router.AccountDetailsIban({ accountMembershipId })
: paymentMenuIsVisible
? Router.AccountPaymentsRoot({ accountMembershipId })
: cardMenuIsVisible
? Router.AccountCardsList({ accountMembershipId })
: memberMenuIsVisible
? Router.AccountMembersList({ accountMembershipId })
: "";

if (accountMembership.user?.id !== user?.id) {
return <Redirect to={Router.ProjectRootRedirect()} />;
Expand All @@ -690,6 +695,19 @@ export const AccountArea = ({ accountMembershipId }: Props) => {
accountMembership.statusInfo.status !== "BindingUserError" &&
accountMembership.canManageAccountMembership;

if (holder?.verificationStatus === "Refused") {
return (
<AccountActivationPage
requireFirstTransfer={requireFirstTransfer}
accentColor={accentColor}
accountMembershipId={accountMembershipId}
additionalInfo={additionalInfo}
accountVisible={accountVisible}
projectName={projectName}
refetchAccountAreaQuery={refetchAccountAreaQuery}
/>
);
}
return (
<Suspense fallback={<LoadingView color={colors.current[500]} />}>
{match(route)
Expand Down
55 changes: 33 additions & 22 deletions clients/banking/src/components/AccountPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export const AccountPicker = ({ accountMembershipId, onPressItem }: Props) => {
});
};

export type AccountActivationTag = "actionRequired" | "pending" | "none";
export type AccountActivationTag = "actionRequired" | "pending" | "none" | "refused";

type AccountPickerButtonProps = {
desktop: boolean;
Expand Down Expand Up @@ -315,29 +315,40 @@ export const AccountPickerButton = forwardRef<View, AccountPickerButtonProps>(

{activationTag !== "none" && (
<View>
<Link
to={Router.AccountActivation({ accountMembershipId })}
onPress={onPressActivationLink}
style={({ hovered }) => [
styles.activationLink,
hovered && styles.activationLinkHovered,
]}
>
{match(activationTag)
.with("actionRequired", () => (
<Tag color="warning" size="small">
{t("accountActivation.menuTag.actionRequired")}
{match(activationTag)
.with("refused", () => (
<View style={styles.activationLink}>
<Tag color="negative" size="small">
{t("accountActivation.menuTag.refused")}
</Tag>
))
.with("pending", () => (
<Tag color="shakespear" size="small">
{t("accountActivation.menuTag.pending")}
</Tag>
))
.exhaustive()}
</View>
))
.otherwise(activationTag => (
<Link
to={Router.AccountActivation({ accountMembershipId })}
onPress={onPressActivationLink}
style={({ hovered }) => [
styles.activationLink,
hovered && styles.activationLinkHovered,
]}
>
{match(activationTag)
.with("actionRequired", () => (
<Tag color="warning" size="small">
{t("accountActivation.menuTag.actionRequired")}
</Tag>
))
.with("pending", () => (
<Tag color="shakespear" size="small">
{t("accountActivation.menuTag.pending")}
</Tag>
))

.exhaustive()}

<Icon name="arrow-right-filled" size={16} color={colors.gray[500]} />
</Link>
<Icon name="arrow-right-filled" size={16} color={colors.gray[500]} />
</Link>
))}

{activationLinkActive && (
<SidebarNavigationTrackerActiveMarker color={colors.current[500]} />
Expand Down
3 changes: 3 additions & 0 deletions clients/banking/src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"accountActivation.identity.title": "Identitätsprüfung",
"accountActivation.menuTag.actionRequired": "Aktion erforderlich",
"accountActivation.menuTag.pending": "Verifizierung steht noch aus",
"accountActivation.menuTag.refused": "Abgelehnt",
"accountActivation.pendingDocuments.text": "Bitte haben Sie etwas Geduld, während wir die Dokumente überprüfen. Dies dauert normalerweise maximal 72 Stunden.",
"accountActivation.pendingDocuments.title": "Wir prüfen Ihre Unterlagen.",
"accountActivation.refused.description": "Unsere Zahlungspartner überprüfen alle potenziellen Kontoinhaber gemäß strenger Vorschriften.\nLeider entsprach die Überprüfung für {name} nicht ihren Kriterien.\n\nBei Fragen senden Sie bitte eine E-Mail an {email}.",
"accountActivation.refused.title": "Leider können wir Ihr Konto nicht eröffnen",
"accountActivation.tag.done": "Erledigt",
"accountActivation.tag.todo": "Aufgaben",
"accountActivation.title": "Kontoaktivierung",
Expand Down
3 changes: 3 additions & 0 deletions clients/banking/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"accountActivation.identity.title": "Identity verification",
"accountActivation.menuTag.actionRequired": "Action required",
"accountActivation.menuTag.pending": "Pending verification",
"accountActivation.menuTag.refused": "Refused",
"accountActivation.pendingDocuments.text": "Please bear with us while we review your documents. This can take up to 72 hours.",
"accountActivation.pendingDocuments.title": "We're reviewing your supporting documents.",
"accountActivation.refused.description": "Our payment partners review all potential account holders according to strict regulations.\nUnfortunately, the review for {name} did not meet their criteria.\n\nPlease send an email to {email} if you have any questions.",
"accountActivation.refused.title": "Regrettably, we can’t open your account",
"accountActivation.tag.done": "Done",
"accountActivation.tag.todo": "To do",
"accountActivation.title": "Account activation",
Expand Down
3 changes: 3 additions & 0 deletions clients/banking/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"accountActivation.identity.title": "Verificación de identidad",
"accountActivation.menuTag.actionRequired": "Acción necesaria",
"accountActivation.menuTag.pending": "Pendiente de verificación",
"accountActivation.menuTag.refused": "Rechazado",
"accountActivation.pendingDocuments.text": "Ten paciencia mientras revisamos tus documentos. Puede tardar hasta 72 horas.",
"accountActivation.pendingDocuments.title": "Estamos revisando tus documentos justificativos.",
"accountActivation.refused.description": "Nuestros socios de pago revisan a todos los posibles titulares de cuentas según regulaciones estrictas.\nDesafortunadamente, la revisión para {name} no cumplió con sus criterios.\n\nSi tienes alguna pregunta, envía un correo electrónico a {email}.",
"accountActivation.refused.title": "Lamentablemente, no podemos abrir tu cuenta",
"accountActivation.tag.done": "Hecho",
"accountActivation.tag.todo": "Pendiente",
"accountActivation.title": "Activación de cuenta",
Expand Down
3 changes: 3 additions & 0 deletions clients/banking/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"accountActivation.identity.title": "Vérification d'identité",
"accountActivation.menuTag.actionRequired": "Action requise",
"accountActivation.menuTag.pending": "En attente de vérification",
"accountActivation.menuTag.refused": "Refusé",
"accountActivation.pendingDocuments.text": "Veuillez patienter pendant que nous examinons vos documents. Cette opération peut prendre jusqu'à 72 heures.",
"accountActivation.pendingDocuments.title": "Nous examinons vos documents justificatifs.",
"accountActivation.refused.description": "Nos partenaires de paiement examinent tous les demandeurs de compte potentiel selon des réglementations strictes.\nMalheureusement, l'examen de {name} n'a pas répondu à leurs critères.\n\nVeuillez envoyer un courriel à {email} si vous avez des questions.",
"accountActivation.refused.title": "Malheureusement, nous ne pouvons pas ouvrir votre compte",
"accountActivation.tag.done": "Terminé",
"accountActivation.tag.todo": "À faire",
"accountActivation.title": "Activation du compte",
Expand Down
3 changes: 3 additions & 0 deletions clients/banking/src/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"accountActivation.identity.title": "Verifica dell'identità",
"accountActivation.menuTag.actionRequired": "Azione richiesta",
"accountActivation.menuTag.pending": "Verifica in attesa",
"accountActivation.menuTag.refused": "Rifiutato",
"accountActivation.pendingDocuments.text": "La preghiamo di attendere mentre esaminiamo i suoi documenti. Questa operazione può richiedere fino a 72 ore.",
"accountActivation.pendingDocuments.title": "Abbiamo ricevuto i suoi documenti.",
"accountActivation.refused.description": "I nostri partner di pagamento esaminano tutti i potenziali titolari di conto in conformità con rigorose normative.\nSfortunatamente, la revisione per {name} non ha soddisfatto i loro criteri.\n\nSe hai domande, invia un'email a {email}.",
"accountActivation.refused.title": "Purtroppo non possiamo aprire il tuo conto",
"accountActivation.tag.done": "Fatto",
"accountActivation.tag.todo": "Da fare",
"accountActivation.title": "Attivazione conto",
Expand Down
3 changes: 3 additions & 0 deletions clients/banking/src/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"accountActivation.identity.title": "Identiteitsverificatie",
"accountActivation.menuTag.actionRequired": "Actie vereist",
"accountActivation.menuTag.pending": "In afwachting van verificatie",
"accountActivation.menuTag.refused": "Geweigerd",
"accountActivation.pendingDocuments.text": "Nog even geduld! We gaan je documenten beoordelen. Dit duurt maximaal 72 uur.",
"accountActivation.pendingDocuments.title": "We hebben je documenten ontvangen.",
"accountActivation.refused.description": "Onze betalingspartners beoordelen alle potentiële rekeninghouders volgens strikte regelgeving.\nHelaas voldoet de beoordeling voor {name} niet aan hun criteria.\n\nAls je vragen hebt, stuur dan een e-mail naar {email}.",
"accountActivation.refused.title": "Helaas kunnen we je account niet openen",
"accountActivation.tag.done": "Klaar",
"accountActivation.tag.todo": "Taken",
"accountActivation.title": "Accountactivatie",
Expand Down
3 changes: 3 additions & 0 deletions clients/banking/src/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@
"accountActivation.identity.title": "Verificação de identidade",
"accountActivation.menuTag.actionRequired": "Ação necessária",
"accountActivation.menuTag.pending": "Verificação pendente",
"accountActivation.menuTag.refused": "Recusado",
"accountActivation.pendingDocuments.text": "Por favor, aguarde enquanto revemos os seus documentos. Este processo pode demorar até 72 horas.",
"accountActivation.pendingDocuments.title": "Estamos verificando os seus documentos de apoio.",
"accountActivation.refused.description": "Nossos parceiros de pagamento analisam todos os potenciais titulares de conta de acordo com regulamentações rigorosas.\nInfelizmente, a análise para {name} não atendeu aos critérios deles.\n\nPor favor, envie um e-mail para {email} se tiver alguma dúvida.",
"accountActivation.refused.title": "Lamentavelmente, não podemos abrir a sua conta",
"accountActivation.tag.done": "Feito",
"accountActivation.tag.todo": "Por fazer",
"accountActivation.title": "Ativação de conta",
Expand Down
Loading

0 comments on commit bbc37e0

Please sign in to comment.