aboutsummaryrefslogtreecommitdiff
path: root/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-06-14 12:33:17 -0300
committerSebastian <sebasjm@gmail.com>2024-06-14 12:33:17 -0300
commit2b895bea57ae486004d8173354ccd5af52cf042e (patch)
tree300b3c50eec3b3ce758bacaabbd416986f2d09aa /packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx
parent4a09a67df3721b27bbbb659032eb441c84836d44 (diff)
downloadwallet-core-2b895bea57ae486004d8173354ccd5af52cf042e.tar.xz
new payto form
Diffstat (limited to 'packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx')
-rw-r--r--packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx22
1 files changed, 15 insertions, 7 deletions
diff --git a/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx b/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx
index 9e0830e6e..2c1a13e27 100644
--- a/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx
+++ b/packages/merchant-backoffice-ui/src/paths/instance/accounts/create/index.tsx
@@ -33,7 +33,7 @@ import {
} from "@gnu-taler/taler-util";
import {
BrowserFetchHttpLib,
- useTranslationContext
+ useTranslationContext,
} from "@gnu-taler/web-util/browser";
import { Fragment, VNode, h } from "preact";
import { useState } from "preact/hooks";
@@ -86,10 +86,13 @@ export enum TestRevenueErrorType {
export async function testRevenueAPI(
revenueAPI: URL,
creds: FacadeCredentials | undefined,
-): Promise<OperationOk<void> | OperationFail<HttpStatusCode.NotFound>
-| OperationFail<HttpStatusCode.Unauthorized>
-| OperationFail<HttpStatusCode.BadRequest>
-| TalerError> {
+): Promise<
+ | OperationOk<PaytoString>
+ | OperationFail<HttpStatusCode.NotFound>
+ | OperationFail<HttpStatusCode.Unauthorized>
+ | OperationFail<HttpStatusCode.BadRequest>
+ | TalerError
+> {
const api = new TalerRevenueHttpClient(
revenueAPI.href,
new BrowserFetchHttpLib(),
@@ -113,6 +116,12 @@ export async function testRevenueAPI(
return config;
}
+ const resp = await api.getHistory(auth);
+ if (resp.type === "fail") {
+ return resp;
+ }
+
+ return opFixedSuccess(resp.body.credit_account as PaytoString);
} catch (err) {
if (err instanceof TalerError) {
return err;
@@ -122,7 +131,6 @@ export async function testRevenueAPI(
// detail: err.errorDetail,
// };
}
+ throw err
}
-
- return opFixedSuccess(undefined);
}