specify bank access API separately in tests
This commit is contained in:
parent
22bc73ac4b
commit
499e003ff8
@ -837,6 +837,7 @@ export const codecForTestPayArgs = (): Codec<TestPayArgs> =>
|
|||||||
export interface IntegrationTestArgs {
|
export interface IntegrationTestArgs {
|
||||||
exchangeBaseUrl: string;
|
exchangeBaseUrl: string;
|
||||||
bankBaseUrl: string;
|
bankBaseUrl: string;
|
||||||
|
bankAccessApiBaseUrl: string;
|
||||||
merchantBaseUrl: string;
|
merchantBaseUrl: string;
|
||||||
merchantAuthToken?: string;
|
merchantAuthToken?: string;
|
||||||
amountToWithdraw: string;
|
amountToWithdraw: string;
|
||||||
@ -851,6 +852,7 @@ export const codecForIntegrationTestArgs = (): Codec<IntegrationTestArgs> =>
|
|||||||
.property("merchantAuthToken", codecOptional(codecForString()))
|
.property("merchantAuthToken", codecOptional(codecForString()))
|
||||||
.property("amountToSpend", codecForAmountString())
|
.property("amountToSpend", codecForAmountString())
|
||||||
.property("amountToWithdraw", codecForAmountString())
|
.property("amountToWithdraw", codecForAmountString())
|
||||||
|
.property("bankAccessApiBaseUrl", codecForAmountString())
|
||||||
.build("IntegrationTestArgs");
|
.build("IntegrationTestArgs");
|
||||||
|
|
||||||
export interface AddExchangeRequest {
|
export interface AddExchangeRequest {
|
||||||
@ -1065,6 +1067,10 @@ export interface CoreApiResponseError {
|
|||||||
export interface WithdrawTestBalanceRequest {
|
export interface WithdrawTestBalanceRequest {
|
||||||
amount: string;
|
amount: string;
|
||||||
bankBaseUrl: string;
|
bankBaseUrl: string;
|
||||||
|
/**
|
||||||
|
* Bank access API base URL. Defaults to the bankBaseUrl.
|
||||||
|
*/
|
||||||
|
bankAccessApiBaseUrl: string;
|
||||||
exchangeBaseUrl: string;
|
exchangeBaseUrl: string;
|
||||||
forcedDenomSel?: ForcedDenomSel;
|
forcedDenomSel?: ForcedDenomSel;
|
||||||
}
|
}
|
||||||
@ -1141,6 +1147,7 @@ export const codecForWithdrawTestBalance =
|
|||||||
.property("bankBaseUrl", codecForString())
|
.property("bankBaseUrl", codecForString())
|
||||||
.property("exchangeBaseUrl", codecForString())
|
.property("exchangeBaseUrl", codecForString())
|
||||||
.property("forcedDenomSel", codecForAny())
|
.property("forcedDenomSel", codecForAny())
|
||||||
|
.property("bankAccessApiBaseUrl", codecForString())
|
||||||
.build("WithdrawTestBalanceRequest");
|
.build("WithdrawTestBalanceRequest");
|
||||||
|
|
||||||
export interface ApplyRefundResponse {
|
export interface ApplyRefundResponse {
|
||||||
|
@ -104,7 +104,7 @@ export async function runBankApiTest(t: GlobalTestState) {
|
|||||||
// Make sure that registering twice results in a 409 Conflict
|
// Make sure that registering twice results in a 409 Conflict
|
||||||
{
|
{
|
||||||
const e = await t.assertThrowsTalerErrorAsync(async () => {
|
const e = await t.assertThrowsTalerErrorAsync(async () => {
|
||||||
await BankApi.registerAccount(bank, "user1", "pw1");
|
await BankApi.registerAccount(bank, "user1", "pw2");
|
||||||
});
|
});
|
||||||
t.assertTrue(e.errorDetail.httpStatusCode === 409);
|
t.assertTrue(e.errorDetail.httpStatusCode === 409);
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ export async function runForcedSelectionTest(t: GlobalTestState) {
|
|||||||
exchangeBaseUrl: exchange.baseUrl,
|
exchangeBaseUrl: exchange.baseUrl,
|
||||||
amount: "TESTKUDOS:10",
|
amount: "TESTKUDOS:10",
|
||||||
bankBaseUrl: bank.baseUrl,
|
bankBaseUrl: bank.baseUrl,
|
||||||
|
bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
|
||||||
forcedDenomSel: {
|
forcedDenomSel: {
|
||||||
denoms: [
|
denoms: [
|
||||||
{
|
{
|
||||||
|
@ -57,6 +57,7 @@ export async function runWalletDblessTest(t: GlobalTestState) {
|
|||||||
http,
|
http,
|
||||||
reserveKeyPair.pub,
|
reserveKeyPair.pub,
|
||||||
bank.baseUrl,
|
bank.baseUrl,
|
||||||
|
bank.bankAccessApiBaseUrl,
|
||||||
exchangeInfo,
|
exchangeInfo,
|
||||||
"TESTKUDOS:10",
|
"TESTKUDOS:10",
|
||||||
);
|
);
|
||||||
|
@ -121,6 +121,7 @@ export async function runWallettestingTest(t: GlobalTestState) {
|
|||||||
amountToSpend: "TESTKUDOS:5",
|
amountToSpend: "TESTKUDOS:5",
|
||||||
amountToWithdraw: "TESTKUDOS:10",
|
amountToWithdraw: "TESTKUDOS:10",
|
||||||
bankBaseUrl: bank.baseUrl,
|
bankBaseUrl: bank.baseUrl,
|
||||||
|
bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
|
||||||
exchangeBaseUrl: exchange.baseUrl,
|
exchangeBaseUrl: exchange.baseUrl,
|
||||||
merchantAuthToken: merchantAuthToken,
|
merchantAuthToken: merchantAuthToken,
|
||||||
merchantBaseUrl: merchant.makeInstanceBaseUrl(),
|
merchantBaseUrl: merchant.makeInstanceBaseUrl(),
|
||||||
@ -144,6 +145,7 @@ export async function runWallettestingTest(t: GlobalTestState) {
|
|||||||
await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
|
await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
|
||||||
amount: "TESTKUDOS:10",
|
amount: "TESTKUDOS:10",
|
||||||
bankBaseUrl: bank.baseUrl,
|
bankBaseUrl: bank.baseUrl,
|
||||||
|
bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
|
||||||
exchangeBaseUrl: exchange.baseUrl,
|
exchangeBaseUrl: exchange.baseUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -169,6 +171,7 @@ export async function runWallettestingTest(t: GlobalTestState) {
|
|||||||
await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
|
await wallet.client.call(WalletApiOperation.WithdrawTestBalance, {
|
||||||
amount: "TESTKUDOS:10",
|
amount: "TESTKUDOS:10",
|
||||||
bankBaseUrl: bank.baseUrl,
|
bankBaseUrl: bank.baseUrl,
|
||||||
|
bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
|
||||||
exchangeBaseUrl: exchange.baseUrl,
|
exchangeBaseUrl: exchange.baseUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -197,10 +197,7 @@ export namespace BankApi {
|
|||||||
);
|
);
|
||||||
|
|
||||||
logger.info(`response status ${resp.status}`);
|
logger.info(`response status ${resp.status}`);
|
||||||
const respJson = await readSuccessResponseJsonOrThrow(
|
const respJson = await readSuccessResponseJsonOrThrow(resp, codecForAny());
|
||||||
resp,
|
|
||||||
codecForAny(),
|
|
||||||
);
|
|
||||||
|
|
||||||
// FIXME: We don't check the status here!
|
// FIXME: We don't check the status here!
|
||||||
}
|
}
|
||||||
@ -214,7 +211,7 @@ export namespace BankApi {
|
|||||||
`accounts/${bankUser.username}/withdrawals/${wopi.withdrawal_id}/abort`,
|
`accounts/${bankUser.username}/withdrawals/${wopi.withdrawal_id}/abort`,
|
||||||
bank.baseUrl,
|
bank.baseUrl,
|
||||||
);
|
);
|
||||||
await bank.http.postJson(
|
const resp = await bank.http.postJson(
|
||||||
url.href,
|
url.href,
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
@ -226,6 +223,7 @@ export namespace BankApi {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
await readSuccessResponseJsonOrThrow(resp, codecForAny());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,12 +111,13 @@ export async function topupReserveWithDemobank(
|
|||||||
http: HttpRequestLibrary,
|
http: HttpRequestLibrary,
|
||||||
reservePub: string,
|
reservePub: string,
|
||||||
bankBaseUrl: string,
|
bankBaseUrl: string,
|
||||||
|
bankAccessApiBaseUrl: string,
|
||||||
exchangeInfo: ExchangeInfo,
|
exchangeInfo: ExchangeInfo,
|
||||||
amount: AmountString,
|
amount: AmountString,
|
||||||
) {
|
) {
|
||||||
const bankHandle: BankServiceHandle = {
|
const bankHandle: BankServiceHandle = {
|
||||||
baseUrl: bankBaseUrl,
|
baseUrl: bankBaseUrl,
|
||||||
bankAccessApiBaseUrl: "??", // FIXME!
|
bankAccessApiBaseUrl: bankAccessApiBaseUrl,
|
||||||
http,
|
http,
|
||||||
};
|
};
|
||||||
const bankUser = await BankApi.createRandomBankUser(bankHandle);
|
const bankUser = await BankApi.createRandomBankUser(bankHandle);
|
||||||
|
@ -348,6 +348,7 @@ export async function runIntegrationTest(
|
|||||||
await withdrawTestBalance(ws, {
|
await withdrawTestBalance(ws, {
|
||||||
amount: args.amountToWithdraw,
|
amount: args.amountToWithdraw,
|
||||||
bankBaseUrl: args.bankBaseUrl,
|
bankBaseUrl: args.bankBaseUrl,
|
||||||
|
bankAccessApiBaseUrl: args.bankAccessApiBaseUrl,
|
||||||
exchangeBaseUrl: args.exchangeBaseUrl,
|
exchangeBaseUrl: args.exchangeBaseUrl,
|
||||||
});
|
});
|
||||||
await ws.runUntilDone();
|
await ws.runUntilDone();
|
||||||
@ -376,6 +377,7 @@ export async function runIntegrationTest(
|
|||||||
await withdrawTestBalance(ws, {
|
await withdrawTestBalance(ws, {
|
||||||
amount: Amounts.stringify(withdrawAmountTwo),
|
amount: Amounts.stringify(withdrawAmountTwo),
|
||||||
bankBaseUrl: args.bankBaseUrl,
|
bankBaseUrl: args.bankBaseUrl,
|
||||||
|
bankAccessApiBaseUrl: args.bankBaseUrl,
|
||||||
exchangeBaseUrl: args.exchangeBaseUrl,
|
exchangeBaseUrl: args.exchangeBaseUrl,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -382,6 +382,8 @@ export async function getBankWithdrawalInfo(
|
|||||||
codecForWithdrawOperationStatusResponse(),
|
codecForWithdrawOperationStatusResponse(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
logger.info(`bank withdrawal operation status: ${j2s(status)}`);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
amount: Amounts.parseOrThrow(status.amount),
|
amount: Amounts.parseOrThrow(status.amount),
|
||||||
confirmTransferUrl: status.confirm_transfer_url,
|
confirmTransferUrl: status.confirm_transfer_url,
|
||||||
|
@ -740,6 +740,7 @@ async function dispatchRequestInternal(
|
|||||||
await withdrawTestBalance(ws, {
|
await withdrawTestBalance(ws, {
|
||||||
amount: "TESTKUDOS:10",
|
amount: "TESTKUDOS:10",
|
||||||
bankBaseUrl: "https://bank.test.taler.net/",
|
bankBaseUrl: "https://bank.test.taler.net/",
|
||||||
|
bankAccessApiBaseUrl: "https://bank.test.taler.net/",
|
||||||
exchangeBaseUrl: "https://exchange.test.taler.net/",
|
exchangeBaseUrl: "https://exchange.test.taler.net/",
|
||||||
});
|
});
|
||||||
return {};
|
return {};
|
||||||
|
Loading…
Reference in New Issue
Block a user