From 335d22b12b3d8ed1a14d39bf8ca17faade9ca34c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Tue, 10 Jan 2023 17:11:34 -0300 Subject: when as number instead of string, fix codec used before declaration, pretty --- packages/taler-util/src/wallet-types.ts | 120 ++++++++++++++++---------------- 1 file changed, 60 insertions(+), 60 deletions(-) (limited to 'packages/taler-util/src/wallet-types.ts') 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 => buildCodecForObject() .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 => + buildCodecForObject() + .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 => buildCodecForObject() @@ -538,7 +596,7 @@ export interface WalletDiagnostics { export interface TalerErrorDetail { code: TalerErrorCode; - when?: string; + when: AbsoluteTime; hint?: string; [x: string]: unknown; } @@ -2099,64 +2157,6 @@ export interface InitiatePeerPullPaymentResponse { transactionId: string; } -/** - * 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 => - buildCodecForObject() - .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. */ -- cgit v1.2.3