summaryrefslogtreecommitdiff
path: root/src/backenddb
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2017-06-07 15:17:17 +0200
committerMarcello Stanisci <marcello.stanisci@inria.fr>2017-06-07 15:17:17 +0200
commit2aab5f342e452b41cedc9817eed5f8796fe510d2 (patch)
tree9fa27f2ed661335879916008ab5637bd2d9e4417 /src/backenddb
parenta1fc2db1340437153cc5d6ba4a7277d171c1daba (diff)
downloadmerchant-2aab5f342e452b41cedc9817eed5f8796fe510d2.tar.gz
merchant-2aab5f342e452b41cedc9817eed5f8796fe510d2.tar.bz2
merchant-2aab5f342e452b41cedc9817eed5f8796fe510d2.zip
refund fee stored along deposit
Diffstat (limited to 'src/backenddb')
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c10
-rw-r--r--src/backenddb/test_merchantdb.c9
2 files changed, 17 insertions, 2 deletions
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index f2620006..e0711a73 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -212,10 +212,13 @@ postgres_initialize (void *cls)
",deposit_fee_val"
",deposit_fee_frac"
",deposit_fee_curr"
+ ",refund_fee_val"
+ ",refund_fee_frac"
+ ",refund_fee_curr"
",signkey_pub"
",exchange_proof) VALUES "
- "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)",
- 11),
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)",
+ 14),
GNUNET_PQ_make_prepare ("insert_transfer",
"INSERT INTO merchant_transfers"
"(h_contract_terms"
@@ -633,6 +636,7 @@ postgres_store_transaction (void *cls,
* @param coin_pub public key of the coin
* @param amount_with_fee amount the exchange will deposit for this coin
* @param deposit_fee fee the exchange will charge for this coin
+ * @param refund_fee fee the exchange will charge for refunding this coin
* @param signkey_pub public key used by the exchange for @a exchange_proof
* @param exchange_proof proof from exchange that coin was accepted
* @return #GNUNET_OK on success, #GNUNET_SYSERR upon error
@@ -644,6 +648,7 @@ postgres_store_deposit (void *cls,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *deposit_fee,
+ const struct TALER_Amount *refund_fee,
const struct TALER_ExchangePublicKeyP *signkey_pub,
const json_t *exchange_proof)
{
@@ -656,6 +661,7 @@ postgres_store_deposit (void *cls,
GNUNET_PQ_query_param_auto_from_type (coin_pub),
TALER_PQ_query_param_amount (amount_with_fee),
TALER_PQ_query_param_amount (deposit_fee),
+ TALER_PQ_query_param_amount (refund_fee),
GNUNET_PQ_query_param_auto_from_type (signkey_pub),
TALER_PQ_query_param_json (exchange_proof),
GNUNET_PQ_query_param_end
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index c5126518..3bec78de 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -112,6 +112,11 @@ static struct TALER_Amount amount_with_fee;
static struct TALER_Amount deposit_fee;
/**
+ * Refund fee for the coin.
+ */
+static struct TALER_Amount refund_fee;
+
+/**
* Public key of the coin. Set to some random value.
*/
static struct TALER_CoinSpendPublicKeyP coin_pub;
@@ -348,6 +353,9 @@ run (void *cls)
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (CURRENCY ":0.000010",
&deposit_fee));
+ GNUNET_assert (GNUNET_OK ==
+ TALER_string_to_amount (CURRENCY ":0.000010",
+ &refund_fee));
RND_BLK (&coin_pub);
deposit_proof = json_object ();
GNUNET_assert (0 ==
@@ -447,6 +455,7 @@ run (void *cls)
&coin_pub,
&amount_with_fee,
&deposit_fee,
+ &refund_fee,
&signkey_pub,
deposit_proof));
FAILIF (GNUNET_OK !=