aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-util/src/wallet-types.ts
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-01-10 17:11:34 -0300
committerSebastian <sebasjm@gmail.com>2023-01-11 15:30:14 -0300
commit335d22b12b3d8ed1a14d39bf8ca17faade9ca34c (patch)
treeb70fa6cb38fdd0951287da17b51671497cce7678 /packages/taler-util/src/wallet-types.ts
parent52be8c915885351cf79f065a7c1787ce8ee7ec89 (diff)
downloadwallet-core-335d22b12b3d8ed1a14d39bf8ca17faade9ca34c.tar.xz
when as number instead of string, fix codec used before declaration, pretty
Diffstat (limited to 'packages/taler-util/src/wallet-types.ts')
-rw-r--r--packages/taler-util/src/wallet-types.ts120
1 files changed, 60 insertions, 60 deletions
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index 1ad5ef0ec..c32bb94e5 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -249,7 +249,7 @@ export interface ConfirmPayResultPending {
export const codecForTalerErrorDetail = (): Codec<TalerErrorDetail> =>
buildCodecForObject<TalerErrorDetail>()
.property("code", codecForNumber())
- .property("when", codecForString())
+ .property("when", codecForAbsoluteTime)
.property("hint", codecOptional(codecForString()))
.build("TalerErrorDetail");
@@ -408,6 +408,64 @@ export const codecForPreparePayResultPaymentPossible =
)
.build("PreparePayResultPaymentPossible");
+/**
+ * Detailed reason for why the wallet's balance is insufficient.
+ */
+export interface PayMerchantInsufficientBalanceDetails {
+ /**
+ * 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;
+
+ /**
+ * Balance of type "age-acceptable" (see balance.ts for definition).
+ */
+ balanceAgeAcceptable: AmountString;
+
+ /**
+ * Balance of type "merchant-acceptable" (see balance.ts for definition).
+ */
+ balanceMerchantAcceptable: AmountString;
+
+ /**
+ * Balance of type "merchant-depositable" (see balance.ts for definition).
+ */
+ balanceMerchantDepositable: AmountString;
+
+ /**
+ * If the payment would succeed without fees
+ * (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;
+}
+
+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");
+
export const codecForPreparePayResultInsufficientBalance =
(): Codec<PreparePayResultInsufficientBalance> =>
buildCodecForObject<PreparePayResultInsufficientBalance>()
@@ -538,7 +596,7 @@ export interface WalletDiagnostics {
export interface TalerErrorDetail {
code: TalerErrorCode;
- when?: string;
+ when: AbsoluteTime;
hint?: string;
[x: string]: unknown;
}
@@ -2102,64 +2160,6 @@ export interface InitiatePeerPullPaymentResponse {
/**
* Detailed reason for why the wallet's balance is insufficient.
*/
-export interface PayMerchantInsufficientBalanceDetails {
- /**
- * 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;
-
- /**
- * Balance of type "age-acceptable" (see balance.ts for definition).
- */
- balanceAgeAcceptable: AmountString;
-
- /**
- * Balance of type "merchant-acceptable" (see balance.ts for definition).
- */
- balanceMerchantAcceptable: AmountString;
-
- /**
- * Balance of type "merchant-depositable" (see balance.ts for definition).
- */
- balanceMerchantDepositable: AmountString;
-
- /**
- * If the payment would succeed without fees
- * (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;
-}
-
-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.