From d37e16a76c32e83407f5ea71e572cc5469a58924 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 5 Jul 2020 22:00:31 +0200 Subject: fix #6408 also in merchant: in principle only allow rounded times over JSON --- src/backend/taler-merchant-httpd_post-orders-ID-pay.c | 16 ++++++++-------- src/backend/taler-merchant-httpd_private-get-orders-ID.c | 4 ++-- .../taler-merchant-httpd_private-patch-instances-ID.c | 8 ++++---- .../taler-merchant-httpd_private-patch-products-ID.c | 8 ++++---- .../taler-merchant-httpd_private-post-instances.c | 8 ++++---- ...-merchant-httpd_private-post-orders-ID-track-UNSPEC.c | 8 ++++---- src/backend/taler-merchant-httpd_private-post-orders.c | 16 ++++++++-------- .../taler-merchant-httpd_private-post-products-ID-lock.c | 4 ++-- src/backend/taler-merchant-httpd_private-post-products.c | 8 ++++---- src/backenddb/plugin_merchantdb_postgres.c | 8 ++++---- src/lib/merchant_api_get_instance.c | 8 ++++---- src/lib/merchant_api_get_orders.c | 4 ++-- src/lib/merchant_api_get_product.c | 4 ++-- src/lib/merchant_api_get_reserve.c | 8 ++++---- src/lib/merchant_api_get_reserves.c | 8 ++++---- src/lib/merchant_api_get_transfers.c | 4 ++-- src/lib/merchant_api_merchant_get_order.c | 8 ++++---- src/lib/merchant_api_merchant_get_tip.c | 4 ++-- src/lib/merchant_api_post_transfers.c | 4 ++-- src/lib/merchant_api_tip_authorize.c | 2 +- src/lib/merchant_api_wallet_get_tip.c | 4 ++-- src/testing/testing_api_cmd_pay_order.c | 12 ++++++------ 22 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c index cf607fcc..d22c5a75 100644 --- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c +++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c @@ -1679,14 +1679,14 @@ parse_pay (struct MHD_Connection *connection, /* Get details from contract and check fundamentals */ { struct GNUNET_JSON_Specification espec[] = { - GNUNET_JSON_spec_absolute_time ("refund_deadline", - &pc->refund_deadline), - GNUNET_JSON_spec_absolute_time ("pay_deadline", - &pc->pay_deadline), - GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline", - &pc->wire_transfer_deadline), - GNUNET_JSON_spec_absolute_time ("timestamp", - &pc->timestamp), + TALER_JSON_spec_absolute_time ("refund_deadline", + &pc->refund_deadline), + TALER_JSON_spec_absolute_time ("pay_deadline", + &pc->pay_deadline), + TALER_JSON_spec_absolute_time ("wire_transfer_deadline", + &pc->wire_transfer_deadline), + TALER_JSON_spec_absolute_time ("timestamp", + &pc->timestamp), TALER_JSON_spec_amount ("max_fee", &pc->max_fee), TALER_JSON_spec_amount ("amount", diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c index e983273a..d637f5cf 100644 --- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c +++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c @@ -1095,8 +1095,8 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh, GNUNET_break (qs >= 0); /* just warn if transaction failed */ { struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_absolute_time ("timestamp", - ×tamp), + TALER_JSON_spec_absolute_time ("timestamp", + ×tamp), GNUNET_JSON_spec_end () }; enum GNUNET_GenericReturnValue res; diff --git a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c index b00e9595..45abd398 100644 --- a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c +++ b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c @@ -81,10 +81,10 @@ TMH_private_patch_instances_ID (const struct TMH_RequestHandler *rh, &is.default_max_wire_fee), GNUNET_JSON_spec_uint32 ("default_wire_fee_amortization", &is.default_wire_fee_amortization), - GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay", - &is.default_wire_transfer_delay), - GNUNET_JSON_spec_relative_time ("default_pay_delay", - &is.default_pay_delay), + TALER_JSON_spec_relative_time ("default_wire_transfer_delay", + &is.default_wire_transfer_delay), + TALER_JSON_spec_relative_time ("default_pay_delay", + &is.default_pay_delay), GNUNET_JSON_spec_end () }; enum GNUNET_DB_QueryStatus qs; diff --git a/src/backend/taler-merchant-httpd_private-patch-products-ID.c b/src/backend/taler-merchant-httpd_private-patch-products-ID.c index 6bbaba2a..e8c08359 100644 --- a/src/backend/taler-merchant-httpd_private-patch-products-ID.c +++ b/src/backend/taler-merchant-httpd_private-patch-products-ID.c @@ -147,8 +147,8 @@ TMH_private_patch_products_ID (const struct TMH_RequestHandler *rh, &total_stock), GNUNET_JSON_spec_uint64 ("total_lost", &pd.total_lost), - GNUNET_JSON_spec_absolute_time ("next_restock", - &pd.next_restock), + TALER_JSON_spec_absolute_time ("next_restock", + &pd.next_restock), GNUNET_JSON_spec_end () }; @@ -175,8 +175,8 @@ TMH_private_patch_products_ID (const struct TMH_RequestHandler *rh, { enum GNUNET_GenericReturnValue res; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_absolute_time ("next_restock", - &pd.next_restock), + TALER_JSON_spec_absolute_time ("next_restock", + &pd.next_restock), GNUNET_JSON_spec_end () }; diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c index 350a8eae..2320cd7b 100644 --- a/src/backend/taler-merchant-httpd_private-post-instances.c +++ b/src/backend/taler-merchant-httpd_private-post-instances.c @@ -161,10 +161,10 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, &is.default_max_wire_fee), GNUNET_JSON_spec_uint32 ("default_wire_fee_amortization", &is.default_wire_fee_amortization), - GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay", - &is.default_wire_transfer_delay), - GNUNET_JSON_spec_relative_time ("default_pay_delay", - &is.default_pay_delay), + TALER_JSON_spec_relative_time ("default_wire_transfer_delay", + &is.default_wire_transfer_delay), + TALER_JSON_spec_relative_time ("default_pay_delay", + &is.default_pay_delay), GNUNET_JSON_spec_end () }; diff --git a/src/backend/taler-merchant-httpd_private-post-orders-ID-track-UNSPEC.c b/src/backend/taler-merchant-httpd_private-post-orders-ID-track-UNSPEC.c index 39f8ce9e..bd90bf64 100644 --- a/src/backend/taler-merchant-httpd_private-post-orders-ID-track-UNSPEC.c +++ b/src/backend/taler-merchant-httpd_private-post-orders-ID-track-UNSPEC.c @@ -1179,10 +1179,10 @@ MH_handler_track_transaction (struct TMH_RequestHandler *rh, { struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_absolute_time ("refund_deadline", - &tctx->refund_deadline), - GNUNET_JSON_spec_absolute_time ("timestamp", - &tctx->timestamp), + TALER_JSON_spec_absolute_time ("refund_deadline", + &tctx->refund_deadline), + TALER_JSON_spec_absolute_time ("timestamp", + &tctx->timestamp), TALER_JSON_spec_amount ("amount", &tctx->total_amount), GNUNET_JSON_spec_fixed_auto ("h_wire", diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c index 2772aef5..06fd562b 100644 --- a/src/backend/taler-merchant-httpd_private-post-orders.c +++ b/src/backend/taler-merchant-httpd_private-post-orders.c @@ -338,14 +338,14 @@ execute_order (struct MHD_Connection *connection, &products), GNUNET_JSON_spec_json ("merchant", &merchant), - GNUNET_JSON_spec_absolute_time ("timestamp", - ×tamp), - GNUNET_JSON_spec_absolute_time ("refund_deadline", - &refund_deadline), - GNUNET_JSON_spec_absolute_time ("pay_deadline", - &pay_deadline), - GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline", - &wire_transfer_deadline), + TALER_JSON_spec_absolute_time ("timestamp", + ×tamp), + TALER_JSON_spec_absolute_time ("refund_deadline", + &refund_deadline), + TALER_JSON_spec_absolute_time ("pay_deadline", + &pay_deadline), + TALER_JSON_spec_absolute_time ("wire_transfer_deadline", + &wire_transfer_deadline), GNUNET_JSON_spec_end () }; enum GNUNET_DB_QueryStatus qs; diff --git a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c index ddd891a6..aac8b8c9 100644 --- a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c +++ b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c @@ -51,8 +51,8 @@ TMH_private_post_products_ID_lock (const struct TMH_RequestHandler *rh, &uuid), GNUNET_JSON_spec_uint32 ("quantity", &quantity), - GNUNET_JSON_spec_relative_time ("duration", - &duration), + TALER_JSON_spec_relative_time ("duration", + &duration), GNUNET_JSON_spec_end () }; diff --git a/src/backend/taler-merchant-httpd_private-post-products.c b/src/backend/taler-merchant-httpd_private-post-products.c index c291845a..688a1aad 100644 --- a/src/backend/taler-merchant-httpd_private-post-products.c +++ b/src/backend/taler-merchant-httpd_private-post-products.c @@ -105,8 +105,8 @@ TMH_private_post_products (const struct TMH_RequestHandler *rh, &pd.address), GNUNET_JSON_spec_int64 ("total_stock", &total_stock), - GNUNET_JSON_spec_absolute_time ("next_restock", - &pd.next_restock), + TALER_JSON_spec_absolute_time ("next_restock", + &pd.next_restock), GNUNET_JSON_spec_end () }; @@ -132,8 +132,8 @@ TMH_private_post_products (const struct TMH_RequestHandler *rh, { enum GNUNET_GenericReturnValue res; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_absolute_time ("next_restock", - &pd.next_restock), + TALER_JSON_spec_absolute_time ("next_restock", + &pd.next_restock), GNUNET_JSON_spec_end () }; diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c index 1360d90c..d44ac15a 100644 --- a/src/backenddb/plugin_merchantdb_postgres.c +++ b/src/backenddb/plugin_merchantdb_postgres.c @@ -1508,10 +1508,10 @@ postgres_insert_contract_terms (void *cls, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("fulfillment_url", &fulfillment_url), - GNUNET_JSON_spec_absolute_time ("pay_deadline", - &pay_deadline), - GNUNET_JSON_spec_absolute_time ("refund_deadline", - &refund_deadline), + TALER_JSON_spec_absolute_time ("pay_deadline", + &pay_deadline), + TALER_JSON_spec_absolute_time ("refund_deadline", + &refund_deadline), GNUNET_JSON_spec_end () }; enum GNUNET_GenericReturnValue res; diff --git a/src/lib/merchant_api_get_instance.c b/src/lib/merchant_api_get_instance.c index 0007fb7f..af93b53c 100644 --- a/src/lib/merchant_api_get_instance.c +++ b/src/lib/merchant_api_get_instance.c @@ -118,10 +118,10 @@ handle_get_instance_finished (void *cls, &default_wire_fee_amortization), TALER_JSON_spec_amount ("default_max_deposit_fee", &default_max_deposit_fee), - GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay", - &default_wire_transfer_delay), - GNUNET_JSON_spec_relative_time ("default_pay_delay", - &default_pay_delay), + 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_end () }; diff --git a/src/lib/merchant_api_get_orders.c b/src/lib/merchant_api_get_orders.c index df96c57a..2f18a6a1 100644 --- a/src/lib/merchant_api_get_orders.c +++ b/src/lib/merchant_api_get_orders.c @@ -86,8 +86,8 @@ parse_orders (const json_t *ia, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("order_id", &ie->order_id), - GNUNET_JSON_spec_absolute_time ("timestamp", - &ie->timestamp), + TALER_JSON_spec_absolute_time ("timestamp", + &ie->timestamp), GNUNET_JSON_spec_uint64 ("row_id", &ie->order_serial), GNUNET_JSON_spec_end () diff --git a/src/lib/merchant_api_get_product.c b/src/lib/merchant_api_get_product.c index e9263b07..bc83c861 100644 --- a/src/lib/merchant_api_get_product.c +++ b/src/lib/merchant_api_get_product.c @@ -132,8 +132,8 @@ handle_get_product_finished (void *cls, "next_restock")) { struct GNUNET_JSON_Specification spect[] = { - GNUNET_JSON_spec_absolute_time ("next_restock", - &next_restock), + TALER_JSON_spec_absolute_time ("next_restock", + &next_restock), GNUNET_JSON_spec_end () }; diff --git a/src/lib/merchant_api_get_reserve.c b/src/lib/merchant_api_get_reserve.c index 3ff14d41..a30b4558 100644 --- a/src/lib/merchant_api_get_reserve.c +++ b/src/lib/merchant_api_get_reserve.c @@ -96,10 +96,10 @@ handle_reserve_get_finished (void *cls, struct TALER_MERCHANT_ReserveSummary rs; const json_t *tips; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_absolute_time ("creation_time", - &rs.creation_time), - GNUNET_JSON_spec_absolute_time ("expiration_time", - &rs.expiration_time), + TALER_JSON_spec_absolute_time ("creation_time", + &rs.creation_time), + TALER_JSON_spec_absolute_time ("expiration_time", + &rs.expiration_time), GNUNET_JSON_spec_bool ("active", &active), TALER_JSON_spec_amount ("merchant_initial_amount", diff --git a/src/lib/merchant_api_get_reserves.c b/src/lib/merchant_api_get_reserves.c index f524514a..428bc81c 100644 --- a/src/lib/merchant_api_get_reserves.c +++ b/src/lib/merchant_api_get_reserves.c @@ -134,10 +134,10 @@ handle_reserves_get_finished (void *cls, struct GNUNET_JSON_Specification ispec[] = { GNUNET_JSON_spec_fixed_auto ("reserve_pub", &rd->reserve_pub), - GNUNET_JSON_spec_absolute_time ("creation_time", - &rd->creation_time), - GNUNET_JSON_spec_absolute_time ("expiration_time", - &rd->expiration_time), + TALER_JSON_spec_absolute_time ("creation_time", + &rd->creation_time), + TALER_JSON_spec_absolute_time ("expiration_time", + &rd->expiration_time), TALER_JSON_spec_amount ("merchant_initial_amount", &rd->merchant_initial_amount), TALER_JSON_spec_amount ("exchange_initial_amount", diff --git a/src/lib/merchant_api_get_transfers.c b/src/lib/merchant_api_get_transfers.c index 5d08dba1..859d97be 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, &td->exchange_url), GNUNET_JSON_spec_uint64 ("transfer_serial_id", &td->credit_serial), - GNUNET_JSON_spec_absolute_time ("execution_time", - &td->execution_time), + TALER_JSON_spec_absolute_time ("execution_time", + &td->execution_time), GNUNET_JSON_spec_bool ("verified", &td->verified), GNUNET_JSON_spec_bool ("confirmed", diff --git a/src/lib/merchant_api_merchant_get_order.c b/src/lib/merchant_api_merchant_get_order.c index edd00f7a..53811ec1 100644 --- a/src/lib/merchant_api_merchant_get_order.c +++ b/src/lib/merchant_api_merchant_get_order.c @@ -198,8 +198,8 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, &wt->exchange_url), GNUNET_JSON_spec_fixed_auto ("wtid", &wt->wtid), - GNUNET_JSON_spec_absolute_time ("execution_time", - &wt->execution_time), + TALER_JSON_spec_absolute_time ("execution_time", + &wt->execution_time), TALER_JSON_spec_amount ("amount", &wt->total_amount), GNUNET_JSON_spec_bool ("confirmed", @@ -273,8 +273,8 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh, &ro->refund_amount), GNUNET_JSON_spec_string ("reason", &ro->reason), - GNUNET_JSON_spec_absolute_time ("timestamp", - &ro->refund_time), + TALER_JSON_spec_absolute_time ("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 5ecd65ee..e1f0f23e 100644 --- a/src/lib/merchant_api_merchant_get_tip.c +++ b/src/lib/merchant_api_merchant_get_tip.c @@ -158,8 +158,8 @@ handle_merchant_tip_get_finished (void *cls, &total_picked_up), GNUNET_JSON_spec_string ("reason", &reason), - GNUNET_JSON_spec_absolute_time ("expiration", - &expiration), + TALER_JSON_spec_absolute_time ("expiration", + &expiration), GNUNET_JSON_spec_fixed_auto ("reserve_pub", &reserve_pub), GNUNET_JSON_spec_end () diff --git a/src/lib/merchant_api_post_transfers.c b/src/lib/merchant_api_post_transfers.c index f9ea25dc..16f636b4 100644 --- a/src/lib/merchant_api_post_transfers.c +++ b/src/lib/merchant_api_post_transfers.c @@ -106,8 +106,8 @@ handle_post_transfers_finished (void *cls, &total), TALER_JSON_spec_amount ("wire_fee", &wire_fee), - GNUNET_JSON_spec_absolute_time ("execution_time", - &execution_time), + TALER_JSON_spec_absolute_time ("execution_time", + &execution_time), GNUNET_JSON_spec_json ("deposit_sums", &deposit_sums), GNUNET_JSON_spec_end () diff --git a/src/lib/merchant_api_tip_authorize.c b/src/lib/merchant_api_tip_authorize.c index 01d369f6..d2f4cd9a 100644 --- a/src/lib/merchant_api_tip_authorize.c +++ b/src/lib/merchant_api_tip_authorize.c @@ -88,7 +88,7 @@ check_ok (struct TALER_MERCHANT_TipAuthorizeHandle *tao, struct GNUNET_TIME_Absolute expiration_time; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("tip_redirect_url", &taler_tip_url), - GNUNET_JSON_spec_absolute_time ("tip_expiration", &expiration_time), + TALER_JSON_spec_absolute_time ("tip_expiration", &expiration_time), GNUNET_JSON_spec_fixed_auto ("tip_id", &tip_id), GNUNET_JSON_spec_end () }; diff --git a/src/lib/merchant_api_wallet_get_tip.c b/src/lib/merchant_api_wallet_get_tip.c index f0fae967..d50b961c 100644 --- a/src/lib/merchant_api_wallet_get_tip.c +++ b/src/lib/merchant_api_wallet_get_tip.c @@ -96,8 +96,8 @@ handle_wallet_tip_get_finished (void *cls, struct TALER_Amount amount_remaining; struct GNUNET_TIME_Absolute expiration; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_absolute_time ("expiration", - &expiration), + TALER_JSON_spec_absolute_time ("expiration", + &expiration), GNUNET_JSON_spec_string ("exchange_url", &exchange_url), TALER_JSON_spec_amount ("tip_amount", diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c index c576c316..62105b4c 100644 --- a/src/testing/testing_api_cmd_pay_order.c +++ b/src/testing/testing_api_cmd_pay_order.c @@ -333,12 +333,12 @@ pay_run (void *cls, struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("order_id", &order_id), - GNUNET_JSON_spec_absolute_time ("refund_deadline", - &refund_deadline), - GNUNET_JSON_spec_absolute_time ("pay_deadline", - &pay_deadline), - GNUNET_JSON_spec_absolute_time ("timestamp", - ×tamp), + TALER_JSON_spec_absolute_time ("refund_deadline", + &refund_deadline), + TALER_JSON_spec_absolute_time ("pay_deadline", + &pay_deadline), + TALER_JSON_spec_absolute_time ("timestamp", + ×tamp), GNUNET_JSON_spec_fixed_auto ("merchant_pub", &merchant_pub), GNUNET_JSON_spec_fixed_auto ("h_wire", -- cgit v1.2.3