aboutsummaryrefslogtreecommitdiff
path: root/packages/demobank-ui/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'packages/demobank-ui/src/pages')
-rw-r--r--packages/demobank-ui/src/pages/ShowAccountDetails.tsx2
-rw-r--r--packages/demobank-ui/src/pages/admin/AdminHome.tsx14
-rw-r--r--packages/demobank-ui/src/pages/business/CreateCashout.tsx52
-rw-r--r--packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx30
4 files changed, 55 insertions, 43 deletions
diff --git a/packages/demobank-ui/src/pages/ShowAccountDetails.tsx b/packages/demobank-ui/src/pages/ShowAccountDetails.tsx
index 2e00fdbba..a88a90499 100644
--- a/packages/demobank-ui/src/pages/ShowAccountDetails.tsx
+++ b/packages/demobank-ui/src/pages/ShowAccountDetails.tsx
@@ -58,7 +58,7 @@ export function ShowAccountDetails({
email: submitAccount.contact_data?.email,
phone: submitAccount.contact_data?.phone,
}),
- is_exchange: false,
+ is_taler_exchange: false,
name: submitAccount.name,
});
diff --git a/packages/demobank-ui/src/pages/admin/AdminHome.tsx b/packages/demobank-ui/src/pages/admin/AdminHome.tsx
index 9bc2ee571..a89b4afca 100644
--- a/packages/demobank-ui/src/pages/admin/AdminHome.tsx
+++ b/packages/demobank-ui/src/pages/admin/AdminHome.tsx
@@ -124,15 +124,15 @@ function Metrics(): VNode {
</div>
<dl class="mt-5 grid grid-cols-1 divide-y divide-gray-200 overflow-hidden rounded-lg bg-white shadow-lg md:grid-cols-3 md:divide-x md:divide-y-0">
- {resp.current.body.type !== "with-cashout" || resp.previous.body.type !== "with-cashout" ? undefined :
+ {resp.current.body.type !== "with-conversions" || resp.previous.body.type !== "with-conversions" ? undefined :
<Fragment>
<div class="px-4 py-5 sm:p-6">
<dt class="text-base font-normal text-gray-900">
<i18n.Translate>Cashin</i18n.Translate>
</dt>
<MetricValue
- current={resp.current.body.cashinExternalVolume}
- previous={resp.previous.body.cashinExternalVolume}
+ current={resp.current.body.cashinFiatVolume}
+ previous={resp.previous.body.cashinFiatVolume}
/>
</div>
<div class="px-4 py-5 sm:p-6">
@@ -140,8 +140,8 @@ function Metrics(): VNode {
<i18n.Translate>Cashout</i18n.Translate>
</dt>
<MetricValue
- current={resp.current.body.cashoutExternalVolume}
- previous={resp.previous.body.cashoutExternalVolume}
+ current={resp.current.body.cashoutFiatVolume}
+ previous={resp.previous.body.cashoutFiatVolume}
/>
</div>
</Fragment>
@@ -151,8 +151,8 @@ function Metrics(): VNode {
<i18n.Translate>Payout</i18n.Translate>
</dt>
<MetricValue
- current={resp.current.body.talerPayoutInternalVolume}
- previous={resp.previous.body.talerPayoutInternalVolume}
+ current={resp.current.body.talerOutVolume}
+ previous={resp.previous.body.talerOutVolume}
/>
</div>
</dl>
diff --git a/packages/demobank-ui/src/pages/business/CreateCashout.tsx b/packages/demobank-ui/src/pages/business/CreateCashout.tsx
index 10be5ec11..525a170bc 100644
--- a/packages/demobank-ui/src/pages/business/CreateCashout.tsx
+++ b/packages/demobank-ui/src/pages/business/CreateCashout.tsx
@@ -16,19 +16,22 @@
import {
Amounts,
TalerError,
- TranslatedString
+ TranslatedString,
+ encodeCrock,
+ getRandomBytes
} from "@gnu-taler/taler-util";
import {
+ Attention,
+ ErrorLoading,
+ Loading,
+ LocalNotificationBanner,
+ ShowInputErrorLabel,
useLocalNotification,
useTranslationContext
} from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { useEffect, useState } from "preact/hooks";
import { mutate } from "swr";
-import { Attention } from "@gnu-taler/web-util/browser";
-import { ErrorLoading } from "@gnu-taler/web-util/browser";
-import { Loading } from "@gnu-taler/web-util/browser";
-import { ShowInputErrorLabel } from "@gnu-taler/web-util/browser";
import { useBankCoreApiContext } from "../../context/config.js";
import { useAccountDetails } from "../../hooks/access.js";
import { useBackendState } from "../../hooks/backend.js";
@@ -37,13 +40,11 @@ import {
} from "../../hooks/circuit.js";
import {
TanChannel,
- undefinedIfEmpty,
- withRuntimeErrorHandling
+ undefinedIfEmpty
} from "../../utils.js";
import { LoginForm } from "../LoginForm.js";
import { InputAmount } from "../PaytoWireTransferForm.js";
import { assertUnreachable } from "../WithdrawalOperationPage.js";
-import { LocalNotificationBanner } from "@gnu-taler/web-util/browser";
interface Props {
account: string;
@@ -321,21 +322,6 @@ export function CreateCashout({
updateForm(structuredClone(form));
}}
/>
- <input
- class={
- "pure-button content " +
- (form.channel === TanChannel.FILE
- ? "pure-button-primary"
- : "pure-button-secondary")
- }
- type="submit"
- value={i18n.str`FILE`}
- onClick={async (e) => {
- e.preventDefault();
- form.channel = TanChannel.FILE;
- updateForm(structuredClone(form));
- }}
- />
</div>
<ShowInputErrorLabel
message={errors?.channel}
@@ -363,7 +349,9 @@ export function CreateCashout({
if (errors || !creds) return;
await handleError(async () => {
+ const request_uid = encodeCrock(getRandomBytes(16))
const resp = await api.createCashout(creds, {
+ request_uid,
amount_credit: Amounts.stringify(calc.credit),
amount_debit: Amounts.stringify(calc.debit),
subject: form.subject,
@@ -404,12 +392,18 @@ export function CreateCashout({
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
});
- // case "": return notify({
- // type: "error",
- // title: i18n.str`This user is not allowed to make a cashout`,
- // description: resp.detail.hint as TranslatedString,
- // debug: resp.detail,
- // });
+ case "request-already-used": return notify({
+ type: "error",
+ title: i18n.str`Duplicated request found, try again.`,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
+ });
+ case "tan-failed": return notify({
+ type: "error",
+ title: i18n.str`Server couldn't send the confirmation request.`,
+ description: resp.detail.hint as TranslatedString,
+ debug: resp.detail,
+ });
default: assertUnreachable(resp)
}
}
diff --git a/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx b/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx
index 4646e9220..ddfc18a0c 100644
--- a/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx
+++ b/packages/demobank-ui/src/pages/business/ShowCashoutDetails.tsx
@@ -121,12 +121,12 @@ export function ShowCashoutDetails({
</label>
<input readOnly value={result.body.status} />
</fieldset>
- <fieldset>
+ {/* <fieldset>
<label>
<i18n.Translate>Destination</i18n.Translate>
</label>
<input readOnly value={result.body.credit_payto_uri} />
- </fieldset>
+ </fieldset> */}
{isPending ? (
<fieldset>
<label>
@@ -220,15 +220,33 @@ export function ShowCashoutDetails({
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "wrong-tan-or-credential": return notify({
+ case "no-enough-balance": 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({
+ 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({
+ 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({
type: "error",
- title: i18n.str`Invalid code or credentials.`,
+ title: i18n.str`Missing destination account.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})
- case "cashout-address-changed": return notify({
+ case "too-many-attempts": return notify({
type: "error",
- title: i18n.str`The cash-out address between the creation and the confirmation changed.`,
+ title: i18n.str`Too many failed attempts.`,
description: resp.detail.hint as TranslatedString,
debug: resp.detail,
})