diff options
author | Florian Dold <florian@dold.me> | 2023-01-05 18:45:49 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-01-05 18:45:54 +0100 |
commit | 92f1b5928c764b3af12a29b97bbc3e434a82b1b0 (patch) | |
tree | 040f88aa54aec8fedb99ba57ad18218715d19e25 /packages/taler-util/src/wallet-types.ts | |
parent | 44aaa7a636ba25b37c1c26a306e64e0db75a2747 (diff) | |
download | wallet-core-92f1b5928c764b3af12a29b97bbc3e434a82b1b0.tar.xz |
wallet-core: implement insufficient balance details
For now, only for merchant payments
Diffstat (limited to 'packages/taler-util/src/wallet-types.ts')
-rw-r--r-- | packages/taler-util/src/wallet-types.ts | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts index d7685fa6e..6b3e39794 100644 --- a/packages/taler-util/src/wallet-types.ts +++ b/packages/taler-util/src/wallet-types.ts @@ -419,6 +419,7 @@ export const codecForPreparePayResultInsufficientBalance = "status", codecForConstString(PreparePayResultType.InsufficientBalance), ) + .property("balanceDetails", codecForPayMerchantInsufficientBalanceDetails()) .build("PreparePayResultInsufficientBalance"); export const codecForPreparePayResultAlreadyConfirmed = @@ -483,6 +484,7 @@ export interface PreparePayResultInsufficientBalance { amountRaw: string; noncePriv: string; talerUri: string; + balanceDetails: PayMerchantInsufficientBalanceDetails; } export interface PreparePayResultAlreadyConfirmed { @@ -2090,32 +2092,32 @@ export interface PayMerchantInsufficientBalanceDetails { /** * Amount requested by the merchant. */ - amountRequested: AmountJson; + amountRequested: AmountString; /** * Balance of type "available" (see balance.ts for definition). */ - balanceAvailable: AmountJson; + balanceAvailable: AmountString; /** * Balance of type "material" (see balance.ts for definition). */ - balanceMaterial: AmountJson; + balanceMaterial: AmountString; /** * Balance of type "age-acceptable" (see balance.ts for definition). */ - balanceAgeAcceptable: AmountJson; + balanceAgeAcceptable: AmountString; /** * Balance of type "merchant-acceptable" (see balance.ts for definition). */ - balanceMechantAcceptable: AmountJson; + balanceMerchantAcceptable: AmountString; /** * Balance of type "merchant-depositable" (see balance.ts for definition). */ - balanceMechantDepositable: AmountJson; + balanceMerchantDepositable: AmountString; /** * If the payment would succeed without fees @@ -2126,5 +2128,17 @@ export interface PayMerchantInsufficientBalanceDetails { * 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: AmountJson; -}
\ No newline at end of file + 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");
\ No newline at end of file |