diff options
author | Özgür Kesim <oec-taler@kesim.org> | 2022-10-08 17:13:57 +0200 |
---|---|---|
committer | Özgür Kesim <oec-taler@kesim.org> | 2022-10-08 17:13:57 +0200 |
commit | 4ba07b54e4ea2ac75c408f795cd806409450bc29 (patch) | |
tree | a9fe35d75de203450ea1eb16a83c3f2bcc527c65 /src/exchangedb/lrbt_callbacks.c | |
parent | d3c509fcd91e5b7e430eda767108d961db196522 (diff) |
WIP: policy_*_fulfiment added and API changes
- policy_fulfilment table defined, handlers added
- policy_details_fulfilment table defined, handlers added
- TALER_extensions_serial_from_policy_details implemened
Diffstat (limited to 'src/exchangedb/lrbt_callbacks.c')
-rw-r--r-- | src/exchangedb/lrbt_callbacks.c | 60 |
1 files changed, 53 insertions, 7 deletions
diff --git a/src/exchangedb/lrbt_callbacks.c b/src/exchangedb/lrbt_callbacks.c index 023f61cc..a2c654f4 100644 --- a/src/exchangedb/lrbt_callbacks.c +++ b/src/exchangedb/lrbt_callbacks.c @@ -1442,7 +1442,6 @@ lrbt_cb_table_policy_details (void *cls, for (unsigned int i = 0; i<num_results; i++) { bool no_config = false; - bool no_fulfilment = false; struct GNUNET_PQ_ResultSpec rs[] = { GNUNET_PQ_result_spec_uint64 ("policy_details_serial_id", &td.serial), @@ -1454,11 +1453,12 @@ lrbt_cb_table_policy_details (void *cls, &td.details.policy_details. policy_options), &no_config), - GNUNET_PQ_result_spec_allow_null ( - GNUNET_PQ_result_spec_uint64 ("fulfilment_serial_id", - &td.details.policy_details. - fulfilment_serial_id), - &no_fulfilment), + GNUNET_PQ_result_spec_timestamp ("deadline", + &td.details.policy_details. + deadline), + GNUNET_PQ_result_spec_uint64 ("fulfilment_state", + &td.details.policy_details. + fulfilment_state), GNUNET_PQ_result_spec_end }; @@ -1500,7 +1500,7 @@ lrbt_cb_table_policy_fulfilments (void *cls, bool no_config = false; bool no_timestamp = false; struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_uint64 ("policy_fulfilment_serial_id", + GNUNET_PQ_result_spec_uint64 ("fulfilment_id", &td.serial), GNUNET_PQ_result_spec_allow_null ( GNUNET_PQ_result_spec_string ("fulfilment_proof", @@ -1532,6 +1532,52 @@ lrbt_cb_table_policy_fulfilments (void *cls, /** + * Function called with policy_details_fulfilments table entries. + * + * @param cls closure + * @param result the postgres result + * @param num_results the number of results in @a result + */ +static void +lrbt_cb_table_policy_details_fulfilments (void *cls, + PGresult *result, + unsigned int num_results) +{ + struct LookupRecordsByTableContext *ctx = cls; + struct TALER_EXCHANGEDB_TableData td = { + .table = TALER_EXCHANGEDB_RT_POLICY_DETAILS_FULFILMENTS + }; + + for (unsigned int i = 0; i<num_results; i++) + { + struct GNUNET_PQ_ResultSpec rs[] = { + GNUNET_PQ_result_spec_uint64 ("fulfilment_id", + &td.details.policy_details_fulfilments. + fulfilment_id), + GNUNET_PQ_result_spec_auto_from_type ("serial_id", + &td.details. + policy_details_fulfilments. + serial_id), + GNUNET_PQ_result_spec_end + }; + + if (GNUNET_OK != + GNUNET_PQ_extract_result (result, + rs, + i)) + { + GNUNET_break (0); + ctx->error = true; + return; + } + ctx->cb (ctx->cb_cls, + &td); + GNUNET_PQ_cleanup_result (rs); + } +} + + +/** * Function called with purse_requests table entries. * * @param cls closure |