commit 54dfaa7d739f259cd4f7210df57ef163977093b7
parent f6cb7a8193a01f9d3c050631cea181b8864162db
Author: Christian Blättler <blatc2@bfh.ch>
Date: Sun, 10 Mar 2024 19:53:03 +0100
add merchant struct to contract datastructure
Diffstat:
1 file changed, 134 insertions(+), 98 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_contract.h b/src/backend/taler-merchant-httpd_contract.h
@@ -40,8 +40,8 @@ enum TALER_MerchantContractVersion
};
/**
-* Possible token classes.
-*/
+ * Possible token classes.
+ */
enum TALER_MerchantContractTokenClass
{
@@ -57,8 +57,8 @@ enum TALER_MerchantContractTokenClass
};
/**
-* Possible input types for the contract terms.
-*/
+ * Possible input types for the contract terms.
+ */
enum TALER_MerchantContractInputType
{
@@ -74,8 +74,8 @@ enum TALER_MerchantContractInputType
};
/**
-* Contract input (part of the v1 contract terms).
-*/
+ * Contract input (part of the v1 contract terms).
+ */
struct TALER_MerchantContractInput
{
/**
@@ -122,8 +122,8 @@ struct TALER_MerchantContractInput
};
/**
-* Possible output types for the contract terms.
-*/
+ * Possible output types for the contract terms.
+ */
enum TALER_MerchantContractOutputType
{
@@ -145,8 +145,8 @@ enum TALER_MerchantContractOutputType
};
/**
-* Contract output (part of the v1 contract terms).
-*/
+ * Contract output (part of the v1 contract terms).
+ */
struct TALER_MerchantContractOutput
{
/**
@@ -203,188 +203,224 @@ struct TALER_MerchantContractOutput
};
/**
-* Contract choice (part of the v1 contract terms).
-*/
+ * Contract choice (part of the v1 contract terms).
+ */
struct TALER_MerchantContractChoice
{
/**
- * Summary of the order.
- */
+ * Summary of the order.
+ */
const char *summary;
/**
- * Internationalized summary.
- */
+ * Internationalized summary.
+ */
json_t *summary_i18n;
/**
- * URL that will show that the order was successful
- * after it has been paid for.
- */
+ * URL that will show that the order was successful
+ * after it has been paid for.
+ */
const char *fulfillment_url;
/**
- * Message shown to the customer after paying for the order.
- * Either fulfillment_url or fulfillment_message must be specified.
- */
+ * Message shown to the customer after paying for the order.
+ * Either fulfillment_url or fulfillment_message must be specified.
+ */
const char *fulfillment_message;
/**
- * Map from IETF BCP 47 language tags to localized fulfillment messages.
- */
+ * Map from IETF BCP 47 language tags to localized fulfillment messages.
+ */
json_t *fulfillment_message_i18n;
/**
- * Array of products that are part of the purchase.
- */
+ * Array of products that are part of the purchase.
+ */
const json_t *products;
/**
- * List of inputs the wallet must provision (all of them) to satisfy the
- * conditions for the contract.
- */
+ * List of inputs the wallet must provision (all of them) to satisfy the
+ * conditions for the contract.
+ */
struct TALER_MerchantContractInput *inputs;
/**
- * Length of the @e inputs array.
- */
+ * Length of the @e inputs array.
+ */
unsigned int inputs_len;
/**
- * List of outputs the merchant promises to yield (all of them) once
- * the contract is paid.
- */
+ * List of outputs the merchant promises to yield (all of them) once
+ * the contract is paid.
+ */
struct TALER_MerchantContractOutput *ouputs;
/**
- * Length of the @e outputs array.
- */
+ * Length of the @e outputs array.
+ */
unsigned int outputs_len;
};
struct TALER_MerchantContractLimits
{
/**
- * Currency these limits are for.
- */
+ * Currency these limits are for.
+ */
char currency[TALER_CURRENCY_LEN];
/**
- * The hash of the merchant instance's wire details.
- */
+ * The hash of the merchant instance's wire details.
+ */
struct TALER_MerchantWireHashP h_wire;
/**
- * Wire transfer method identifier for the wire method associated with ``h_wire``.
- * The wallet may only select exchanges via a matching auditor if the
- * exchange also supports this wire method.
- * The wire transfer fees must be added based on this wire transfer method.
- */
+ * Wire transfer method identifier for the wire method associated with ``h_wire``.
+ * The wallet may only select exchanges via a matching auditor if the
+ * exchange also supports this wire method.
+ * The wire transfer fees must be added based on this wire transfer method.
+ */
char *wire_method;
/**
- * Maximum total deposit fee accepted by the merchant for this contract.
- */
+ * Maximum total deposit fee accepted by the merchant for this contract.
+ */
struct TALER_Amount max_fee;
};
/**
-* Struct to hold contract terms in v0 and v1 format. v0 contracts are mdoelled
-* as a v1 contract with a single choice and no inputs and outputs. Use the
-* version field to explicitly differentiate between v0 and v1 contracts.
-*/
+ * Struct to hold contract terms in v0 and v1 format. v0 contracts are mdoelled
+ * as a v1 contract with a single choice and no inputs and outputs. Use the
+ * version field to explicitly differentiate between v0 and v1 contracts.
+ */
struct TALER_MerchantContract
{
/**
- * URL where the same contract could be ordered again (if available).
- */
+ * URL where the same contract could be ordered again (if available).
+ */
const char *public_reorder_url;
/**
- * Our order ID.
- */
+ * Our order ID.
+ */
const char *order_id;
/**
- * Merchant base URL.
- */
+ * Merchant base URL.
+ */
char *merchant_base_url;
/**
- * Price to be paid for the transaction. Could be 0. The price is in addition
- * to other instruments, such as rations and tokens.
- * The exchange will subtract deposit fees from that amount
- * before transferring it to the merchant.
- */
+ * Merchant information.
+ */
+ struct
+ {
+ /**
+ * Legal name of the instance
+ */
+ char *name;
+
+ /**
+ * Merchant's site url
+ */
+ char *website;
+
+ /**
+ * Email contact for customers
+ */
+ char *email;
+
+ /**
+ * merchant's logo data uri
+ */
+ char *logo;
+
+ /**
+ * Merchant address
+ */
+ json_t *address;
+
+ /**
+ * Jurisdiction of the business
+ */
+ json_t *jurisdiction;
+ } merchant;
+
+ /**
+ * Price to be paid for the transaction. Could be 0. The price is in addition
+ * to other instruments, such as rations and tokens.
+ * The exchange will subtract deposit fees from that amount
+ * before transferring it to the merchant.
+ */
struct TALER_Amount brutto;
/**
- * Timestamp of the order.
- */
+ * Timestamp of the order.
+ */
struct GNUNET_TIME_Timestamp timestamp;
/**
- * Deadline for refunds.
- */
+ * Deadline for refunds.
+ */
struct GNUNET_TIME_Timestamp refund_deadline;
/**
- * Specifies for how long the wallet should try to get an
- * automatic refund for the purchase.
- */
+ * Specifies for how long the wallet should try to get an
+ * automatic refund for the purchase.
+ */
struct GNUNET_TIME_Relative auto_refund;
/**
- * Payment deadline.
- */
+ * Payment deadline.
+ */
struct GNUNET_TIME_Timestamp pay_deadline;
/**
- * Wire transfer deadline.
- */
+ * Wire transfer deadline.
+ */
struct GNUNET_TIME_Timestamp wire_deadline;
/**
- * Delivery date.
- */
+ * Delivery date.
+ */
struct GNUNET_TIME_Timestamp delivery_date;
/**
- * Delivery location.
- */
+ * Delivery location.
+ */
json_t *delivery_location;
/**
- * Nonce generated by the wallet and echoed by the merchant
- * in this field when the proposal is generated.
- */
+ * Nonce generated by the wallet and echoed by the merchant
+ * in this field when the proposal is generated.
+ */
const char *nonce;
/**
- * Extra data that is only interpreted by the merchant frontend.
- */
+ * Extra data that is only interpreted by the merchant frontend.
+ */
const json_t *extra;
/**
- * Specified version of the contract.
- */
+ * Specified version of the contract.
+ */
enum TALER_MerchantContractVersion version;
/**
- * Array of possible specific contracts the wallet/customer may choose
- * from by selecting the respective index when signing the deposit
- * confirmation.
- */
+ * Array of possible specific contracts the wallet/customer may choose
+ * from by selecting the respective index when signing the deposit
+ * confirmation.
+ */
struct TALER_MerchantContractChoice *choices;
/**
- * Length of the @e choices array.
- */
+ * Length of the @e choices array.
+ */
unsigned int choices_len;
/**
- * Array of token authorities.
- */
+ * Array of token authorities.
+ */
struct
{
/**
@@ -485,18 +521,18 @@ struct TALER_MerchantContract
} *token_authorities;
/**
- * Length of the @e token_authorities array.
- */
+ * Length of the @e token_authorities array.
+ */
unsigned int token_authorities_len;
/**
- * Array of fee limits and wire account details by currency.
- */
+ * Array of fee limits and wire account details by currency.
+ */
struct TALER_MerchantContractLimits *limits;
/**
- * Length of the @e limits array;
- */
+ * Length of the @e limits array;
+ */
unsigned int limits_len;
};