[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: check instance currency matches
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: check instance currency matches config |
Date: |
Fri, 14 Aug 2020 08:39:07 +0200 |
This is an automated email from the git hooks/post-receive script.
jonathan-buchanan pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 5e9a041 check instance currency matches config
5e9a041 is described below
commit 5e9a041c084f70c7bb80d13b960402d30cd5e6fe
Author: Jonathan Buchanan <jonathan.russ.buchanan@gmail.com>
AuthorDate: Fri Aug 14 02:38:56 2020 -0400
check instance currency matches config
---
.../taler-merchant-httpd_private-patch-instances-ID.c | 18 ++++++++++++++++--
.../taler-merchant-httpd_private-post-instances.c | 13 +++++++++++++
src/testing/test_merchant_api.c | 10 ++++++++--
3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
index d6fbb50..8634815 100644
--- a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
@@ -120,6 +120,19 @@ TMH_private_patch_instances_ID (const struct
TMH_RequestHandler *rh,
free_wm (wm);
}
}
+ if ((0 != strcasecmp (is.default_max_deposit_fee.currency,
+ TMH_currency)) ||
+ (0 != strcasecmp (is.default_max_wire_fee.currency,
+ TMH_currency)))
+ {
+ GNUNET_break (0);
+ GNUNET_JSON_parse_free (spec);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_POST_INSTANCES_BAD_CURRENCY,
+ "Max deposit fee or max wire fee
currency incompatible with config");
+ break;
+ }
if (GNUNET_OK !=
TMH_db->start (TMH_db->cls,
"PATCH /instances"))
@@ -142,8 +155,9 @@ TMH_private_patch_instances_ID (const struct
TMH_RequestHandler *rh,
&is.default_max_deposit_fee)) &&
(0 == TALER_amount_cmp (&mi->settings.default_max_deposit_fee,
&is.default_max_deposit_fee)) &&
- (GNUNET_YES == TALER_amount_cmp_currency
(&mi->settings.default_max_wire_fee,
- &is.default_max_wire_fee)) &&
+ (GNUNET_YES == TALER_amount_cmp_currency (
+ &mi->settings.default_max_wire_fee,
+ &is.default_max_wire_fee)) &&
(0 == TALER_amount_cmp (&mi->settings.default_max_wire_fee,
&is.default_max_wire_fee)) &&
(mi->settings.default_wire_fee_amortization ==
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c
b/src/backend/taler-merchant-httpd_private-post-instances.c
index c89b28f..0fec449 100644
--- a/src/backend/taler-merchant-httpd_private-post-instances.c
+++ b/src/backend/taler-merchant-httpd_private-post-instances.c
@@ -180,6 +180,19 @@ TMH_private_post_instances (const struct
TMH_RequestHandler *rh,
: MHD_NO;
}
+ if ((0 != strcasecmp (is.default_max_deposit_fee.currency,
+ TMH_currency)) ||
+ (0 != strcasecmp (is.default_max_wire_fee.currency,
+ TMH_currency)))
+ {
+ GNUNET_break (0);
+ GNUNET_JSON_parse_free (spec);
+ return TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_POST_INSTANCES_BAD_CURRENCY,
+ "Max deposit fee or max wire fee
currency incompatible with config");
+ }
+
{
/* Test if an instance of this id is known */
struct TMH_MerchantInstance *mi;
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 5e62053..92fb3f4 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -1170,7 +1170,7 @@ run (void *cls,
"i1",
MHD_HTTP_OK,
"instance-create-i1"),
- TALER_TESTING_cmd_merchant_patch_instance
("instance-patch-i1-other-currency",
+ TALER_TESTING_cmd_merchant_patch_instance
("instance-patch-i1-bad-currency",
merchant_url,
"i1",
2,
@@ -1187,7 +1187,7 @@ run (void *cls,
"USD:0.5",
GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_MINUTES,
- MHD_HTTP_NO_CONTENT),
+ MHD_HTTP_BAD_REQUEST),
TALER_TESTING_cmd_merchant_patch_instance ("instance-patch-i1",
merchant_url,
"i1",
@@ -1248,6 +1248,12 @@ run (void *cls,
"i2",
MHD_HTTP_NOT_FOUND,
NULL),
+ TALER_TESTING_cmd_merchant_post_instances ("instance-create-bad-currency",
+ merchant_url,
+ "i2",
+ PAYTO_I1,
+ "USD",
+ MHD_HTTP_BAD_REQUEST),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2",
merchant_url,
"i2",
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: check instance currency matches config,
gnunet <=