summaryrefslogtreecommitdiff
path: root/src/backenddb/pg_insert_order.c
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-12-16 17:54:16 +0800
committerChristian Grothoff <grothoff@gnunet.org>2023-12-16 17:54:30 +0800
commit7891e62bf98bd884c8c993ae698f9a985dbacfbd (patch)
tree0294420f02463fb7d516c95a6b04736c64058274 /src/backenddb/pg_insert_order.c
parent1c1ec9c54e09e9b90ea7a91e81bf5a6eb878c53b (diff)
downloadmerchant-7891e62bf98bd884c8c993ae698f9a985dbacfbd.tar.gz
merchant-7891e62bf98bd884c8c993ae698f9a985dbacfbd.tar.bz2
merchant-7891e62bf98bd884c8c993ae698f9a985dbacfbd.zip
partial implementation of protocol v6: GET with additional filters, POST not done
Diffstat (limited to 'src/backenddb/pg_insert_order.c')
-rw-r--r--src/backenddb/pg_insert_order.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/backenddb/pg_insert_order.c b/src/backenddb/pg_insert_order.c
index 7c7ad486..867fdec8 100644
--- a/src/backenddb/pg_insert_order.c
+++ b/src/backenddb/pg_insert_order.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2022 Taler Systems SA
+ Copyright (C) 2022, 2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -17,6 +17,7 @@
* @file backenddb/pg_insert_order.c
* @brief Implementation of the insert_order function for Postgres
* @author Iván Ávalos
+ * @author Christian Grothoff
*/
#include "platform.h"
#include <taler/taler_error_codes.h>
@@ -29,6 +30,7 @@ enum GNUNET_DB_QueryStatus
TMH_PG_insert_order (void *cls,
const char *instance_id,
const char *order_id,
+ const char *session_id,
const struct TALER_MerchantPostDataHashP *h_post_data,
struct GNUNET_TIME_Timestamp pay_deadline,
const struct TALER_ClaimTokenP *claim_token,
@@ -39,6 +41,9 @@ TMH_PG_insert_order (void *cls,
struct PostgresClosure *pg = cls;
struct GNUNET_TIME_Timestamp now;
uint32_t pos32 = (uint32_t) pos_algorithm;
+ const char *fulfillment_url
+ = json_string_value (json_object_get (contract_terms,
+ "fulfillment_url"));
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_string (order_id),
@@ -51,6 +56,12 @@ TMH_PG_insert_order (void *cls,
? GNUNET_PQ_query_param_null ()
: GNUNET_PQ_query_param_string (pos_key),
GNUNET_PQ_query_param_uint32 (&pos32),
+ (NULL == session_id)
+ ? GNUNET_PQ_query_param_string ("")
+ : GNUNET_PQ_query_param_string (session_id),
+ (NULL == fulfillment_url)
+ ? GNUNET_PQ_query_param_null ()
+ : GNUNET_PQ_query_param_string (fulfillment_url),
GNUNET_PQ_query_param_end
};
@@ -71,9 +82,11 @@ TMH_PG_insert_order (void *cls,
",creation_time"
",contract_terms"
",pos_key"
- ",pos_algorithm)"
+ ",pos_algorithm"
+ ",session_id"
+ ",fulfillment_url)"
" SELECT merchant_serial,"
- " $2, $3, $4, $5, $6, $7, $8, $9"
+ " $2, $3, $4, $5, $6, $7, $8, $9, $10, $11"
" FROM merchant_instances"
" WHERE merchant_id=$1");
return GNUNET_PQ_eval_prepared_non_select (pg->conn,