[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-wallet-core] 01/03: allow age-restricted withdrawal from the CLI
From: |
gnunet |
Subject: |
[taler-wallet-core] 01/03: allow age-restricted withdrawal from the CLI |
Date: |
Wed, 07 Sep 2022 15:55:59 +0200 |
This is an automated email from the git hooks/post-receive script.
dold pushed a commit to branch master
in repository wallet-core.
commit 3ce5eb4bd85c98113a1f0a91506e50d2179d5550
Author: Florian Dold <florian@dold.me>
AuthorDate: Wed Sep 7 15:40:03 2022 +0200
allow age-restricted withdrawal from the CLI
---
packages/taler-wallet-cli/src/index.ts | 41 ++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/packages/taler-wallet-cli/src/index.ts
b/packages/taler-wallet-cli/src/index.ts
index 2a594bd6..2ed37142 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -49,6 +49,7 @@ import {
AgeRestriction,
getRandomBytes,
encodeCrock,
+ j2s,
} from "@gnu-taler/taler-util";
import {
NodeHttpLib,
@@ -381,6 +382,46 @@ walletCli
});
});
+walletCli
+ .subcommand("withdraw", "withdraw", {
+ help: "Withdraw with a taler://withdraw/ URI",
+ })
+ .requiredArgument("uri", clk.STRING)
+ .maybeOption("restrictAge", ["--restrict-age"], clk.STRING)
+ .action(async (args) => {
+ const uri = args.withdraw.uri;
+ const restrictAge =
+ args.withdraw.restrictAge == null
+ ? undefined
+ : Number.parseInt(args.withdraw.restrictAge);
+ console.log(`age restriction requested (${restrictAge})`);
+ await withWallet(args, async (wallet) => {
+ const withdrawInfo = await wallet.client.call(
+ WalletApiOperation.GetWithdrawalDetailsForUri,
+ {
+ talerWithdrawUri: uri,
+ restrictAge,
+ },
+ );
+ console.log("withdrawInfo", withdrawInfo);
+ const selectedExchange = withdrawInfo.defaultExchangeBaseUrl;
+ if (!selectedExchange) {
+ console.error("no suggested exchange!");
+ process.exit(1);
+ return;
+ }
+ const res = await wallet.client.call(
+ WalletApiOperation.AcceptBankIntegratedWithdrawal,
+ {
+ exchangeBaseUrl: selectedExchange,
+ talerWithdrawUri: uri,
+ restrictAge,
+ },
+ );
+ console.log(j2s(res));
+ });
+ });
+
walletCli
.subcommand("handleUri", "handle-uri", {
help: "Handle a taler:// URI.",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.