summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c3
-rw-r--r--src/backenddb/test_merchantdb.c134
-rw-r--r--src/lib/merchant_api_get_reserve.c10
-rw-r--r--src/lib/merchant_api_get_transfers.c9
-rw-r--r--src/lib/merchant_api_merchant_get_order.c9
-rw-r--r--src/lib/merchant_api_post_orders.c11
13 files changed, 244 insertions, 144 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 ()
};
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index d45e2fbb..8a86c2a0 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -2151,7 +2151,8 @@ postgres_update_contract_terms (void *cls,
&refund_deadline),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("fulfillment_url",
- &fulfillment_url)),
+ &fulfillment_url),
+ NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_GenericReturnValue res;
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 57b38899..f7c2dde7 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -2330,14 +2330,7 @@ struct ExchangeSignkeyData
static void
make_exchange_signkey (struct ExchangeSignkeyData *signkey)
{
- struct TALER_ExchangeSigningKeyValidityPS exch_sign = {
- .purpose = {
- .size = htonl (sizeof (struct TALER_ExchangeSigningKeyValidityPS)),
- .purpose = htonl (TALER_SIGNATURE_MASTER_SIGNING_KEY_VALIDITY)
- }
-
-
- };
+ struct GNUNET_TIME_Timestamp now = GNUNET_TIME_timestamp_get ();
GNUNET_CRYPTO_eddsa_key_create (&signkey->exchange_priv.eddsa_priv);
GNUNET_CRYPTO_eddsa_key_get_public (&signkey->exchange_priv.eddsa_priv,
@@ -2345,12 +2338,16 @@ make_exchange_signkey (struct ExchangeSignkeyData *signkey)
GNUNET_CRYPTO_eddsa_key_create (&signkey->master_priv.eddsa_priv);
GNUNET_CRYPTO_eddsa_key_get_public (&signkey->master_priv.eddsa_priv,
&signkey->master_pub.eddsa_pub);
- GNUNET_CRYPTO_eddsa_sign (&signkey->master_priv.eddsa_priv,
- &exch_sign,
- &signkey->master_sig.eddsa_signature);
- signkey->start_date = GNUNET_TIME_timestamp_get ();
- signkey->expire_date = GNUNET_TIME_timestamp_get ();
- signkey->end_date = GNUNET_TIME_timestamp_get ();
+ signkey->start_date = now;
+ signkey->expire_date = now;
+ signkey->end_date = now;
+ TALER_exchange_offline_signkey_validity_sign (
+ &signkey->exchange_pub,
+ signkey->start_date,
+ signkey->expire_date,
+ signkey->end_date,
+ &signkey->master_priv,
+ &signkey->master_sig);
}
@@ -2413,6 +2410,39 @@ struct DepositData
/**
+ * Private key for my_sign_cb().
+ */
+static const struct TALER_ExchangePrivateKeyP *msc_exchange_priv;
+
+/**
+ * Function that signs the message in @a purpose with the
+ * exchange's signing key from #msc_exchange_priv.
+ *
+ * The @a purpose data is the beginning of the data of which the signature is
+ * to be created. The `size` field in @a purpose must correctly indicate the
+ * number of bytes of the data structure, including its header. *
+ * @param purpose the message to sign
+ * @param[out] pub set to the current public signing key of the exchange
+ * @param[out] sig signature over purpose using current signing key
+ * @return #TALER_EC_NONE on success
+ */
+static enum TALER_ErrorCode
+my_sign_cb (
+ const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose,
+ struct TALER_ExchangePublicKeyP *pub,
+ struct TALER_ExchangeSignatureP *sig)
+{
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CRYPTO_eddsa_sign_ (&msc_exchange_priv->eddsa_priv,
+ purpose,
+ &sig->eddsa_signature));
+ GNUNET_CRYPTO_eddsa_key_get_public (&msc_exchange_priv->eddsa_priv,
+ &pub->eddsa_pub);
+ return TALER_EC_NONE;
+}
+
+
+/**
* Generates deposit data for an order.
*
* @param instance the instance to make the deposit to.
@@ -2429,13 +2459,12 @@ make_deposit (const struct InstanceData *instance,
struct DepositData *deposit)
{
struct TALER_CoinSpendPrivateKeyP coin_priv;
- struct TALER_DepositConfirmationPS deposit_sign = {
- .purpose.size = htonl (sizeof (deposit_sign)),
- .purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_DEPOSIT)
- };
+ struct GNUNET_TIME_Timestamp now;
struct TALER_Amount amount_without_fee;
+ struct TALER_ExchangePublicKeyP exchange_pub;
- deposit->timestamp = GNUNET_TIME_timestamp_get ();
+ now = GNUNET_TIME_timestamp_get ();
+ deposit->timestamp = now;
GNUNET_assert (GNUNET_OK ==
TALER_JSON_contract_hash (order->contract,
&deposit->h_contract_terms));
@@ -2460,21 +2489,22 @@ make_deposit (const struct InstanceData *instance,
&deposit->amount_with_fee,
&deposit->deposit_fee));
deposit->h_wire = account->h_wire;
- deposit_sign.h_contract_terms = deposit->h_contract_terms;
- deposit_sign.h_wire = deposit->h_wire;
- deposit_sign.exchange_timestamp = GNUNET_TIME_timestamp_hton (
- GNUNET_TIME_timestamp_get ());
- deposit_sign.wire_deadline = GNUNET_TIME_timestamp_hton (
- GNUNET_TIME_timestamp_get ());
- deposit_sign.refund_deadline = GNUNET_TIME_timestamp_hton (
- GNUNET_TIME_timestamp_get ());
- TALER_amount_hton (&deposit_sign.amount_without_fee,
- &amount_without_fee);
- deposit_sign.merchant_pub = instance->merchant_pub;
- deposit_sign.coin_pub = deposit->coin_pub;
- GNUNET_CRYPTO_eddsa_sign (&signkey->exchange_priv.eddsa_priv,
- &deposit_sign,
- &deposit->exchange_sig.eddsa_signature);
+ msc_exchange_priv = &signkey->exchange_priv;
+ GNUNET_assert (TALER_EC_NONE ==
+ TALER_exchange_online_deposit_confirmation_sign (
+ &my_sign_cb,
+ &deposit->h_contract_terms,
+ &deposit->h_wire,
+ NULL,
+ now,
+ now,
+ now,
+ &amount_without_fee,
+ &deposit->coin_pub,
+ &instance->merchant_pub,
+ &exchange_pub,
+ &deposit->exchange_sig));
+ msc_exchange_priv = NULL;
}
@@ -3267,12 +3297,12 @@ make_wire_fee (const struct ExchangeSignkeyData *signkey,
wire_fee->wire_fee_end = GNUNET_TIME_relative_to_timestamp (
GNUNET_TIME_UNIT_MONTHS);
TALER_exchange_offline_wire_fee_sign (
- wire_fee->wire_method,
- wire_fee->wire_fee_start,
- wire_fee->wire_fee_end,
- &wire_fee->fees,
- &signkey->master_priv,
- &wire_fee->fee_sig);
+ wire_fee->wire_method,
+ wire_fee->wire_fee_start,
+ wire_fee->wire_fee_end,
+ &wire_fee->fees,
+ &signkey->master_priv,
+ &wire_fee->fee_sig);
}
@@ -3807,13 +3837,13 @@ test_insert_wire_fee (const struct ExchangeSignkeyData *signkey,
{
TEST_COND_RET_ON_FAIL (expected_result ==
plugin->store_wire_fee_by_exchange (
- plugin->cls,
- &signkey->master_pub,
- &wire_fee->h_wire_method,
- &wire_fee->fees,
- wire_fee->wire_fee_start,
- wire_fee->wire_fee_end,
- &wire_fee->fee_sig),
+ plugin->cls,
+ &signkey->master_pub,
+ &wire_fee->h_wire_method,
+ &wire_fee->fees,
+ wire_fee->wire_fee_start,
+ wire_fee->wire_fee_end,
+ &wire_fee->fee_sig),
"Store wire fee by exchange failed\n");
return 0;
}
@@ -5904,11 +5934,11 @@ lookup_refunds_detailed_cb (void *cls,
*/
static int
test_lookup_refunds_detailed (
- const struct InstanceData *instance,
- const struct TALER_PrivateContractHashP *h_contract_terms,
- bool cmp_timestamps,
- unsigned int refunds_length,
- const struct RefundData *refunds)
+ const struct InstanceData *instance,
+ const struct TALER_PrivateContractHashP *h_contract_terms,
+ bool cmp_timestamps,
+ unsigned int refunds_length,
+ const struct RefundData *refunds)
{
unsigned int results_matching[refunds_length];
struct TestLookupRefundsDetailed_Closure cmp = {
diff --git a/src/lib/merchant_api_get_reserve.c b/src/lib/merchant_api_get_reserve.c
index 3d8f9cbf..cc6bc562 100644
--- a/src/lib/merchant_api_get_reserve.c
+++ b/src/lib/merchant_api_get_reserve.c
@@ -100,17 +100,19 @@ handle_reserve_get_finished (void *cls,
const char *payto_uri = NULL;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_timestamp ("creation_time",
- &rs.creation_time),
+ &rs.creation_time),
GNUNET_JSON_spec_timestamp ("expiration_time",
- &rs.expiration_time),
+ &rs.expiration_time),
GNUNET_JSON_spec_bool ("active",
&active),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("exchange_url",
- &exchange_url)),
+ &exchange_url),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("payto_uri",
- &payto_uri)),
+ &payto_uri),
+ NULL),
TALER_JSON_spec_amount_any ("merchant_initial_amount",
&rs.merchant_initial_amount),
TALER_JSON_spec_amount_any ("exchange_initial_amount",
diff --git a/src/lib/merchant_api_get_transfers.c b/src/lib/merchant_api_get_transfers.c
index 0d061498..8938c3d7 100644
--- a/src/lib/merchant_api_get_transfers.c
+++ b/src/lib/merchant_api_get_transfers.c
@@ -145,13 +145,16 @@ handle_transfers_get_finished (void *cls,
&td->credit_serial),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("execution_time",
- &td->execution_time)),
+ &td->execution_time),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("verified",
- &td->verified)),
+ &td->verified),
+ NULL),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_bool ("confirmed",
- &td->confirmed)),
+ &td->confirmed),
+ NULL),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/merchant_api_merchant_get_order.c b/src/lib/merchant_api_merchant_get_order.c
index aedeb366..0bb6b6c4 100644
--- a/src/lib/merchant_api_merchant_get_order.c
+++ b/src/lib/merchant_api_merchant_get_order.c
@@ -86,13 +86,14 @@ handle_unpaid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh,
&osr.details.unpaid.contract_amount),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_string ("already_paid_order_id",
- &osr.details.unpaid.already_paid_order_id)),
+ &osr.details.unpaid.already_paid_order_id),
+ NULL),
GNUNET_JSON_spec_string ("taler_pay_uri",
&osr.details.unpaid.taler_pay_uri),
GNUNET_JSON_spec_string ("summary",
&osr.details.unpaid.summary),
GNUNET_JSON_spec_timestamp ("creation_time",
- &osr.details.unpaid.creation_time),
+ &osr.details.unpaid.creation_time),
GNUNET_JSON_spec_end ()
};
@@ -250,7 +251,7 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh,
GNUNET_JSON_spec_fixed_auto ("wtid",
&wt->wtid),
GNUNET_JSON_spec_timestamp ("execution_time",
- &wt->execution_time),
+ &wt->execution_time),
TALER_JSON_spec_amount_any ("amount",
&wt->total_amount),
GNUNET_JSON_spec_bool ("confirmed",
@@ -325,7 +326,7 @@ handle_paid (struct TALER_MERCHANT_OrderMerchantGetHandle *omgh,
GNUNET_JSON_spec_string ("reason",
&ro->reason),
GNUNET_JSON_spec_timestamp ("timestamp",
- &ro->refund_time),
+ &ro->refund_time),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/merchant_api_post_orders.c b/src/lib/merchant_api_post_orders.c
index ff142cde..c4ccea36 100644
--- a/src/lib/merchant_api_post_orders.c
+++ b/src/lib/merchant_api_post_orders.c
@@ -92,7 +92,7 @@ handle_post_order_finished (void *cls,
.hr.http_status = (unsigned int) response_code,
.hr.reply = json
};
- struct TALER_ClaimTokenP token = {0};
+ struct TALER_ClaimTokenP token;
po->job = NULL;
switch (response_code)
@@ -102,12 +102,14 @@ handle_post_order_finished (void *cls,
break;
case MHD_HTTP_OK:
{
+ bool no_token;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("order_id",
&por.details.ok.order_id),
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_fixed_auto ("token",
- &token)),
+ &token),
+ &no_token),
GNUNET_JSON_spec_end ()
};
@@ -122,7 +124,7 @@ handle_post_order_finished (void *cls,
}
else
{
- if (! GNUNET_is_zero (&token))
+ if (! no_token)
por.details.ok.token = &token;
}
}
@@ -177,7 +179,8 @@ handle_post_order_finished (void *cls,
GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp (
"restock_expected",
- &por.details.gone.restock_expected)),
+ &por.details.gone.restock_expected),
+ NULL),
GNUNET_JSON_spec_end ()
};