diff options
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Makefile.am | 2 | ||||
-rw-r--r-- | src/lib/merchant_api_get_instance.c | 8 | ||||
-rw-r--r-- | src/lib/merchant_api_get_orders.c | 16 | ||||
-rw-r--r-- | src/lib/merchant_api_get_product.c | 9 | ||||
-rw-r--r-- | src/lib/merchant_api_get_reserve.c | 4 | ||||
-rw-r--r-- | src/lib/merchant_api_get_reserves.c | 20 | ||||
-rw-r--r-- | src/lib/merchant_api_get_transfers.c | 26 | ||||
-rw-r--r-- | src/lib/merchant_api_merchant_get_order.c | 6 | ||||
-rw-r--r-- | src/lib/merchant_api_merchant_get_tip.c | 10 | ||||
-rw-r--r-- | src/lib/merchant_api_patch_product.c | 7 | ||||
-rw-r--r-- | src/lib/merchant_api_post_order_pay.c | 9 | ||||
-rw-r--r-- | src/lib/merchant_api_post_orders.c | 2 | ||||
-rw-r--r-- | src/lib/merchant_api_post_products.c | 7 | ||||
-rw-r--r-- | src/lib/merchant_api_post_transfers.c | 8 | ||||
-rw-r--r-- | src/lib/merchant_api_tip_authorize.c | 6 | ||||
-rw-r--r-- | src/lib/merchant_api_wallet_get_tip.c | 8 |
16 files changed, 72 insertions, 76 deletions
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 7a0fa94f..95e431e5 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -10,7 +10,7 @@ lib_LTLIBRARIES = \ libtalermerchant.la libtalermerchant_la_LDFLAGS = \ - -version-info 2:0:0 \ + -version-info 3:0:0 \ -no-undefined libtalermerchant_la_SOURCES = \ diff --git a/src/lib/merchant_api_get_instance.c b/src/lib/merchant_api_get_instance.c index edf45e97..bb71a1ed 100644 --- a/src/lib/merchant_api_get_instance.c +++ b/src/lib/merchant_api_get_instance.c @@ -119,10 +119,10 @@ handle_get_instance_finished (void *cls, &default_wire_fee_amortization), TALER_JSON_spec_amount_any ("default_max_deposit_fee", &default_max_deposit_fee), - TALER_JSON_spec_relative_time ("default_wire_transfer_delay", - &default_wire_transfer_delay), - TALER_JSON_spec_relative_time ("default_pay_delay", - &default_pay_delay), + GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay", + &default_wire_transfer_delay), + GNUNET_JSON_spec_relative_time ("default_pay_delay", + &default_pay_delay), GNUNET_JSON_spec_end () }; diff --git a/src/lib/merchant_api_get_orders.c b/src/lib/merchant_api_get_orders.c index 92a20614..817c9240 100644 --- a/src/lib/merchant_api_get_orders.c +++ b/src/lib/merchant_api_get_orders.c @@ -87,8 +87,8 @@ parse_orders (const json_t *ia, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("order_id", &ie->order_id), - TALER_JSON_spec_absolute_time ("timestamp", - &ie->timestamp), + GNUNET_JSON_spec_timestamp ("timestamp", + &ie->timestamp), GNUNET_JSON_spec_uint64 ("row_id", &ie->order_serial), TALER_JSON_spec_amount_any ("amount", @@ -232,7 +232,7 @@ TALER_MERCHANT_orders_get ( TALER_EXCHANGE_YNA_ALL, TALER_EXCHANGE_YNA_ALL, TALER_EXCHANGE_YNA_ALL, - GNUNET_TIME_UNIT_FOREVER_ABS, + GNUNET_TIME_UNIT_FOREVER_TS, UINT64_MAX, -20, /* default is most recent 20 entries */ GNUNET_TIME_UNIT_ZERO, @@ -248,7 +248,7 @@ TALER_MERCHANT_orders_get2 ( enum TALER_EXCHANGE_YesNoAll paid, enum TALER_EXCHANGE_YesNoAll refunded, enum TALER_EXCHANGE_YesNoAll wired, - struct GNUNET_TIME_Absolute date, + struct GNUNET_TIME_Timestamp date, uint64_t start_row, int64_t delta, struct GNUNET_TIME_Relative timeout, @@ -292,21 +292,21 @@ TALER_MERCHANT_orders_get2 ( sizeof (cbuf), "%llu", (unsigned long long) start_row); + // FIXME: use date_s, no need for milliseconds! GNUNET_snprintf (dstr, sizeof (dstr), "%llu", - (unsigned long long) (date.abs_value_us + (unsigned long long) (date.abs_time.abs_value_us / GNUNET_TIME_UNIT_MILLISECONDS. rel_value_us)); if (delta > 0) { - have_date = (0 != date.abs_value_us); + have_date = ! GNUNET_TIME_absolute_is_zero (date.abs_time); have_srow = (0 != start_row); } else { - have_date = (GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us != - date.abs_value_us); + have_date = ! GNUNET_TIME_absolute_is_never (date.abs_time); have_srow = (UINT64_MAX != start_row); } ogh->url = TALER_url_join (backend_url, diff --git a/src/lib/merchant_api_get_product.c b/src/lib/merchant_api_get_product.c index 73fa9f71..94d38ec7 100644 --- a/src/lib/merchant_api_get_product.c +++ b/src/lib/merchant_api_get_product.c @@ -103,7 +103,8 @@ handle_get_product_finished (void *cls, uint64_t total_lost; json_t *address; bool rst_ok = true; - struct GNUNET_TIME_Absolute next_restock = {0}; + struct GNUNET_TIME_Timestamp next_restock + = GNUNET_TIME_UNIT_ZERO_TS; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("description", &description), @@ -133,8 +134,8 @@ handle_get_product_finished (void *cls, "next_restock")) { struct GNUNET_JSON_Specification spect[] = { - TALER_JSON_spec_absolute_time ("next_restock", - &next_restock), + GNUNET_JSON_spec_timestamp ("next_restock", + &next_restock), GNUNET_JSON_spec_end () }; @@ -205,7 +206,7 @@ handle_get_product_finished (void *cls, 0, 0, NULL, - GNUNET_TIME_UNIT_FOREVER_ABS); + GNUNET_TIME_UNIT_FOREVER_TS); TALER_MERCHANT_product_get_cancel (pgh); } diff --git a/src/lib/merchant_api_get_reserve.c b/src/lib/merchant_api_get_reserve.c index f7ce1927..3d8f9cbf 100644 --- a/src/lib/merchant_api_get_reserve.c +++ b/src/lib/merchant_api_get_reserve.c @@ -99,9 +99,9 @@ handle_reserve_get_finished (void *cls, const char *exchange_url = NULL; const char *payto_uri = NULL; struct GNUNET_JSON_Specification spec[] = { - TALER_JSON_spec_absolute_time ("creation_time", + GNUNET_JSON_spec_timestamp ("creation_time", &rs.creation_time), - TALER_JSON_spec_absolute_time ("expiration_time", + GNUNET_JSON_spec_timestamp ("expiration_time", &rs.expiration_time), GNUNET_JSON_spec_bool ("active", &active), diff --git a/src/lib/merchant_api_get_reserves.c b/src/lib/merchant_api_get_reserves.c index 56bcd133..24a527d6 100644 --- a/src/lib/merchant_api_get_reserves.c +++ b/src/lib/merchant_api_get_reserves.c @@ -135,10 +135,10 @@ handle_reserves_get_finished (void *cls, struct GNUNET_JSON_Specification ispec[] = { GNUNET_JSON_spec_fixed_auto ("reserve_pub", &rd->reserve_pub), - TALER_JSON_spec_absolute_time ("creation_time", - &rd->creation_time), - TALER_JSON_spec_absolute_time ("expiration_time", - &rd->expiration_time), + GNUNET_JSON_spec_timestamp ("creation_time", + &rd->creation_time), + GNUNET_JSON_spec_timestamp ("expiration_time", + &rd->expiration_time), TALER_JSON_spec_amount_any ("merchant_initial_amount", &rd->merchant_initial_amount), TALER_JSON_spec_amount_any ("exchange_initial_amount", @@ -217,7 +217,7 @@ handle_reserves_get_finished (void *cls, struct TALER_MERCHANT_ReservesGetHandle * TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context *ctx, const char *backend_url, - struct GNUNET_TIME_Absolute after, + struct GNUNET_TIME_Timestamp after, enum TALER_EXCHANGE_YesNoAll active, enum TALER_EXCHANGE_YesNoAll failures, TALER_MERCHANT_ReservesGetCallback cb, @@ -235,8 +235,8 @@ TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context *ctx, rgh->cb_cls = cb_cls; active_s = TALER_yna_to_string (active); failures_s = TALER_yna_to_string (failures); - after_s = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string ( - after)); + // FIXME: use different format? + after_s = GNUNET_strdup (GNUNET_TIME_timestamp2s (after)); rgh->url = TALER_url_join (backend_url, "private/reserves", "active", @@ -244,9 +244,9 @@ TALER_MERCHANT_reserves_get (struct GNUNET_CURL_Context *ctx, "failures", failures_s, "after", - after.abs_value_us != 0 - ? after_s - : NULL, + GNUNET_TIME_absolute_is_zero (after.abs_time) + ? NULL + : after_s, NULL); GNUNET_free (after_s); if (NULL == rgh->url) diff --git a/src/lib/merchant_api_get_transfers.c b/src/lib/merchant_api_get_transfers.c index 13a05998..0d061498 100644 --- a/src/lib/merchant_api_get_transfers.c +++ b/src/lib/merchant_api_get_transfers.c @@ -144,8 +144,8 @@ handle_transfers_get_finished (void *cls, GNUNET_JSON_spec_uint64 ("transfer_serial_id", &td->credit_serial), GNUNET_JSON_spec_mark_optional ( - TALER_JSON_spec_absolute_time ("execution_time", - &td->execution_time)), + GNUNET_JSON_spec_timestamp ("execution_time", + &td->execution_time)), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_bool ("verified", &td->verified)), @@ -228,8 +228,8 @@ TALER_MERCHANT_transfers_get ( struct GNUNET_CURL_Context *ctx, const char *backend_url, const char *payto_uri, - const struct GNUNET_TIME_Absolute before, - const struct GNUNET_TIME_Absolute after, + const struct GNUNET_TIME_Timestamp before, + const struct GNUNET_TIME_Timestamp after, int64_t limit, uint64_t offset, enum TALER_EXCHANGE_YesNoAll verified, @@ -257,8 +257,9 @@ TALER_MERCHANT_transfers_get ( sizeof (offset_s), "%lld", (unsigned long long) offset); - before_s = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (before)); - after_s = GNUNET_strdup (GNUNET_STRINGS_absolute_time_to_string (after)); + // FIXME: use other format? + before_s = GNUNET_strdup (GNUNET_TIME_timestamp2s (before)); + after_s = GNUNET_strdup (GNUNET_TIME_timestamp2s (after)); gth->url = TALER_url_join (backend_url, "private/transfers", "payto_uri", @@ -276,14 +277,13 @@ TALER_MERCHANT_transfers_get ( ? offset_s : NULL, "before", - before.abs_value_us != - GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us - ? before_s - : NULL, + GNUNET_TIME_absolute_is_never (before.abs_time) + ? NULL + : before_s, "after", - after.abs_value_us != 0 - ? after_s - : NULL, + GNUNET_TIME_absolute_is_zero (after.abs_time) + ? NULL + : after_s, NULL); GNUNET_free (before_s); GNUNET_free (after_s); diff --git a/src/lib/merchant_api_merchant_get_order.c b/src/lib/merchant_api_merchant_get_order.c index 643c8a51..aedeb366 100644 --- a/src/lib/merchant_api_merchant_get_order.c +++ b/src/lib/merchant_api_merchant_get_order.c @@ -91,7 +91,7 @@ handle_unpaid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, &osr.details.unpaid.taler_pay_uri), GNUNET_JSON_spec_string ("summary", &osr.details.unpaid.summary), - TALER_JSON_spec_absolute_time ("creation_time", + GNUNET_JSON_spec_timestamp ("creation_time", &osr.details.unpaid.creation_time), GNUNET_JSON_spec_end () }; @@ -249,7 +249,7 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, &wt->exchange_url), GNUNET_JSON_spec_fixed_auto ("wtid", &wt->wtid), - TALER_JSON_spec_absolute_time ("execution_time", + GNUNET_JSON_spec_timestamp ("execution_time", &wt->execution_time), TALER_JSON_spec_amount_any ("amount", &wt->total_amount), @@ -324,7 +324,7 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, &ro->refund_amount), GNUNET_JSON_spec_string ("reason", &ro->reason), - TALER_JSON_spec_absolute_time ("timestamp", + GNUNET_JSON_spec_timestamp ("timestamp", &ro->refund_time), GNUNET_JSON_spec_end () }; diff --git a/src/lib/merchant_api_merchant_get_tip.c b/src/lib/merchant_api_merchant_get_tip.c index 1b4cf082..374634b4 100644 --- a/src/lib/merchant_api_merchant_get_tip.c +++ b/src/lib/merchant_api_merchant_get_tip.c @@ -65,7 +65,7 @@ parse_pickups (const json_t *pa, const struct TALER_Amount *total_authorized, const struct TALER_Amount *total_picked_up, const char *reason, - struct GNUNET_TIME_Absolute expiration, + struct GNUNET_TIME_Timestamp expiration, const struct TALER_ReservePublicKeyP *reserve_pub, struct TALER_MERCHANT_TipMerchantGetHandle *tgh) { @@ -150,7 +150,7 @@ handle_merchant_tip_get_finished (void *cls, struct TALER_Amount total_authorized; struct TALER_Amount total_picked_up; const char *reason; - struct GNUNET_TIME_Absolute expiration; + struct GNUNET_TIME_Timestamp expiration; struct TALER_ReservePublicKeyP reserve_pub; struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount_any ("total_authorized", @@ -159,8 +159,8 @@ handle_merchant_tip_get_finished (void *cls, &total_picked_up), GNUNET_JSON_spec_string ("reason", &reason), - TALER_JSON_spec_absolute_time ("expiration", - &expiration), + GNUNET_JSON_spec_timestamp ("expiration", + &expiration), GNUNET_JSON_spec_fixed_auto ("reserve_pub", &reserve_pub), GNUNET_JSON_spec_end () @@ -246,7 +246,7 @@ handle_merchant_tip_get_finished (void *cls, NULL, NULL, NULL, - GNUNET_TIME_UNIT_ZERO_ABS, + GNUNET_TIME_UNIT_ZERO_TS, NULL, 0, NULL); diff --git a/src/lib/merchant_api_patch_product.c b/src/lib/merchant_api_patch_product.c index 200c0a50..7f931655 100644 --- a/src/lib/merchant_api_patch_product.c +++ b/src/lib/merchant_api_patch_product.c @@ -169,14 +169,13 @@ TALER_MERCHANT_product_patch ( int64_t total_stock, uint64_t total_lost, const json_t *address, - struct GNUNET_TIME_Absolute next_restock, + struct GNUNET_TIME_Timestamp next_restock, TALER_MERCHANT_ProductPatchCallback cb, void *cb_cls) { struct TALER_MERCHANT_ProductPatchHandle *pph; json_t *req_obj; - (void) GNUNET_TIME_round_abs (&next_restock); req_obj = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("description", description), @@ -196,8 +195,8 @@ TALER_MERCHANT_product_patch ( total_lost), GNUNET_JSON_pack_object_incref ("address", (json_t *) address), - GNUNET_JSON_pack_time_abs ("next_restock", - next_restock)); + GNUNET_JSON_pack_timestamp ("next_restock", + next_restock)); pph = GNUNET_new (struct TALER_MERCHANT_ProductPatchHandle); pph->ctx = ctx; pph->cb = cb; diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c index 869533c4..bb4e2ca6 100644 --- a/src/lib/merchant_api_post_order_pay.c +++ b/src/lib/merchant_api_post_order_pay.c @@ -575,9 +575,9 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx, const struct TALER_Amount *max_fee, const struct TALER_MerchantPublicKeyP *merchant_pub, const struct TALER_MerchantSignatureP *merchant_sig, - struct GNUNET_TIME_Absolute timestamp, - struct GNUNET_TIME_Absolute refund_deadline, - struct GNUNET_TIME_Absolute pay_deadline, + struct GNUNET_TIME_Timestamp timestamp, + struct GNUNET_TIME_Timestamp refund_deadline, + struct GNUNET_TIME_Timestamp pay_deadline, const struct TALER_MerchantWireHash *h_wire, const char *order_id, unsigned int num_coins, @@ -585,9 +585,6 @@ TALER_MERCHANT_order_pay (struct GNUNET_CURL_Context *ctx, TALER_MERCHANT_OrderPayCallback pay_cb, void *pay_cb_cls) { - (void) GNUNET_TIME_round_abs (×tamp); - (void) GNUNET_TIME_round_abs (&pay_deadline); - (void) GNUNET_TIME_round_abs (&refund_deadline); if (GNUNET_YES != TALER_amount_cmp_currency (amount, max_fee)) diff --git a/src/lib/merchant_api_post_orders.c b/src/lib/merchant_api_post_orders.c index 430ddcdd..ff142cde 100644 --- a/src/lib/merchant_api_post_orders.c +++ b/src/lib/merchant_api_post_orders.c @@ -175,7 +175,7 @@ handle_post_order_finished (void *cls, "available_quantity", &por.details.gone.available_quantity), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_absolute_time ( + GNUNET_JSON_spec_timestamp ( "restock_expected", &por.details.gone.restock_expected)), GNUNET_JSON_spec_end () diff --git a/src/lib/merchant_api_post_products.c b/src/lib/merchant_api_post_products.c index b2f44139..43799032 100644 --- a/src/lib/merchant_api_post_products.c +++ b/src/lib/merchant_api_post_products.c @@ -170,14 +170,13 @@ TALER_MERCHANT_products_post ( const json_t *taxes, int64_t total_stock, const json_t *address, - struct GNUNET_TIME_Absolute next_restock, + struct GNUNET_TIME_Timestamp next_restock, TALER_MERCHANT_ProductsPostCallback cb, void *cb_cls) { struct TALER_MERCHANT_ProductsPostHandle *pph; json_t *req_obj; - (void) GNUNET_TIME_round_abs (&next_restock); req_obj = GNUNET_JSON_PACK ( GNUNET_JSON_pack_string ("product_id", product_id), @@ -198,8 +197,8 @@ TALER_MERCHANT_products_post ( GNUNET_JSON_pack_object_incref ("address", (json_t *) address), GNUNET_JSON_pack_allow_null ( - GNUNET_JSON_pack_time_abs ("next_restock", - next_restock))); + GNUNET_JSON_pack_timestamp ("next_restock", + next_restock))); pph = GNUNET_new (struct TALER_MERCHANT_ProductsPostHandle); pph->ctx = ctx; pph->cb = cb; diff --git a/src/lib/merchant_api_post_transfers.c b/src/lib/merchant_api_post_transfers.c index 8b302ab1..01144833 100644 --- a/src/lib/merchant_api_post_transfers.c +++ b/src/lib/merchant_api_post_transfers.c @@ -101,15 +101,15 @@ handle_post_transfers_finished (void *cls, { struct TALER_Amount total; struct TALER_Amount wire_fee; - struct GNUNET_TIME_Absolute execution_time; + struct GNUNET_TIME_Timestamp execution_time; json_t *deposit_sums; struct GNUNET_JSON_Specification spec[] = { TALER_JSON_spec_amount_any ("total", &total), TALER_JSON_spec_amount_any ("wire_fee", &wire_fee), - TALER_JSON_spec_absolute_time ("execution_time", - &execution_time), + GNUNET_JSON_spec_timestamp ("execution_time", + &execution_time), GNUNET_JSON_spec_json ("deposit_sums", &deposit_sums), GNUNET_JSON_spec_end () @@ -263,7 +263,7 @@ handle_post_transfers_finished (void *cls, } pth->cb (pth->cb_cls, &hr, - GNUNET_TIME_UNIT_FOREVER_ABS, + GNUNET_TIME_UNIT_FOREVER_TS, NULL, NULL, 0, diff --git a/src/lib/merchant_api_tip_authorize.c b/src/lib/merchant_api_tip_authorize.c index 1b177ea9..c56fab38 100644 --- a/src/lib/merchant_api_tip_authorize.c +++ b/src/lib/merchant_api_tip_authorize.c @@ -87,11 +87,11 @@ check_ok (struct TALER_MERCHANT_TipAuthorizeHandle *tao, const char *tip_status_url; const char *taler_tip_uri; struct GNUNET_HashCode tip_id; - struct GNUNET_TIME_Absolute expiration_time; + struct GNUNET_TIME_Timestamp expiration_time; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("tip_status_url", &tip_status_url), GNUNET_JSON_spec_string ("taler_tip_uri", &taler_tip_uri), - TALER_JSON_spec_absolute_time ("tip_expiration", &expiration_time), + GNUNET_JSON_spec_timestamp ("tip_expiration", &expiration_time), GNUNET_JSON_spec_fixed_auto ("tip_id", &tip_id), GNUNET_JSON_spec_end () }; @@ -207,7 +207,7 @@ handle_tip_authorize_finished (void *cls, &hr, NULL, NULL, - GNUNET_TIME_UNIT_ZERO_ABS); + GNUNET_TIME_UNIT_ZERO_TS); TALER_MERCHANT_tip_authorize_cancel (tao); } diff --git a/src/lib/merchant_api_wallet_get_tip.c b/src/lib/merchant_api_wallet_get_tip.c index f503af85..cd40dc4e 100644 --- a/src/lib/merchant_api_wallet_get_tip.c +++ b/src/lib/merchant_api_wallet_get_tip.c @@ -95,10 +95,10 @@ handle_wallet_tip_get_finished (void *cls, { const char *exchange_url; struct TALER_Amount amount_remaining; - struct GNUNET_TIME_Absolute expiration; + struct GNUNET_TIME_Timestamp expiration; struct GNUNET_JSON_Specification spec[] = { - TALER_JSON_spec_absolute_time ("expiration", - &expiration), + GNUNET_JSON_spec_timestamp ("expiration", + &expiration), GNUNET_JSON_spec_string ("exchange_url", &exchange_url), TALER_JSON_spec_amount_any ("tip_amount", @@ -149,7 +149,7 @@ handle_wallet_tip_get_finished (void *cls, } tgh->cb (tgh->cb_cls, &hr, - GNUNET_TIME_UNIT_ZERO_ABS, + GNUNET_TIME_UNIT_ZERO_TS, NULL, NULL); TALER_MERCHANT_wallet_tip_get_cancel (tgh); |