diff options
author | Sebastian <sebasjm@gmail.com> | 2024-01-09 18:51:49 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2024-01-09 18:51:49 -0300 |
commit | f5771cc7b99dc938fd606dcbee350b66ec8027c9 (patch) | |
tree | 95c1aa5b8a5e6067c7689b0caf161c50d1f694ed /packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx | |
parent | 1826b9121a0308aa0a7ac39a89ad7dc8ea2ae965 (diff) | |
download | wallet-core-f5771cc7b99dc938fd606dcbee350b66ec8027c9.tar.xz |
prepare for 2fa impl
Diffstat (limited to 'packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx')
-rw-r--r-- | packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx b/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx index 3ef835574..5d8db5aee 100644 --- a/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx +++ b/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx @@ -15,7 +15,9 @@ */ import { Amounts, + HttpStatusCode, TalerError, + TalerErrorCode, TranslatedString } from "@gnu-taler/taler-util"; import { @@ -73,9 +75,9 @@ export function ShowCashoutDetails({ } if (result.type === "fail") { switch (result.case) { - case "not-found": return <Attention type="warning" title={i18n.str`This cashout not found. Maybe already aborted.`}> + case HttpStatusCode.NotFound: return <Attention type="warning" title={i18n.str`This cashout not found. Maybe already aborted.`}> </Attention> - case "cashout-not-supported": return <Attention type="warning" title={i18n.str`Cashouts are not supported`}> + case HttpStatusCode.NotImplemented: return <Attention type="warning" title={i18n.str`Cashouts are not supported`}> </Attention> default: assertUnreachable(result) } @@ -93,6 +95,7 @@ export function ShowCashoutDetails({ }); const isPending = String(result.body.status).toUpperCase() === "PENDING"; const { fiat_currency_specification, regional_currency_specification } = info.body + // won't implement in retry in old API 3:0:3 since request_uid is missing async function doAbortCashout() { if (!creds) return; await handleError(async () => { @@ -101,19 +104,19 @@ export function ShowCashoutDetails({ onCancel(); } else { switch (resp.case) { - case "not-found": return notify({ + case HttpStatusCode.NotFound: return notify({ type: "error", title: i18n.str`Cashout not found. It may be also mean that it was already aborted.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "already-confirmed": return notify({ + case HttpStatusCode.Conflict: return notify({ type: "error", title: i18n.str`Cashout was already confimed.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "cashout-not-supported": return notify({ + case HttpStatusCode.NotImplemented: return notify({ type: "error", title: i18n.str`Cashout operation is not supported.`, description: resp.detail.hint as TranslatedString, @@ -136,49 +139,49 @@ export function ShowCashoutDetails({ mutate(() => true)//clean cashout state } else { switch (resp.case) { - case "not-found": return notify({ + case HttpStatusCode.NotFound: return notify({ type: "error", title: i18n.str`Cashout not found. It may be also mean that it was already aborted.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "no-enough-balance": return notify({ + case TalerErrorCode.BANK_UNALLOWED_DEBIT: return notify({ type: "error", title: i18n.str`The account does not have sufficient funds`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }); - case "incorrect-exchange-rate": return notify({ + case TalerErrorCode.BANK_BAD_CONVERSION: return notify({ type: "error", title: i18n.str`The exchange rate was incorrectly applied`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }); - case "already-aborted": return notify({ + case TalerErrorCode.BANK_CONFIRM_ABORT_CONFLICT: return notify({ type: "error", title: i18n.str`The cashout operation is already aborted.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }); - case "no-cashout-payto": return notify({ + case TalerErrorCode.BANK_CONFIRM_INCOMPLETE: return notify({ type: "error", title: i18n.str`Missing destination account.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "too-many-attempts": return notify({ + case HttpStatusCode.TooManyRequests: return notify({ type: "error", title: i18n.str`Too many failed attempts.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "cashout-not-supported": return notify({ + case HttpStatusCode.NotImplemented: return notify({ type: "error", title: i18n.str`Cashout operation is not supported.`, description: resp.detail.hint as TranslatedString, debug: resp.detail, }) - case "invalid-code": return notify({ + case TalerErrorCode.BANK_TAN_CHALLENGE_FAILED: return notify({ type: "error", title: i18n.str`The code for this cashout is invalid.`, description: resp.detail.hint as TranslatedString, |