harness: wait for withdrawal, configure instance properly
This commit is contained in:
parent
3ee3ab3ced
commit
6affe04fe6
@ -106,7 +106,7 @@ export async function runBankApiTest(t: GlobalTestState) {
|
||||
// Make sure that registering twice results in a 409 Conflict
|
||||
{
|
||||
const e = await t.assertThrowsTalerErrorAsync(async () => {
|
||||
await bankClient.registerAccount("user1", "pw1");
|
||||
await bankClient.registerAccount("user1", "pw2");
|
||||
});
|
||||
t.assertTrue(e.errorDetail.httpStatusCode === 409);
|
||||
}
|
||||
|
@ -50,13 +50,14 @@ export async function runDenomUnofferedTest(t: GlobalTestState) {
|
||||
// Effectively we completely reset the exchange,
|
||||
// but keep the exchange master public key.
|
||||
|
||||
await merchant.stop();
|
||||
|
||||
await exchange.stop();
|
||||
await exchange.purgeDatabase();
|
||||
await exchange.purgeSecmodKeys();
|
||||
await exchange.start();
|
||||
await exchange.pingUntilAvailable();
|
||||
|
||||
await merchant.stop();
|
||||
await merchant.start();
|
||||
await merchant.pingUntilAvailable();
|
||||
|
||||
|
@ -123,13 +123,15 @@ export async function runPaymentMultipleTest(t: GlobalTestState) {
|
||||
|
||||
// Withdraw digital cash into the wallet.
|
||||
|
||||
await withdrawViaBankV2(t, {
|
||||
const wres = await withdrawViaBankV2(t, {
|
||||
walletClient,
|
||||
bank,
|
||||
exchange,
|
||||
amount: "TESTKUDOS:100",
|
||||
});
|
||||
|
||||
await wres.withdrawalFinishedCond;
|
||||
|
||||
// Set up order.
|
||||
|
||||
const orderResp = await merchantClient.createOrder({
|
||||
|
@ -44,13 +44,15 @@ export async function runRefundGoneTest(t: GlobalTestState) {
|
||||
|
||||
// Withdraw digital cash into the wallet.
|
||||
|
||||
await withdrawViaBankV2(t, {
|
||||
const wres = await withdrawViaBankV2(t, {
|
||||
walletClient,
|
||||
bank,
|
||||
exchange,
|
||||
amount: "TESTKUDOS:20",
|
||||
});
|
||||
|
||||
await wres.withdrawalFinishedCond;
|
||||
|
||||
// Set up order.
|
||||
|
||||
const orderResp = await merchantClient.createOrder({
|
||||
|
@ -19,7 +19,9 @@
|
||||
*/
|
||||
import {
|
||||
Amounts,
|
||||
Duration,
|
||||
MerchantApiClient,
|
||||
MerchantContractTerms,
|
||||
PreparePayResultType,
|
||||
} from "@gnu-taler/taler-util";
|
||||
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
||||
@ -41,7 +43,18 @@ export async function runWalletBalanceTest(t: GlobalTestState) {
|
||||
const { merchant, walletClient, exchange, bank } =
|
||||
await createSimpleTestkudosEnvironmentV2(t);
|
||||
|
||||
const merchantClient = new MerchantApiClient(merchant.makeInstanceBaseUrl());
|
||||
await merchant.addInstanceWithWireAccount({
|
||||
id: "myinst",
|
||||
name: "My Instance",
|
||||
paytoUris: ["payto://void/foo"],
|
||||
defaultWireTransferDelay: Duration.toTalerProtocolDuration(
|
||||
Duration.fromSpec({ minutes: 1 }),
|
||||
),
|
||||
});
|
||||
|
||||
const merchantClient = new MerchantApiClient(
|
||||
merchant.makeInstanceBaseUrl("myinst"),
|
||||
);
|
||||
|
||||
// Withdraw digital cash into the wallet.
|
||||
|
||||
@ -54,7 +67,7 @@ export async function runWalletBalanceTest(t: GlobalTestState) {
|
||||
|
||||
await wres.withdrawalFinishedCond;
|
||||
|
||||
const order = {
|
||||
const order: Partial<MerchantContractTerms> = {
|
||||
summary: "Buy me!",
|
||||
amount: "TESTKUDOS:5",
|
||||
fulfillment_url: "taler://fulfillment-success/thx",
|
||||
|
@ -588,22 +588,22 @@ async function selectPayMerchantCandidates(
|
||||
for (const acc of exchangeDetails.wireInfo.accounts) {
|
||||
const pp = parsePaytoUri(acc.payto_uri);
|
||||
checkLogicInvariant(!!pp);
|
||||
if (pp.targetType === req.wireMethod) {
|
||||
// also check that wire method is supported now
|
||||
const wireFeeStr = exchangeDetails.wireInfo.feesForType[
|
||||
req.wireMethod
|
||||
]?.find((x) => {
|
||||
return AbsoluteTime.isBetween(
|
||||
AbsoluteTime.now(),
|
||||
AbsoluteTime.fromProtocolTimestamp(x.startStamp),
|
||||
AbsoluteTime.fromProtocolTimestamp(x.endStamp),
|
||||
);
|
||||
})?.wireFee;
|
||||
if (wireFeeStr) {
|
||||
wireMethodFee = wireFeeStr;
|
||||
}
|
||||
break;
|
||||
if (pp.targetType !== req.wireMethod) {
|
||||
continue;
|
||||
}
|
||||
const wireFeeStr = exchangeDetails.wireInfo.feesForType[
|
||||
req.wireMethod
|
||||
]?.find((x) => {
|
||||
return AbsoluteTime.isBetween(
|
||||
AbsoluteTime.now(),
|
||||
AbsoluteTime.fromProtocolTimestamp(x.startStamp),
|
||||
AbsoluteTime.fromProtocolTimestamp(x.endStamp),
|
||||
);
|
||||
})?.wireFee;
|
||||
if (wireFeeStr) {
|
||||
wireMethodFee = wireFeeStr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (!wireMethodFee) {
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user