From 9e92dc1004bedde592b14ad4a50071562a90ddd8 Mon Sep 17 00:00:00 2001 From: priscilla Date: Tue, 21 Feb 2023 11:50:53 -0500 Subject: update changes with git pull and push modification for post order and using templates --- .../taler-merchant-httpd_post-using-templates.c | 7 ++- .../taler-merchant-httpd_private-post-orders.c | 52 +++++++++++++++++----- 2 files changed, 43 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/backend/taler-merchant-httpd_post-using-templates.c b/src/backend/taler-merchant-httpd_post-using-templates.c index aeb50cee..22a93847 100644 --- a/src/backend/taler-merchant-httpd_post-using-templates.c +++ b/src/backend/taler-merchant-httpd_post-using-templates.c @@ -45,8 +45,6 @@ TMH_post_using_templates_ID (const struct TMH_RequestHandler *rh, json_t *fake_body; bool no_summary; struct TALER_MERCHANTDB_TemplateDetails etp; - char *pos_key = NULL; // FIXME: fetch from DB! - enum TALER_MerchantConfirmationAlgorithm pos_algorithm = TALER_MCA_NONE; // FIXME fetch from DB! struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_string ("summary", @@ -114,6 +112,7 @@ TMH_post_using_templates_ID (const struct TMH_RequestHandler *rh, } { + /* template */ const char *tsummary; uint32_t min_age; struct GNUNET_TIME_Relative pay_duration; @@ -238,8 +237,8 @@ TMH_post_using_templates_ID (const struct TMH_RequestHandler *rh, mret = TMH_private_post_orders_with_pos_secrets (NULL, /* not even used */ connection, &fake_hc, - pos_key, - pos_algorithm); + etp.pos_key, + etp.pos_algorithm); } TALER_MERCHANTDB_template_details_free (&etp); json_decref (fake_body); diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c index 66c698e8..c191f374 100644 --- a/src/backend/taler-merchant-httpd_private-post-orders.c +++ b/src/backend/taler-merchant-httpd_private-post-orders.c @@ -257,7 +257,9 @@ execute_transaction (struct TMH_HandlerContext *hc, const struct InventoryProduct inventory_products[], unsigned int uuids_length, const struct GNUNET_Uuid uuids[], - unsigned int *out_of_stock_index) + unsigned int *out_of_stock_index, + const char *pos_key, + enum TALER_MerchantConfirmationAlgorithm pos_algorithm) { enum GNUNET_DB_QueryStatus qs; struct GNUNET_TIME_Timestamp timestamp; @@ -278,8 +280,8 @@ execute_transaction (struct TMH_HandlerContext *hc, pay_deadline, claim_token, order, /* called 'contract terms' at database. */ - NULL, // FIXME! - TALER_MCA_NONE); // FIXME: use from TMH_private_post_orders_with_pos_secrets + pos_key, + pos_algorithm); if (qs <= 0) { /* qs == 0: probably instance does not exist (anymore) */ @@ -364,6 +366,8 @@ execute_transaction (struct TMH_HandlerContext *hc, * @param inventory_products array of products to add to @a order from our inventory * @param uuids_length length of the @a uuids array * @param uuids array of UUIDs used to reserve products from @a inventory_products + * @param pos_key encoded key for verification payment + * @param pos_algorithm algorithm to compute the payment verification * @return MHD result code */ static MHD_RESULT @@ -375,7 +379,9 @@ execute_order (struct MHD_Connection *connection, unsigned int inventory_products_length, const struct InventoryProduct inventory_products[], unsigned int uuids_length, - const struct GNUNET_Uuid uuids[]) + const struct GNUNET_Uuid uuids[], + const char *pos_key, + enum TALER_MerchantConfirmationAlgorithm pos_algorithm) { const struct TALER_MERCHANTDB_InstanceSettings *settings = &hc->instance->settings; @@ -555,7 +561,9 @@ execute_order (struct MHD_Connection *connection, inventory_products, uuids_length, uuids, - &out_of_stock_index); + &out_of_stock_index, + pos_key, + pos_algorithm); if (GNUNET_DB_STATUS_SOFT_ERROR != qs) break; } @@ -693,6 +701,8 @@ execute_order (struct MHD_Connection *connection, * @param inventory_products array of products to add to @a order from our inventory * @param uuids_length length of the @a uuids array * @param uuids array of UUIDs used to reserve products from @a inventory_products + * @param pos_key encoded key for verification payment + * @param pos_algorithm algorithm to compute the payment verification * @return MHD result code */ static MHD_RESULT @@ -705,7 +715,9 @@ patch_order (struct MHD_Connection *connection, unsigned int inventory_products_length, const struct InventoryProduct inventory_products[], unsigned int uuids_length, - const struct GNUNET_Uuid uuids[]) + const struct GNUNET_Uuid uuids[], + const char *pos_key, + enum TALER_MerchantConfirmationAlgorithm pos_algorithm) { const struct TALER_MERCHANTDB_InstanceSettings *settings = &hc->instance->settings; @@ -1205,7 +1217,9 @@ patch_order (struct MHD_Connection *connection, inventory_products_length, inventory_products, uuids_length, - uuids); + uuids, + pos_key, + pos_algorithm); GNUNET_JSON_parse_free (spec); return mres; } @@ -1228,6 +1242,8 @@ patch_order (struct MHD_Connection *connection, * @param inventory_products array of products to add to @a order from our inventory * @param uuids_length length of the @a uuids array * @param uuids array of UUIDs used to reserve products from @a inventory_products + * @param pos_key encoded key for verification payment + * @param pos_algorithm algorithm to compute the payment verification * @return MHD result code */ static MHD_RESULT @@ -1241,7 +1257,9 @@ add_payment_details (struct MHD_Connection *connection, unsigned int inventory_products_length, const struct InventoryProduct inventory_products[], unsigned int uuids_length, - const struct GNUNET_Uuid uuids[]) + const struct GNUNET_Uuid uuids[], + const char *pos_key, + enum TALER_MerchantConfirmationAlgorithm pos_algorithm) { struct TMH_WireMethod *wm; @@ -1281,7 +1299,9 @@ add_payment_details (struct MHD_Connection *connection, inventory_products_length, inventory_products, uuids_length, - uuids); + uuids, + pos_key, + pos_algorithm); } @@ -1301,6 +1321,8 @@ add_payment_details (struct MHD_Connection *connection, * @param inventory_products array of products to add to @a order from our inventory * @param uuids_length length of the @a uuids array * @param uuids array of UUIDs used to reserve products from @a inventory_products + * @param pos_key encoded key for verification payment + * @param pos_algorithm algorithm to compute the payment verification * @return MHD result code */ static MHD_RESULT @@ -1314,7 +1336,9 @@ merge_inventory (struct MHD_Connection *connection, unsigned int inventory_products_length, const struct InventoryProduct inventory_products[], unsigned int uuids_length, - const struct GNUNET_Uuid uuids[]) + const struct GNUNET_Uuid uuids[], + const char *pos_key, + enum TALER_MerchantConfirmationAlgorithm pos_algorithm) { /** * inventory_products => instructions to add products to contract terms @@ -1437,7 +1461,9 @@ merge_inventory (struct MHD_Connection *connection, inventory_products_length, inventory_products, uuids_length, - uuids); + uuids, + pos_key, + pos_algorithm); } @@ -1650,7 +1676,9 @@ TMH_private_post_orders_with_pos_secrets ( ips_len, ips, uuids_len, - uuids); + uuids, + pos_key, + pos_algorithm); GNUNET_array_grow (ips, ips_len, 0); -- cgit v1.2.3