aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-util')
-rw-r--r--packages/taler-util/src/taler-error-codes.ts8
-rw-r--r--packages/taler-util/src/wallet-types.ts65
2 files changed, 59 insertions, 14 deletions
diff --git a/packages/taler-util/src/taler-error-codes.ts b/packages/taler-util/src/taler-error-codes.ts
index 8bac5bffb..5e3c8fdfb 100644
--- a/packages/taler-util/src/taler-error-codes.ts
+++ b/packages/taler-util/src/taler-error-codes.ts
@@ -3241,6 +3241,14 @@ export enum TalerErrorCode {
/**
+ * The wallet does not have sufficient balance to create a peer push payment.
+ * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ WALLET_PEER_PUSH_PAYMENT_INSUFFICIENT_BALANCE = 7027,
+
+
+ /**
* We encountered a timeout with our payment backend.
* Returned with an HTTP status code of #MHD_HTTP_GATEWAY_TIMEOUT (504).
* (A value of 0 indicates that the error is generated client-side).
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index b63e043f5..3a1176021 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -419,7 +419,10 @@ export const codecForPreparePayResultInsufficientBalance =
"status",
codecForConstString(PreparePayResultType.InsufficientBalance),
)
- .property("balanceDetails", codecForPayMerchantInsufficientBalanceDetails())
+ .property(
+ "balanceDetails",
+ codecForPayMerchantInsufficientBalanceDetails(),
+ )
.build("PreparePayResultInsufficientBalance");
export const codecForPreparePayResultAlreadyConfirmed =
@@ -2084,7 +2087,6 @@ export interface InitiatePeerPullPaymentResponse {
transactionId: string;
}
-
/**
* Detailed reason for why the wallet's balance is insufficient.
*/
@@ -2124,23 +2126,58 @@ export interface PayMerchantInsufficientBalanceDetails {
* (i.e. balanceMechantWireable >= amountRequested),
* this field contains an estimate of the amount that would additionally
* be required to cover the fees.
- *
+ *
* It is not possible to give an exact value here, since it depends
* on the coin selection for the amount that would be additionally withdrawn.
*/
feeGapEstimate: AmountString;
}
-const codecForPayMerchantInsufficientBalanceDetails =
-(): Codec<PayMerchantInsufficientBalanceDetails> =>
- buildCodecForObject<PayMerchantInsufficientBalanceDetails>()
- .property("amountRequested", codecForAmountString())
- .property("balanceAgeAcceptable", codecForAmountString())
- .property("balanceAvailable", codecForAmountString())
- .property("balanceMaterial", codecForAmountString())
- .property("balanceMerchantAcceptable", codecForAmountString())
- .property("balanceMerchantDepositable", codecForAmountString())
- .property("feeGapEstimate", codecForAmountString())
- .build("PayMerchantInsufficientBalanceDetails");
+export const codecForPayMerchantInsufficientBalanceDetails =
+ (): Codec<PayMerchantInsufficientBalanceDetails> =>
+ buildCodecForObject<PayMerchantInsufficientBalanceDetails>()
+ .property("amountRequested", codecForAmountString())
+ .property("balanceAgeAcceptable", codecForAmountString())
+ .property("balanceAvailable", codecForAmountString())
+ .property("balanceMaterial", codecForAmountString())
+ .property("balanceMerchantAcceptable", codecForAmountString())
+ .property("balanceMerchantDepositable", codecForAmountString())
+ .property("feeGapEstimate", codecForAmountString())
+ .build("PayMerchantInsufficientBalanceDetails");
+
+/**
+ * Detailed reason for why the wallet's balance is insufficient.
+ */
+export interface PayPeerInsufficientBalanceDetails {
+ /**
+ * Amount requested by the merchant.
+ */
+ amountRequested: AmountString;
+
+ /**
+ * Balance of type "available" (see balance.ts for definition).
+ */
+ balanceAvailable: AmountString;
+
+ /**
+ * Balance of type "material" (see balance.ts for definition).
+ */
+ balanceMaterial: AmountString;
+ /**
+ * Acceptable balance based on restrictions on which
+ * exchange can be used.
+ */
+ balanceExchangeAcceptable: AmountString
+ /**
+ * If the payment would succeed without fees
+ * (i.e. balanceExchangeAcceptable >= amountRequested),
+ * this field contains an estimate of the amount that would additionally
+ * be required to cover the fees.
+ *
+ * It is not possible to give an exact value here, since it depends
+ * on the coin selection for the amount that would be additionally withdrawn.
+ */
+ feeGapEstimate: AmountString;
+}