add kyc warning
This commit is contained in:
parent
335d22b12b
commit
e87073d42a
@ -19,6 +19,7 @@ import { styled } from "@linaria/react";
|
||||
import { Fragment, h, VNode } from "preact";
|
||||
import { useState } from "preact/hooks";
|
||||
import { Amount } from "../../components/Amount.js";
|
||||
import { AlertView } from "../../components/CurrentAlerts.js";
|
||||
import { ErrorMessage } from "../../components/ErrorMessage.js";
|
||||
import { SelectList } from "../../components/SelectList.js";
|
||||
import { Input, SvgIcon } from "../../components/styled/index.js";
|
||||
@ -144,11 +145,23 @@ export function NoExchangesView({
|
||||
}: SelectExchangeState.NoExchange): VNode {
|
||||
const { i18n } = useTranslationContext();
|
||||
if (!currency) {
|
||||
return <ErrorMessage title={i18n.str`Could not find any exchange`} />;
|
||||
return (
|
||||
<AlertView
|
||||
alert={{
|
||||
type: "warning",
|
||||
message: i18n.str`Could not find any exchange `,
|
||||
description: i18n.str`You are trying to withdraw coins but there is no exchange and the bank didn't suggested one.`,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<ErrorMessage
|
||||
title={i18n.str`Could not find any exchange for the currency ${currency}`}
|
||||
<AlertView
|
||||
alert={{
|
||||
type: "warning",
|
||||
message: i18n.str`Could not find any exchange `,
|
||||
description: i18n.str`You are trying to withdraw coins for the currency ${currency} but there is no exchange registered in this wallet and the bank didn't suggested one.`,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -221,6 +221,14 @@ const transactionError = {
|
||||
message: "Unexpected error code in response",
|
||||
};
|
||||
|
||||
const kycError = {
|
||||
code: 7025,
|
||||
hint: "KYC check required for withdrawal",
|
||||
kycUrl:
|
||||
"http://localhost:6666/oauth/v2/login?client_id=taler-exchange&redirect_uri=http%3A%2F%2Flocalhost%3A8081%2F%2Fkyc-proof%2F59WFS5VXXY3CEE25BM45XPB7ZCDQZNZ46PJCMNXK05P65T9M1X90%2FKYC-PROVIDER-MYPROV%2F1",
|
||||
when: AbsoluteTime.now(),
|
||||
};
|
||||
|
||||
export const Withdraw = tests.createExample(TestedComponent, {
|
||||
transaction: exampleData.withdraw,
|
||||
});
|
||||
@ -257,6 +265,12 @@ export const WithdrawError = tests.createExample(TestedComponent, {
|
||||
},
|
||||
});
|
||||
|
||||
export const WithdrawErrorKYC = tests.createExample(TestedComponent, {
|
||||
transaction: {
|
||||
...exampleData.withdraw,
|
||||
error: kycError,
|
||||
},
|
||||
});
|
||||
// export const WithdrawErrorInDevMode = tests.createExampleInCustomContext(
|
||||
// TestedComponent,
|
||||
// {
|
||||
|
@ -44,7 +44,7 @@ import emptyImg from "../../static/img/empty.png";
|
||||
import { Amount } from "../components/Amount.js";
|
||||
import { BankDetailsByPaytoType } from "../components/BankDetailsByPaytoType.js";
|
||||
import { CopyButton } from "../components/CopyButton.js";
|
||||
import { ErrorAlertView } from "../components/CurrentAlerts.js";
|
||||
import { AlertView, ErrorAlertView } from "../components/CurrentAlerts.js";
|
||||
import { Loading } from "../components/Loading.js";
|
||||
import { Kind, Part, PartCollapsible, PartPayto } from "../components/Part.js";
|
||||
import { QR } from "../components/QR.js";
|
||||
@ -199,12 +199,33 @@ export function TransactionView({
|
||||
<Fragment>
|
||||
<section style={{ padding: 8, textAlign: "center" }}>
|
||||
{transaction?.error ? (
|
||||
transaction.error.code === 7025 ? (
|
||||
<AlertView
|
||||
alert={{
|
||||
type: "warning",
|
||||
message: i18n.str`KYC check required for the transaction to complete`,
|
||||
description:
|
||||
transaction.error.kycUrl &&
|
||||
typeof transaction.error.kycUrl === "string" ? (
|
||||
<div>
|
||||
<i18n.Translate>
|
||||
Follow this link to the{` `}
|
||||
<a href={transaction.error.kycUrl}>KYC verifier</a>
|
||||
</i18n.Translate>
|
||||
</div>
|
||||
) : (
|
||||
i18n.str`No more information has been provided`
|
||||
),
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<ErrorAlertView
|
||||
error={alertFromError(
|
||||
i18n.str`There was an error trying to complete the transaction`,
|
||||
transaction.error,
|
||||
)}
|
||||
/>
|
||||
)
|
||||
) : undefined}
|
||||
{transaction.pending && (
|
||||
<WarningBox>
|
||||
|
Loading…
Reference in New Issue
Block a user