From 00f108b9ddd4ac3447fd29552b3a503d6daed48d Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 24 Apr 2023 23:42:14 -0300 Subject: fix #7684 --- .../merchant-backoffice-ui/src/declaration.d.ts | 7 ++- .../src/paths/instance/index.stories.ts | 1 + .../paths/instance/kyc/list/ListPage.stories.tsx | 58 ++++++++++++++++++++++ .../src/paths/instance/kyc/list/ListPage.tsx | 51 ++++++++++++++----- 4 files changed, 104 insertions(+), 13 deletions(-) create mode 100644 packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx (limited to 'packages') diff --git a/packages/merchant-backoffice-ui/src/declaration.d.ts b/packages/merchant-backoffice-ui/src/declaration.d.ts index 9fc4f0d77..a9d0f3a7f 100644 --- a/packages/merchant-backoffice-ui/src/declaration.d.ts +++ b/packages/merchant-backoffice-ui/src/declaration.d.ts @@ -395,11 +395,16 @@ export namespace MerchantBackend { // URL that the user should open in a browser to // proceed with the KYC process (as returned // by the exchange's /kyc-check/ endpoint). - kyc_url: string; + // Optional, missing if the account is blocked + // due to AML and not due to KYC. + kyc_url?: string; // Base URL of the exchange this is about. exchange_url: string; + // AML status of the account. + aml_status: number; + // Our bank wire account this is about. payto_uri: string; } diff --git a/packages/merchant-backoffice-ui/src/paths/instance/index.stories.ts b/packages/merchant-backoffice-ui/src/paths/instance/index.stories.ts index fcb75cd7c..50918e131 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/index.stories.ts +++ b/packages/merchant-backoffice-ui/src/paths/instance/index.stories.ts @@ -15,3 +15,4 @@ */ export * as details from "./details/stories.js"; +export * as kycList from "./kyc/list/ListPage.stories.js"; diff --git a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx new file mode 100644 index 000000000..6c48c6d55 --- /dev/null +++ b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.stories.tsx @@ -0,0 +1,58 @@ +/* + This file is part of GNU Taler + (C) 2021-2023 Taler Systems S.A. + + GNU Taler is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + GNU Taler; see the file COPYING. If not, see + */ + +/** + * + * @author Sebastian Javier Marchano (sebasjm) + */ + +import { h, VNode, FunctionalComponent } from "preact"; +import { ListPage as TestedComponent } from "./ListPage.js"; +import { tests } from "@gnu-taler/web-util/lib/index.browser"; +import { MerchantBackend } from "../../../../declaration.js"; + +export default { + title: "Pages/KYC/List", + component: TestedComponent, + argTypes: { + onUpdate: { action: "onUpdate" }, + onBack: { action: "onBack" }, + }, +}; + +export const Example = tests.createExample(TestedComponent, { + status: { + timeout_kycs: [], + pending_kycs: [ + { + aml_status: 0, + exchange_url: "http://exchange.taler", + payto_uri: "payto://iban/de123123123", + kyc_url: "http://exchange.taler/kyc", + }, + { + aml_status: 1, + exchange_url: "http://exchange.taler", + payto_uri: "payto://iban/de123123123", + }, + { + aml_status: 2, + exchange_url: "http://exchange.taler", + payto_uri: "payto://iban/de123123123", + }, + ], + } as MerchantBackend.Instances.AccountKycRedirects, +}); diff --git a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx index 7966a2cdd..91d876a8a 100644 --- a/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx +++ b/packages/merchant-backoffice-ui/src/paths/instance/kyc/list/ListPage.tsx @@ -106,23 +106,50 @@ function PendingTable({ entries }: PendingTableProps): VNode { Target account - KYC URL + Reason {entries.map((e, i) => { - return ( - - {e.exchange_url} - {e.payto_uri} - - - {e.kyc_url} - - - - ); + if (e.kyc_url === undefined) { + // blocked by AML + return ( + + {e.exchange_url} + {e.payto_uri} + + {e.aml_status === 1 ? ( + + There is an anti-money laundering process pending to + complete + + ) : ( + + The account is frozen due to the anti-money laundering + rules. Contact the exchange service provider for further + instructions. + + )} + + + ); + } else { + // blocked by KYC + return ( + + {e.exchange_url} + {e.payto_uri} + + + + Pending KYC process, click here to complete + + + + + ); + } })} -- cgit v1.2.3