summaryrefslogtreecommitdiff
path: root/src/backenddb/plugin_merchantdb_postgres.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backenddb/plugin_merchantdb_postgres.c')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 0001a8e6..780becfb 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1755,6 +1755,7 @@ postgres_insert_order_lock (void *cls,
* @param order_id order_id used to lookup.
* @param[out] contract_terms where to store the result, NULL to only check for existence
* @param[out] order_serial set to the order's serial number
+ * @param[out] claim_token set to the claim token, NULL to only check for existence
* @return transaction status
*/
static enum GNUNET_DB_QueryStatus
@@ -1762,23 +1763,32 @@ postgres_lookup_contract_terms (void *cls,
const char *instance_id,
const char *order_id,
json_t **contract_terms,
- uint64_t *order_serial)
+ uint64_t *order_serial,
+ struct TALER_ClaimTokenP *claim_token)
{
struct PostgresClosure *pg = cls;
+ struct TALER_ClaimTokenP ct;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_string (order_id),
GNUNET_PQ_query_param_end
};
- struct GNUNET_PQ_ResultSpec rs[] = {
+ struct GNUNET_PQ_ResultSpec rs[4] = {
/* contract_terms must be first! */
TALER_PQ_result_spec_json ("contract_terms",
contract_terms),
GNUNET_PQ_result_spec_uint64 ("order_serial",
order_serial),
+ GNUNET_PQ_result_spec_auto_from_type ("claim_token",
+ &ct),
GNUNET_PQ_result_spec_end
};
+ if (NULL != claim_token)
+ {
+ *claim_token = ct;
+ }
+
check_connection (pg);
return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"lookup_contract_terms",
@@ -7648,6 +7658,7 @@ postgres_connect (void *cls)
"SELECT"
" contract_terms"
",order_serial"
+ ",claim_token"
" FROM merchant_contract_terms"
" WHERE order_id=$2"
" AND merchant_serial="
@@ -7666,18 +7677,20 @@ postgres_connect (void *cls)
",creation_time"
",pay_deadline"
",refund_deadline"
- ",fulfillment_url)"
+ ",fulfillment_url"
+ ",claim_token)"
"SELECT"
- " order_serial"
- ",merchant_serial"
- ",order_id"
+ " mo.order_serial"
+ ",mo.merchant_serial"
+ ",mo.order_id"
",$3" /* contract_terms */
",$4" /* h_contract_terms */
- ",creation_time"
+ ",mo.creation_time"
",$5" /* pay_deadline */
",$6" /* refund_deadline */
",$7" /* fulfillment_url */
- "FROM merchant_orders"
+ ",mo.claim_token "
+ "FROM merchant_orders mo"
" WHERE order_id=$2"
" AND merchant_serial="
" (SELECT merchant_serial"