commit 63ee75405649671ba35483d54bdbc12cdd9a4b40
parent d495a1b4103735520e113d8e7f4c4de08bf7ce20
Author: Florian Dold <florian@dold.me>
Date: Tue, 12 May 2026 13:56:36 +0200
harness: fix assumption in kyc-fail-recover-simple test
When an AML program fails, the fallback measure is taken. We do not
allow retries in that case.
Diffstat:
1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-kyc-fail-recover-simple.ts b/packages/taler-harness/src/integrationtests/test-kyc-fail-recover-simple.ts
@@ -33,9 +33,8 @@ import {
Logger,
TalerKycAml,
TalerSignaturePurpose,
- WalletKycRequest
+ WalletKycRequest,
} from "@gnu-taler/taler-util";
-import { execSync } from "node:child_process";
import {
configureCommonKyc,
createKycTestkudosEnvironmentFull,
@@ -44,19 +43,15 @@ import { GlobalTestState } from "../harness/harness.js";
const logger = new Logger(`test-kyc-merchant-fail-recover.ts`);
+const specialFailName = "exit-fail";
+
export const AML_PROGRAM_FAIL_RECOVER: TalerKycAml.AmlProgramDefinition = {
name: "FAIL_RECOVER",
logic: async (input, config) => {
logger.info("INPUT", input);
- if (input?.attributes?.NAME === "trow-error") {
- throw Error("i was asked to fail");
- }
- if (input?.attributes?.NAME === "exit-fail") {
+ if (input?.attributes?.NAME === specialFailName) {
process.exit(1);
}
- if (input?.attributes?.NAME === "child-fail") {
- execSync("something-that-doesnt-exists make-this-fail");
- }
const outcome: TalerKycAml.AmlOutcome = {
to_investigate: false,
@@ -161,7 +156,7 @@ export async function runKycFailRecoverSimpleTest(t: GlobalTestState) {
kycPaytoHash = clientInfo.h_payto;
}
- logger.info("step 2) Get account access token");
+ logger.info("get account access token");
{
const sigBlob = buildSigPS(TalerSignaturePurpose.KYC_AUTH).build();
const accountPriv = encodeCrock(eddsaSign(sigBlob, account.signingKey));
@@ -179,7 +174,7 @@ export async function runKycFailRecoverSimpleTest(t: GlobalTestState) {
accessToken = clientInfo.access_token;
}
- logger.info("step 3) Check KYC info, should be waiting for the first form");
+ t.logStep("check KYC info, should be waiting for the first form");
{
const infoResp = await exchangeApi.checkKycInfo(accessToken);
t.assertTrue(infoResp.type === "ok");
@@ -192,11 +187,11 @@ export async function runKycFailRecoverSimpleTest(t: GlobalTestState) {
latestFormId = clientInfo.requirements[0].id;
}
- logger.info("step 4) Complete form expecting to fail");
{
+ t.logStep("complete form expecting to fail");
const infoResp = await exchangeApi.uploadKycForm(latestFormId, {
- FORM_ID: "test",
- NAME: "child-fail",
+ FORM_ID: "firstform",
+ NAME: specialFailName,
FORM_VERSION: 1,
} as ExchangeKycUploadFormRequest);
@@ -206,23 +201,8 @@ export async function runKycFailRecoverSimpleTest(t: GlobalTestState) {
);
}
- logger.info("step 5) Complete form expecting but this time it should work");
{
- const infoResp = await exchangeApi.uploadKycForm(latestFormId, {
- FORM_ID: "test",
- NAME: "just-kidding",
- FORM_VERSION: 1,
- } as ExchangeKycUploadFormRequest);
-
- logger.info(`kyc-upload response: ${j2s(infoResp)}`);
-
- t.assertTrue(infoResp.type === "ok");
- }
-
- {
- logger.info(
- "step 6) Check KYC info again after some time, here the exchange fails",
- );
+ t.logStep("check KYC info again");
const infoResp = await exchangeApi.checkKycInfo(accessToken);
t.assertTrue(infoResp.type === "ok");
const clientInfo = infoResp.body;