summaryrefslogtreecommitdiff
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
parentec735d213d3b7ab52e5e69f70b882ea7faeefa41 (diff)
parent6745f267a6cda82965a9ab96e2d96f39a953cac2 (diff)
downloadexchange-a699f01ab2ce41d0215a02ed34ef059b9152471a.tar.gz
exchange-a699f01ab2ce41d0215a02ed34ef059b9152471a.tar.bz2
exchange-a699f01ab2ce41d0215a02ed34ef059b9152471a.zip
Merge branch 'master' of git+ssh://git.taler.net/exchange
-rw-r--r--contrib/Makefile.am.in4
-rw-r--r--contrib/ci/jobs/0-codespell/config.ini1
-rwxr-xr-xcontrib/taler-nexus-prepare115
-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
7 files changed, 48 insertions, 162 deletions
diff --git a/contrib/Makefile.am.in b/contrib/Makefile.am.in
index 64a5a9f54..01cd6ac2f 100644
--- a/contrib/Makefile.am.in
+++ b/contrib/Makefile.am.in
@@ -32,8 +32,8 @@ bin_SCRIPTS = \
taler-auditor-dbconfig \
taler-exchange-dbconfig \
taler-terms-generator \
- taler-bank-manage-testing \
- taler-nexus-prepare
+ taler-bank-manage-testing
+
edit_script = $(SED) -e 's,%termsdir%,$(termsdir),'g -e 's,%localedir%,$(localedir),'g $(NULL)
taler-terms-generator: taler-terms-generator.in
diff --git a/contrib/ci/jobs/0-codespell/config.ini b/contrib/ci/jobs/0-codespell/config.ini
index 1c52b6a1a..bd7d73860 100644
--- a/contrib/ci/jobs/0-codespell/config.ini
+++ b/contrib/ci/jobs/0-codespell/config.ini
@@ -3,3 +3,4 @@ HALT_ON_FAILURE = False
WARN_ON_FAILURE = True
CONTAINER_BUILD = False
CONTAINER_NAME = nixery.dev/shell/codespell
+CONTAINER_ARCH = amd64
diff --git a/contrib/taler-nexus-prepare b/contrib/taler-nexus-prepare
deleted file mode 100755
index d98e5eb43..000000000
--- a/contrib/taler-nexus-prepare
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/bash
-
-set -eu
-
-# EBICS details
-EBICS_URL="http://localhost:5000/ebicsweb"
-HOST_ID="HOST01"
-PARTNER_ID="PARTNER1"
-USER_ID="USER1"
-
-# This is used _both_ at Sandbox and at Nexus.
-# Basically, Nexus imports the offered bank account
-# using the same name used by the Sandbox.
-BANK_ACCOUNT_LABEL="my-bank-account"
-BANK_CONNECTION_LABEL="my-bank-connection"
-FACADE_LABEL="my-facade"
-
-export LIBEUFIN_SANDBOX_USERNAME=exchange
-export LIBEUFIN_SANDBOX_PASSWORD=x
-export LIBEUFIN_SANDBOX_URL=http://localhost:5000/
-libeufin-cli sandbox demobank register --name "Exchange Company"
-
-export LIBEUFIN_SANDBOX_USERNAME=fortytwo
-export LIBEUFIN_SANDBOX_PASSWORD=x
-export LIBEUFIN_SANDBOX_URL=http://localhost:5000/
-libeufin-cli sandbox demobank register \
- --name User42 --iban FR7630006000011234567890189
-
-export LIBEUFIN_SANDBOX_USERNAME=fortythree
-export LIBEUFIN_SANDBOX_PASSWORD=x
-export LIBEUFIN_SANDBOX_URL=http://localhost:5000/
-libeufin-cli sandbox demobank register \
- --name User43 --iban GB33BUKB20201555555555
-
-export LIBEUFIN_SANDBOX_USERNAME=admin
-export LIBEUFIN_SANDBOX_PASSWORD=secret
-export LIBEUFIN_SANDBOX_URL=http://localhost:5000/
-echo -n "Create EBICS host at Sandbox..."
-libeufin-cli sandbox \
- --sandbox-url "http://localhost:5000" \
- ebicshost create --host-id $HOST_ID
-echo " OK"
-
-echo -n "Create exchange EBICS subscriber at Sandbox..."
-libeufin-cli sandbox \
- demobank new-ebicssubscriber --host-id $HOST_ID \
- --user-id $USER_ID --partner-id $PARTNER_ID \
- --bank-account exchange # that's a username _and_ a bank account name
-echo " OK"
-unset LIBEUFIN_SANDBOX_USERNAME
-unset LIBEUFIN_SANDBOX_PASSWORD
-unset LIBEUFIN_SANDBOX_URL
-
-export LIBEUFIN_NEXUS_USERNAME=exchange
-export LIBEUFIN_NEXUS_PASSWORD=x
-export LIBEUFIN_NEXUS_URL=http://localhost:5001/
-
-echo -n "Create the exchange (super)user at Nexus..."
-libeufin-nexus superuser exchange --password x
-echo " DONE"
-
-echo -n "Creating a EBICS connection at Nexus..."
-libeufin-cli connections new-ebics-connection \
- --ebics-url $EBICS_URL \
- --host-id $HOST_ID \
- --partner-id $PARTNER_ID \
- --ebics-user-id $USER_ID \
- $BANK_CONNECTION_LABEL
-echo " OK"
-
-echo -n "Setup EBICS keying..."
-libeufin-cli connections connect $BANK_CONNECTION_LABEL > /dev/null
-echo " OK"
-
-echo -n "Download bank account name from Sandbox..."
-libeufin-cli connections download-bank-accounts $BANK_CONNECTION_LABEL
-echo " OK"
-
-echo -n "Importing bank account info into Nexus..."
-libeufin-cli connections import-bank-account \
- --offered-account-id exchange \
- --nexus-bank-account-id $BANK_ACCOUNT_LABEL \
- $BANK_CONNECTION_LABEL
-echo " OK"
-
-echo -n "Create the Taler facade at Nexus..."
-libeufin-cli facades \
- new-taler-wire-gateway-facade \
- --currency KUDOS --facade-name $FACADE_LABEL \
- $BANK_CONNECTION_LABEL $BANK_ACCOUNT_LABEL
-echo " DONE"
-
-echo -n Setup payments submission task..
-# Tries every second.
-libeufin-cli accounts task-schedule \
- --task-type submit \
- --task-name exchange-payments \
- --task-cronspec "* * *" \
- $BANK_ACCOUNT_LABEL
-echo OK
-# Tries every second. Ask C52
-echo -n Setup history fetch task..
-libeufin-cli accounts task-schedule \
- --task-type fetch \
- --task-name exchange-history \
- --task-cronspec "* * *" \
- --task-param-level report \
- --task-param-range-type latest \
- $BANK_ACCOUNT_LABEL
-echo OK
-
-# unset, in case the script gets 'source'd.
-unset LIBEUFIN_NEXUS_USERNAME
-unset LIBEUFIN_NEXUS_PASSWORD
-unset LIBEUFIN_NEXUS_URL
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,