[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-typescript-core] branch master updated: fix #10031: spa now have
From: |
Admin |
Subject: |
[taler-typescript-core] branch master updated: fix #10031: spa now have a new list kyc-auth |
Date: |
Thu, 12 Jun 2025 16:47:48 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository taler-typescript-core.
The following commit(s) were added to refs/heads/master by this push:
new 5c66655f9 fix #10031: spa now have a new list kyc-auth
5c66655f9 is described below
commit 5c66655f9b95bf9628f18630d135439c88a82b88
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Thu Jun 12 11:47:39 2025 -0300
fix #10031: spa now have a new list kyc-auth
---
packages/aml-backoffice-ui/src/hooks/transfers.ts | 62 +++++++++++++------
packages/aml-backoffice-ui/src/pages/Transfers.tsx | 9 ++-
.../taler-util/src/http-client/exchange-client.ts | 70 +++++++++++++++++++++-
3 files changed, 117 insertions(+), 24 deletions(-)
diff --git a/packages/aml-backoffice-ui/src/hooks/transfers.ts
b/packages/aml-backoffice-ui/src/hooks/transfers.ts
index 7df794927..2a6eb6367 100644
--- a/packages/aml-backoffice-ui/src/hooks/transfers.ts
+++ b/packages/aml-backoffice-ui/src/hooks/transfers.ts
@@ -20,6 +20,7 @@ import {
AmountJson,
OfficerAccount,
OperationOk,
+ PaytoHash,
TalerExchangeResultByMethod2,
TalerHttpError,
} from "@gnu-taler/taler-util";
@@ -80,6 +81,7 @@ export function useTransferDebit() {
);
}
+type Direction = "credit" | "debit" | "kyc-auth";
/**
* @param args
* @returns
@@ -87,7 +89,12 @@ export function useTransferDebit() {
export function useTransferList({
direction,
threshold,
-}: { direction?: "credit" | "debit"; threshold?: AmountJson } = {}) {
+ account
+}: {
+ direction?: "credit" | "debit" | "kyc-auth";
+ threshold?: AmountJson;
+ account?: PaytoHash
+} = {}) {
const officer = useOfficer();
const session = officer.state === "ready" ? officer.account : undefined;
const {
@@ -95,28 +102,40 @@ export function useTransferList({
} = useExchangeApiContext();
const [offset, setOffset] = useState<string>();
- const isDebit = "debit" === direction;
- async function fetcher([officer, offset, isDebit, threshold]: [
+ async function fetcher([officer, offset, direction, threshold, account]: [
OfficerAccount,
string,
- boolean,
+ Direction,
AmountJson | undefined,
+ PaytoHash | undefined
]) {
- if (isDebit) {
- return await api.getTransfersDebit(officer, {
- order: "dec",
- offset,
- limit: PAGINATED_LIST_REQUEST,
- threshold,
- });
+ switch (direction) {
+ case "credit": {
+ return await api.getTransfersCredit(officer, {
+ order: "dec",
+ offset,
+ limit: PAGINATED_LIST_REQUEST,
+ threshold,
+ });
+ }
+ case "debit": {
+ return await api.getTransfersDebit(officer, {
+ order: "dec",
+ offset,
+ limit: PAGINATED_LIST_REQUEST,
+ threshold,
+ });
+ }
+ case "kyc-auth": {
+ return await api.getTransfersKycAuth(officer, {
+ order: "dec",
+ offset,
+ limit: PAGINATED_LIST_REQUEST,
+ threshold,
+ });
+ }
}
- return await api.getTransfersCredit(officer, {
- order: "dec",
- offset,
- limit: PAGINATED_LIST_REQUEST,
- threshold,
- });
}
const { data, error } = useSWR<
@@ -125,7 +144,14 @@ export function useTransferList({
>(
!session
? undefined
- : [session, offset, isDebit, threshold, "getTransfersCredit"],
+ : [
+ session,
+ offset,
+ direction ?? "debit",
+ threshold,
+ account,
+ "getTransfers",
+ ],
fetcher,
);
diff --git a/packages/aml-backoffice-ui/src/pages/Transfers.tsx
b/packages/aml-backoffice-ui/src/pages/Transfers.tsx
index a7770e364..0d7f79d9f 100644
--- a/packages/aml-backoffice-ui/src/pages/Transfers.tsx
+++ b/packages/aml-backoffice-ui/src/pages/Transfers.tsx
@@ -35,7 +35,7 @@ export function Transfers({
const { config } = useExchangeApiContext();
type FormType = {
- direction: "credit" | "debit";
+ direction: "credit" | "debit" | "kyc-auth";
threshold: AmountJson;
};
const design: FormDesign = {
@@ -54,6 +54,10 @@ export function Transfers({
label: i18n.str`Debit`,
value: "debit",
},
+ {
+ label: i18n.str`KYC Auth`,
+ value: "kyc-auth",
+ },
],
},
{
@@ -73,8 +77,7 @@ export function Transfers({
);
const direction = form.status.result.direction as
- | "credit"
- | "debit"
+ | FormType["direction"]
| undefined;
const threshold = form.status.result.threshold;
diff --git a/packages/taler-util/src/http-client/exchange-client.ts
b/packages/taler-util/src/http-client/exchange-client.ts
index 84c50d31f..93363dc7e 100644
--- a/packages/taler-util/src/http-client/exchange-client.ts
+++ b/packages/taler-util/src/http-client/exchange-client.ts
@@ -46,6 +46,7 @@ import {
LongPollParams,
OfficerAccount,
PaginationParams,
+ PaytoHash,
codecForTalerCommonConfigResponse,
} from "../types-taler-common.js";
import {
@@ -1008,7 +1009,7 @@ export class TalerExchangeHttpClient {
async getAmlDecisions(
auth: OfficerAccount,
params: PaginationParams & {
- account?: string;
+ account?: PaytoHash;
active?: boolean;
investigation?: boolean;
} = {},
@@ -1153,7 +1154,10 @@ export class TalerExchangeHttpClient {
*/
async getTransfersCredit(
auth: OfficerAccount,
- params: PaginationParams & { threshold?: AmountJson } = {},
+ params: PaginationParams & {
+ threshold?: AmountJson;
+ account?: PaytoHash;
+ } = {},
): Promise<
| OperationOk<ExchangeTransferList>
| OperationFail<
@@ -1169,6 +1173,9 @@ export class TalerExchangeHttpClient {
if (params.threshold) {
url.searchParams.set("threshold", Amounts.stringify(params.threshold));
}
+ if (params.account) {
+ url.searchParams.set("h_payto", Amounts.stringify(params.account));
+ }
const resp = await this.fetch(url, {
headers: {
@@ -1198,7 +1205,10 @@ export class TalerExchangeHttpClient {
*/
async getTransfersDebit(
auth: OfficerAccount,
- params: PaginationParams & { threshold?: AmountJson } = {},
+ params: PaginationParams & {
+ threshold?: AmountJson;
+ account?: PaytoHash;
+ } = {},
): Promise<
| OperationOk<ExchangeTransferList>
| OperationFail<
@@ -1214,6 +1224,60 @@ export class TalerExchangeHttpClient {
if (params.threshold) {
url.searchParams.set("threshold", Amounts.stringify(params.threshold));
}
+ if (params.account) {
+ url.searchParams.set("h_payto", Amounts.stringify(params.account));
+ }
+
+ const resp = await this.fetch(url, {
+ headers: {
+ "Taler-AML-Officer-Signature": encodeCrock(
+ signAmlQuery(auth.signingKey),
+ ),
+ },
+ });
+
+ switch (resp.status) {
+ case HttpStatusCode.Ok:
+ return opSuccessFromHttp(resp, codecForExchangeTransferList());
+ case HttpStatusCode.NoContent:
+ return opFixedSuccess({ transfers: [] });
+ case HttpStatusCode.Forbidden:
+ case HttpStatusCode.NotFound:
+ case HttpStatusCode.Conflict:
+ return opKnownHttpFailure(resp.status, resp);
+ default:
+ return opUnknownHttpFailure(resp);
+ }
+ }
+
+ /**
+ *
https://docs.taler.net/core/api-exchange.html#get--aml-$OFFICER_PUB-transfers-kycauth
+ *
+ */
+ async getTransfersKycAuth(
+ auth: OfficerAccount,
+ params: PaginationParams & {
+ threshold?: AmountJson;
+ account?: PaytoHash;
+ } = {},
+ ): Promise<
+ | OperationOk<ExchangeTransferList>
+ | OperationFail<
+ | HttpStatusCode.Forbidden
+ | HttpStatusCode.NotFound
+ | HttpStatusCode.Conflict
+ >
+ > {
+ const url = new URL(`aml/${auth.id}/transfers-kycauth`, this.baseUrl);
+
+ addPaginationParams(url, params);
+
+ if (params.threshold) {
+ url.searchParams.set("threshold", Amounts.stringify(params.threshold));
+ }
+ if (params.account) {
+ url.searchParams.set("h_payto", Amounts.stringify(params.account));
+ }
const resp = await this.fetch(url, {
headers: {
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-typescript-core] branch master updated: fix #10031: spa now have a new list kyc-auth,
Admin <=