[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 02/02: harness: adjust tests to new kyc config const
From: |
gnunet |
Subject: |
[taler-wallet-core] 02/02: harness: adjust tests to new kyc config constraints (continued) |
Date: |
Wed, 08 Jan 2025 17:41:31 +0100 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
commit 04163a5dec5206455511e74ac5c0c7c1b8ef8b13
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Jan 8 17:41:26 2025 +0100
harness: adjust tests to new kyc config constraints (continued)
---
.../test-kyc-deposit-deposit-kyctransfer.ts | 203 ++--------------
.../integrationtests/test-kyc-deposit-deposit.ts | 12 +-
.../integrationtests/test-kyc-exchange-wallet.ts | 188 +++------------
.../integrationtests/test-kyc-form-withdrawal.ts | 241 +++++--------------
.../test-kyc-merchant-activate-bank-account.ts | 1 +
.../test-kyc-merchant-aggregate.ts | 12 +-
.../integrationtests/test-kyc-merchant-deposit.ts | 7 +-
.../src/integrationtests/test-kyc-new-measure.ts | 265 +++++----------------
.../src/integrationtests/test-kyc-peer-pull.ts | 207 ++--------------
.../src/integrationtests/test-kyc-peer-push.ts | 207 ++--------------
.../integrationtests/test-kyc-skip-expiration.ts | 13 +-
11 files changed, 241 insertions(+), 1115 deletions(-)
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-deposit-deposit-kyctransfer.ts
b/packages/taler-harness/src/integrationtests/test-kyc-deposit-deposit-kyctransfer.ts
index 378b235b6..c6d7f59ff 100644
---
a/packages/taler-harness/src/integrationtests/test-kyc-deposit-deposit-kyctransfer.ts
+++
b/packages/taler-harness/src/integrationtests/test-kyc-deposit-deposit-kyctransfer.ts
@@ -18,201 +18,46 @@
* Imports.
*/
import {
+ Configuration,
Logger,
parsePaytoUri,
- TalerCorebankApiClient,
TransactionMajorState,
TransactionMinorState,
TransactionType,
WireGatewayApiClient,
} from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
- createSyncCryptoApi,
- EddsaKeyPairStrings,
- WalletApiOperation,
-} from "@gnu-taler/taler-wallet-core";
-import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
+ configureCommonKyc,
+ createKycTestkudosEnvironment,
+ postAmlDecisionNoRules,
+ withdrawViaBankV3,
+} from "../harness/environments.js";
import {
- BankService,
- DbInfo,
- ExchangeService,
getTestHarnessPaytoForLabel,
GlobalTestState,
- HarnessExchangeBankAccount,
- setupDb,
- WalletClient,
- WalletService,
} from "../harness/harness.js";
-import {
- EnvOptions,
- postAmlDecisionNoRules,
- withdrawViaBankV3,
-} from "../harness/environments.js";
const logger = new Logger("test-kyc-deposit-deposit.ts");
-interface KycTestEnv {
- commonDb: DbInfo;
- bankClient: TalerCorebankApiClient;
- exchange: ExchangeService;
- exchangeBankAccount: HarnessExchangeBankAccount;
- walletClient: WalletClient;
- walletService: WalletService;
- amlKeypair: EddsaKeyPairStrings;
-}
-
-async function createKycTestkudosEnvironment(
- t: GlobalTestState,
- coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")),
- opts: EnvOptions = {},
-): Promise<KycTestEnv> {
- const db = await setupDb(t);
-
- const bank = await BankService.create(t, {
- allowRegistrations: true,
- currency: "TESTKUDOS",
- database: db.connStr,
- httpPort: 8082,
- });
-
- const exchange = ExchangeService.create(t, {
- name: "testexchange-1",
- currency: "TESTKUDOS",
- httpPort: 8081,
- database: db.connStr,
- });
-
- let receiverName = "Exchange";
- let exchangeBankUsername = "exchange";
- let exchangeBankPassword = "mypw-password";
- let exchangePaytoUri = getTestHarnessPaytoForLabel(exchangeBankUsername);
-
- const wireGatewayApiBaseUrl = new URL(
- `accounts/${exchangeBankUsername}/taler-wire-gateway/`,
- bank.corebankApiBaseUrl,
- ).href;
-
- await exchange.addBankAccount("1", {
- accountName: exchangeBankUsername,
- accountPassword: exchangeBankPassword,
- wireGatewayApiBaseUrl,
- accountPaytoUri: exchangePaytoUri,
- });
-
- bank.setSuggestedExchange(exchange, exchangePaytoUri);
-
- await bank.start();
-
- await bank.pingUntilAvailable();
-
- const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, {
- auth: {
- username: "admin",
- password: "admin-password",
- },
- });
-
- await bankClient.registerAccountExtended({
- name: receiverName,
- password: exchangeBankPassword,
- username: exchangeBankUsername,
- is_taler_exchange: true,
- payto_uri: exchangePaytoUri,
- });
-
- const ageMaskSpec = opts.ageMaskSpec;
-
- if (ageMaskSpec) {
- exchange.enableAgeRestrictions(ageMaskSpec);
- // Enable age restriction for all coins.
- exchange.addCoinConfigList(
- coinConfig.map((x) => ({
- ...x,
- name: `${x.name}-age`,
- ageRestricted: true,
- })),
- );
- // For mixed age restrictions, we also offer coins without age restrictions
- if (opts.mixedAgeRestriction) {
- exchange.addCoinConfigList(
- coinConfig.map((x) => ({ ...x, ageRestricted: false })),
- );
- }
- } else {
- exchange.addCoinConfigList(coinConfig);
- }
+function adjustExchangeConfig(config: Configuration) {
+ configureCommonKyc(config);
- await exchange.modifyConfig(async (config) => {
- config.setString("exchange", "enable_kyc", "yes");
-
- config.setString("KYC-RULE-R1", "operation_type", "deposit");
- config.setString("KYC-RULE-R1", "enabled", "yes");
- config.setString("KYC-RULE-R1", "exposed", "yes");
- config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
- config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
- config.setString("KYC-RULE-R1", "timeframe", "1d");
- config.setString("KYC-RULE-R1", "next_measures", "M1");
-
- config.setString("KYC-MEASURE-M1", "check_name", "C1");
- config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("AML-PROGRAM-P1", "command", "/bin/true");
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString("AML-PROGRAM-P1", "description", "this does nothing");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
-
- config.setString("KYC-CHECK-C1", "type", "INFO");
- config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
- });
-
- await exchange.start();
-
- const cryptoApi = createSyncCryptoApi();
- const amlKeypair = await cryptoApi.createEddsaKeypair({});
-
- await exchange.enableAmlAccount(amlKeypair.pub, "Alice");
-
- const walletService = new WalletService(t, {
- name: "wallet",
- useInMemoryDb: true,
- });
- await walletService.start();
- await walletService.pingUntilAvailable();
-
- const walletClient = new WalletClient({
- name: "wallet",
- unixPath: walletService.socketPath,
- onNotification(n) {
- console.log("got notification", n);
- },
- });
- await walletClient.connect();
- await walletClient.client.call(WalletApiOperation.InitWallet, {
- config: {
- testing: {
- skipDefaults: true,
- },
- },
- });
+ config.setString("KYC-RULE-R1", "operation_type", "deposit");
+ config.setString("KYC-RULE-R1", "enabled", "yes");
+ config.setString("KYC-RULE-R1", "exposed", "yes");
+ config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
+ config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
+ config.setString("KYC-RULE-R1", "timeframe", "1d");
+ config.setString("KYC-RULE-R1", "next_measures", "M1");
- console.log("setup done!");
+ config.setString("KYC-MEASURE-M1", "check_name", "C1");
+ config.setString("KYC-MEASURE-M1", "context", "{}");
+ config.setString("KYC-MEASURE-M1", "program", "NONE");
- return {
- commonDb: db,
- exchange,
- amlKeypair,
- walletClient,
- walletService,
- bankClient,
- exchangeBankAccount: {
- accountName: exchangeBankUsername,
- accountPassword: exchangeBankPassword,
- accountPaytoUri: exchangePaytoUri,
- wireGatewayApiBaseUrl,
- },
- };
+ config.setString("KYC-CHECK-C1", "type", "INFO");
+ config.setString("KYC-CHECK-C1", "description", "my check!");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
}
export async function runKycDepositDepositKyctransferTest(t: GlobalTestState) {
@@ -224,7 +69,9 @@ export async function runKycDepositDepositKyctransferTest(t:
GlobalTestState) {
exchange,
amlKeypair,
exchangeBankAccount,
- } = await createKycTestkudosEnvironment(t);
+ } = await createKycTestkudosEnvironment(t, {
+ adjustExchangeConfig,
+ });
// Withdraw digital cash into the wallet.
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-deposit-deposit.ts
b/packages/taler-harness/src/integrationtests/test-kyc-deposit-deposit.ts
index bd3ea294c..f88ecba67 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-deposit-deposit.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-deposit-deposit.ts
@@ -25,6 +25,7 @@ import {
} from "@gnu-taler/taler-util";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
+ configureCommonKyc,
createKycTestkudosEnvironment,
postAmlDecisionNoRules,
withdrawViaBankV3,
@@ -34,7 +35,7 @@ import { GlobalTestState } from "../harness/harness.js";
const logger = new Logger("test-kyc-deposit-deposit.ts");
function adjustExchangeConfig(config: Configuration) {
- config.setString("exchange", "enable_kyc", "yes");
+ configureCommonKyc(config);
config.setString("KYC-RULE-R1", "operation_type", "deposit");
config.setString("KYC-RULE-R1", "enabled", "yes");
@@ -46,16 +47,11 @@ function adjustExchangeConfig(config: Configuration) {
config.setString("KYC-MEASURE-M1", "check_name", "C1");
config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("AML-PROGRAM-P1", "command", "/bin/true");
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString("AML-PROGRAM-P1", "description", "this does nothing");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
+ config.setString("KYC-MEASURE-M1", "program", "NONE");
config.setString("KYC-CHECK-C1", "type", "INFO");
config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
}
export async function runKycDepositDepositTest(t: GlobalTestState) {
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-exchange-wallet.ts
b/packages/taler-harness/src/integrationtests/test-kyc-exchange-wallet.ts
index a56d82a51..113c88a28 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-exchange-wallet.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-exchange-wallet.ts
@@ -22,174 +22,40 @@ import {
ExchangeWalletKycStatus,
hashFullPaytoUri,
j2s,
- TalerCorebankApiClient,
} from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
- createSyncCryptoApi,
- EddsaKeyPairStrings,
- WalletApiOperation,
-} from "@gnu-taler/taler-wallet-core";
-import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
-import { EnvOptions, postAmlDecisionNoRules } from
"../harness/environments.js";
-import {
- BankService,
- DbInfo,
- ExchangeService,
- getTestHarnessPaytoForLabel,
- GlobalTestState,
- HarnessExchangeBankAccount,
- setupDb,
- WalletClient,
- WalletService,
-} from "../harness/harness.js";
-
-interface KycTestEnv {
- commonDb: DbInfo;
- bankClient: TalerCorebankApiClient;
- exchange: ExchangeService;
- exchangeBankAccount: HarnessExchangeBankAccount;
- walletClient: WalletClient;
- walletService: WalletService;
- amlKeypair: EddsaKeyPairStrings;
-}
-
-async function createKycTestkudosEnvironment(
- t: GlobalTestState,
- coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")),
- opts: EnvOptions = {},
-): Promise<KycTestEnv> {
- const db = await setupDb(t);
-
- const bank = await BankService.create(t, {
- allowRegistrations: true,
- currency: "TESTKUDOS",
- database: db.connStr,
- httpPort: 8082,
- });
-
- const exchange = ExchangeService.create(t, {
- name: "testexchange-1",
- currency: "TESTKUDOS",
- httpPort: 8081,
- database: db.connStr,
- });
-
- let receiverName = "Exchange";
- let exchangeBankUsername = "exchange";
- let exchangeBankPassword = "mypw-password";
- let exchangePaytoUri = getTestHarnessPaytoForLabel(exchangeBankUsername);
-
- await exchange.addBankAccount("1", {
- accountName: exchangeBankUsername,
- accountPassword: exchangeBankPassword,
- wireGatewayApiBaseUrl: new URL(
- "accounts/exchange/taler-wire-gateway/",
- bank.baseUrl,
- ).href,
- accountPaytoUri: exchangePaytoUri,
- });
-
- bank.setSuggestedExchange(exchange, exchangePaytoUri);
-
- await bank.start();
-
- await bank.pingUntilAvailable();
-
- const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, {
- auth: {
- username: "admin",
- password: "admin-password",
- },
- });
-
- await bankClient.registerAccountExtended({
- name: receiverName,
- password: exchangeBankPassword,
- username: exchangeBankUsername,
- is_taler_exchange: true,
- payto_uri: exchangePaytoUri,
- });
-
- exchange.addCoinConfigList(coinConfig);
-
- await exchange.modifyConfig(async (config) => {
- config.setString("exchange", "enable_kyc", "yes");
-
- config.setString("KYC-RULE-R1", "operation_type", "balance");
- config.setString("KYC-RULE-R1", "enabled", "yes");
- config.setString("KYC-RULE-R1", "exposed", "yes");
- config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
- config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
- config.setString("KYC-RULE-R1", "timeframe", "forever");
- config.setString("KYC-RULE-R1", "next_measures", "M1");
-
- config.setString("KYC-MEASURE-M1", "check_name", "C1");
- config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("AML-PROGRAM-P1", "command", "/bin/true");
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString("AML-PROGRAM-P1", "description", "this does nothing");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
-
- config.setString("KYC-CHECK-C1", "type", "INFO");
- config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
- });
-
- await exchange.start();
-
- const cryptoApi = createSyncCryptoApi();
- const amlKeypair = await cryptoApi.createEddsaKeypair({});
-
- await exchange.enableAmlAccount(amlKeypair.pub, "Alice");
-
- const walletService = new WalletService(t, {
- name: "wallet",
- useInMemoryDb: true,
- });
- await walletService.start();
- await walletService.pingUntilAvailable();
-
- const walletClient = new WalletClient({
- name: "wallet",
- unixPath: walletService.socketPath,
- onNotification(n) {
- console.log("got notification", n);
- },
- });
- await walletClient.connect();
- await walletClient.client.call(WalletApiOperation.InitWallet, {
- config: {
- testing: {
- skipDefaults: true,
- },
- },
- });
-
- console.log("setup done!");
-
- return {
- commonDb: db,
- exchange,
- walletClient,
- walletService,
- bankClient,
- exchangeBankAccount: {
- accountName: "",
- accountPassword: "",
- accountPaytoUri: "",
- wireGatewayApiBaseUrl: "",
- },
- amlKeypair,
- };
-}
+ configureCommonKyc,
+ createKycTestkudosEnvironment,
+ postAmlDecisionNoRules,
+} from "../harness/environments.js";
+import { GlobalTestState } from "../harness/harness.js";
export async function runKycExchangeWalletTest(t: GlobalTestState) {
// Set up test environment
const { walletClient, exchange, amlKeypair } =
- await createKycTestkudosEnvironment(t);
+ await createKycTestkudosEnvironment(t, {
+ adjustExchangeConfig(config) {
+ configureCommonKyc(config);
+
+ config.setString("KYC-RULE-R1", "operation_type", "balance");
+ config.setString("KYC-RULE-R1", "enabled", "yes");
+ config.setString("KYC-RULE-R1", "exposed", "yes");
+ config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
+ config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
+ config.setString("KYC-RULE-R1", "timeframe", "forever");
+ config.setString("KYC-RULE-R1", "next_measures", "M1");
+
+ config.setString("KYC-MEASURE-M1", "check_name", "C1");
+ config.setString("KYC-MEASURE-M1", "context", "{}");
+ config.setString("KYC-MEASURE-M1", "program", "NONE");
+
+ config.setString("KYC-CHECK-C1", "type", "INFO");
+ config.setString("KYC-CHECK-C1", "description", "my check!");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
+ },
+ });
await walletClient.call(WalletApiOperation.AddExchange, {
exchangeBaseUrl: exchange.baseUrl,
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-form-withdrawal.ts
b/packages/taler-harness/src/integrationtests/test-kyc-form-withdrawal.ts
index 35718dc04..4e36883ae 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-form-withdrawal.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-form-withdrawal.ts
@@ -20,210 +20,75 @@
import {
codecForAny,
codecForKycProcessClientInformation,
+ Configuration,
decodeCrock,
encodeCrock,
j2s,
signAmlQuery,
- TalerCorebankApiClient,
TransactionIdStr,
TransactionMajorState,
TransactionMinorState,
} from "@gnu-taler/taler-util";
import { readResponseJsonOrThrow } from "@gnu-taler/taler-util/http";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
- createSyncCryptoApi,
- EddsaKeyPairStrings,
- WalletApiOperation,
-} from "@gnu-taler/taler-wallet-core";
-import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
-import {
- BankService,
- DbInfo,
- ExchangeService,
- getTestHarnessPaytoForLabel,
- GlobalTestState,
- HarnessExchangeBankAccount,
- harnessHttpLib,
- setupDb,
- WalletClient,
- WalletService,
-} from "../harness/harness.js";
-import { EnvOptions, withdrawViaBankV3 } from "../harness/environments.js";
-
-interface KycTestEnv {
- commonDb: DbInfo;
- bankClient: TalerCorebankApiClient;
- exchange: ExchangeService;
- exchangeBankAccount: HarnessExchangeBankAccount;
- walletClient: WalletClient;
- walletService: WalletService;
- amlKeypair: EddsaKeyPairStrings;
-}
-
-async function createKycTestkudosEnvironment(
- t: GlobalTestState,
- coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")),
- opts: EnvOptions = {},
-): Promise<KycTestEnv> {
- const db = await setupDb(t);
-
- const bank = await BankService.create(t, {
- allowRegistrations: true,
- currency: "TESTKUDOS",
- database: db.connStr,
- httpPort: 8082,
- });
-
- const exchange = ExchangeService.create(t, {
- name: "testexchange-1",
- currency: "TESTKUDOS",
- httpPort: 8081,
- database: db.connStr,
- });
-
- let receiverName = "Exchange";
- let exchangeBankUsername = "exchange";
- let exchangeBankPassword = "mypw-password";
- let exchangePaytoUri = getTestHarnessPaytoForLabel(exchangeBankUsername);
-
- await exchange.addBankAccount("1", {
- accountName: exchangeBankUsername,
- accountPassword: exchangeBankPassword,
- wireGatewayApiBaseUrl: new URL(
- "accounts/exchange/taler-wire-gateway/",
- bank.baseUrl,
- ).href,
- accountPaytoUri: exchangePaytoUri,
- });
-
- bank.setSuggestedExchange(exchange, exchangePaytoUri);
-
- await bank.start();
-
- await bank.pingUntilAvailable();
-
- const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, {
- auth: {
- username: "admin",
- password: "admin-password",
- },
- });
-
- await bankClient.registerAccountExtended({
- name: receiverName,
- password: exchangeBankPassword,
- username: exchangeBankUsername,
- is_taler_exchange: true,
- payto_uri: exchangePaytoUri,
- });
-
- exchange.addCoinConfigList(coinConfig);
-
- await exchange.modifyConfig(async (config) => {
- config.setString("exchange", "enable_kyc", "yes");
-
- config.setString("KYC-RULE-R1", "operation_type", "withdraw");
- config.setString("KYC-RULE-R1", "enabled", "yes");
- config.setString("KYC-RULE-R1", "exposed", "yes");
- config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
- config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
- config.setString("KYC-RULE-R1", "timeframe", "1d");
- config.setString("KYC-RULE-R1", "next_measures", "M1 M2");
-
- config.setString("KYC-MEASURE-M1", "check_name", "C1");
- config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("KYC-MEASURE-M2", "check_name", "C2");
- config.setString("KYC-MEASURE-M2", "context", "{}");
- config.setString("KYC-MEASURE-M2", "program", "P2");
-
- config.setString(
- "AML-PROGRAM-P1",
- "command",
- "taler-exchange-helper-measure-test-form",
- );
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString(
- "AML-PROGRAM-P1",
- "description",
- "test for full_name and birthdate",
- );
- config.setString("AML-PROGRAM-P1", "description_i18n", "{}");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
-
- config.setString("AML-PROGRAM-P2", "command", "/bin/true");
- config.setString("AML-PROGRAM-P2", "enabled", "true");
- config.setString("AML-PROGRAM-P2", "description", "does nothing");
- config.setString("AML-PROGRAM-P2", "description_i18n", "{}");
- config.setString("AML-PROGRAM-P2", "fallback", "M1");
-
- config.setString("KYC-CHECK-C1", "type", "FORM");
- config.setString("KYC-CHECK-C1", "form_name", "myform");
- config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "description_i18n", "{}");
- config.setString("KYC-CHECK-C1", "outputs", "full_name birthdate");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
-
- config.setString("KYC-CHECK-C2", "type", "INFO");
- config.setString("KYC-CHECK-C2", "description", "my check info!");
- config.setString("KYC-CHECK-C2", "description_i18n", "{}");
- config.setString("KYC-CHECK-C2", "fallback", "M2");
- });
-
- await exchange.start();
-
- const cryptoApi = createSyncCryptoApi();
- const amlKeypair = await cryptoApi.createEddsaKeypair({});
-
- await exchange.enableAmlAccount(amlKeypair.pub, "Alice");
-
- const walletService = new WalletService(t, {
- name: "wallet",
- useInMemoryDb: true,
- });
- await walletService.start();
- await walletService.pingUntilAvailable();
-
- const walletClient = new WalletClient({
- name: "wallet",
- unixPath: walletService.socketPath,
- onNotification(n) {
- console.log("got notification", n);
- },
- });
- await walletClient.connect();
- await walletClient.client.call(WalletApiOperation.InitWallet, {
- config: {
- testing: {
- skipDefaults: true,
- },
- },
- });
-
- console.log("setup done!");
-
- return {
- commonDb: db,
- exchange,
- amlKeypair,
- walletClient,
- walletService,
- bankClient,
- exchangeBankAccount: {
- accountName: "",
- accountPassword: "",
- accountPaytoUri: "",
- wireGatewayApiBaseUrl: "",
- },
- };
+ configureCommonKyc,
+ createKycTestkudosEnvironment,
+ withdrawViaBankV3,
+} from "../harness/environments.js";
+import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
+
+function adjustExchangeConfig(config: Configuration) {
+ configureCommonKyc(config);
+
+ config.setString("KYC-RULE-R1", "operation_type", "withdraw");
+ config.setString("KYC-RULE-R1", "enabled", "yes");
+ config.setString("KYC-RULE-R1", "exposed", "yes");
+ config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
+ config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
+ config.setString("KYC-RULE-R1", "timeframe", "1d");
+ config.setString("KYC-RULE-R1", "next_measures", "M1 M2");
+
+ config.setString("KYC-MEASURE-M1", "check_name", "C1");
+ config.setString("KYC-MEASURE-M1", "context", "{}");
+ config.setString("KYC-MEASURE-M1", "program", "P1");
+
+ config.setString("KYC-MEASURE-M2", "check_name", "C2");
+ config.setString("KYC-MEASURE-M2", "context", "{}");
+ config.setString("KYC-MEASURE-M2", "program", "NONE");
+
+ config.setString(
+ "AML-PROGRAM-P1",
+ "command",
+ "taler-exchange-helper-measure-test-form",
+ );
+ config.setString("AML-PROGRAM-P1", "enabled", "true");
+ config.setString(
+ "AML-PROGRAM-P1",
+ "description",
+ "test for full_name and birthdate",
+ );
+ config.setString("AML-PROGRAM-P1", "description_i18n", "{}");
+ config.setString("AML-PROGRAM-P1", "fallback", "FREEZE");
+
+ config.setString("KYC-CHECK-C1", "type", "FORM");
+ config.setString("KYC-CHECK-C1", "form_name", "myform");
+ config.setString("KYC-CHECK-C1", "description", "my check!");
+ config.setString("KYC-CHECK-C1", "description_i18n", "{}");
+ config.setString("KYC-CHECK-C1", "outputs", "full_name birthdate");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
+
+ config.setString("KYC-CHECK-C2", "type", "INFO");
+ config.setString("KYC-CHECK-C2", "description", "my check info!");
+ config.setString("KYC-CHECK-C2", "description_i18n", "{}");
+ config.setString("KYC-CHECK-C2", "fallback", "FREEZE");
}
export async function runKycFormWithdrawalTest(t: GlobalTestState) {
// Set up test environment
const { walletClient, bankClient, exchange, amlKeypair } =
- await createKycTestkudosEnvironment(t);
+ await createKycTestkudosEnvironment(t, { adjustExchangeConfig });
// Withdraw digital cash into the wallet.
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-merchant-activate-bank-account.ts
b/packages/taler-harness/src/integrationtests/test-kyc-merchant-activate-bank-account.ts
index f13c4cfb7..bf598d6a6 100644
---
a/packages/taler-harness/src/integrationtests/test-kyc-merchant-activate-bank-account.ts
+++
b/packages/taler-harness/src/integrationtests/test-kyc-merchant-activate-bank-account.ts
@@ -20,6 +20,7 @@
import {
codecForAccountKycRedirects,
codecForQueryInstancesResponse,
+ Configuration,
j2s,
Logger,
MerchantAccountKycRedirectsResponse,
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-merchant-aggregate.ts
b/packages/taler-harness/src/integrationtests/test-kyc-merchant-aggregate.ts
index 6b6f615ce..d6f246721 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-merchant-aggregate.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-merchant-aggregate.ts
@@ -19,6 +19,7 @@
*/
import { Configuration, j2s } from "@gnu-taler/taler-util";
import {
+ configureCommonKyc,
createKycTestkudosEnvironment,
makeTestPaymentV2,
withdrawViaBankV3,
@@ -30,7 +31,7 @@ import {
} from "../harness/harness.js";
function adjustExchangeConfig(config: Configuration) {
- config.setString("exchange", "enable_kyc", "yes");
+ configureCommonKyc(config);
config.setString("KYC-RULE-R1", "operation_type", "aggregate");
config.setString("KYC-RULE-R1", "enabled", "yes");
@@ -42,16 +43,11 @@ function adjustExchangeConfig(config: Configuration) {
config.setString("KYC-MEASURE-M1", "check_name", "C1");
config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("AML-PROGRAM-P1", "command", "/bin/true");
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString("AML-PROGRAM-P1", "description", "this does nothing");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
+ config.setString("KYC-MEASURE-M1", "program", "NONE");
config.setString("KYC-CHECK-C1", "type", "INFO");
config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
}
export async function runKycMerchantAggregateTest(t: GlobalTestState) {
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-merchant-deposit.ts
b/packages/taler-harness/src/integrationtests/test-kyc-merchant-deposit.ts
index 74571ba26..1bf2f13ab 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-merchant-deposit.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-merchant-deposit.ts
@@ -35,6 +35,7 @@ import {
readSuccessResponseJsonOrThrow,
} from "@gnu-taler/taler-util/http";
import {
+ configureCommonKyc,
createKycTestkudosEnvironment,
postAmlDecisionNoRules,
withdrawViaBankV3,
@@ -48,7 +49,7 @@ import {
const logger = new Logger(`test-kyc-merchant-deposit.ts`);
function adjustExchangeConfig(config: Configuration) {
- config.setString("exchange", "enable_kyc", "yes");
+ configureCommonKyc(config);
config.setString("KYC-RULE-R1", "operation_type", "deposit");
config.setString("KYC-RULE-R1", "enabled", "yes");
@@ -69,11 +70,11 @@ function adjustExchangeConfig(config: Configuration) {
config.setString("AML-PROGRAM-P1", "command", "/bin/true");
config.setString("AML-PROGRAM-P1", "enabled", "true");
config.setString("AML-PROGRAM-P1", "description", "this does nothing");
- config.setString("AML-PROGRAM-P1", "fallback", "FM");
+ config.setString("AML-PROGRAM-P1", "fallback", "FREEZE");
config.setString("KYC-CHECK-C1", "type", "INFO");
config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "fallback", "FM");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
}
export async function runKycMerchantDepositTest(t: GlobalTestState) {
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-new-measure.ts
b/packages/taler-harness/src/integrationtests/test-kyc-new-measure.ts
index cc854dc64..117245315 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-new-measure.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-new-measure.ts
@@ -24,214 +24,20 @@ import {
encodeCrock,
j2s,
signAmlQuery,
- TalerCorebankApiClient,
TalerProtocolTimestamp,
TransactionIdStr,
TransactionMajorState,
TransactionMinorState,
} from "@gnu-taler/taler-util";
import { readResponseJsonOrThrow } from "@gnu-taler/taler-util/http";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
- createSyncCryptoApi,
- EddsaKeyPairStrings,
- WalletApiOperation,
-} from "@gnu-taler/taler-wallet-core";
-import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
-import {
- BankService,
- DbInfo,
- ExchangeService,
- getTestHarnessPaytoForLabel,
- GlobalTestState,
- HarnessExchangeBankAccount,
- harnessHttpLib,
- setupDb,
- WalletClient,
- WalletService,
-} from "../harness/harness.js";
-import {
- EnvOptions,
+ configureCommonKyc,
+ createKycTestkudosEnvironment,
postAmlDecision,
withdrawViaBankV3,
} from "../harness/environments.js";
-
-interface KycTestEnv {
- commonDb: DbInfo;
- bankClient: TalerCorebankApiClient;
- exchange: ExchangeService;
- exchangeBankAccount: HarnessExchangeBankAccount;
- walletClient: WalletClient;
- walletService: WalletService;
- amlKeypair: EddsaKeyPairStrings;
-}
-
-async function createKycTestkudosEnvironment(
- t: GlobalTestState,
- coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")),
- opts: EnvOptions = {},
-): Promise<KycTestEnv> {
- const db = await setupDb(t);
-
- const bank = await BankService.create(t, {
- allowRegistrations: true,
- currency: "TESTKUDOS",
- database: db.connStr,
- httpPort: 8082,
- });
-
- const exchange = ExchangeService.create(t, {
- name: "testexchange-1",
- currency: "TESTKUDOS",
- httpPort: 8081,
- database: db.connStr,
- });
-
- let receiverName = "Exchange";
- let exchangeBankUsername = "exchange";
- let exchangeBankPassword = "mypw-password";
- let exchangePaytoUri = getTestHarnessPaytoForLabel(exchangeBankUsername);
-
- await exchange.addBankAccount("1", {
- accountName: exchangeBankUsername,
- accountPassword: exchangeBankPassword,
- wireGatewayApiBaseUrl: new URL(
- "accounts/exchange/taler-wire-gateway/",
- bank.baseUrl,
- ).href,
- accountPaytoUri: exchangePaytoUri,
- });
-
- bank.setSuggestedExchange(exchange, exchangePaytoUri);
-
- await bank.start();
-
- await bank.pingUntilAvailable();
-
- const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, {
- auth: {
- username: "admin",
- password: "admin-password",
- },
- });
-
- await bankClient.registerAccountExtended({
- name: receiverName,
- password: exchangeBankPassword,
- username: exchangeBankUsername,
- is_taler_exchange: true,
- payto_uri: exchangePaytoUri,
- });
-
- exchange.addCoinConfigList(coinConfig);
-
- await exchange.modifyConfig(async (config) => {
- config.setString("exchange", "enable_kyc", "yes");
-
- config.setString("KYC-RULE-R1", "operation_type", "withdraw");
- config.setString("KYC-RULE-R1", "enabled", "yes");
- config.setString("KYC-RULE-R1", "exposed", "yes");
- config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
- config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
- config.setString("KYC-RULE-R1", "timeframe", "1d");
- config.setString("KYC-RULE-R1", "next_measures", "M1 M2");
-
- config.setString("KYC-MEASURE-M1", "check_name", "C1");
- config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("KYC-MEASURE-M2", "check_name", "C2");
- config.setString("KYC-MEASURE-M2", "context", "{}");
- config.setString("KYC-MEASURE-M2", "program", "P2");
-
- config.setString("KYC-MEASURE-M3", "check_name", "C3");
- config.setString("KYC-MEASURE-M3", "context", "{}");
- config.setString("KYC-MEASURE-M3", "program", "P2");
-
- config.setString(
- "AML-PROGRAM-P1",
- "command",
- "taler-exchange-helper-measure-test-form",
- );
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString(
- "AML-PROGRAM-P1",
- "description",
- "test for full_name and birthdate",
- );
- config.setString("AML-PROGRAM-P1", "description_i18n", "{}");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
-
- config.setString("AML-PROGRAM-P2", "command", "/bin/true");
- config.setString("AML-PROGRAM-P2", "enabled", "true");
- config.setString("AML-PROGRAM-P2", "description", "does nothing");
- config.setString("AML-PROGRAM-P2", "description_i18n", "{}");
- config.setString("AML-PROGRAM-P2", "fallback", "M1");
-
- config.setString("KYC-CHECK-C1", "type", "FORM");
- config.setString("KYC-CHECK-C1", "form_name", "myform");
- config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "description_i18n", "{}");
- config.setString("KYC-CHECK-C1", "outputs", "full_name birthdate");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
-
- config.setString("KYC-CHECK-C2", "type", "INFO");
- config.setString("KYC-CHECK-C2", "description", "my check info!");
- config.setString("KYC-CHECK-C2", "description_i18n", "{}");
- config.setString("KYC-CHECK-C2", "fallback", "M2");
-
- config.setString("KYC-CHECK-C3", "type", "INFO");
- config.setString("KYC-CHECK-C3", "description", "this is info c3");
- config.setString("KYC-CHECK-C3", "description_i18n", "{}");
- config.setString("KYC-CHECK-C3", "fallback", "M2");
- });
-
- await exchange.start();
-
- const cryptoApi = createSyncCryptoApi();
- const amlKeypair = await cryptoApi.createEddsaKeypair({});
-
- await exchange.enableAmlAccount(amlKeypair.pub, "Alice");
-
- const walletService = new WalletService(t, {
- name: "wallet",
- useInMemoryDb: true,
- });
- await walletService.start();
- await walletService.pingUntilAvailable();
-
- const walletClient = new WalletClient({
- name: "wallet",
- unixPath: walletService.socketPath,
- onNotification(n) {
- console.log("got notification", n);
- },
- });
- await walletClient.connect();
- await walletClient.client.call(WalletApiOperation.InitWallet, {
- config: {
- testing: {
- skipDefaults: true,
- },
- },
- });
-
- console.log("setup done!");
-
- return {
- commonDb: db,
- exchange,
- amlKeypair,
- walletClient,
- walletService,
- bankClient,
- exchangeBankAccount: {
- accountName: "",
- accountPassword: "",
- accountPaytoUri: "",
- wireGatewayApiBaseUrl: "",
- },
- };
-}
+import { GlobalTestState, harnessHttpLib } from "../harness/harness.js";
/**
* Test setting a `new_measure` as the AML officer.
@@ -240,7 +46,68 @@ export async function runKycNewMeasureTest(t:
GlobalTestState) {
// Set up test environment
const { walletClient, bankClient, exchange, amlKeypair } =
- await createKycTestkudosEnvironment(t);
+ await createKycTestkudosEnvironment(t, {
+ adjustExchangeConfig(config) {
+ configureCommonKyc(config);
+
+ config.setString("KYC-RULE-R1", "operation_type", "withdraw");
+ config.setString("KYC-RULE-R1", "enabled", "yes");
+ config.setString("KYC-RULE-R1", "exposed", "yes");
+ config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
+ config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
+ config.setString("KYC-RULE-R1", "timeframe", "1d");
+ config.setString("KYC-RULE-R1", "next_measures", "M1 M2");
+
+ config.setString("KYC-MEASURE-M1", "check_name", "C1");
+ config.setString("KYC-MEASURE-M1", "context", "{}");
+ config.setString("KYC-MEASURE-M1", "program", "P1");
+
+ config.setString("KYC-MEASURE-M2", "check_name", "C2");
+ config.setString("KYC-MEASURE-M2", "context", "{}");
+ config.setString("KYC-MEASURE-M2", "program", "P2");
+
+ config.setString("KYC-MEASURE-M3", "check_name", "C3");
+ config.setString("KYC-MEASURE-M3", "context", "{}");
+ config.setString("KYC-MEASURE-M3", "program", "P2");
+
+ config.setString(
+ "AML-PROGRAM-P1",
+ "command",
+ "taler-exchange-helper-measure-test-form",
+ );
+ config.setString("AML-PROGRAM-P1", "enabled", "true");
+ config.setString(
+ "AML-PROGRAM-P1",
+ "description",
+ "test for full_name and birthdate",
+ );
+ config.setString("AML-PROGRAM-P1", "description_i18n", "{}");
+ config.setString("AML-PROGRAM-P1", "fallback", "FREEZE");
+
+ config.setString("AML-PROGRAM-P2", "command", "/bin/true");
+ config.setString("AML-PROGRAM-P2", "enabled", "true");
+ config.setString("AML-PROGRAM-P2", "description", "does nothing");
+ config.setString("AML-PROGRAM-P2", "description_i18n", "{}");
+ config.setString("AML-PROGRAM-P2", "fallback", "FREEZE");
+
+ config.setString("KYC-CHECK-C1", "type", "FORM");
+ config.setString("KYC-CHECK-C1", "form_name", "myform");
+ config.setString("KYC-CHECK-C1", "description", "my check!");
+ config.setString("KYC-CHECK-C1", "description_i18n", "{}");
+ config.setString("KYC-CHECK-C1", "outputs", "full_name birthdate");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
+
+ config.setString("KYC-CHECK-C2", "type", "INFO");
+ config.setString("KYC-CHECK-C2", "description", "my check info!");
+ config.setString("KYC-CHECK-C2", "description_i18n", "{}");
+ config.setString("KYC-CHECK-C2", "fallback", "FREEZE");
+
+ config.setString("KYC-CHECK-C3", "type", "INFO");
+ config.setString("KYC-CHECK-C3", "description", "this is info c3");
+ config.setString("KYC-CHECK-C3", "description_i18n", "{}");
+ config.setString("KYC-CHECK-C3", "fallback", "FREEZE");
+ },
+ });
// Withdraw digital cash into the wallet.
let kycPaytoHash: string | undefined;
diff --git a/packages/taler-harness/src/integrationtests/test-kyc-peer-pull.ts
b/packages/taler-harness/src/integrationtests/test-kyc-peer-pull.ts
index dd92919ef..c1a61976a 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-peer-pull.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-peer-pull.ts
@@ -22,203 +22,46 @@ import {
AmountString,
Duration,
j2s,
- TalerCorebankApiClient,
TransactionIdStr,
TransactionMajorState,
TransactionMinorState,
TransactionType,
} from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
- createSyncCryptoApi,
- EddsaKeyPairStrings,
- WalletApiOperation,
-} from "@gnu-taler/taler-wallet-core";
-import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
-import {
- BankService,
- DbInfo,
- ExchangeService,
- getTestHarnessPaytoForLabel,
- GlobalTestState,
- HarnessExchangeBankAccount,
- setupDb,
- WalletClient,
- WalletService,
-} from "../harness/harness.js";
-import {
+ configureCommonKyc,
+ createKycTestkudosEnvironment,
createWalletDaemonWithClient,
- EnvOptions,
postAmlDecisionNoRules,
withdrawViaBankV3,
} from "../harness/environments.js";
-
-interface KycTestEnv {
- commonDb: DbInfo;
- bankClient: TalerCorebankApiClient;
- exchange: ExchangeService;
- exchangeBankAccount: HarnessExchangeBankAccount;
- walletClient: WalletClient;
- walletService: WalletService;
- amlKeypair: EddsaKeyPairStrings;
-}
-
-async function createKycTestkudosEnvironment(
- t: GlobalTestState,
- coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")),
- opts: EnvOptions = {},
-): Promise<KycTestEnv> {
- const db = await setupDb(t);
-
- const bank = await BankService.create(t, {
- allowRegistrations: true,
- currency: "TESTKUDOS",
- database: db.connStr,
- httpPort: 8082,
- });
-
- const exchange = ExchangeService.create(t, {
- name: "testexchange-1",
- currency: "TESTKUDOS",
- httpPort: 8081,
- database: db.connStr,
- });
-
- let receiverName = "Exchange";
- let exchangeBankUsername = "exchange";
- let exchangeBankPassword = "mypw-password";
- let exchangePaytoUri = getTestHarnessPaytoForLabel(exchangeBankUsername);
-
- await exchange.addBankAccount("1", {
- accountName: exchangeBankUsername,
- accountPassword: exchangeBankPassword,
- wireGatewayApiBaseUrl: new URL(
- "accounts/exchange/taler-wire-gateway/",
- bank.baseUrl,
- ).href,
- accountPaytoUri: exchangePaytoUri,
- });
-
- bank.setSuggestedExchange(exchange, exchangePaytoUri);
-
- await bank.start();
-
- await bank.pingUntilAvailable();
-
- const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, {
- auth: {
- username: "admin",
- password: "admin-password",
- },
- });
-
- await bankClient.registerAccountExtended({
- name: receiverName,
- password: exchangeBankPassword,
- username: exchangeBankUsername,
- is_taler_exchange: true,
- payto_uri: exchangePaytoUri,
- });
-
- const ageMaskSpec = opts.ageMaskSpec;
-
- if (ageMaskSpec) {
- exchange.enableAgeRestrictions(ageMaskSpec);
- // Enable age restriction for all coins.
- exchange.addCoinConfigList(
- coinConfig.map((x) => ({
- ...x,
- name: `${x.name}-age`,
- ageRestricted: true,
- })),
- );
- // For mixed age restrictions, we also offer coins without age restrictions
- if (opts.mixedAgeRestriction) {
- exchange.addCoinConfigList(
- coinConfig.map((x) => ({ ...x, ageRestricted: false })),
- );
- }
- } else {
- exchange.addCoinConfigList(coinConfig);
- }
-
- await exchange.modifyConfig(async (config) => {
- config.setString("exchange", "enable_kyc", "yes");
-
- config.setString("KYC-RULE-R1", "operation_type", "merge");
- config.setString("KYC-RULE-R1", "enabled", "yes");
- config.setString("KYC-RULE-R1", "exposed", "yes");
- config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
- config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
- config.setString("KYC-RULE-R1", "timeframe", "1d");
- config.setString("KYC-RULE-R1", "next_measures", "M1");
-
- config.setString("KYC-MEASURE-M1", "check_name", "C1");
- config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("AML-PROGRAM-P1", "command", "/bin/true");
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString("AML-PROGRAM-P1", "description", "this does nothing");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
-
- config.setString("KYC-CHECK-C1", "type", "INFO");
- config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
- });
-
- await exchange.start();
-
- const cryptoApi = createSyncCryptoApi();
- const amlKeypair = await cryptoApi.createEddsaKeypair({});
-
- await exchange.enableAmlAccount(amlKeypair.pub, "Alice");
-
- const walletService = new WalletService(t, {
- name: "wallet",
- useInMemoryDb: true,
- });
- await walletService.start();
- await walletService.pingUntilAvailable();
-
- const walletClient = new WalletClient({
- name: "wallet",
- unixPath: walletService.socketPath,
- onNotification(n) {
- console.log("got notification", n);
- },
- });
- await walletClient.connect();
- await walletClient.client.call(WalletApiOperation.InitWallet, {
- config: {
- testing: {
- skipDefaults: true,
- },
- },
- });
-
- console.log("setup done!");
-
- return {
- commonDb: db,
- exchange,
- amlKeypair,
- walletClient,
- walletService,
- bankClient,
- exchangeBankAccount: {
- accountName: "",
- accountPassword: "",
- accountPaytoUri: "",
- wireGatewayApiBaseUrl: "",
- },
- };
-}
+import { GlobalTestState, WalletClient } from "../harness/harness.js";
export async function runKycPeerPullTest(t: GlobalTestState) {
// Set up test environment
const { walletClient, bankClient, exchange, amlKeypair } =
- await createKycTestkudosEnvironment(t);
+ await createKycTestkudosEnvironment(t, {
+ adjustExchangeConfig(config) {
+ configureCommonKyc(config);
+
+ config.setString("KYC-RULE-R1", "operation_type", "merge");
+ config.setString("KYC-RULE-R1", "enabled", "yes");
+ config.setString("KYC-RULE-R1", "exposed", "yes");
+ config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
+ config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
+ config.setString("KYC-RULE-R1", "timeframe", "1d");
+ config.setString("KYC-RULE-R1", "next_measures", "M1");
+
+ config.setString("KYC-MEASURE-M1", "check_name", "C1");
+ config.setString("KYC-MEASURE-M1", "context", "{}");
+ config.setString("KYC-MEASURE-M1", "program", "NONE");
+
+ config.setString("KYC-CHECK-C1", "type", "INFO");
+ config.setString("KYC-CHECK-C1", "description", "my check!");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
+ },
+ });
// Origin wallet for the p2p transaction,
// will pay for the invoice.
diff --git a/packages/taler-harness/src/integrationtests/test-kyc-peer-push.ts
b/packages/taler-harness/src/integrationtests/test-kyc-peer-push.ts
index 455b7138a..2748a54f1 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-peer-push.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-peer-push.ts
@@ -22,202 +22,45 @@ import {
AmountString,
Duration,
j2s,
- TalerCorebankApiClient,
TransactionMajorState,
TransactionMinorState,
TransactionType,
} from "@gnu-taler/taler-util";
+import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
- createSyncCryptoApi,
- EddsaKeyPairStrings,
- WalletApiOperation,
-} from "@gnu-taler/taler-wallet-core";
-import { CoinConfig, defaultCoinConfig } from "../harness/denomStructures.js";
-import {
- BankService,
- DbInfo,
- ExchangeService,
- getTestHarnessPaytoForLabel,
- GlobalTestState,
- HarnessExchangeBankAccount,
- setupDb,
- WalletClient,
- WalletService,
-} from "../harness/harness.js";
-import {
+ configureCommonKyc,
+ createKycTestkudosEnvironment,
createWalletDaemonWithClient,
- EnvOptions,
postAmlDecisionNoRules,
withdrawViaBankV3,
} from "../harness/environments.js";
-
-interface KycTestEnv {
- commonDb: DbInfo;
- bankClient: TalerCorebankApiClient;
- exchange: ExchangeService;
- exchangeBankAccount: HarnessExchangeBankAccount;
- walletClient: WalletClient;
- walletService: WalletService;
- amlKeypair: EddsaKeyPairStrings;
-}
-
-async function createKycTestkudosEnvironment(
- t: GlobalTestState,
- coinConfig: CoinConfig[] = defaultCoinConfig.map((x) => x("TESTKUDOS")),
- opts: EnvOptions = {},
-): Promise<KycTestEnv> {
- const db = await setupDb(t);
-
- const bank = await BankService.create(t, {
- allowRegistrations: true,
- currency: "TESTKUDOS",
- database: db.connStr,
- httpPort: 8082,
- });
-
- const exchange = ExchangeService.create(t, {
- name: "testexchange-1",
- currency: "TESTKUDOS",
- httpPort: 8081,
- database: db.connStr,
- });
-
- let receiverName = "Exchange";
- let exchangeBankUsername = "exchange";
- let exchangeBankPassword = "mypw-password";
- let exchangePaytoUri = getTestHarnessPaytoForLabel(exchangeBankUsername);
-
- await exchange.addBankAccount("1", {
- accountName: exchangeBankUsername,
- accountPassword: exchangeBankPassword,
- wireGatewayApiBaseUrl: new URL(
- "accounts/exchange/taler-wire-gateway/",
- bank.baseUrl,
- ).href,
- accountPaytoUri: exchangePaytoUri,
- });
-
- bank.setSuggestedExchange(exchange, exchangePaytoUri);
-
- await bank.start();
-
- await bank.pingUntilAvailable();
-
- const bankClient = new TalerCorebankApiClient(bank.corebankApiBaseUrl, {
- auth: {
- username: "admin",
- password: "admin-password",
- },
- });
-
- await bankClient.registerAccountExtended({
- name: receiverName,
- password: exchangeBankPassword,
- username: exchangeBankUsername,
- is_taler_exchange: true,
- payto_uri: exchangePaytoUri,
- });
-
- const ageMaskSpec = opts.ageMaskSpec;
-
- if (ageMaskSpec) {
- exchange.enableAgeRestrictions(ageMaskSpec);
- // Enable age restriction for all coins.
- exchange.addCoinConfigList(
- coinConfig.map((x) => ({
- ...x,
- name: `${x.name}-age`,
- ageRestricted: true,
- })),
- );
- // For mixed age restrictions, we also offer coins without age restrictions
- if (opts.mixedAgeRestriction) {
- exchange.addCoinConfigList(
- coinConfig.map((x) => ({ ...x, ageRestricted: false })),
- );
- }
- } else {
- exchange.addCoinConfigList(coinConfig);
- }
-
- await exchange.modifyConfig(async (config) => {
- config.setString("exchange", "enable_kyc", "yes");
-
- config.setString("KYC-RULE-R1", "operation_type", "merge");
- config.setString("KYC-RULE-R1", "enabled", "yes");
- config.setString("KYC-RULE-R1", "exposed", "yes");
- config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
- config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
- config.setString("KYC-RULE-R1", "timeframe", "1d");
- config.setString("KYC-RULE-R1", "next_measures", "M1");
-
- config.setString("KYC-MEASURE-M1", "check_name", "C1");
- config.setString("KYC-MEASURE-M1", "context", "{}");
- config.setString("KYC-MEASURE-M1", "program", "P1");
-
- config.setString("AML-PROGRAM-P1", "command", "/bin/true");
- config.setString("AML-PROGRAM-P1", "enabled", "true");
- config.setString("AML-PROGRAM-P1", "description", "this does nothing");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
-
- config.setString("KYC-CHECK-C1", "type", "INFO");
- config.setString("KYC-CHECK-C1", "description", "my check!");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
- });
-
- await exchange.start();
-
- const cryptoApi = createSyncCryptoApi();
- const amlKeypair = await cryptoApi.createEddsaKeypair({});
-
- await exchange.enableAmlAccount(amlKeypair.pub, "Alice");
-
- const walletService = new WalletService(t, {
- name: "wallet",
- useInMemoryDb: true,
- });
- await walletService.start();
- await walletService.pingUntilAvailable();
-
- const walletClient = new WalletClient({
- name: "wallet",
- unixPath: walletService.socketPath,
- onNotification(n) {
- console.log("got notification", n);
- },
- });
- await walletClient.connect();
- await walletClient.client.call(WalletApiOperation.InitWallet, {
- config: {
- testing: {
- skipDefaults: true,
- },
- },
- });
-
- console.log("setup done!");
-
- return {
- commonDb: db,
- exchange,
- amlKeypair,
- walletClient,
- walletService,
- bankClient,
- exchangeBankAccount: {
- accountName: "",
- accountPassword: "",
- accountPaytoUri: "",
- wireGatewayApiBaseUrl: "",
- },
- };
-}
+import { GlobalTestState, WalletClient } from "../harness/harness.js";
export async function runKycPeerPushTest(t: GlobalTestState) {
// Set up test environment
const { walletClient, bankClient, exchange, amlKeypair } =
- await createKycTestkudosEnvironment(t);
+ await createKycTestkudosEnvironment(t, {
+ adjustExchangeConfig(config) {
+ configureCommonKyc(config);
+
+ config.setString("KYC-RULE-R1", "operation_type", "merge");
+ config.setString("KYC-RULE-R1", "enabled", "yes");
+ config.setString("KYC-RULE-R1", "exposed", "yes");
+ config.setString("KYC-RULE-R1", "is_and_combinator", "yes");
+ config.setString("KYC-RULE-R1", "threshold", "TESTKUDOS:5");
+ config.setString("KYC-RULE-R1", "timeframe", "1d");
+ config.setString("KYC-RULE-R1", "next_measures", "M1");
+
+ config.setString("KYC-MEASURE-M1", "check_name", "C1");
+ config.setString("KYC-MEASURE-M1", "context", "{}");
+ config.setString("KYC-MEASURE-M1", "program", "NONE");
+
+ config.setString("KYC-CHECK-C1", "type", "INFO");
+ config.setString("KYC-CHECK-C1", "description", "my check!");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
+ },
+ });
// Origin wallet for the p2p transaction.
const w0 = await createWalletDaemonWithClient(t, {
diff --git
a/packages/taler-harness/src/integrationtests/test-kyc-skip-expiration.ts
b/packages/taler-harness/src/integrationtests/test-kyc-skip-expiration.ts
index 2e463d5b7..fda61396c 100644
--- a/packages/taler-harness/src/integrationtests/test-kyc-skip-expiration.ts
+++ b/packages/taler-harness/src/integrationtests/test-kyc-skip-expiration.ts
@@ -35,6 +35,7 @@ import {
import { readResponseJsonOrThrow } from "@gnu-taler/taler-util/http";
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
import {
+ configureCommonKyc,
createKycTestkudosEnvironment,
postAmlDecision,
withdrawViaBankV3,
@@ -78,7 +79,7 @@ export const AML_PROGRAM_FROM_ATTRIBUTES_TO_CONTEXT:
TalerKycAml.AmlProgramDefin
};
function adjustExchangeConfig(config: Configuration) {
- config.setString("exchange", "enable_kyc", "yes");
+ configureCommonKyc(config);
config.setString("KYC-RULE-R1", "operation_type", "withdraw");
config.setString("KYC-RULE-R1", "enabled", "yes");
@@ -108,32 +109,32 @@ function adjustExchangeConfig(config: Configuration) {
config.setString("AML-PROGRAM-P1", "enabled", "true");
config.setString("AML-PROGRAM-P1", "description", "remove all rules");
config.setString("AML-PROGRAM-P1", "description_i18n", "{}");
- config.setString("AML-PROGRAM-P1", "fallback", "M1");
+ config.setString("AML-PROGRAM-P1", "fallback", "FREEZE");
config.setString("AML-PROGRAM-P2", "command", "/bin/true");
config.setString("AML-PROGRAM-P2", "enabled", "true");
config.setString("AML-PROGRAM-P2", "description", "does nothing");
config.setString("AML-PROGRAM-P2", "description_i18n", "{}");
- config.setString("AML-PROGRAM-P2", "fallback", "M1");
+ config.setString("AML-PROGRAM-P2", "fallback", "FREEZE");
config.setString("KYC-CHECK-C1", "type", "FORM");
config.setString("KYC-CHECK-C1", "form_name", "myform");
config.setString("KYC-CHECK-C1", "description", "my check!");
config.setString("KYC-CHECK-C1", "description_i18n", "{}");
config.setString("KYC-CHECK-C1", "outputs", "full_name birthdate");
- config.setString("KYC-CHECK-C1", "fallback", "M1");
+ config.setString("KYC-CHECK-C1", "fallback", "FREEZE");
config.setString("KYC-CHECK-C2", "type", "FORM");
config.setString("KYC-CHECK-C2", "form_name", "dynamicform");
config.setString("KYC-CHECK-C2", "description", "my check info!");
config.setString("KYC-CHECK-C2", "description_i18n", "{}");
config.setString("KYC-CHECK-C1", "outputs", "what_the_officer_asked");
- config.setString("KYC-CHECK-C2", "fallback", "M2");
+ config.setString("KYC-CHECK-C2", "fallback", "FREEZE");
config.setString("KYC-CHECK-C3", "type", "INFO");
config.setString("KYC-CHECK-C3", "description", "this is info c3");
config.setString("KYC-CHECK-C3", "description_i18n", "{}");
- config.setString("KYC-CHECK-C3", "fallback", "M2");
+ config.setString("KYC-CHECK-C3", "fallback", "FREEZE");
}
/**
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.