aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-cli
diff options
context:
space:
mode:
authorFlorian Dold <florian@dold.me>2023-05-11 14:16:48 +0200
committerFlorian Dold <florian@dold.me>2023-05-11 14:16:48 +0200
commitedd3a39a0ca01a299b6d9ebed8d34c29a9c3bb30 (patch)
tree46dd32585bbc9a7005330c79f621193f49e4330e /packages/taler-wallet-cli
parent1d718dda1d2fdb079e3712c2f27a8c7694f98fe1 (diff)
downloadwallet-core-edd3a39a0ca01a299b6d9ebed8d34c29a9c3bb30.tar.xz
taler-util: remove deprecated function
Diffstat (limited to 'packages/taler-wallet-cli')
-rw-r--r--packages/taler-wallet-cli/src/index.ts97
1 files changed, 49 insertions, 48 deletions
diff --git a/packages/taler-wallet-cli/src/index.ts b/packages/taler-wallet-cli/src/index.ts
index 66d2d92e0..f713635a2 100644
--- a/packages/taler-wallet-cli/src/index.ts
+++ b/packages/taler-wallet-cli/src/index.ts
@@ -21,7 +21,6 @@ import {
AbsoluteTime,
addPaytoQueryParams,
AgeRestriction,
- classifyTalerUri,
codecForList,
codecForString,
CoreApiResponse,
@@ -32,13 +31,14 @@ import {
j2s,
Logger,
parsePaytoUri,
+ parseTalerUri,
PreparePayResultType,
RecoveryMergeStrategy,
sampleWalletCoreTransactions,
setDangerousTimetravel,
setGlobalLogLevelFromString,
summarizeTalerErrorDetail,
- TalerUriType,
+ TalerUriAction,
WalletNotification,
} from "@gnu-taler/taler-util";
import { clk } from "@gnu-taler/taler-util/clk";
@@ -639,70 +639,68 @@ walletCli
} else {
uri = await readlinePrompt("Taler URI: ");
}
- const uriType = classifyTalerUri(uri);
- switch (uriType) {
- case TalerUriType.TalerPay:
+ const parsedTalerUri = parseTalerUri(uri);
+ if (!parsedTalerUri) {
+ throw Error("invalid taler URI");
+ }
+ switch (parsedTalerUri.type) {
+ case TalerUriAction.Pay:
await doPay(wallet.client, uri, {
alwaysYes: args.handleUri.autoYes,
});
break;
- case TalerUriType.TalerTip:
- {
- const res = await wallet.client.call(
- WalletApiOperation.PrepareTip,
- {
- talerTipUri: uri,
- },
- );
- console.log("tip status", res);
- await wallet.client.call(WalletApiOperation.AcceptTip, {
- walletTipId: res.walletTipId,
- });
- }
+ case TalerUriAction.Tip: {
+ const res = await wallet.client.call(WalletApiOperation.PrepareTip, {
+ talerTipUri: uri,
+ });
+ console.log("tip status", res);
+ await wallet.client.call(WalletApiOperation.AcceptTip, {
+ walletTipId: res.walletTipId,
+ });
break;
- case TalerUriType.TalerRefund:
+ }
+ case TalerUriAction.Refund:
await wallet.client.call(WalletApiOperation.StartRefundQueryForUri, {
talerRefundUri: uri,
});
break;
- case TalerUriType.TalerWithdraw:
- {
- const withdrawInfo = await wallet.client.call(
- WalletApiOperation.GetWithdrawalDetailsForUri,
- {
- talerWithdrawUri: uri,
- restrictAge: args.handleUri.restrictAge,
- },
- );
- console.log("withdrawInfo", withdrawInfo);
- const selectedExchange =
- args.handleUri.withdrawalExchange ??
- withdrawInfo.defaultExchangeBaseUrl;
- if (!selectedExchange) {
- console.error(
- "no exchange specified for withdrawal (and no exchange suggested by the bank)",
- );
- processExit(1);
- return;
- }
- const res = await wallet.client.call(
- WalletApiOperation.AcceptBankIntegratedWithdrawal,
- {
- exchangeBaseUrl: selectedExchange,
- talerWithdrawUri: uri,
- },
+ case TalerUriAction.Withdraw: {
+ const withdrawInfo = await wallet.client.call(
+ WalletApiOperation.GetWithdrawalDetailsForUri,
+ {
+ talerWithdrawUri: uri,
+ restrictAge: args.handleUri.restrictAge,
+ },
+ );
+ console.log("withdrawInfo", withdrawInfo);
+ const selectedExchange =
+ args.handleUri.withdrawalExchange ??
+ withdrawInfo.defaultExchangeBaseUrl;
+ if (!selectedExchange) {
+ console.error(
+ "no exchange specified for withdrawal (and no exchange suggested by the bank)",
);
- console.log("accept withdrawal response", res);
+ processExit(1);
+ return;
}
+ const res = await wallet.client.call(
+ WalletApiOperation.AcceptBankIntegratedWithdrawal,
+ {
+ exchangeBaseUrl: selectedExchange,
+ talerWithdrawUri: uri,
+ },
+ );
+ console.log("accept withdrawal response", res);
break;
- case TalerUriType.TalerDevExperiment: {
+ }
+ case TalerUriAction.DevExperiment: {
await wallet.client.call(WalletApiOperation.ApplyDevExperiment, {
devExperimentUri: uri,
});
break;
}
default:
- console.log(`URI type (${uriType}) not handled`);
+ console.log(`URI type (${parsedTalerUri}) not handled`);
break;
}
return;
@@ -1683,3 +1681,6 @@ async function read(stream: NodeJS.ReadStream) {
export function main() {
walletCli.run();
}
+function classifyTalerUri(uri: string) {
+ throw new Error("Function not implemented.");
+}