summaryrefslogtreecommitdiff
path: root/src/exchangedb/plugin_exchangedb_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-05-08 11:37:37 +0200
committerChristian Grothoff <christian@grothoff.org>2022-05-08 11:37:37 +0200
commitd3a63881999aa1c6d763263346a0a5979ec6efac (patch)
tree92f220ad08ce79d1f18366346ffabfa93cf33d75 /src/exchangedb/plugin_exchangedb_postgres.c
parent6b8e732bf8d8bfae268e7f5a9a09af9167fd0d47 (diff)
downloadexchange-d3a63881999aa1c6d763263346a0a5979ec6efac.tar.gz
exchange-d3a63881999aa1c6d763263346a0a5979ec6efac.tar.bz2
exchange-d3a63881999aa1c6d763263346a0a5979ec6efac.zip
pass purse_fee to determine how purse creation is paid for
Diffstat (limited to 'src/exchangedb/plugin_exchangedb_postgres.c')
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index aa4066e6f..a4807d030 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -3541,13 +3541,17 @@ prepare_statements (struct PostgresClosure *pg)
" ,purse_expiration"
" ,h_contract_terms"
" ,age_limit"
+ " ,flags"
+ " ,in_reserve_quota"
" ,amount_with_fee_val"
" ,amount_with_fee_frac"
+ " ,purse_fee_val"
+ " ,purse_fee_frac"
" ,purse_sig"
" ) VALUES "
- " ($1, $2, $3, $4, $5, $6, $7, $8)"
+ " ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)"
" ON CONFLICT DO NOTHING;",
- 8),
+ 12),
/* Used in #postgres_select_purse */
GNUNET_PQ_make_prepare (
"select_purse",
@@ -13481,6 +13485,8 @@ postgres_select_purse_request (
* @param purse_expiration time when the purse will expire
* @param h_contract_terms hash of the contract for the purse
* @param age_limit age limit to enforce for payments into the purse
+ * @param flags flags for the operation
+ * @param purse_fee fee we are allowed to charge to the reserve (depending on @a flags)
* @param amount target amount (with fees) to be put into the purse
* @param purse_sig signature with @a purse_pub's private key affirming the above
* @param[out] in_conflict set to true if the meta data
@@ -13497,19 +13503,27 @@ postgres_insert_purse_request (
struct GNUNET_TIME_Timestamp purse_expiration,
const struct TALER_PrivateContractHashP *h_contract_terms,
uint32_t age_limit,
+ enum TALER_WalletAccountMergeFlags flags,
+ const struct TALER_Amount *purse_fee,
const struct TALER_Amount *amount,
const struct TALER_PurseContractSignatureP *purse_sig,
bool *in_conflict)
{
struct PostgresClosure *pg = cls;
enum GNUNET_DB_QueryStatus qs;
+ uint32_t flags32 = (uint32_t) flags;
+ bool in_reserve_quota = (TALER_WAMF_MODE_CREATE_WITH_PURSE_FEE
+ == (flags & TALER_WAMF_MERGE_MODE_MASK));
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (purse_pub),
GNUNET_PQ_query_param_auto_from_type (merge_pub),
GNUNET_PQ_query_param_timestamp (&purse_expiration),
GNUNET_PQ_query_param_auto_from_type (h_contract_terms),
GNUNET_PQ_query_param_uint32 (&age_limit),
+ GNUNET_PQ_query_param_uint32 (&flags32),
+ GNUNET_PQ_query_param_bool (in_reserve_quota),
TALER_PQ_query_param_amount (amount),
+ TALER_PQ_query_param_amount (purse_fee),
GNUNET_PQ_query_param_auto_from_type (purse_sig),
GNUNET_PQ_query_param_end
};