summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-04-05 17:15:58 +0200
committerChristian Grothoff <christian@grothoff.org>2022-04-05 17:15:58 +0200
commit58f1ae25c69e0e378af2c45b929c8bbf7d5c1b2a (patch)
treeef9625d7929245f48d0142a658a702ca758399bd /src/backend
parent69131a3253264dd8e7b595f4dd985c5ad8a8e2de (diff)
downloadmerchant-58f1ae25c69e0e378af2c45b929c8bbf7d5c1b2a.tar.gz
merchant-58f1ae25c69e0e378af2c45b929c8bbf7d5c1b2a.tar.bz2
merchant-58f1ae25c69e0e378af2c45b929c8bbf7d5c1b2a.zip
adapt to latest GNUnet API: GNUNET_JSON_spec_mark_optional() changed
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/taler-merchant-httpd_helper.c82
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-claim.c3
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-pay.c15
-rw-r--r--src/backend/taler-merchant-httpd_private-get-orders-ID.c3
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-products-ID.c21
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c70
-rw-r--r--src/backend/taler-merchant-httpd_private-post-products.c18
7 files changed, 136 insertions, 76 deletions
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c
index e271cbaa..da0ea559 100644
--- a/src/backend/taler-merchant-httpd_helper.c
+++ b/src/backend/taler-merchant-httpd_helper.c
@@ -92,47 +92,57 @@ TMH_payto_uri_array_valid (const json_t *payto_uris)
bool
TMH_location_object_valid (const json_t *location)
{
- const char *country;
- const char *subdivision;
- const char *district;
- const char *town;
- const char *town_loc;
- const char *postcode;
- const char *street;
- const char *building;
- const char *building_no;
+ const char *country = NULL;
+ const char *subdivision = NULL;
+ const char *district = NULL;
+ const char *town = NULL;
+ const char *town_loc = NULL;
+ const char *postcode = NULL;
+ const char *street = NULL;
+ const char *building = NULL;
+ const char *building_no = NULL;
json_t *lines = NULL;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("country",
- &country)),
+ &country),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("country_subdivision",
- &subdivision)),
+ &subdivision),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("district",
- &district)),
+ &district),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("town",
- &town)),
+ &town),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("town_location",
- &town_loc)),
+ &town_loc),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("post_code",
- &postcode)),
+ &postcode),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("street",
- &street)),
+ &street),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("building_name",
- &building)),
+ &building),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("building_number",
- &building_no)),
+ &building_no),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("address_lines",
- &lines)),
+ &lines),
+ NULL),
GNUNET_JSON_spec_end ()
};
const char *ename;
@@ -187,43 +197,51 @@ TMH_products_array_valid (const json_t *products)
return false;
json_array_foreach ((json_t *) products, idx, product)
{
- const char *product_id;
+ const char *product_id = NULL;
const char *description;
json_t *description_i18n = NULL;
- uint64_t quantity;
- const char *unit;
- struct TALER_Amount price;
+ uint64_t quantity = 0;
+ const char *unit = NULL;
+ struct TALER_Amount price = { .value = 0 };
const char *image_data_url = NULL;
json_t *taxes = NULL;
- struct GNUNET_TIME_Timestamp delivery_date;
+ struct GNUNET_TIME_Timestamp delivery_date = { 0 };
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("product_id",
- &product_id)),
+ &product_id),
+ NULL),
GNUNET_JSON_spec_string ("description",
&description),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("description_i18n",
- &description_i18n)),
+ &description_i18n),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint64 ("quantity",
- &quantity)),
+ &quantity),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("unit",
- &unit)),
+ &unit),
+ NULL),
GNUNET_JSON_spec_mark_optional (
TALER_JSON_spec_amount ("price",
TMH_currency,
- &price)),
+ &price),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("image",
- &image_data_url)),
+ &image_data_url),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("taxes",
- &taxes)),
+ &taxes),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("delivery_date",
- &delivery_date)),
+ &delivery_date),
+ NULL),
GNUNET_JSON_spec_end ()
};
const char *ename;
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-claim.c b/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
index 1f9d8e2b..3d8a7d01 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-claim.c
@@ -208,7 +208,8 @@ TMH_post_orders_ID_claim (const struct TMH_RequestHandler *rh,
&nonce),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("token",
- &claim_token)),
+ &claim_token),
+ NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue res;
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 ff4f1ab1..10dca3d9 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -1975,7 +1975,8 @@ parse_pay (struct MHD_Connection *connection,
&coins),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("session_id",
- &session_id)),
+ &session_id),
+ NULL),
GNUNET_JSON_spec_end ()
};
@@ -2059,10 +2060,12 @@ parse_pay (struct MHD_Connection *connection,
&exchange_url),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("minimum_age_sig",
- &minimum_age_sig)),
+ &minimum_age_sig),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("age_commitment",
- &age_commitment)),
+ &age_commitment),
+ NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue res;
@@ -2264,7 +2267,8 @@ parse_pay (struct MHD_Connection *connection,
&pc->amount),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("fulfillment_url",
- &fulfillment_url)),
+ &fulfillment_url),
+ NULL),
TALER_JSON_spec_amount ("max_fee",
TMH_currency,
&pc->max_fee),
@@ -2285,7 +2289,8 @@ parse_pay (struct MHD_Connection *connection,
&pc->h_wire),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("minimum_age",
- &pc->minimum_age)),
+ &pc->minimum_age),
+ NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue res;
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 6ef119c5..58c05604 100644
--- a/src/backend/taler-merchant-httpd_private-get-orders-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -1083,7 +1083,8 @@ TMH_private_get_orders_ID (const struct TMH_RequestHandler *rh,
&gorc->contract_amount),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("fulfillment_url",
- &gorc->fulfillment_url)),
+ &gorc->fulfillment_url),
+ NULL),
GNUNET_JSON_spec_string ("summary",
&summary),
GNUNET_JSON_spec_timestamp ("timestamp",
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 06e9e7be..c4ba755b 100644
--- a/src/backend/taler-merchant-httpd_private-patch-products-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-products-ID.c
@@ -121,7 +121,8 @@ TMH_private_patch_products_ID (const struct TMH_RequestHandler *rh,
(const char **) &pd.description),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("description_i18n",
- &pd.description_i18n)),
+ &pd.description_i18n),
+ NULL),
GNUNET_JSON_spec_string ("unit",
(const char **) &pd.unit),
TALER_JSON_spec_amount ("price",
@@ -129,24 +130,30 @@ TMH_private_patch_products_ID (const struct TMH_RequestHandler *rh,
&pd.price),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("image",
- (const char **) &pd.image)),
+ (const char **) &pd.image),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("taxes",
- &pd.taxes)),
+ &pd.taxes),
+ NULL),
GNUNET_JSON_spec_int64 ("total_stock",
&total_stock),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint64 ("total_lost",
- &pd.total_lost)),
+ &pd.total_lost),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("address",
- &pd.address)),
+ &pd.address),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("next_restock",
- &pd.next_restock)),
+ &pd.next_restock),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("minimum_age",
- &pd.minimum_age)),
+ &pd.minimum_age),
+ NULL),
GNUNET_JSON_spec_end ()
};
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
index baaf3de9..4631a18c 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -354,18 +354,22 @@ execute_order (struct MHD_Connection *connection,
&merchant),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("summary_i18n",
- &summary_i18n)),
+ &summary_i18n),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("fulfillment_message",
- &fulfillment_msg)),
+ &fulfillment_msg),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("fulfillment_message_i18n",
- &fulfillment_i18n)),
+ &fulfillment_i18n),
+ NULL),
GNUNET_JSON_spec_timestamp ("timestamp",
&timestamp),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("refund_deadline",
- &refund_deadline)),
+ &refund_deadline),
+ NULL),
GNUNET_JSON_spec_timestamp ("pay_deadline",
&pay_deadline),
GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
@@ -676,49 +680,62 @@ patch_order (struct MHD_Connection *connection,
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("merchant_base_url",
- &merchant_base_url)),
+ &merchant_base_url),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("merchant",
- &jmerchant)),
+ &jmerchant),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("order_id",
- &order_id)),
+ &order_id),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("fulfillment_url",
- &fulfillment_url)),
+ &fulfillment_url),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("timestamp",
- &timestamp)),
+ &timestamp),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("refund_deadline",
- &refund_deadline)),
+ &refund_deadline),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("pay_deadline",
- &pay_deadline)),
+ &pay_deadline),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("wire_transfer_deadline",
- &wire_deadline)),
+ &wire_deadline),
+ NULL),
GNUNET_JSON_spec_mark_optional (
TALER_JSON_spec_amount ("max_fee",
TMH_currency,
- &max_fee)),
+ &max_fee),
+ NULL),
GNUNET_JSON_spec_mark_optional (
TALER_JSON_spec_amount ("max_wire_fee",
TMH_currency,
- &max_wire_fee)),
+ &max_wire_fee),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("wire_fee_amortization",
- &wire_fee_amortization)),
+ &wire_fee_amortization),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("delivery_date",
- &delivery_date)),
+ &delivery_date),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("auto_refund",
- &auto_refund)),
+ &auto_refund),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("delivery_location",
- &delivery_location)),
-
+ &delivery_location),
+ NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue ret;
@@ -1351,19 +1368,24 @@ TMH_private_post_orders (const struct TMH_RequestHandler *rh,
&order),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_relative_time ("refund_delay",
- &refund_delay)),
+ &refund_delay),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("payment_target",
- &payment_target)),
+ &payment_target),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("inventory_products",
- &ip)),
+ &ip),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("lock_uuids",
- &uuid)),
+ &uuid),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("create_token",
- &create_token)),
+ &create_token),
+ NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue ret;
diff --git a/src/backend/taler-merchant-httpd_private-post-products.c b/src/backend/taler-merchant-httpd_private-post-products.c
index 18a38d83..0c20cdac 100644
--- a/src/backend/taler-merchant-httpd_private-post-products.c
+++ b/src/backend/taler-merchant-httpd_private-post-products.c
@@ -89,7 +89,8 @@ TMH_private_post_products (const struct TMH_RequestHandler *rh,
(const char **) &pd.description),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("description_i18n",
- &pd.description_i18n)),
+ &pd.description_i18n),
+ NULL),
GNUNET_JSON_spec_string ("unit",
(const char **) &pd.unit),
TALER_JSON_spec_amount ("price",
@@ -97,21 +98,26 @@ TMH_private_post_products (const struct TMH_RequestHandler *rh,
&pd.price),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("image",
- (const char **) &pd.image)),
+ (const char **) &pd.image),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("taxes",
- &pd.taxes)),
+ &pd.taxes),
+ NULL),
GNUNET_JSON_spec_int64 ("total_stock",
&total_stock),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_json ("address",
- &pd.address)),
+ &pd.address),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("next_restock",
- &pd.next_restock)),
+ &pd.next_restock),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_uint32 ("minimum_age",
- &pd.minimum_age)),
+ &pd.minimum_age),
+ NULL),
GNUNET_JSON_spec_end ()
};