commit 8876292c3fcf2b5493b5398ea0f10cd73b386ff2
parent 23b999c4e248e2c4e31755fb1b8b349ff873e7fe
Author: Florian Dold <florian@dold.me>
Date: Mon, 17 Feb 2025 22:04:38 +0100
wallet-core: define cause hints for insufficient balance
Diffstat:
1 file changed, 42 insertions(+), 0 deletions(-)
diff --git a/packages/taler-util/src/types-taler-wallet.ts b/packages/taler-util/src/types-taler-wallet.ts
@@ -748,6 +748,39 @@ export const codecForPreparePayResultPaymentPossible =
export interface BalanceDetails {}
+export enum InsufficientBalanceHint {
+ /**
+ * Merchant doesn't accept money from exchange(s) that the wallet supports.
+ */
+ MerchantAcceptInsufficient = "merchant-accept-insufficient",
+
+ /**
+ * Merchant accepts funds from a matching exchange, but the funds can't be
+ * deposited with the wire method.
+ */
+ MerchantDepositInsufficient = "merchant-deposit-insufficient",
+
+ /**
+ * While in principle the balance is sufficient,
+ * the age restriction on coins causes the spendable
+ * balance to be insufficient.
+ */
+ MerchantAgeRestricted = "merchant-age-restricted",
+
+ /**
+ * Wallet has enough available funds,
+ * but the material funds are insufficient. Usually because there is a
+ * pending refresh operation.
+ */
+ WalletMateriallyInsufficient = "wallet-materially-insufficient",
+
+ /**
+ * Exchange is missing the global fee configuration, thus fees are unknown
+ * and funds from this exchange can't be used for p2p payments.
+ */
+ ExchangeMissingGlobalFees = "exchange-missing-global-fees",
+}
+
/**
* Detailed reason for why the wallet's balance is insufficient.
*/
@@ -799,11 +832,20 @@ export interface PaymentInsufficientBalanceDetails {
balanceReceiverAcceptable: AmountString;
balanceReceiverDepositable: AmountString;
maxEffectiveSpendAmount: AmountString;
+
/**
* Exchange doesn't have global fees configured for the relevant year,
* p2p payments aren't possible.
+ *
+ * @deprecated use causeHint instead
*/
missingGlobalFees: boolean;
+
+ /**
+ * Hint that UIs should show to explain the insufficient
+ * balance.
+ */
+ causeHint?: string | undefined;
};
};
}