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
|
// Make sure that registering twice results in a 409 Conflict
|
||||||
{
|
{
|
||||||
const e = await t.assertThrowsTalerErrorAsync(async () => {
|
const e = await t.assertThrowsTalerErrorAsync(async () => {
|
||||||
await bankClient.registerAccount("user1", "pw1");
|
await bankClient.registerAccount("user1", "pw2");
|
||||||
});
|
});
|
||||||
t.assertTrue(e.errorDetail.httpStatusCode === 409);
|
t.assertTrue(e.errorDetail.httpStatusCode === 409);
|
||||||
}
|
}
|
||||||
|
@ -50,13 +50,14 @@ export async function runDenomUnofferedTest(t: GlobalTestState) {
|
|||||||
// Effectively we completely reset the exchange,
|
// Effectively we completely reset the exchange,
|
||||||
// but keep the exchange master public key.
|
// but keep the exchange master public key.
|
||||||
|
|
||||||
|
await merchant.stop();
|
||||||
|
|
||||||
await exchange.stop();
|
await exchange.stop();
|
||||||
await exchange.purgeDatabase();
|
await exchange.purgeDatabase();
|
||||||
await exchange.purgeSecmodKeys();
|
await exchange.purgeSecmodKeys();
|
||||||
await exchange.start();
|
await exchange.start();
|
||||||
await exchange.pingUntilAvailable();
|
await exchange.pingUntilAvailable();
|
||||||
|
|
||||||
await merchant.stop();
|
|
||||||
await merchant.start();
|
await merchant.start();
|
||||||
await merchant.pingUntilAvailable();
|
await merchant.pingUntilAvailable();
|
||||||
|
|
||||||
|
@ -123,13 +123,15 @@ export async function runPaymentMultipleTest(t: GlobalTestState) {
|
|||||||
|
|
||||||
// Withdraw digital cash into the wallet.
|
// Withdraw digital cash into the wallet.
|
||||||
|
|
||||||
await withdrawViaBankV2(t, {
|
const wres = await withdrawViaBankV2(t, {
|
||||||
walletClient,
|
walletClient,
|
||||||
bank,
|
bank,
|
||||||
exchange,
|
exchange,
|
||||||
amount: "TESTKUDOS:100",
|
amount: "TESTKUDOS:100",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await wres.withdrawalFinishedCond;
|
||||||
|
|
||||||
// Set up order.
|
// Set up order.
|
||||||
|
|
||||||
const orderResp = await merchantClient.createOrder({
|
const orderResp = await merchantClient.createOrder({
|
||||||
|
@ -44,13 +44,15 @@ export async function runRefundGoneTest(t: GlobalTestState) {
|
|||||||
|
|
||||||
// Withdraw digital cash into the wallet.
|
// Withdraw digital cash into the wallet.
|
||||||
|
|
||||||
await withdrawViaBankV2(t, {
|
const wres = await withdrawViaBankV2(t, {
|
||||||
walletClient,
|
walletClient,
|
||||||
bank,
|
bank,
|
||||||
exchange,
|
exchange,
|
||||||
amount: "TESTKUDOS:20",
|
amount: "TESTKUDOS:20",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await wres.withdrawalFinishedCond;
|
||||||
|
|
||||||
// Set up order.
|
// Set up order.
|
||||||
|
|
||||||
const orderResp = await merchantClient.createOrder({
|
const orderResp = await merchantClient.createOrder({
|
||||||
|
@ -19,7 +19,9 @@
|
|||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
Amounts,
|
Amounts,
|
||||||
|
Duration,
|
||||||
MerchantApiClient,
|
MerchantApiClient,
|
||||||
|
MerchantContractTerms,
|
||||||
PreparePayResultType,
|
PreparePayResultType,
|
||||||
} from "@gnu-taler/taler-util";
|
} from "@gnu-taler/taler-util";
|
||||||
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
import { WalletApiOperation } from "@gnu-taler/taler-wallet-core";
|
||||||
@ -41,7 +43,18 @@ export async function runWalletBalanceTest(t: GlobalTestState) {
|
|||||||
const { merchant, walletClient, exchange, bank } =
|
const { merchant, walletClient, exchange, bank } =
|
||||||
await createSimpleTestkudosEnvironmentV2(t);
|
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.
|
// Withdraw digital cash into the wallet.
|
||||||
|
|
||||||
@ -54,7 +67,7 @@ export async function runWalletBalanceTest(t: GlobalTestState) {
|
|||||||
|
|
||||||
await wres.withdrawalFinishedCond;
|
await wres.withdrawalFinishedCond;
|
||||||
|
|
||||||
const order = {
|
const order: Partial<MerchantContractTerms> = {
|
||||||
summary: "Buy me!",
|
summary: "Buy me!",
|
||||||
amount: "TESTKUDOS:5",
|
amount: "TESTKUDOS:5",
|
||||||
fulfillment_url: "taler://fulfillment-success/thx",
|
fulfillment_url: "taler://fulfillment-success/thx",
|
||||||
|
@ -588,22 +588,22 @@ async function selectPayMerchantCandidates(
|
|||||||
for (const acc of exchangeDetails.wireInfo.accounts) {
|
for (const acc of exchangeDetails.wireInfo.accounts) {
|
||||||
const pp = parsePaytoUri(acc.payto_uri);
|
const pp = parsePaytoUri(acc.payto_uri);
|
||||||
checkLogicInvariant(!!pp);
|
checkLogicInvariant(!!pp);
|
||||||
if (pp.targetType === req.wireMethod) {
|
if (pp.targetType !== req.wireMethod) {
|
||||||
// also check that wire method is supported now
|
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;
|
|
||||||
}
|
}
|
||||||
|
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) {
|
if (!wireMethodFee) {
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user