aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2022-08-25 18:34:25 +0200
committerFlorian Dold <florian@dold.me>2022-08-25 18:34:25 +0200
commit499e003ff8bfcb75a20619c65c4a03a73cb7a850 (patch)
treee08a9d8b5a069fdfd1d1625c98975592f547bd42
parent22bc73ac4be09e52be0339780018f6440fdca94c (diff)
specify bank access API separately in tests
-rw-r--r--packages/taler-util/src/walletTypes.ts7
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts2
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-forced-selection.ts1
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-wallet-dbless.ts1
-rw-r--r--packages/taler-wallet-cli/src/integrationtests/test-wallettesting.ts3
-rw-r--r--packages/taler-wallet-core/src/bank-api-client.ts8
-rw-r--r--packages/taler-wallet-core/src/dbless.ts3
-rw-r--r--packages/taler-wallet-core/src/operations/testing.ts2
-rw-r--r--packages/taler-wallet-core/src/operations/withdraw.ts2
-rw-r--r--packages/taler-wallet-core/src/wallet.ts1
10 files changed, 23 insertions, 7 deletions
diff --git a/packages/taler-util/src/walletTypes.ts b/packages/taler-util/src/walletTypes.ts
index 6d3837a62..b34eb0d04 100644
--- a/packages/taler-util/src/walletTypes.ts
+++ b/packages/taler-util/src/walletTypes.ts
@@ -837,6 +837,7 @@ export const codecForTestPayArgs = (): Codec<TestPayArgs> =>
export interface IntegrationTestArgs {
exchangeBaseUrl: string;
bankBaseUrl: string;
+ bankAccessApiBaseUrl: string;
merchantBaseUrl: string;
merchantAuthToken?: string;
amountToWithdraw: string;
@@ -851,6 +852,7 @@ export const codecForIntegrationTestArgs = (): Codec<IntegrationTestArgs> =>
.property("merchantAuthToken", codecOptional(codecForString()))
.property("amountToSpend", codecForAmountString())
.property("amountToWithdraw", codecForAmountString())
+ .property("bankAccessApiBaseUrl", codecForAmountString())
.build("IntegrationTestArgs");
export interface AddExchangeRequest {
@@ -1065,6 +1067,10 @@ export interface CoreApiResponseError {
export interface WithdrawTestBalanceRequest {
amount: string;
bankBaseUrl: string;
+ /**
+ * Bank access API base URL. Defaults to the bankBaseUrl.
+ */
+ bankAccessApiBaseUrl: string;
exchangeBaseUrl: string;
forcedDenomSel?: ForcedDenomSel;
}
@@ -1141,6 +1147,7 @@ export const codecForWithdrawTestBalance =
.property("bankBaseUrl", codecForString())
.property("exchangeBaseUrl", codecForString())
.property("forcedDenomSel", codecForAny())
+ .property("bankAccessApiBaseUrl", codecForString())
.build("WithdrawTestBalanceRequest");
export interface ApplyRefundResponse {
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts b/packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts
index 97dbf369c..31113aa1f 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-bank-api.ts
@@ -104,7 +104,7 @@ export async function runBankApiTest(t: GlobalTestState) {
// Make sure that registering twice results in a 409 Conflict
{
const e = await t.assertThrowsTalerErrorAsync(async () => {
- await BankApi.registerAccount(bank, "user1", "pw1");
+ await BankApi.registerAccount(bank, "user1", "pw2");
});
t.assertTrue(e.errorDetail.httpStatusCode === 409);
}
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-forced-selection.ts b/packages/taler-wallet-cli/src/integrationtests/test-forced-selection.ts
index 0fe5f639a..302e3364a 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-forced-selection.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-forced-selection.ts
@@ -47,6 +47,7 @@ export async function runForcedSelectionTest(t: GlobalTestState) {
exchangeBaseUrl: exchange.baseUrl,
amount: "TESTKUDOS:10",
bankBaseUrl: bank.baseUrl,
+ bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
forcedDenomSel: {
denoms: [
{
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-wallet-dbless.ts b/packages/taler-wallet-cli/src/integrationtests/test-wallet-dbless.ts
index 3837e567a..75d6c208c 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-wallet-dbless.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-wallet-dbless.ts
@@ -57,6 +57,7 @@ export async function runWalletDblessTest(t: GlobalTestState) {
http,
reserveKeyPair.pub,
bank.baseUrl,
+ bank.bankAccessApiBaseUrl,
exchangeInfo,
"TESTKUDOS:10",
);
diff --git a/packages/taler-wallet-cli/src/integrationtests/test-wallettesting.ts b/packages/taler-wallet-cli/src/integrationtests/test-wallettesting.ts
index c42ae5adf..c16a85f19 100644
--- a/packages/taler-wallet-cli/src/integrationtests/test-wallettesting.ts
+++ b/packages/taler-wallet-cli/src/integrationtests/test-wallettesting.ts
@@ -121,6 +121,7 @@ export async function runWallettestingTest(t: GlobalTestState) {
amountToSpend: "TESTKUDOS:5",
amountToWithdraw: "TESTKUDOS:10",
bankBaseUrl: bank.baseUrl,
+ bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
exchangeBaseUrl: exchange.baseUrl,
merchantAuthToken: merchantAuthToken,
merchantBaseUrl: merchant.makeInstanceBaseUrl(),
@@ -144,6 +145,7 @@ export async function runWallettestingTest(t: GlobalTestState) {
await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
amount: "TESTKUDOS:10",
bankBaseUrl: bank.baseUrl,
+ bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
exchangeBaseUrl: exchange.baseUrl,
});
@@ -169,6 +171,7 @@ export async function runWallettestingTest(t: GlobalTestState) {
await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
amount: "TESTKUDOS:10",
bankBaseUrl: bank.baseUrl,
+ bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
exchangeBaseUrl: exchange.baseUrl,
});
diff --git a/packages/taler-wallet-core/src/bank-api-client.ts b/packages/taler-wallet-core/src/bank-api-client.ts
index fa93409c5..c2de65982 100644
--- a/packages/taler-wallet-core/src/bank-api-client.ts
+++ b/packages/taler-wallet-core/src/bank-api-client.ts
@@ -197,10 +197,7 @@ export namespace BankApi {
);
logger.info(`response status ${resp.status}`);
- const respJson = await readSuccessResponseJsonOrThrow(
- resp,
- codecForAny(),
- );
+ const respJson = await readSuccessResponseJsonOrThrow(resp, codecForAny());
// FIXME: We don't check the status here!
}
@@ -214,7 +211,7 @@ export namespace BankApi {
`accounts/${bankUser.username}/withdrawals/${wopi.withdrawal_id}/abort`,
bank.baseUrl,
);
- await bank.http.postJson(
+ const resp = await bank.http.postJson(
url.href,
{},
{
@@ -226,6 +223,7 @@ export namespace BankApi {
},
},
);
+ await readSuccessResponseJsonOrThrow(resp, codecForAny());
}
}
diff --git a/packages/taler-wallet-core/src/dbless.ts b/packages/taler-wallet-core/src/dbless.ts
index 4669b0be7..3a775c3f1 100644
--- a/packages/taler-wallet-core/src/dbless.ts
+++ b/packages/taler-wallet-core/src/dbless.ts
@@ -111,12 +111,13 @@ export async function topupReserveWithDemobank(
http: HttpRequestLibrary,
reservePub: string,
bankBaseUrl: string,
+ bankAccessApiBaseUrl: string,
exchangeInfo: ExchangeInfo,
amount: AmountString,
) {
const bankHandle: BankServiceHandle = {
baseUrl: bankBaseUrl,
- bankAccessApiBaseUrl: "??", // FIXME!
+ bankAccessApiBaseUrl: bankAccessApiBaseUrl,
http,
};
const bankUser = await BankApi.createRandomBankUser(bankHandle);
diff --git a/packages/taler-wallet-core/src/operations/testing.ts b/packages/taler-wallet-core/src/operations/testing.ts
index bec8ec8f8..8d28c62f7 100644
--- a/packages/taler-wallet-core/src/operations/testing.ts
+++ b/packages/taler-wallet-core/src/operations/testing.ts
@@ -348,6 +348,7 @@ export async function runIntegrationTest(
await withdrawTestBalance(ws, {
amount: args.amountToWithdraw,
bankBaseUrl: args.bankBaseUrl,
+ bankAccessApiBaseUrl: args.bankAccessApiBaseUrl,
exchangeBaseUrl: args.exchangeBaseUrl,
});
await ws.runUntilDone();
@@ -376,6 +377,7 @@ export async function runIntegrationTest(
await withdrawTestBalance(ws, {
amount: Amounts.stringify(withdrawAmountTwo),
bankBaseUrl: args.bankBaseUrl,
+ bankAccessApiBaseUrl: args.bankBaseUrl,
exchangeBaseUrl: args.exchangeBaseUrl,
});
diff --git a/packages/taler-wallet-core/src/operations/withdraw.ts b/packages/taler-wallet-core/src/operations/withdraw.ts
index f92ce5063..03ec9b61b 100644
--- a/packages/taler-wallet-core/src/operations/withdraw.ts
+++ b/packages/taler-wallet-core/src/operations/withdraw.ts
@@ -382,6 +382,8 @@ export async function getBankWithdrawalInfo(
codecForWithdrawOperationStatusResponse(),
);
+ logger.info(`bank withdrawal operation status: ${j2s(status)}`);
+
return {
amount: Amounts.parseOrThrow(status.amount),
confirmTransferUrl: status.confirm_transfer_url,
diff --git a/packages/taler-wallet-core/src/wallet.ts b/packages/taler-wallet-core/src/wallet.ts
index 3c83cea6e..8ae4b2b7b 100644
--- a/packages/taler-wallet-core/src/wallet.ts
+++ b/packages/taler-wallet-core/src/wallet.ts
@@ -740,6 +740,7 @@ async function dispatchRequestInternal(
await withdrawTestBalance(ws, {
amount: "TESTKUDOS:10",
bankBaseUrl: "https://bank.test.taler.net/",
+ bankAccessApiBaseUrl: "https://bank.test.taler.net/",
exchangeBaseUrl: "https://exchange.test.taler.net/",
});
return {};