summaryrefslogtreecommitdiff
path: root/src/backenddb
diff options
context:
space:
mode:
authorChristian Grothoff <grothoff@gnunet.org>2023-10-13 14:43:50 +0200
committerChristian Grothoff <grothoff@gnunet.org>2023-10-13 21:16:50 +0200
commita5f50083e65a3e9a0945b150701349afa81a0e9e (patch)
treea6a89fa83c78d812a7f6a38e851659cf443269dd /src/backenddb
parenta8b2456ecf47e2650f8bac1da3cc25b4ace54d24 (diff)
downloadmerchant-a5f50083e65a3e9a0945b150701349afa81a0e9e.tar.gz
merchant-a5f50083e65a3e9a0945b150701349afa81a0e9e.tar.bz2
merchant-a5f50083e65a3e9a0945b150701349afa81a0e9e.zip
work towards multi-currency support
Diffstat (limited to 'src/backenddb')
-rw-r--r--src/backenddb/pg_authorize_reward.c2
-rw-r--r--src/backenddb/pg_increase_refund.c8
-rw-r--r--src/backenddb/pg_insert_pickup.c7
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c7
4 files changed, 23 insertions, 1 deletions
diff --git a/src/backenddb/pg_authorize_reward.c b/src/backenddb/pg_authorize_reward.c
index 336112cb..5038f4fa 100644
--- a/src/backenddb/pg_authorize_reward.c
+++ b/src/backenddb/pg_authorize_reward.c
@@ -130,7 +130,7 @@ lookup_reserve_for_reward_cb (void *cls,
/* insufficient balance */
if (lac->ok)
continue; /* got another reserve */
- lac->ec = TALER_EC_GENERIC_CURRENCY_MISMATCH;
+ lac->ec = TALER_EC_MERCHANT_GENERIC_CURRENCY_MISMATCH;
continue;
}
if (0 >
diff --git a/src/backenddb/pg_increase_refund.c b/src/backenddb/pg_increase_refund.c
index f1813e9b..832a84eb 100644
--- a/src/backenddb/pg_increase_refund.c
+++ b/src/backenddb/pg_increase_refund.c
@@ -223,6 +223,14 @@ process_deposits_for_refund_cb (
return;
}
+ if (0 != strcmp (rcd[i].deposited_with_fee.currency,
+ ctx->refund->currency))
+ {
+ GNUNET_break_op (0);
+ ctx->rs = TALER_MERCHANTDB_RS_BAD_CURRENCY;
+ return;
+ }
+
{
enum GNUNET_DB_QueryStatus ires;
struct GNUNET_PQ_QueryParam params[] = {
diff --git a/src/backenddb/pg_insert_pickup.c b/src/backenddb/pg_insert_pickup.c
index 73b97c6d..4094d748 100644
--- a/src/backenddb/pg_insert_pickup.c
+++ b/src/backenddb/pg_insert_pickup.c
@@ -134,6 +134,13 @@ TMH_PG_insert_pickup (
if (0 > qs)
return qs;
}
+ if (GNUNET_OK !=
+ TALER_amount_cmp_currency (&reserve_picked_up,
+ total_requested))
+ {
+ GNUNET_break (0);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
if (0 >=
TALER_amount_add (&reserve_picked_up,
&reserve_picked_up,
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 30def849..c2c99cd1 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -1172,6 +1172,13 @@ postgres_lookup_transfer (
{
*have_exchange_sig = ! no_sig;
*verified = (0 != verified8);
+ if (GNUNET_OK !=
+ TALER_amount_cmp_currency (&credit_amount,
+ wire_fee))
+ {
+ GNUNET_break (0);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
if ( (! no_sig) &&
(0 >
TALER_amount_add (total_amount,