commit 6c33d36abb293fa553d4a24359d6fb41c4521dee
parent 246e2ebfedd3445c06bb871ba1e4fbd603ca7d67
Author: Iván Ávalos <avalos@disroot.org>
Date: Thu, 31 Jul 2025 18:21:25 +0200
taler-util: add contract choice description fields
Diffstat:
1 file changed, 18 insertions(+), 0 deletions(-)
diff --git a/packages/taler-util/src/types-taler-merchant.ts b/packages/taler-util/src/types-taler-merchant.ts
@@ -716,6 +716,13 @@ export interface MerchantContractChoice {
// before transferring it to the merchant.
amount: AmountString;
+ // Human readable description of the semantics of the choice
+ // within the contract to be shown to the user at payment.
+ description?: string;
+
+ // Map from IETF 47 language tags to localized descriptions.
+ description_i18n?: InternationalizedString;
+
// List of inputs the wallet must provision (all of them) to
// satisfy the conditions for the contract.
inputs: MerchantContractInput[];
@@ -1030,6 +1037,8 @@ export const codecForMerchantContractChoice =
(): Codec<MerchantContractChoice> =>
buildCodecForObject<MerchantContractChoice>()
.property("amount", codecForAmountString())
+ .property("description", codecOptional(codecForString()))
+ .property("description_i18n", codecOptional(codecForInternationalizedString()))
.property("inputs", codecForList(codecForMerchantContractInput()))
.property("outputs", codecForList(codecForMerchantContractOutput()))
.property("max_fee", codecForAmountString())
@@ -3145,6 +3154,13 @@ export interface OrderChoice {
// fees from that amount before transferring it to the merchant.
amount: AmountString;
+ // Human readable description of the semantics of the choice
+ // within the contract to be shown to the user at payment.
+ description?: string;
+
+ // Map from IETF 47 language tags to localized descriptions.
+ description_i18n?: InternationalizedString;
+
// Inputs that must be provided by the customer, if this choice is selected.
// Defaults to empty array if not specified.
inputs?: OrderInput[];
@@ -3994,6 +4010,8 @@ export const codecForOrder = (): Codec<Order> =>
export const codecForOrderChoice = (): Codec<OrderChoice> =>
buildCodecForObject<OrderChoice>()
.property("amount", codecForAmountString())
+ .property("description", codecOptional(codecForString()))
+ .property("description_i18n", codecOptional(codecForInternationalizedString()))
.property("max_fee", codecOptional(codecForAmountString()))
.property("inputs", codecOptional(codecForList(codecForOrderInput())))
.property("outputs", codecOptional(codecForList(codecForOrderOutput())))