commit aea675863a48d9bacca475820959cc5ec9ce3b95
parent bd2fb32791bf8a726b0b1c2c4a5cce5a20552cab
Author: Florian Dold <florian@dold.me>
Date: Thu, 12 Mar 2026 23:18:28 +0100
harness: fix amount, be more liberal about kyc-check response
Diffstat:
3 files changed, 73 insertions(+), 33 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-exchange-kyc-auth.ts b/packages/taler-harness/src/integrationtests/test-exchange-kyc-auth.ts
@@ -187,7 +187,13 @@ export async function runExchangeKycAuthTest(t: GlobalTestState) {
});
console.log(j2s(checkResp1));
- t.assertTrue(checkResp1.type === "ok");
+ switch (checkResp1.case) {
+ case "ok":
+ case HttpStatusCode.Accepted:
+ break;
+ default:
+ t.fail();
+ }
}
const reservePair2 = createEddsaKeyPair();
@@ -254,7 +260,13 @@ export async function runExchangeKycAuthTest(t: GlobalTestState) {
console.log(j2s(checkResp));
- t.assertDeepEqual(checkResp.case, HttpStatusCode.Accepted);
+ switch (checkResp.case) {
+ case "ok":
+ case HttpStatusCode.Accepted:
+ break;
+ default:
+ t.fail();
+ }
}
// Now, kyc auth must work with explicit account key and both reserve pubs!
@@ -272,7 +284,13 @@ export async function runExchangeKycAuthTest(t: GlobalTestState) {
console.log(j2s(checkResp));
- t.assertDeepEqual(checkResp.case, HttpStatusCode.Accepted);
+ switch (checkResp.case) {
+ case "ok":
+ case HttpStatusCode.Accepted:
+ break;
+ default:
+ t.fail();
+ }
}
{
@@ -288,7 +306,13 @@ export async function runExchangeKycAuthTest(t: GlobalTestState) {
console.log(j2s(checkResp));
- t.assertDeepEqual(checkResp.case, HttpStatusCode.Accepted);
+ switch (checkResp.case) {
+ case "ok":
+ case HttpStatusCode.Accepted:
+ break;
+ default:
+ t.fail();
+ }
}
{
@@ -304,7 +328,13 @@ export async function runExchangeKycAuthTest(t: GlobalTestState) {
console.log(j2s(checkResp));
- t.assertDeepEqual(checkResp.case, HttpStatusCode.Accepted);
+ switch (checkResp.case) {
+ case "ok":
+ case HttpStatusCode.Accepted:
+ break;
+ default:
+ t.fail();
+ }
}
await postAmlDecisionNoRules(t, {
diff --git a/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts b/packages/taler-harness/src/integrationtests/test-wallet-wirefees.ts
@@ -122,23 +122,27 @@ export async function runWalletWirefeesTest(t: GlobalTestState) {
await merchant.start();
await merchant.pingUntilAvailable();
- const { accessToken: adminAccessToken } = await merchant.addInstanceWithWireAccount({
- id: "admin",
- name: "Default Instance",
- paytoUris: [getTestHarnessPaytoForLabel("merchant-default")],
- defaultWireTransferDelay: Duration.toTalerProtocolDuration(
- Duration.fromSpec({ minutes: 1 }),
- ),
- });
-
- await merchant.addInstanceWithWireAccount({
- id: "minst1",
- name: "minst1",
- paytoUris: [getTestHarnessPaytoForLabel("minst1")],
- defaultWireTransferDelay: Duration.toTalerProtocolDuration(
- Duration.fromSpec({ minutes: 1 }),
- ),
- }, { adminAccessToken });
+ const { accessToken: adminAccessToken } =
+ await merchant.addInstanceWithWireAccount({
+ id: "admin",
+ name: "Default Instance",
+ paytoUris: [getTestHarnessPaytoForLabel("merchant-default")],
+ defaultWireTransferDelay: Duration.toTalerProtocolDuration(
+ Duration.fromSpec({ minutes: 1 }),
+ ),
+ });
+
+ await merchant.addInstanceWithWireAccount(
+ {
+ id: "minst1",
+ name: "minst1",
+ paytoUris: [getTestHarnessPaytoForLabel("minst1")],
+ defaultWireTransferDelay: Duration.toTalerProtocolDuration(
+ Duration.fromSpec({ minutes: 1 }),
+ ),
+ },
+ { adminAccessToken },
+ );
const { walletClient, walletService } = await createWalletDaemonWithClient(
t,
@@ -177,7 +181,10 @@ export async function runWalletWirefeesTest(t: GlobalTestState) {
);
let orderStatus = succeedOrThrow(
- await merchantClient.getOrderDetails(merchantAdminAccessToken, orderResp.order_id),
+ await merchantClient.getOrderDetails(
+ merchantAdminAccessToken,
+ orderResp.order_id,
+ ),
);
t.assertTrue(orderStatus.order_status === "unpaid");
@@ -197,7 +204,7 @@ export async function runWalletWirefeesTest(t: GlobalTestState) {
console.log(`amountEffective: ${preparePayResult.amountEffective}`);
- t.assertAmountEquals(preparePayResult.amountEffective, "TESTKUDOS:6.4");
+ t.assertAmountEquals(preparePayResult.amountEffective, "TESTKUDOS:6.12");
await walletClient.call(WalletApiOperation.ConfirmPay, {
transactionId: preparePayResult.transactionId,
diff --git a/packages/taler-util/src/http-client/exchange-client.ts b/packages/taler-util/src/http-client/exchange-client.ts
@@ -659,12 +659,14 @@ export class TalerExchangeHttpClient {
longpoll?: boolean;
awaitAuth?: boolean;
}): Promise<
- | OperationOk<void>
- | OperationAlternative<HttpStatusCode.Ok, AccountKycStatus>
+ | OperationOk<AccountKycStatus>
| OperationAlternative<HttpStatusCode.Accepted, AccountKycStatus>
- | OperationFail<HttpStatusCode.Forbidden>
- | OperationFail<HttpStatusCode.NotFound>
- | OperationFail<HttpStatusCode.Conflict>
+ | OperationAlternative<HttpStatusCode.NoContent, void>
+ | OperationFail<
+ | HttpStatusCode.Forbidden
+ | HttpStatusCode.NotFound
+ | HttpStatusCode.Conflict
+ >
> {
const { paytoHash, accountSig, longpoll, awaitAuth } = args;
const url = new URL(`kyc-check/${paytoHash}`, this.baseUrl);
@@ -683,15 +685,16 @@ export class TalerExchangeHttpClient {
);
switch (resp.status) {
- case HttpStatusCode.Ok:
- case HttpStatusCode.Accepted:
+ case HttpStatusCode.Ok: // means there are voluntary checks
+ return opSuccessFromHttp(resp, codecForAccountKycStatus());
+ case HttpStatusCode.Accepted: // means there are required checks
return opKnownAlternativeHttpFailure(
resp,
resp.status,
codecForAccountKycStatus(),
);
- case HttpStatusCode.NoContent:
- return opEmptySuccess();
+ case HttpStatusCode.NoContent: // no checks can be done
+ return opKnownFailureWithBody(resp.status, undefined);
case HttpStatusCode.Forbidden:
case HttpStatusCode.NotFound:
case HttpStatusCode.Conflict: