taler-wallet-cli: allow exchange selection for handle-uri

This commit is contained in:
Florian Dold 2023-04-05 17:43:08 +02:00
parent 2823b1cdf4
commit 451400b3a4
No known key found for this signature in database
GPG Key ID: D2E4F00F29D02A4B

View File

@ -575,6 +575,10 @@ walletCli
help: "Handle a taler:// URI.", help: "Handle a taler:// URI.",
}) })
.maybeArgument("uri", clk.STRING) .maybeArgument("uri", clk.STRING)
.maybeOption("withdrawalExchange", ["--withdrawal-exchange"], clk.STRING, {
help: "Exchange to use for withdrawal operations.",
})
.maybeOption("restrictAge", ["--restrict-age"], clk.INT)
.flag("autoYes", ["-y", "--yes"]) .flag("autoYes", ["-y", "--yes"])
.action(async (args) => { .action(async (args) => {
await withWallet(args, async (wallet) => { await withWallet(args, async (wallet) => {
@ -616,12 +620,17 @@ walletCli
WalletApiOperation.GetWithdrawalDetailsForUri, WalletApiOperation.GetWithdrawalDetailsForUri,
{ {
talerWithdrawUri: uri, talerWithdrawUri: uri,
restrictAge: args.handleUri.restrictAge,
}, },
); );
console.log("withdrawInfo", withdrawInfo); console.log("withdrawInfo", withdrawInfo);
const selectedExchange = withdrawInfo.defaultExchangeBaseUrl; const selectedExchange =
args.handleUri.withdrawalExchange ??
withdrawInfo.defaultExchangeBaseUrl;
if (!selectedExchange) { if (!selectedExchange) {
console.error("no suggested exchange!"); console.error(
"no exchange specified for withdrawal (and no exchange suggested by the bank)",
);
processExit(1); processExit(1);
return; return;
} }