move kycurl to commons, make webex aware

This commit is contained in:
Sebastian 2023-06-05 10:58:24 -03:00
parent 16900104b5
commit 75fdf6137f
No known key found for this signature in database
GPG Key ID: 173909D1A5F66069
3 changed files with 50 additions and 57 deletions

View File

@ -50,7 +50,6 @@ import {
TransactionIdStr, TransactionIdStr,
} from "./wallet-types.js"; } from "./wallet-types.js";
export interface TransactionsRequest { export interface TransactionsRequest {
/** /**
* return only transactions in the given currency * return only transactions in the given currency
@ -174,6 +173,12 @@ export interface TransactionCommon {
amountEffective: AmountString; amountEffective: AmountString;
error?: TalerErrorDetail; error?: TalerErrorDetail;
/**
* If the transaction minor state is in KycRequired this field is going to
* have the location where the user need to go to complete KYC information.
*/
kycUrl?: string;
} }
export type Transaction = export type Transaction =
@ -345,8 +350,6 @@ export interface TransactionPeerPullCredit extends TransactionCommon {
* URI to send to the other party. * URI to send to the other party.
*/ */
talerUri: string; talerUri: string;
kycUrl: string | undefined;
} }
/** /**
@ -415,8 +418,6 @@ export interface TransactionPeerPushCredit extends TransactionCommon {
* Amount that actually was (or will be) added to the wallet's balance. * Amount that actually was (or will be) added to the wallet's balance.
*/ */
amountEffective: AmountString; amountEffective: AmountString;
kycUrl: string | undefined;
} }
export enum PaymentStatus { export enum PaymentStatus {

View File

@ -232,14 +232,6 @@ const transactionError = {
message: "Unexpected error code in response", 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, { export const Withdraw = tests.createExample(TestedComponent, {
transaction: exampleData.withdraw, transaction: exampleData.withdraw,
}); });
@ -285,21 +277,10 @@ export const WithdrawErrorKYC = tests.createExample(TestedComponent, {
major: TransactionMajorState.Pending, major: TransactionMajorState.Pending,
minor: TransactionMinorState.KycRequired, minor: TransactionMinorState.KycRequired,
}, },
kycUrl:
// error: kycError, "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",
}, },
}); });
// export const WithdrawErrorInDevMode = tests.createExampleInCustomContext(
// TestedComponent,
// {
// transaction: {
// ...exampleData.withdraw,
// error: transactionError,
// },
// },
// DevContextProviderForTesting,
// { value: true },
// );
export const WithdrawPendingManual = tests.createExample( export const WithdrawPendingManual = tests.createExample(
TestedComponent, TestedComponent,

View File

@ -25,12 +25,14 @@ import {
parsePaytoUri, parsePaytoUri,
PaytoUri, PaytoUri,
stringifyPaytoUri, stringifyPaytoUri,
TalerErrorCode,
TalerPreciseTimestamp, TalerPreciseTimestamp,
TalerProtocolTimestamp, TalerProtocolTimestamp,
Transaction, Transaction,
TransactionDeposit, TransactionDeposit,
TransactionIdStr, TransactionIdStr,
TransactionMajorState, TransactionMajorState,
TransactionMinorState,
TransactionType, TransactionType,
TranslatedString, TranslatedString,
WithdrawalType, WithdrawalType,
@ -259,19 +261,28 @@ function TransactionTemplate({
return ( return (
<Fragment> <Fragment>
<section style={{ padding: 8, textAlign: "center" }}> <section style={{ padding: 8, textAlign: "center" }}>
{transaction?.error ? ( {transaction?.error &&
transaction.error.code === 7025 ? ( // FIXME: wallet core should stop sending this error on KYC
transaction.error.code !==
TalerErrorCode.WALLET_WITHDRAWAL_KYC_REQUIRED ? (
<ErrorAlertView
error={alertFromError(
i18n.str`There was an error trying to complete the transaction`,
transaction.error,
)}
/>
) : undefined}
{transaction.txState.minor === TransactionMinorState.KycRequired && (
<AlertView <AlertView
alert={{ alert={{
type: "warning", type: "warning",
message: i18n.str`KYC check required for the transaction to complete`, message: i18n.str`KYC check required for the transaction to complete`,
description: description:
transaction.error.kycUrl && transaction.kycUrl && typeof transaction.kycUrl === "string" ? (
typeof transaction.error.kycUrl === "string" ? (
<div> <div>
<i18n.Translate> <i18n.Translate>
Follow this link to the{` `} Follow this link to the{` `}
<a href={transaction.error.kycUrl}>KYC verifier</a> <a href={transaction.kycUrl}>KYC verifier</a>
</i18n.Translate> </i18n.Translate>
</div> </div>
) : ( ) : (
@ -279,15 +290,15 @@ function TransactionTemplate({
), ),
}} }}
/> />
) : (
<ErrorAlertView
error={alertFromError(
i18n.str`There was an error trying to complete the transaction`,
transaction.error,
)} )}
/> {transaction.txState.minor === TransactionMinorState.AmlRequired && (
) <WarningBox>
) : undefined} <i18n.Translate>
The transaction has been blocked since the account required an AML
check
</i18n.Translate>
</WarningBox>
)}
{transaction.txState.major === TransactionMajorState.Pending && ( {transaction.txState.major === TransactionMajorState.Pending && (
<WarningBox> <WarningBox>
<i18n.Translate>This transaction is not completed</i18n.Translate> <i18n.Translate>This transaction is not completed</i18n.Translate>