commit 25df8c94a431bed94b2325ff8cd4e52176774588
parent 187a4cd7e750fb3d5a6aeb699de3aea83ee956e5
Author: Florian Dold <florian@dold.me>
Date: Fri, 12 Dec 2025 23:11:20 +0100
harness: reproduce p2p aml issue
Diffstat:
2 files changed, 35 insertions(+), 22 deletions(-)
diff --git a/packages/taler-harness/src/integrationtests/test-tops-aml-basic.ts b/packages/taler-harness/src/integrationtests/test-tops-aml-basic.ts
@@ -19,14 +19,11 @@
*/
import {
AccessToken,
- decodeCrock,
encodeCrock,
hashNormalizedPaytoUri,
j2s,
KycStatusLongPollingReason,
Logger,
- OfficerAccount,
- OfficerId,
parsePaytoUriOrThrow,
succeedOrThrow,
TalerExchangeHttpClient,
@@ -52,6 +49,7 @@ export async function runTopsAmlBasicTest(t: GlobalTestState) {
merchantAdminAccessToken,
wireGatewayApi,
bank,
+ officerAcc,
} = await createTopsEnvironment(t);
const challenger = await startFakeChallenger({
@@ -59,6 +57,10 @@ export async function runTopsAmlBasicTest(t: GlobalTestState) {
addressType: "postal-ch",
});
+ const exchangeClient = new TalerExchangeHttpClient(exchange.baseUrl, {
+ httpClient: harnessHttpLib,
+ });
+
// Withdrawal below threshold succeeds!
const wres = await withdrawViaBankV3(t, {
amount: "CHF:20",
@@ -130,10 +132,6 @@ export async function runTopsAmlBasicTest(t: GlobalTestState) {
);
}
- const exchangeClient = new TalerExchangeHttpClient(exchange.baseUrl, {
- httpClient: harnessHttpLib,
- });
-
// Accept ToS
{
const kycInfo = await exchangeClient.checkKycInfo(
@@ -184,11 +182,6 @@ export async function runTopsAmlBasicTest(t: GlobalTestState) {
logger.info(`kyc status after accept-tos: ${j2s(kycStatus)}`);
}
- const officerAcc: OfficerAccount = {
- id: amlKeypair.pub as OfficerId,
- signingKey: decodeCrock(amlKeypair.priv),
- };
-
// Trigger postal registration check
// via AML officer.
{
diff --git a/packages/taler-harness/src/integrationtests/test-tops-peer.ts b/packages/taler-harness/src/integrationtests/test-tops-peer.ts
@@ -22,8 +22,10 @@ import {
AccessToken,
Duration,
j2s,
+ LimitOperationType,
Logger,
succeedOrThrow,
+ TalerExchangeHttpClient,
TransactionMajorState,
TransactionMinorState,
TransactionType,
@@ -39,22 +41,18 @@ const logger = new Logger("test-tops-aml.ts");
export async function runTopsPeerTest(t: GlobalTestState) {
// Set up test environment
- const {
- walletClient,
- bankClient,
- exchange,
- amlKeypair,
- merchant,
- exchangeBankAccount,
- wireGatewayApi,
- exchangeApi,
- } = await createTopsEnvironment(t);
+ const { walletClient, bankClient, exchange, exchangeApi, officerAcc } =
+ await createTopsEnvironment(t);
const challenger = await startFakeChallenger({
port: 6001,
addressType: "postal-ch",
});
+ const exchangeClient = new TalerExchangeHttpClient(exchange.baseUrl, {
+ httpClient: harnessHttpLib,
+ });
+
t.logStep("starting withdrawal");
// Withdrawal below threshold succeeds!
@@ -133,6 +131,9 @@ export async function runTopsPeerTest(t: GlobalTestState) {
},
);
+ const paytoHash = pushCreditTxDet.kycPaytoHash;
+ t.assertTrue(!!paytoHash);
+
const accessToken = pushCreditTxDet.kycAccessToken;
t.assertTrue(typeof accessToken === "string");
@@ -199,6 +200,25 @@ export async function runTopsPeerTest(t: GlobalTestState) {
major: TransactionMajorState.Done,
},
});
+
+ const decisions = succeedOrThrow(
+ await exchangeClient.getAmlDecisions(officerAcc, {
+ active: true,
+ account: paytoHash,
+ }),
+ );
+
+ console.log(`all decisions after withdrawal: ${j2s(decisions)}`);
+
+ const dec = decisions.records[0];
+ t.assertTrue(!!dec);
+
+ t.assertTrue(
+ !!dec.limits.rules.find(
+ (x) => x.operation_type === LimitOperationType.merge,
+ ),
+ "merge rule must exist after KYC for P2P payment",
+ );
}
runTopsPeerTest.suites = ["wallet"];