diff options
Diffstat (limited to 'src/bank-lib')
-rw-r--r-- | src/bank-lib/bank_api_admin.c | 31 | ||||
-rw-r--r-- | src/bank-lib/bank_api_common.c | 9 | ||||
-rw-r--r-- | src/bank-lib/bank_api_credit.c | 4 | ||||
-rw-r--r-- | src/bank-lib/bank_api_debit.c | 6 | ||||
-rw-r--r-- | src/bank-lib/bank_api_parse.c | 16 | ||||
-rw-r--r-- | src/bank-lib/bank_api_transfer.c | 6 | ||||
-rw-r--r-- | src/bank-lib/fakebank.c | 35 | ||||
-rw-r--r-- | src/bank-lib/taler-exchange-wire-gateway-client.c | 10 |
8 files changed, 35 insertions, 82 deletions
diff --git a/src/bank-lib/bank_api_admin.c b/src/bank-lib/bank_api_admin.c index d1a05297d..77b1a38e4 100644 --- a/src/bank-lib/bank_api_admin.c +++ b/src/bank-lib/bank_api_admin.c @@ -75,12 +75,12 @@ handle_admin_add_incoming_finished (void *cls, { struct TALER_BANK_AdminAddIncomingHandle *aai = cls; uint64_t row_id = UINT64_MAX; - struct GNUNET_TIME_Absolute timestamp; + struct GNUNET_TIME_Timestamp timestamp; enum TALER_ErrorCode ec; const json_t *j = response; aai->job = NULL; - timestamp = GNUNET_TIME_UNIT_FOREVER_ABS; + timestamp = GNUNET_TIME_UNIT_FOREVER_TS; switch (response_code) { case 0: @@ -91,8 +91,8 @@ handle_admin_add_incoming_finished (void *cls, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_uint64 ("row_id", &row_id), - TALER_JSON_spec_absolute_time ("timestamp", - ×tamp), + GNUNET_JSON_spec_timestamp ("timestamp", + ×tamp), GNUNET_JSON_spec_end () }; @@ -158,23 +158,6 @@ handle_admin_add_incoming_finished (void *cls, } -/** - * Perform a wire transfer from some account to the exchange to fill a - * reserve. Note that this API is usually only used for testing (with - * fakebank and our Python bank) and thus may not be accessible in a - * production setting. - * - * @param ctx curl context for the event loop - * @param auth authentication data to send to the bank - * @param reserve_pub wire transfer subject for the transfer - * @param amount amount that was is to be deposited - * @param debit_account account to deposit from (payto URI, but used as 'payfrom') - * @param res_cb the callback to call when the final result for this request is available - * @param res_cb_cls closure for the above callback - * @return NULL - * if the inputs are invalid (i.e. invalid amount) or internal errors. - * In this case, the callback is not called. - */ struct TALER_BANK_AdminAddIncomingHandle * TALER_BANK_admin_add_incoming ( struct GNUNET_CURL_Context *ctx, @@ -268,12 +251,6 @@ TALER_BANK_admin_add_incoming ( } -/** - * Cancel an add incoming. This function cannot be used on a request - * handle if a response is already served for it. - * - * @param aai the admin add incoming request handle - */ void TALER_BANK_admin_add_incoming_cancel ( struct TALER_BANK_AdminAddIncomingHandle *aai) diff --git a/src/bank-lib/bank_api_common.c b/src/bank-lib/bank_api_common.c index abdeee31a..f749e0a92 100644 --- a/src/bank-lib/bank_api_common.c +++ b/src/bank-lib/bank_api_common.c @@ -23,15 +23,6 @@ #include "bank_api_common.h" -/** - * Set authentication data in @a easy from @a auth. - * The API currently specifies the use of HTTP basic - * authentication. - * - * @param easy curl handle to setup for authentication - * @param auth authentication data to use - * @return #GNUNET_OK in success - */ int TALER_BANK_setup_auth_ (CURL *easy, const struct TALER_BANK_AuthenticationData *auth) diff --git a/src/bank-lib/bank_api_credit.c b/src/bank-lib/bank_api_credit.c index eff2ad971..1ea2e269e 100644 --- a/src/bank-lib/bank_api_credit.c +++ b/src/bank-lib/bank_api_credit.c @@ -97,8 +97,8 @@ parse_account_history (struct TALER_BANK_CreditHistoryHandle *hh, struct GNUNET_JSON_Specification hist_spec[] = { TALER_JSON_spec_amount_any ("amount", &td.amount), - TALER_JSON_spec_absolute_time ("date", - &td.execution_date), + GNUNET_JSON_spec_timestamp ("date", + &td.execution_date), GNUNET_JSON_spec_uint64 ("row_id", &row_id), GNUNET_JSON_spec_fixed_auto ("reserve_pub", diff --git a/src/bank-lib/bank_api_debit.c b/src/bank-lib/bank_api_debit.c index 339dfef40..2a76495bd 100644 --- a/src/bank-lib/bank_api_debit.c +++ b/src/bank-lib/bank_api_debit.c @@ -73,7 +73,7 @@ struct TALER_BANK_DebitHistoryHandle * were set, * #GNUNET_SYSERR if there was a protocol violation in @a history */ -static int +static enum GNUNET_GenericReturnValue parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh, const json_t *history) { @@ -97,8 +97,8 @@ parse_account_history (struct TALER_BANK_DebitHistoryHandle *hh, struct GNUNET_JSON_Specification hist_spec[] = { TALER_JSON_spec_amount_any ("amount", &td.amount), - TALER_JSON_spec_absolute_time ("date", - &td.execution_date), + GNUNET_JSON_spec_timestamp ("date", + &td.execution_date), GNUNET_JSON_spec_uint64 ("row_id", &row_id), GNUNET_JSON_spec_fixed_auto ("wtid", diff --git a/src/bank-lib/bank_api_parse.c b/src/bank-lib/bank_api_parse.c index b09e5af35..0d30e9d08 100644 --- a/src/bank-lib/bank_api_parse.c +++ b/src/bank-lib/bank_api_parse.c @@ -23,15 +23,7 @@ #include "taler_bank_service.h" -/** - * Parse configuration section with bank authentication data. - * - * @param cfg configuration to parse - * @param section the section with the configuration data - * @param[out] auth set to the configuration data found - * @return #GNUNET_OK on success - */ -int +enum GNUNET_GenericReturnValue TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, struct TALER_BANK_AuthenticationData *auth) @@ -122,12 +114,6 @@ TALER_BANK_auth_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg, } -/** - * Free memory inside of @a auth (but not @a auth itself). - * Dual to #TALER_BANK_auth_parse_cfg(). - * - * @param[in] auth authentication data to free - */ void TALER_BANK_auth_free (struct TALER_BANK_AuthenticationData *auth) { diff --git a/src/bank-lib/bank_api_transfer.c b/src/bank-lib/bank_api_transfer.c index 7b8c74b24..bbfc9cec8 100644 --- a/src/bank-lib/bank_api_transfer.c +++ b/src/bank-lib/bank_api_transfer.c @@ -170,7 +170,7 @@ handle_transfer_finished (void *cls, struct TALER_BANK_TransferHandle *th = cls; const json_t *j = response; uint64_t row_id = UINT64_MAX; - struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_UNIT_FOREVER_ABS; + struct GNUNET_TIME_Timestamp timestamp = GNUNET_TIME_UNIT_FOREVER_TS; enum TALER_ErrorCode ec; th->job = NULL; @@ -184,8 +184,8 @@ handle_transfer_finished (void *cls, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_uint64 ("row_id", &row_id), - TALER_JSON_spec_absolute_time ("timestamp", - ×tamp), + GNUNET_JSON_spec_timestamp ("timestamp", + ×tamp), GNUNET_JSON_spec_end () }; diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index 6549a288d..2ccc2c751 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -219,7 +219,7 @@ struct Transaction /** * When did the transaction happen? */ - struct GNUNET_TIME_Absolute date; + struct GNUNET_TIME_Timestamp date; /** * Number of this transaction. @@ -963,7 +963,7 @@ make_transfer ( const char *exchange_base_url, const struct GNUNET_HashCode *request_uid, uint64_t *ret_row_id, - struct GNUNET_TIME_Absolute *timestamp) + struct GNUNET_TIME_Timestamp *timestamp) { struct Transaction *t; struct Account *debit_acc; @@ -1022,9 +1022,9 @@ make_transfer ( t->debit_account = debit_acc; t->credit_account = credit_acc; t->amount = *amount; - t->date = GNUNET_TIME_absolute_get (); - (void) GNUNET_TIME_round_abs (&t->date); - *timestamp = t->date; + t->date = GNUNET_TIME_timestamp_get (); + if (NULL != timestamp) + *timestamp = t->date; t->type = T_DEBIT; memcpy (t->subject.debit.exchange_base_url, exchange_base_url, @@ -1082,7 +1082,7 @@ make_admin_transfer ( const struct TALER_Amount *amount, const struct TALER_ReservePublicKeyP *reserve_pub, uint64_t *row_id, - struct GNUNET_TIME_Absolute *timestamp) + struct GNUNET_TIME_Timestamp *timestamp) { struct Transaction *t; const struct GNUNET_PeerIdentity *pid; @@ -1125,8 +1125,7 @@ make_admin_transfer ( t->debit_account = debit_acc; t->credit_account = credit_acc; t->amount = *amount; - t->date = GNUNET_TIME_absolute_get (); - (void) GNUNET_TIME_round_abs (&t->date); + t->date = GNUNET_TIME_timestamp_get (); if (NULL != timestamp) *timestamp = t->date; t->type = T_CREDIT; @@ -1334,7 +1333,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h, enum GNUNET_JSON_PostResult pr; json_t *json; uint64_t row_id; - struct GNUNET_TIME_Absolute timestamp; + struct GNUNET_TIME_Timestamp timestamp; pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX, connection, @@ -1431,8 +1430,8 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h, MHD_HTTP_OK, GNUNET_JSON_pack_uint64 ("row_id", row_id), - GNUNET_JSON_pack_time_abs ("timestamp", - timestamp)); + GNUNET_JSON_pack_timestamp ("timestamp", + timestamp)); } @@ -1458,7 +1457,7 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h, enum GNUNET_JSON_PostResult pr; json_t *json; uint64_t row_id; - struct GNUNET_TIME_Absolute ts; + struct GNUNET_TIME_Timestamp ts; pr = GNUNET_JSON_post_parser (REQUEST_BUFFER_MAX, connection, @@ -1561,8 +1560,8 @@ handle_transfer (struct TALER_FAKEBANK_Handle *h, MHD_HTTP_OK, GNUNET_JSON_pack_uint64 ("row_id", row_id), - GNUNET_JSON_pack_time_abs ("timestamp", - ts)); + GNUNET_JSON_pack_timestamp ("timestamp", + ts)); } @@ -2016,8 +2015,8 @@ handle_debit_history (struct TALER_FAKEBANK_Handle *h, trans = GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("row_id", pos->row_id), - GNUNET_JSON_pack_time_abs ("date", - pos->date), + GNUNET_JSON_pack_timestamp ("date", + pos->date), TALER_JSON_pack_amount ("amount", &pos->amount), GNUNET_JSON_pack_string ("credit_account", @@ -2215,8 +2214,8 @@ handle_credit_history (struct TALER_FAKEBANK_Handle *h, trans = GNUNET_JSON_PACK ( GNUNET_JSON_pack_uint64 ("row_id", pos->row_id), - GNUNET_JSON_pack_time_abs ("date", - pos->date), + GNUNET_JSON_pack_timestamp ("date", + pos->date), TALER_JSON_pack_amount ("amount", &pos->amount), GNUNET_JSON_pack_string ("credit_account", diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c b/src/bank-lib/taler-exchange-wire-gateway-client.c index 0af3d2662..ab16573a7 100644 --- a/src/bank-lib/taler-exchange-wire-gateway-client.c +++ b/src/bank-lib/taler-exchange-wire-gateway-client.c @@ -227,7 +227,7 @@ credit_history_cb (void *cls, details->credit_account_uri, TALER_B2S (&details->reserve_pub), TALER_amount2s (&details->amount), - GNUNET_STRINGS_absolute_time_to_string (details->execution_date)); + GNUNET_TIME_timestamp2s (details->execution_date)); return GNUNET_OK; } @@ -340,7 +340,7 @@ debit_history_cb (void *cls, details->credit_account_uri, TALER_B2S (&details->wtid), TALER_amount2s (&details->amount), - GNUNET_STRINGS_absolute_time_to_string (details->execution_date)); + GNUNET_TIME_timestamp2s (details->execution_date)); return GNUNET_OK; } @@ -391,7 +391,7 @@ confirmation_cb (void *cls, unsigned int response_code, enum TALER_ErrorCode ec, uint64_t row_id, - struct GNUNET_TIME_Absolute timestamp) + struct GNUNET_TIME_Timestamp timestamp) { (void) cls; eh = NULL; @@ -408,7 +408,7 @@ confirmation_cb (void *cls, fprintf (stdout, "Wire transfer #%llu executed successfully at %s.\n", (unsigned long long) row_id, - GNUNET_STRINGS_absolute_time_to_string (timestamp)); + GNUNET_TIME_timestamp2s (timestamp)); global_ret = 0; GNUNET_SCHEDULER_shutdown (); } @@ -500,7 +500,7 @@ res_cb (void *cls, unsigned int http_status, enum TALER_ErrorCode ec, uint64_t serial_id, - struct GNUNET_TIME_Absolute timestamp, + struct GNUNET_TIME_Timestamp timestamp, const json_t *json) { (void) cls; |