aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Kügel <skuegel@web.de>2023-11-27 14:22:13 +0100
committerStefan Kügel <skuegel@web.de>2023-11-27 14:22:13 +0100
commita699f01ab2ce41d0215a02ed34ef059b9152471a (patch)
tree484634b9f30436b16cb8cb5878d16d6d4b6f3b1c /src
parentec735d213d3b7ab52e5e69f70b882ea7faeefa41 (diff)
parent6745f267a6cda82965a9ab96e2d96f39a953cac2 (diff)
downloadexchange-a699f01ab2ce41d0215a02ed34ef059b9152471a.tar.xz
Merge branch 'master' of git+ssh://git.taler.net/exchange
Diffstat (limited to 'src')
-rw-r--r--src/include/taler_crypto_lib.h2
-rw-r--r--src/json/json_helper.c54
-rw-r--r--src/lib/test_stefan.c2
-rw-r--r--src/testing/testing_api_cmd_refund.c32
4 files changed, 45 insertions, 45 deletions
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index 0d3935238..c17dcb34f 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -5867,7 +5867,7 @@ struct TALER_DenominationGroup
enum GNUNET_CRYPTO_BlindSignatureAlgorithm cipher;
/**
- * Age mask for the denomiation.
+ * Age mask for the denomination.
*/
struct TALER_AgeMask age_mask;
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
index 19dec2170..0628282ca 100644
--- a/src/json/json_helper.c
+++ b/src/json/json_helper.c
@@ -1440,21 +1440,16 @@ parse_ec (void *cls,
struct GNUNET_JSON_Specification *spec)
{
enum TALER_ErrorCode *ec = spec->ptr;
- uint32_t num;
- struct GNUNET_JSON_Specification dspec[] = {
- GNUNET_JSON_spec_uint32 (spec->field,
- &num),
- GNUNET_JSON_spec_end ()
- };
- const char *emsg;
- unsigned int eline;
+ json_int_t num;
(void) cls;
- if (GNUNET_OK !=
- GNUNET_JSON_parse (root,
- dspec,
- &emsg,
- &eline))
+ if (! json_is_integer (root))
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
+ num = json_integer_value (root);
+ if (num < 0)
{
GNUNET_break_op (0);
*ec = TALER_EC_INVALID;
@@ -1494,26 +1489,17 @@ parse_aml_decision (void *cls,
struct GNUNET_JSON_Specification *spec)
{
enum TALER_AmlDecisionState *aml = spec->ptr;
- uint32_t num;
- struct GNUNET_JSON_Specification dspec[] = {
- GNUNET_JSON_spec_uint32 (spec->field,
- &num),
- GNUNET_JSON_spec_end ()
- };
- const char *emsg;
- unsigned int eline;
+ json_int_t num;
(void) cls;
- if (GNUNET_OK !=
- GNUNET_JSON_parse (root,
- dspec,
- &emsg,
- &eline))
+ if (! json_is_integer (root))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if (num > TALER_AML_MAX)
+ num = json_integer_value (root);
+ if ( (num > TALER_AML_MAX) ||
+ (num < 0) )
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
@@ -1649,25 +1635,15 @@ parse_protocol_version (void *cls,
{
struct TALER_JSON_ProtocolVersion *pv = spec->ptr;
const char *ver;
- struct GNUNET_JSON_Specification dspec[] = {
- GNUNET_JSON_spec_string (spec->field,
- &ver),
- GNUNET_JSON_spec_end ()
- };
- const char *emsg;
- unsigned int eline;
char dummy;
(void) cls;
- if (GNUNET_OK !=
- GNUNET_JSON_parse (root,
- dspec,
- &emsg,
- &eline))
+ if (! json_is_string (root))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
+ ver = json_string_value (root);
if (3 != sscanf (ver,
"%u:%u:%u%c",
&pv->current,
diff --git a/src/lib/test_stefan.c b/src/lib/test_stefan.c
index 838cca769..4f7add593 100644
--- a/src/lib/test_stefan.c
+++ b/src/lib/test_stefan.c
@@ -92,7 +92,7 @@ main (int argc,
"INFO",
NULL);
GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount ("MAGIC:0.13",
+ TALER_string_to_amount ("MAGIC:0.00001",
&dk.value));
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount ("MAGIC:1",
diff --git a/src/testing/testing_api_cmd_refund.c b/src/testing/testing_api_cmd_refund.c
index 516d64503..29b68ef08 100644
--- a/src/testing/testing_api_cmd_refund.c
+++ b/src/testing/testing_api_cmd_refund.c
@@ -97,6 +97,34 @@ refund_cb (void *cls,
rs->expected_response_code);
return;
}
+ if (MHD_HTTP_OK == hr->http_status)
+ {
+ struct TALER_Amount refund_amount;
+
+ if (GNUNET_OK !=
+ TALER_string_to_amount (rs->refund_amount,
+ &refund_amount))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to parse amount `%s'\n",
+ rs->refund_amount);
+ TALER_TESTING_interpreter_fail (rs->is);
+ return;
+ }
+ if (0 >
+ TALER_amount_subtract (&rs->che.amount,
+ &refund_amount,
+ &rs->che.details.refund.refund_fee))
+ {
+ GNUNET_break (0);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to subtract %s from %s\n",
+ TALER_amount2s (&rs->che.details.refund.refund_fee),
+ rs->refund_amount);
+ TALER_TESTING_interpreter_fail (rs->is);
+ return;
+ }
+ }
TALER_TESTING_interpreter_next (rs->is);
}
@@ -187,10 +215,6 @@ refund_run (void *cls,
&rs->che.details.refund.merchant_pub.eddsa_pub);
rs->che.details.refund.refund_fee = denom_pub->fees.refund;
rs->che.details.refund.sig_amount = refund_amount;
- GNUNET_assert (0 <=
- TALER_amount_subtract (&rs->che.amount,
- &refund_amount,
- &rs->che.details.refund.refund_fee));
rs->che.details.refund.rtransaction_id = rs->refund_transaction_id;
TALER_merchant_refund_sign (&rs->coin,
&h_contract_terms,