exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit 22d64ba319681fe76d92a3686f3064c8ae788412
parent 3ee66c46d4bbd837f780624db52aa2a6eb30928a
Author: Christian Grothoff <christian@grothoff.org>
Date:   Sat,  4 Apr 2026 10:11:17 +0200

add missing attribute options to client API for POSTing AML officer decisions

Diffstat:
Msrc/include/taler/taler-exchange/post-aml-OFFICER_PUB-decision.h | 60+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Msrc/lib/exchange_api_post-aml-OFFICER_PUB-decision.c | 42+++++++++++++++++++++++++++++++++++++++++-
2 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/src/include/taler/taler-exchange/post-aml-OFFICER_PUB-decision.h b/src/include/taler/taler-exchange/post-aml-OFFICER_PUB-decision.h @@ -85,6 +85,12 @@ struct TALER_EXCHANGE_AccountRule bool exposed; /** + * Optional human-readable name for this rule. + * May be NULL. + */ + const char *rule_name; + + /** * True if all the measures will eventually need to * be satisfied, false if any of the measures should * do. Primarily used by the SPA to indicate how @@ -128,7 +134,18 @@ enum TALER_EXCHANGE_PostAmlDecisionOption /** * Array of event names to trigger. */ - TALER_EXCHANGE_POST_AML_DECISION_OPTION_EVENTS + TALER_EXCHANGE_POST_AML_DECISION_OPTION_EVENTS, + + /** + * JSON object with KYC attributes to set for the account. + */ + TALER_EXCHANGE_POST_AML_DECISION_OPTION_ATTRIBUTES, + + /** + * Expiration time for the KYC attributes. + * Must be set if attributes are set. + */ + TALER_EXCHANGE_POST_AML_DECISION_OPTION_ATTRIBUTES_EXPIRATION }; @@ -185,6 +202,19 @@ struct TALER_EXCHANGE_PostAmlDecisionOptionValue const char **events; } events; + /** + * Value if @e option is + * #TALER_EXCHANGE_POST_AML_DECISION_OPTION_ATTRIBUTES. + * JSON object with KYC attributes. + */ + const json_t *attributes; + + /** + * Value if @e option is + * #TALER_EXCHANGE_POST_AML_DECISION_OPTION_ATTRIBUTES_EXPIRATION. + */ + struct GNUNET_TIME_Timestamp attributes_expiration; + } details; }; @@ -300,6 +330,34 @@ TALER_EXCHANGE_post_aml_decision_create ( /** + * Set the KYC attributes for the account. + * + * @param a JSON object with KYC attributes + * @return representation of the option as a struct TALER_EXCHANGE_PostAmlDecisionOptionValue + */ +#define TALER_EXCHANGE_post_aml_decision_option_attributes(a) \ + (const struct TALER_EXCHANGE_PostAmlDecisionOptionValue) \ + { \ + .option = TALER_EXCHANGE_POST_AML_DECISION_OPTION_ATTRIBUTES, \ + .details.attributes = (a) \ + } + +/** + * Set the expiration time for KYC attributes. + * + * @param t the expiration timestamp + * @return representation of the option as a struct TALER_EXCHANGE_PostAmlDecisionOptionValue + */ +#define TALER_EXCHANGE_post_aml_decision_option_attributes_expiration(t) \ + (const struct TALER_EXCHANGE_PostAmlDecisionOptionValue) \ + { \ + .option = \ + TALER_EXCHANGE_POST_AML_DECISION_OPTION_ATTRIBUTES_EXPIRATION, \ + .details.attributes_expiration = (t) \ + } + + +/** * Set the requested options for the operation. * * If any option fails, other options may or may not be applied. diff --git a/src/lib/exchange_api_post-aml-OFFICER_PUB-decision.c b/src/lib/exchange_api_post-aml-OFFICER_PUB-decision.c @@ -129,6 +129,18 @@ struct TALER_EXCHANGE_PostAmlDecisionHandle */ json_t *jevents; + /** + * Optional: JSON object with KYC attributes + * (from options; may be NULL). + */ + json_t *attributes; + + /** + * Optional: expiration time for KYC attributes. + * Only meaningful if @e attributes is non-NULL. + */ + struct GNUNET_TIME_Timestamp attributes_expiration; + }; @@ -235,6 +247,9 @@ build_new_rules ( al->timeframe), GNUNET_JSON_pack_array_steal ("measures", ameasures), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_string ("rule_name", + al->rule_name)), GNUNET_JSON_pack_bool ("exposed", al->exposed), GNUNET_JSON_pack_bool ("is_and_combinator", @@ -386,6 +401,17 @@ TALER_EXCHANGE_post_aml_decision_set_options_ ( } } break; + case TALER_EXCHANGE_POST_AML_DECISION_OPTION_ATTRIBUTES: + if (NULL != padh->attributes) + json_decref (padh->attributes); + padh->attributes = + (NULL != opt->details.attributes) + ? json_incref ((json_t *) opt->details.attributes) + : NULL; + break; + case TALER_EXCHANGE_POST_AML_DECISION_OPTION_ATTRIBUTES_EXPIRATION: + padh->attributes_expiration = opt->details.attributes_expiration; + break; default: GNUNET_break (0); return GNUNET_SYSERR; @@ -467,8 +493,20 @@ TALER_EXCHANGE_post_aml_decision_start ( padh->decision_time), GNUNET_JSON_pack_allow_null ( GNUNET_JSON_pack_array_incref ("events", - padh->jevents)) + padh->jevents)), + GNUNET_JSON_pack_allow_null ( + GNUNET_JSON_pack_object_incref ("attributes", + padh->attributes)) ); + if (NULL != padh->attributes) + { + GNUNET_assert ( + 0 == + json_object_set_new ( + body, + "attributes_expiration", + GNUNET_JSON_from_timestamp (padh->attributes_expiration))); + } eh = TALER_EXCHANGE_curl_easy_get_ (padh->url); if ( (NULL == eh) || @@ -520,6 +558,8 @@ TALER_EXCHANGE_post_aml_decision_cancel ( json_decref (padh->properties); if (NULL != padh->jevents) json_decref (padh->jevents); + if (NULL != padh->attributes) + json_decref (padh->attributes); GNUNET_free (padh->url); GNUNET_free (padh->base_url); GNUNET_free (padh->justification);