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 {
|
||||
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 {
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ export async function runForcedSelectionTest(t: GlobalTestState) {
|
||||
exchangeBaseUrl: exchange.baseUrl,
|
||||
amount: "TESTKUDOS:10",
|
||||
bankBaseUrl: bank.baseUrl,
|
||||
bankAccessApiBaseUrl: bank.bankAccessApiBaseUrl,
|
||||
forcedDenomSel: {
|
||||
denoms: [
|
||||
{
|
||||
|
@ -57,6 +57,7 @@ export async function runWalletDblessTest(t: GlobalTestState) {
|
||||
http,
|
||||
reserveKeyPair.pub,
|
||||
bank.baseUrl,
|
||||
bank.bankAccessApiBaseUrl,
|
||||
exchangeInfo,
|
||||
"TESTKUDOS:10",
|
||||
);
|
||||
|
@ -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,
|
||||
});
|
||||
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
});
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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 {};
|
||||
|
Loading…
Reference in New Issue
Block a user