aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-08-22 23:15:08 +0200
committerChristian Grothoff <christian@grothoff.org>2023-08-22 23:15:08 +0200
commitc98d960d1badd1eeb834bacbc133960e2f86d304 (patch)
treefc94b246475ff387cf5aa4d8bbc3f0aa2f4b7d65 /src
parent525426db10c179fcacd19487f6c22cac837b2d40 (diff)
add currency to amounts in merchant DB
Diffstat (limited to 'src')
-rw-r--r--src/backend/taler-merchant-httpd.h2
-rw-r--r--src/backend/taler-merchant-httpd_post-orders-ID-pay.c70
-rw-r--r--src/backend/taler-merchant-httpd_private-get-instances-ID.c8
-rw-r--r--src/backend/taler-merchant-httpd_private-patch-instances-ID.c23
-rw-r--r--src/backend/taler-merchant-httpd_private-post-instances.c25
-rw-r--r--src/backend/taler-merchant-httpd_private-post-orders.c45
-rw-r--r--src/backenddb/merchant-0001.sql59
-rw-r--r--src/backenddb/pg_activate_reserve.c2
-rw-r--r--src/backenddb/pg_authorize_reward.c34
-rw-r--r--src/backenddb/pg_helper.h30
-rw-r--r--src/backenddb/pg_increase_refund.c11
-rw-r--r--src/backenddb/pg_insert_deposit.c8
-rw-r--r--src/backenddb/pg_insert_deposit_to_transfer.c2
-rw-r--r--src/backenddb/pg_insert_instance.c12
-rw-r--r--src/backenddb/pg_insert_pickup.c18
-rw-r--r--src/backenddb/pg_insert_product.c2
-rw-r--r--src/backenddb/pg_insert_reserve.c15
-rw-r--r--src/backenddb/pg_insert_transfer.c2
-rw-r--r--src/backenddb/pg_insert_transfer_details.c8
-rw-r--r--src/backenddb/pg_lookup_deposits.c17
-rw-r--r--src/backenddb/pg_lookup_instances.c16
-rw-r--r--src/backenddb/pg_lookup_product.c2
-rw-r--r--src/backenddb/pg_lookup_refunds.c5
-rw-r--r--src/backenddb/pg_lookup_reserves.c17
-rw-r--r--src/backenddb/pg_lookup_transfers.c5
-rw-r--r--src/backenddb/pg_select_exchange_keys.c5
-rw-r--r--src/backenddb/pg_select_open_transfers.c5
-rw-r--r--src/backenddb/pg_set_transfer_status_to_confirmed.c6
-rw-r--r--src/backenddb/pg_store_wire_fee_by_exchange.c4
-rw-r--r--src/backenddb/pg_update_instance.c22
-rw-r--r--src/backenddb/pg_update_product.c2
-rw-r--r--src/backenddb/plugin_merchantdb_postgres.c144
-rw-r--r--src/backenddb/test_merchantdb.c30
-rw-r--r--src/include/taler_merchant_service.h31
-rw-r--r--src/include/taler_merchant_testing_lib.h22
-rw-r--r--src/include/taler_merchantdb_plugin.h18
-rw-r--r--src/lib/merchant_api_get_instance.c37
-rw-r--r--src/lib/merchant_api_patch_instance.c12
-rw-r--r--src/lib/merchant_api_post_instances.c12
-rw-r--r--src/merchant-tools/taler-merchant-benchmark.c3
-rwxr-xr-xsrc/testing/test_key_rotation.sh2
-rw-r--r--src/testing/test_kyc_api.c1
-rw-r--r--src/testing/test_merchant_api.c63
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/16909972041
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/16916017041
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1690997204bin32 -> 0 bytes
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/16916017041
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1690997204bin32 -> 0 bytes
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/16916017041
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/16909972041
-rw-r--r--src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/16916017041
-rw-r--r--src/testing/test_merchant_api_twisted.c3
-rwxr-xr-xsrc/testing/test_merchant_instance_auth.sh4
-rwxr-xr-xsrc/testing/test_merchant_instance_creation.sh6
-rwxr-xr-xsrc/testing/test_merchant_instance_purge.sh4
-rwxr-xr-xsrc/testing/test_merchant_instance_response.sh2
-rwxr-xr-xsrc/testing/test_merchant_kyc.sh2
-rwxr-xr-xsrc/testing/test_merchant_order_autocleanup.sh2
-rwxr-xr-xsrc/testing/test_merchant_order_creation.sh4
-rwxr-xr-xsrc/testing/test_merchant_product_creation.sh2
-rwxr-xr-xsrc/testing/test_merchant_reserve_creation.sh2
-rwxr-xr-xsrc/testing/test_merchant_transfer_tracking.sh4
-rwxr-xr-xsrc/testing/test_merchant_wirewatch.sh2
-rw-r--r--src/testing/testing_api_cmd_get_instance.c53
-rw-r--r--src/testing/testing_api_cmd_patch_instance.c43
-rw-r--r--src/testing/testing_api_cmd_post_instances.c56
66 files changed, 324 insertions, 728 deletions
diff --git a/src/backend/taler-merchant-httpd.h b/src/backend/taler-merchant-httpd.h
index 4f25bab8..e1f2eeff 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2021 Taler Systems SA
+ Copyright (C) 2014-2023 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
index d4e620bd..5233d103 100644
--- a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
+++ b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -296,30 +296,11 @@ struct PayContext
* Note that IF the total fee of the exchange is higher, that is
* acceptable to the merchant if the customer is willing to
* pay the difference
- * (i.e. amount - max_fee <= actual-amount - actual-fee).
+ * (i.e. amount - max_fee <= actual_amount - actual_fee).
*/
struct TALER_Amount max_fee;
/**
- * Maximum wire fee the merchant is willing to pay, from @e root.
- * Note that IF the total fee of the exchange is higher, that is
- * acceptable to the merchant if the customer is willing to
- * pay the amorized difference. Wire fees are charged over an
- * aggregate of several translations, hence unlike the deposit
- * fees, they are amortized over several customer's transactions.
- * The contract specifies under @e wire_fee_amortization how many
- * customer's transactions he expects the wire fees to be amortized
- * over on average. Thus, if the wire fees are larger than
- * @e max_wire_fee, each customer is expected to contribute
- * $\frac{actual-wire-fee - max_wire_fee}{wire_fee_amortization}$.
- * The customer's contribution may be further reduced by the
- * difference between @e max_fee and the sum of the deposit fees.
- *
- * Default is that the merchant is unwilling to pay any wire fees.
- */
- struct TALER_Amount max_wire_fee;
-
- /**
* Amount from @e root. This is the amount the merchant expects
* to make, minus @e max_fee.
*/
@@ -377,15 +358,6 @@ struct PayContext
enum TALER_MerchantConfirmationAlgorithm pos_alg;
/**
- * Number of transactions that the wire fees are expected to be
- * amortized over. Never zero, defaults (conservateively) to 1.
- * May be higher if merchants expect many small transactions to
- * be aggregated and thus wire fees to be reasonably amortized
- * due to aggregation.
- */
- uint32_t wire_fee_amortization;
-
- /**
* Minimum age required for this purchase.
*/
unsigned int minimum_age;
@@ -1643,8 +1615,6 @@ check_payment_sufficient (struct PayContext *pc)
struct TALER_Amount acc_fee;
struct TALER_Amount acc_amount;
struct TALER_Amount final_amount;
- struct TALER_Amount wire_fee_delta;
- struct TALER_Amount wire_fee_customer_contribution;
struct TALER_Amount total_wire_fee;
struct TALER_Amount total_needed;
@@ -1743,9 +1713,6 @@ check_payment_sufficient (struct PayContext *pc)
"Total wire fee: %s\n",
TALER_amount2s (&total_wire_fee));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Max wire fee: %s\n",
- TALER_amount2s (&pc->max_wire_fee));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Deposit fee limit for merchant: %s\n",
TALER_amount2s (&pc->max_fee));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1753,10 +1720,10 @@ check_payment_sufficient (struct PayContext *pc)
TALER_amount2s (&pc->total_refunded));
/* Now compare exchange wire fee compared to
- * what we are willing to pay */
+ * what we are willing to pay */
if (GNUNET_YES !=
TALER_amount_cmp_currency (&total_wire_fee,
- &pc->max_wire_fee))
+ &acc_fee))
{
GNUNET_break (0);
resume_pay_with_error (pc,
@@ -1765,34 +1732,12 @@ check_payment_sufficient (struct PayContext *pc)
return false;
}
- switch (TALER_amount_subtract (&wire_fee_delta,
- &total_wire_fee,
- &pc->max_wire_fee))
- {
- case TALER_AAR_RESULT_POSITIVE:
- /* Actual wire fee is indeed higher than our maximum,
- compute how much the customer is expected to cover! */
- TALER_amount_divide (&wire_fee_customer_contribution,
- &wire_fee_delta,
- pc->wire_fee_amortization);
- break;
- case TALER_AAR_RESULT_ZERO:
- case TALER_AAR_INVALID_NEGATIVE_RESULT:
- /* Wire fee threshold is still above the wire fee amount.
- Customer is not going to contribute on this. */
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (total_wire_fee.currency,
- &wire_fee_customer_contribution));
- break;
- default:
- GNUNET_assert (0);
- }
- /* add wire fee contribution to the total fees */
+ /* add wire fee to the total fees */
if (0 >
TALER_amount_add (&acc_fee,
&acc_fee,
- &wire_fee_customer_contribution))
+ &total_wire_fee))
{
GNUNET_break (0);
resume_pay_with_error (pc,
@@ -2639,11 +2584,6 @@ check_contract (struct PayContext *pc)
TALER_JSON_spec_amount ("max_fee",
TMH_currency,
&pc->max_fee),
- TALER_JSON_spec_amount ("max_wire_fee",
- TMH_currency,
- &pc->max_wire_fee),
- GNUNET_JSON_spec_uint32 ("wire_fee_amortization",
- &pc->wire_fee_amortization),
GNUNET_JSON_spec_timestamp ("timestamp",
&pc->timestamp),
GNUNET_JSON_spec_timestamp ("refund_deadline",
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID.c b/src/backend/taler-merchant-httpd_private-get-instances-ID.c
index 2a2116d9..adc99c39 100644
--- a/src/backend/taler-merchant-httpd_private-get-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-get-instances-ID.c
@@ -95,12 +95,8 @@ get_instances_ID (struct TMH_MerchantInstance *mi,
mi->settings.address),
GNUNET_JSON_pack_object_incref ("jurisdiction",
mi->settings.jurisdiction),
- TALER_JSON_pack_amount ("default_max_wire_fee",
- &mi->settings.default_max_wire_fee),
- TALER_JSON_pack_amount ("default_max_deposit_fee",
- &mi->settings.default_max_deposit_fee),
- GNUNET_JSON_pack_uint64 ("default_wire_fee_amortization",
- mi->settings.default_wire_fee_amortization),
+ GNUNET_JSON_pack_bool ("use_stefan",
+ mi->settings.use_stefan),
GNUNET_JSON_pack_time_rel ("default_wire_transfer_delay",
mi->settings.default_wire_transfer_delay),
GNUNET_JSON_pack_time_rel ("default_pay_delay",
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 5fa66e1f..bc6e3aae 100644
--- a/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
+++ b/src/backend/taler-merchant-httpd_private-patch-instances-ID.c
@@ -93,14 +93,8 @@ patch_instances_ID (struct TMH_MerchantInstance *mi,
&is.address),
GNUNET_JSON_spec_json ("jurisdiction",
&is.jurisdiction),
- TALER_JSON_spec_amount ("default_max_wire_fee",
- TMH_currency,
- &is.default_max_wire_fee),
- GNUNET_JSON_spec_uint32 ("default_wire_fee_amortization",
- &is.default_wire_fee_amortization),
- TALER_JSON_spec_amount ("default_max_deposit_fee",
- TMH_currency,
- &is.default_max_deposit_fee),
+ GNUNET_JSON_spec_bool ("use_stefan",
+ &is.use_stefan),
GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay",
&is.default_wire_transfer_delay),
GNUNET_JSON_spec_relative_time ("default_pay_delay",
@@ -220,18 +214,7 @@ patch_instances_ID (struct TMH_MerchantInstance *mi,
is.address)) &&
(1 == json_equal (mi->settings.jurisdiction,
is.jurisdiction)) &&
- (GNUNET_YES == TALER_amount_cmp_currency (
- &mi->settings.default_max_deposit_fee,
- &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)) &&
- (0 == TALER_amount_cmp (&mi->settings.default_max_wire_fee,
- &is.default_max_wire_fee)) &&
- (mi->settings.default_wire_fee_amortization ==
- is.default_wire_fee_amortization) &&
+ (mi->settings.use_stefan == is.use_stefan) &&
(GNUNET_TIME_relative_cmp (mi->settings.default_wire_transfer_delay,
==,
is.default_wire_transfer_delay)) &&
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c
index 236741a1..6c9727e9 100644
--- a/src/backend/taler-merchant-httpd_private-post-instances.c
+++ b/src/backend/taler-merchant-httpd_private-post-instances.c
@@ -136,14 +136,8 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
&is.address),
GNUNET_JSON_spec_json ("jurisdiction",
&is.jurisdiction),
- TALER_JSON_spec_amount ("default_max_wire_fee",
- TMH_currency,
- &is.default_max_wire_fee),
- GNUNET_JSON_spec_uint32 ("default_wire_fee_amortization",
- &is.default_wire_fee_amortization),
- TALER_JSON_spec_amount ("default_max_deposit_fee",
- TMH_currency,
- &is.default_max_deposit_fee),
+ GNUNET_JSON_spec_bool ("use_stefan",
+ &is.use_stefan),
GNUNET_JSON_spec_relative_time ("default_wire_transfer_delay",
&is.default_wire_transfer_delay),
GNUNET_JSON_spec_relative_time ("default_pay_delay",
@@ -292,20 +286,7 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh,
is.address)) &&
(1 == json_equal (mi->settings.jurisdiction,
is.jurisdiction)) &&
- (GNUNET_OK ==
- TALER_amount_cmp_currency (
- &mi->settings.default_max_deposit_fee,
- &is.default_max_deposit_fee)) &&
- (0 == TALER_amount_cmp (&mi->settings.default_max_deposit_fee,
- &is.default_max_deposit_fee)) &&
- (GNUNET_OK ==
- 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 ==
- is.default_wire_fee_amortization) &&
+ (mi->settings.use_stefan == is.use_stefan) &&
(GNUNET_TIME_relative_cmp (mi->settings.default_wire_transfer_delay,
==,
is.default_wire_transfer_delay)) &&
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
index c83baf1d..370050d4 100644
--- a/src/backend/taler-merchant-httpd_private-post-orders.c
+++ b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -1066,9 +1066,7 @@ patch_order (struct OrderContext *oc)
const char *merchant_base_url = NULL;
const json_t *jmerchant = NULL;
const json_t *delivery_location = NULL;
- struct TALER_Amount max_wire_fee = { 0 };
struct TALER_Amount max_fee = { 0 };
- uint32_t wire_fee_amortization = 0;
struct GNUNET_TIME_Timestamp timestamp
= GNUNET_TIME_UNIT_ZERO_TS;
struct GNUNET_TIME_Timestamp delivery_date
@@ -1120,15 +1118,6 @@ patch_order (struct OrderContext *oc)
&max_fee),
NULL),
GNUNET_JSON_spec_mark_optional (
- TALER_JSON_spec_amount ("max_wire_fee",
- TMH_currency,
- &max_wire_fee),
- NULL),
- GNUNET_JSON_spec_mark_optional (
- GNUNET_JSON_spec_uint32 ("wire_fee_amortization",
- &wire_fee_amortization),
- NULL),
- GNUNET_JSON_spec_mark_optional (
GNUNET_JSON_spec_timestamp ("delivery_date",
&delivery_date),
NULL),
@@ -1366,34 +1355,26 @@ patch_order (struct OrderContext *oc)
/* Note: total amount currency match checked
later in execute_order() */
if (GNUNET_OK !=
- TALER_amount_is_valid (&max_wire_fee))
- {
- GNUNET_assert (0 ==
- json_object_set_new (
- oc->order,
- "max_wire_fee",
- TALER_JSON_from_amount (&settings->default_max_wire_fee)));
- }
-
- if (GNUNET_OK !=
TALER_amount_is_valid (&max_fee))
{
+ struct TALER_Amount stefan;
+
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TMH_currency,
+ &stefan));
+ if (settings->use_stefan)
+ {
+ /* FIXME: update amount from stefan curve! */
+ stefan.value = 5; // FIXME!
+ }
+
GNUNET_assert (0 ==
json_object_set_new (
oc->order,
"max_fee",
- TALER_JSON_from_amount (
- &settings->default_max_deposit_fee)));
- }
- if (0 == wire_fee_amortization)
- {
- GNUNET_assert (0 ==
- json_object_set_new (
- oc->order,
- "wire_fee_amortization",
- json_integer (
- (json_int_t) settings->default_wire_fee_amortization)));
+ TALER_JSON_from_amount (&stefan)));
}
+
if (NULL == merchant_base_url)
{
char *url;
diff --git a/src/backenddb/merchant-0001.sql b/src/backenddb/merchant-0001.sql
index 1c9a8aaf..bbc97828 100644
--- a/src/backenddb/merchant-0001.sql
+++ b/src/backenddb/merchant-0001.sql
@@ -30,12 +30,13 @@ COMMENT ON SCHEMA merchant IS 'taler-merchant data';
SET search_path TO merchant;
-CREATE TYPE taler_amount
+CREATE TYPE taler_amount_currency
AS
(val INT8
,frac INT4
+ ,curr VARCHAR(12)
);
-COMMENT ON TYPE taler_amount
+COMMENT ON TYPE taler_amount_currency
IS 'Stores an amount, fraction is in units of 1/100000000 of the base value';
---------------- Exchange information ---------------------------
@@ -46,8 +47,8 @@ CREATE TABLE IF NOT EXISTS merchant_exchange_wire_fees
,h_wire_method BYTEA NOT NULL CHECK (LENGTH(h_wire_method)=64)
,start_date INT8 NOT NULL
,end_date INT8 NOT NULL
- ,wire_fee taler_amount NOT NULL
- ,closing_fee taler_amount NOT NULL
+ ,wire_fee taler_amount_currency NOT NULL
+ ,closing_fee taler_amount_currency NOT NULL
,master_sig BYTEA NOT NULL CHECK (LENGTH(master_sig)=64)
,UNIQUE (master_pub,h_wire_method,start_date)
);
@@ -86,9 +87,7 @@ CREATE TABLE IF NOT EXISTS merchant_instances
,logo BYTEA
,address BYTEA NOT NULL
,jurisdiction BYTEA NOT NULL
- ,default_max_deposit_fee taler_amount NOT NULL
- ,default_max_wire_fee taler_amount NOT NULL
- ,default_wire_fee_amortization INT4 NOT NULL
+ ,use_stefan BOOLEAN NOT NULL DEFAULT TRUE
,default_wire_transfer_delay INT8 NOT NULL
,default_pay_delay INT8 NOT NULL
,user_type INT4
@@ -100,17 +99,19 @@ COMMENT ON COLUMN merchant_instances.merchant_id
COMMENT ON COLUMN merchant_instances.merchant_name
IS 'legal name of the merchant as a simple string (required)';
COMMENT ON COLUMN merchant_instances.address
- IS 'physical address of the merchant as a Location in JSON format (required)';
+ IS 'physical address of the merchant as a location in JSON format (required)';
COMMENT ON COLUMN merchant_instances.jurisdiction
- IS 'jurisdiction of the merchant as a Location in JSON format (required)';
+ IS 'jurisdiction of the merchant as a location in JSON format (required)';
COMMENT ON COLUMN merchant_instances.website
IS 'merchant site URL';
+COMMENT ON COLUMN merchant_instances.use_stefan
+ IS 'use STEFAN curve of exchange to determine acceptable fees (unless given explicitly)';
COMMENT ON COLUMN merchant_instances.email
IS 'email';
COMMENT ON COLUMN merchant_instances.logo
IS 'data image url';
COMMENT ON COLUMN merchant_instances.auth_hash
- IS 'hash used for merchant back office Authorization, NULL for no check';
+ IS 'hash used for merchant back office authorization, NULL for no check';
COMMENT ON COLUMN merchant_instances.auth_salt
IS 'salt to use when hashing Authorization header before comparing with auth_hash';
COMMENT ON COLUMN merchant_instances.user_type
@@ -170,7 +171,7 @@ CREATE TABLE IF NOT EXISTS merchant_inventory
,unit TEXT NOT NULL
,image BYTEA NOT NULL
,taxes BYTEA NOT NULL
- ,price taler_amount NOT NULL
+ ,price taler_amount_currency NOT NULL
,total_stock BIGINT NOT NULL
,total_sold BIGINT NOT NULL DEFAULT 0
,total_lost BIGINT NOT NULL DEFAULT 0
@@ -361,10 +362,10 @@ CREATE TABLE IF NOT EXISTS merchant_deposits
,deposit_timestamp INT8 NOT NULL
,coin_pub BYTEA NOT NULL CHECK (LENGTH(coin_pub)=32)
,exchange_url TEXT NOT NULL
- ,amount_with_fee taler_amount NOT NULL
- ,deposit_fee taler_amount NOT NULL
- ,refund_fee taler_amount NOT NULL
- ,wire_fee taler_amount NOT NULL
+ ,amount_with_fee taler_amount_currency NOT NULL
+ ,deposit_fee taler_amount_currency NOT NULL
+ ,refund_fee taler_amount_currency NOT NULL
+ ,wire_fee taler_amount_currency NOT NULL
,signkey_serial BIGINT NOT NULL
REFERENCES merchant_exchange_signing_keys (signkey_serial) ON DELETE CASCADE
,exchange_sig BYTEA NOT NULL CHECK (LENGTH(exchange_sig)=64)
@@ -391,7 +392,7 @@ CREATE TABLE IF NOT EXISTS merchant_refunds
,refund_timestamp INT8 NOT NULL
,coin_pub BYTEA NOT NULL
,reason TEXT NOT NULL
- ,refund_amount taler_amount NOT NULL
+ ,refund_amount taler_amount_currency NOT NULL
,UNIQUE (order_serial, coin_pub, rtransaction_id)
);
COMMENT ON TABLE merchant_deposits
@@ -420,7 +421,7 @@ CREATE TABLE IF NOT EXISTS merchant_transfers
(credit_serial INT8 GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY
,exchange_url TEXT NOT NULL
,wtid BYTEA CHECK (LENGTH(wtid)=32)
- ,credit_amount taler_amount NOT NULL
+ ,credit_amount taler_amount_currency NOT NULL
,account_serial INT8 NOT NULL
REFERENCES merchant_accounts (account_serial) ON DELETE CASCADE
,ready_time INT8 NOT NULL DEFAULT (0)
@@ -456,8 +457,8 @@ CREATE TABLE IF NOT EXISTS merchant_transfer_signatures
REFERENCES merchant_transfers (credit_serial) ON DELETE CASCADE
,signkey_serial BIGINT NOT NULL
REFERENCES merchant_exchange_signing_keys (signkey_serial) ON DELETE CASCADE
- ,wire_fee taler_amount NOT NULL
- ,credit_amount taler_amount NOT NULL
+ ,wire_fee taler_amount_currency NOT NULL
+ ,credit_amount taler_amount_currency NOT NULL
,execution_time INT8 NOT NULL
,exchange_sig BYTEA NOT NULL CHECK (LENGTH(exchange_sig)=64)
);
@@ -475,8 +476,8 @@ CREATE TABLE IF NOT EXISTS merchant_transfer_to_coin
,credit_serial BIGINT NOT NULL
REFERENCES merchant_transfers (credit_serial) ON DELETE CASCADE
,offset_in_exchange_list INT8 NOT NULL
- ,exchange_deposit_value taler_amount NOT NULL
- ,exchange_deposit_fee taler_amount NOT NULL
+ ,exchange_deposit_value taler_amount_currency NOT NULL
+ ,exchange_deposit_fee taler_amount_currency NOT NULL
);
CREATE INDEX IF NOT EXISTS merchant_transfers_by_credit
ON merchant_transfer_to_coin
@@ -491,7 +492,7 @@ COMMENT ON COLUMN merchant_transfer_to_coin.exchange_deposit_fee
CREATE TABLE IF NOT EXISTS merchant_deposit_to_transfer
(deposit_serial BIGINT NOT NULL
REFERENCES merchant_deposits (deposit_serial) ON DELETE CASCADE
- ,coin_contribution_value taler_amount NOT NULL
+ ,coin_contribution_value taler_amount_currency NOT NULL
,credit_serial BIGINT NOT NULL
REFERENCES merchant_transfers (credit_serial)
,execution_time INT8 NOT NULL
@@ -515,10 +516,10 @@ CREATE TABLE IF NOT EXISTS merchant_reward_reserves
REFERENCES merchant_instances (merchant_serial) ON DELETE CASCADE
,creation_time INT8 NOT NULL
,expiration INT8 NOT NULL
- ,merchant_initial_balance taler_amount NOT NULL
- ,exchange_initial_balance taler_amount NOT NULL DEFAULT (0,0)
- ,rewards_committed taler_amount NOT NULL DEFAULT (0,0)
- ,rewards_picked_up taler_amount NOT NULL DEFAULT (0,0)
+ ,merchant_initial_balance taler_amount_currency NOT NULL
+ ,exchange_initial_balance taler_amount_currency NOT NULL
+ ,rewards_committed taler_amount_currency NOT NULL
+ ,rewards_picked_up taler_amount_currency NOT NULL
);
COMMENT ON TABLE merchant_reward_reserves
IS 'balances of the reserves available for rewards';
@@ -566,8 +567,8 @@ CREATE TABLE IF NOT EXISTS merchant_rewards
,justification TEXT NOT NULL
,next_url TEXT NOT NULL
,expiration INT8 NOT NULL
- ,amount taler_amount NOT NULL
- ,picked_up taler_amount NOT NULL DEFAULT (0, 0)
+ ,amount taler_amount_currency NOT NULL
+ ,picked_up taler_amount_currency NOT NULL
,was_picked_up BOOLEAN NOT NULL DEFAULT FALSE
);
CREATE INDEX IF NOT EXISTS merchant_rewards_by_pickup_and_expiration
@@ -589,7 +590,7 @@ CREATE TABLE IF NOT EXISTS merchant_reward_pickups
,reward_serial BIGINT NOT NULL
REFERENCES merchant_rewards (reward_serial) ON DELETE CASCADE
,pickup_id BYTEA NOT NULL UNIQUE CHECK (LENGTH(pickup_id)=64)
- ,amount taler_amount NOT NULL
+ ,amount taler_amount_currency NOT NULL
);
COMMENT ON TABLE merchant_reward_pickups
IS 'rewards that have been picked up';
diff --git a/src/backenddb/pg_activate_reserve.c b/src/backenddb/pg_activate_reserve.c
index fbdca791..d7a4ff48 100644
--- a/src/backenddb/pg_activate_reserve.c
+++ b/src/backenddb/pg_activate_reserve.c
@@ -36,7 +36,7 @@ TMH_PG_activate_reserve (void *cls,
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
initial_exchange_balance),
GNUNET_PQ_query_param_end
};
diff --git a/src/backenddb/pg_authorize_reward.c b/src/backenddb/pg_authorize_reward.c
index 29cf6c5f..6ebf4796 100644
--- a/src/backenddb/pg_authorize_reward.c
+++ b/src/backenddb/pg_authorize_reward.c
@@ -91,7 +91,6 @@ lookup_reserve_for_reward_cb (void *cls,
unsigned int num_results)
{
struct LookupReserveForRewardContext *lac = cls;
- struct PostgresClosure *pg = lac->pg;
for (unsigned int i = 0; i < num_results; i++)
{
@@ -103,10 +102,10 @@ lookup_reserve_for_reward_cb (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("reserve_pub",
&reserve_pub),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_initial_balance",
- &initial_balance),
- TALER_PQ_RESULT_SPEC_AMOUNT ("rewards_committed",
- &committed_amount),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_initial_balance",
+ &initial_balance),
+ TALER_PQ_result_spec_amount_with_currency ("rewards_committed",
+ &committed_amount),
GNUNET_PQ_result_spec_timestamp ("expiration",
&expiration),
GNUNET_PQ_result_spec_end
@@ -229,9 +228,10 @@ TMH_PG_authorize_reward (void *cls,
",next_url"
",expiration"
",amount"
+ ",picked_up"
") "
"SELECT"
- " reserve_serial, $3, $4, $5, $6, $7"
+ " reserve_serial, $3, $4, $5, $6, $7, $8"
" FROM merchant_reward_reserves"
" WHERE reserve_pub=$2"
" AND merchant_serial = "
@@ -302,10 +302,10 @@ RETRY:
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_timestamp ("expiration",
expiration),
- TALER_PQ_RESULT_SPEC_AMOUNT ("rewards_committed",
- &rewards_committed),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_initial_balance",
- &exchange_initial_balance),
+ TALER_PQ_result_spec_amount_with_currency ("rewards_committed",
+ &rewards_committed),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_initial_balance",
+ &exchange_initial_balance),
GNUNET_PQ_result_spec_end
};
@@ -358,8 +358,8 @@ RETRY:
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (reserve_pubp),
- TALER_PQ_query_param_amount (pg->conn,
- &rewards_committed),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ &rewards_committed),
GNUNET_PQ_query_param_end
};
@@ -382,6 +382,7 @@ RETRY:
reward_id,
sizeof (*reward_id));
{
+ struct TALER_Amount zero;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (reserve_pubp),
@@ -389,11 +390,16 @@ RETRY:
GNUNET_PQ_query_param_string (justification),
GNUNET_PQ_query_param_string (next_url),
GNUNET_PQ_query_param_timestamp (expiration),
- TALER_PQ_query_param_amount (pg->conn,
- amount),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ amount),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ &zero),
GNUNET_PQ_query_param_end
};
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (amount->currency,
+ &zero));
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_reward",
params);
diff --git a/src/backenddb/pg_helper.h b/src/backenddb/pg_helper.h
index 2de99c69..5f677fc5 100644
--- a/src/backenddb/pg_helper.h
+++ b/src/backenddb/pg_helper.h
@@ -36,11 +36,6 @@ struct PostgresClosure
struct GNUNET_PQ_Context *conn;
/**
- * Which currency do we deal in?
- */
- char *currency;
-
- /**
* Directory with SQL statements to run to create tables.
*/
char *sql_dir;
@@ -96,31 +91,6 @@ struct PostgresClosure
/**
- * Wrapper macro to add the currency from the plugin's state
- * when fetching amounts from the database.
- *
- * @param field name of the database field to fetch amount from
- * @param[out] amountp pointer to amount to set
- */
-#define TALER_PQ_RESULT_SPEC_AMOUNT(field, \
- amountp) TALER_PQ_result_spec_amount ( \
- field,pg->currency,amountp)
-
-
-/**
- * Wrapper macro to add the currency from the plugin's state
- * when fetching amounts from the database. NBO variant.
- *
- * @param field name of the database field to fetch amount from
- * @param[out] amountp pointer to amount to set
- */
-#define TALER_PQ_RESULT_SPEC_AMOUNT_NBO(field, \
- amountp) \
- TALER_PQ_result_spec_amount_nbo ( \
- field,pg->currency,amountp)
-
-
-/**
* Check that the database connection is still up
* and automatically reconnects unless we are
* already inside of a transaction.
diff --git a/src/backenddb/pg_increase_refund.c b/src/backenddb/pg_increase_refund.c
index e003512e..5fd548d7 100644
--- a/src/backenddb/pg_increase_refund.c
+++ b/src/backenddb/pg_increase_refund.c
@@ -68,7 +68,6 @@ process_refund_cb (void *cls,
unsigned int num_results)
{
struct FindRefundContext *ictx = cls;
- struct PostgresClosure *pg = ictx->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -76,8 +75,8 @@ process_refund_cb (void *cls,
struct TALER_Amount acc;
uint64_t rtransaction_id;
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_RESULT_SPEC_AMOUNT ("refund_amount",
- &acc),
+ TALER_PQ_result_spec_amount_with_currency ("refund_amount",
+ &acc),
GNUNET_PQ_result_spec_uint64 ("rtransaction_id",
&rtransaction_id),
GNUNET_PQ_result_spec_end
@@ -205,8 +204,8 @@ process_deposits_for_refund_cb (
&rcd[i].coin_pub),
GNUNET_PQ_result_spec_uint64 ("order_serial",
&rcd[i].order_serial),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
- &rcd[i].deposited_with_fee),
+ TALER_PQ_result_spec_amount_with_currency ("amount_with_fee",
+ &rcd[i].deposited_with_fee),
GNUNET_PQ_result_spec_end
};
struct FindRefundContext ictx = {
@@ -364,7 +363,7 @@ process_deposits_for_refund_cb (
GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_auto_from_type (&rcd[i].coin_pub),
GNUNET_PQ_query_param_string (ctx->reason),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
increment),
GNUNET_PQ_query_param_end
};
diff --git a/src/backenddb/pg_insert_deposit.c b/src/backenddb/pg_insert_deposit.c
index 3b85dcf6..f99c6f44 100644
--- a/src/backenddb/pg_insert_deposit.c
+++ b/src/backenddb/pg_insert_deposit.c
@@ -50,13 +50,13 @@ TMH_PG_insert_deposit (
GNUNET_PQ_query_param_timestamp (&deposit_timestamp), /* $3 */
GNUNET_PQ_query_param_auto_from_type (coin_pub),
GNUNET_PQ_query_param_string (exchange_url),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
amount_with_fee), /* $6 */
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
deposit_fee), /* $7 */
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
refund_fee), /* $8 */
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
wire_fee), /* $9 */
GNUNET_PQ_query_param_auto_from_type (h_wire), /* $10 */
GNUNET_PQ_query_param_auto_from_type (exchange_sig), /* $11 */
diff --git a/src/backenddb/pg_insert_deposit_to_transfer.c b/src/backenddb/pg_insert_deposit_to_transfer.c
index b79dd37c..4b5f0cc3 100644
--- a/src/backenddb/pg_insert_deposit_to_transfer.c
+++ b/src/backenddb/pg_insert_deposit_to_transfer.c
@@ -35,7 +35,7 @@ TMH_PG_insert_deposit_to_transfer (
struct PostgresClosure *pg = cls;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&deposit_serial),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&dd->coin_contribution),
GNUNET_PQ_query_param_timestamp (&dd->execution_time),
GNUNET_PQ_query_param_auto_from_type (&dd->exchange_sig),
diff --git a/src/backenddb/pg_insert_instance.c b/src/backenddb/pg_insert_instance.c
index 8f6fcc50..6928a094 100644
--- a/src/backenddb/pg_insert_instance.c
+++ b/src/backenddb/pg_insert_instance.c
@@ -45,11 +45,7 @@ TMH_PG_insert_instance (
GNUNET_PQ_query_param_uint32 (&ut32),
TALER_PQ_query_param_json (is->address),
TALER_PQ_query_param_json (is->jurisdiction),
- TALER_PQ_query_param_amount (pg->conn,
- &is->default_max_deposit_fee),
- TALER_PQ_query_param_amount (pg->conn,
- &is->default_max_wire_fee),
- GNUNET_PQ_query_param_uint32 (&is->default_wire_fee_amortization),
+ GNUNET_PQ_query_param_bool (is->use_stefan),
GNUNET_PQ_query_param_relative_time (
&is->default_wire_transfer_delay),
GNUNET_PQ_query_param_relative_time (&is->default_pay_delay),
@@ -83,16 +79,14 @@ TMH_PG_insert_instance (
",user_type"
",address"
",jurisdiction"
- ",default_max_deposit_fee"
- ",default_max_wire_fee"
- ",default_wire_fee_amortization"
+ ",use_stefan"
",default_wire_transfer_delay"
",default_pay_delay"
",website"
",email"
",logo)"
"VALUES"
- "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)");
+ "($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)");
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_instance",
params);
diff --git a/src/backenddb/pg_insert_pickup.c b/src/backenddb/pg_insert_pickup.c
index 281d4c19..73b97c6d 100644
--- a/src/backenddb/pg_insert_pickup.c
+++ b/src/backenddb/pg_insert_pickup.c
@@ -58,7 +58,7 @@ TMH_PG_insert_pickup (
"update_picked_up_reward",
"UPDATE merchant_rewards SET"
" picked_up=$2"
- ",was_picked_up = (CAST($2 AS taler_amount) = amount)"
+ ",was_picked_up = (CAST($2 AS taler_amount_currency) = amount)"
" WHERE reward_id = $1");
PREPARE (pg,
"lookup_picked_up_reserve",
@@ -83,8 +83,8 @@ TMH_PG_insert_pickup (
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (reward_id),
GNUNET_PQ_query_param_auto_from_type (pickup_id),
- TALER_PQ_query_param_amount (pg->conn,
- total_requested),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ total_requested),
GNUNET_PQ_query_param_end
};
@@ -98,8 +98,8 @@ TMH_PG_insert_pickup (
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (reward_id),
- TALER_PQ_query_param_amount (pg->conn,
- total_picked_up),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ total_picked_up),
GNUNET_PQ_query_param_end
};
@@ -121,8 +121,8 @@ TMH_PG_insert_pickup (
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("reserve_serial",
&reserve_serial),
- TALER_PQ_RESULT_SPEC_AMOUNT ("rewards_picked_up",
- &reserve_picked_up),
+ TALER_PQ_result_spec_amount_with_currency ("rewards_picked_up",
+ &reserve_picked_up),
GNUNET_PQ_result_spec_end
};
@@ -146,8 +146,8 @@ TMH_PG_insert_pickup (
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&reserve_serial),
- TALER_PQ_query_param_amount (pg->conn,
- &reserve_picked_up),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ &reserve_picked_up),
GNUNET_PQ_query_param_end
};
diff --git a/src/backenddb/pg_insert_product.c b/src/backenddb/pg_insert_product.c
index 19096962..55db57e9 100644
--- a/src/backenddb/pg_insert_product.c
+++ b/src/backenddb/pg_insert_product.c
@@ -41,7 +41,7 @@ TMH_PG_insert_product (void *cls,
GNUNET_PQ_query_param_string (pd->unit),
GNUNET_PQ_query_param_string (pd->image),
TALER_PQ_query_param_json (pd->taxes),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&pd->price),
GNUNET_PQ_query_param_uint64 (&pd->total_stock),
TALER_PQ_query_param_json (pd->address),
diff --git a/src/backenddb/pg_insert_reserve.c b/src/backenddb/pg_insert_reserve.c
index c2da4e15..67e2652a 100644
--- a/src/backenddb/pg_insert_reserve.c
+++ b/src/backenddb/pg_insert_reserve.c
@@ -55,8 +55,11 @@ TMH_PG_insert_reserve (void *cls,
",creation_time"
",expiration"
",merchant_initial_balance"
+ ",exchange_initial_balance"
+ ",rewards_committed"
+ ",rewards_picked_up"
")"
- "SELECT $2, merchant_serial, $3, $4, $5"
+ "SELECT $2, merchant_serial, $3, $4, $5, $6, $6, $6"
" FROM merchant_instances"
" WHERE merchant_id=$1");
RETRY:
@@ -72,18 +75,24 @@ RETRY:
/* Setup reserve */
{
+ struct TALER_Amount zero;
struct GNUNET_TIME_Timestamp now;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (reserve_pub),
GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_timestamp (&expiration),
- TALER_PQ_query_param_amount (pg->conn,
- initial_balance),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ initial_balance),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ &zero),
GNUNET_PQ_query_param_end
};
now = GNUNET_TIME_timestamp_get ();
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (initial_balance->currency,
+ &zero));
qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
"insert_reserve",
params);
diff --git a/src/backenddb/pg_insert_transfer.c b/src/backenddb/pg_insert_transfer.c
index 3c1502e5..6e8b8adf 100644
--- a/src/backenddb/pg_insert_transfer.c
+++ b/src/backenddb/pg_insert_transfer.c
@@ -40,7 +40,7 @@ TMH_PG_insert_transfer (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (exchange_url),
GNUNET_PQ_query_param_auto_from_type (wtid),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
credit_amount),
GNUNET_PQ_query_param_string (payto_uri),
GNUNET_PQ_query_param_bool (confirmed),
diff --git a/src/backenddb/pg_insert_transfer_details.c b/src/backenddb/pg_insert_transfer_details.c
index 1b08733f..a4f69989 100644
--- a/src/backenddb/pg_insert_transfer_details.c
+++ b/src/backenddb/pg_insert_transfer_details.c
@@ -174,9 +174,9 @@ RETRY:
{
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&credit_serial),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&td->total_amount),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&td->wire_fee),
GNUNET_PQ_query_param_timestamp (&td->execution_time),
GNUNET_PQ_query_param_auto_from_type (&td->exchange_sig),
@@ -218,9 +218,9 @@ RETRY:
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_uint64 (&credit_serial),
GNUNET_PQ_query_param_uint64 (&i64),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&d->coin_value),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&d->coin_fee), /* deposit fee */
GNUNET_PQ_query_param_auto_from_type (&d->coin_pub),
GNUNET_PQ_query_param_auto_from_type (&d->h_contract_terms),
diff --git a/src/backenddb/pg_lookup_deposits.c b/src/backenddb/pg_lookup_deposits.c
index 01e35183..242d7bbb 100644
--- a/src/backenddb/pg_lookup_deposits.c
+++ b/src/backenddb/pg_lookup_deposits.c
@@ -66,7 +66,6 @@ lookup_deposits_cb (void *cls,
unsigned int num_results)
{
struct LookupDepositsContext *ldc = cls;
- struct PostgresClosure *pg = ldc->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -81,14 +80,14 @@ lookup_deposits_cb (void *cls,
&exchange_url),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&coin_pub),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
- &amount_with_fee),
- TALER_PQ_RESULT_SPEC_AMOUNT ("deposit_fee",
- &deposit_fee),
- TALER_PQ_RESULT_SPEC_AMOUNT ("refund_fee",
- &refund_fee),
- TALER_PQ_RESULT_SPEC_AMOUNT ("wire_fee",
- &wire_fee),
+ TALER_PQ_result_spec_amount_with_currency ("amount_with_fee",
+ &amount_with_fee),
+ TALER_PQ_result_spec_amount_with_currency ("deposit_fee",
+ &deposit_fee),
+ TALER_PQ_result_spec_amount_with_currency ("refund_fee",
+ &refund_fee),
+ TALER_PQ_result_spec_amount_with_currency ("wire_fee",
+ &wire_fee),
GNUNET_PQ_result_spec_end
};
diff --git a/src/backenddb/pg_lookup_instances.c b/src/backenddb/pg_lookup_instances.c
index ada20134..15137518 100644
--- a/src/backenddb/pg_lookup_instances.c
+++ b/src/backenddb/pg_lookup_instances.c
@@ -296,12 +296,8 @@ lookup_instances_cb (void *cls,
&lic->is.address),
TALER_PQ_result_spec_json ("jurisdiction",
&lic->is.jurisdiction),
- TALER_PQ_RESULT_SPEC_AMOUNT ("default_max_deposit_fee",
- &lic->is.default_max_deposit_fee),
- TALER_PQ_RESULT_SPEC_AMOUNT ("default_max_wire_fee",
- &lic->is.default_max_wire_fee),
- GNUNET_PQ_result_spec_uint32 ("default_wire_fee_amortization",
- &lic->is.default_wire_fee_amortization),
+ GNUNET_PQ_result_spec_bool ("use_stefan",
+ &lic->is.use_stefan),
GNUNET_PQ_result_spec_relative_time ("default_wire_transfer_delay",
&lic->is.default_wire_transfer_delay),
GNUNET_PQ_result_spec_relative_time ("default_pay_delay",
@@ -392,9 +388,7 @@ TMH_PG_lookup_instances (void *cls,
",user_type"
",address"
",jurisdiction"
- ",default_max_deposit_fee"
- ",default_max_wire_fee"
- ",default_wire_fee_amortization"
+ ",use_stefan"
",default_wire_transfer_delay"
",default_pay_delay"
",website"
@@ -445,9 +439,7 @@ TMH_PG_lookup_instance (void *cls,
",user_type"
",address"
",jurisdiction"
- ",default_max_deposit_fee"
- ",default_max_wire_fee"
- ",default_wire_fee_amortization"
+ ",use_stefan"
",default_wire_transfer_delay"
",default_pay_delay"
",website"
diff --git a/src/backenddb/pg_lookup_product.c b/src/backenddb/pg_lookup_product.c
index 04c27dff..65a3c0e5 100644
--- a/src/backenddb/pg_lookup_product.c
+++ b/src/backenddb/pg_lookup_product.c
@@ -59,7 +59,7 @@ TMH_PG_lookup_product (void *cls,
&pd->description_i18n),
GNUNET_PQ_result_spec_string ("unit",
&pd->unit),
- TALER_PQ_RESULT_SPEC_AMOUNT ("price",
+ TALER_PQ_result_spec_amount_with_currency ("price",
&pd->price),
TALER_PQ_result_spec_json ("taxes",
&pd->taxes),
diff --git a/src/backenddb/pg_lookup_refunds.c b/src/backenddb/pg_lookup_refunds.c
index e53860c2..2facb73f 100644
--- a/src/backenddb/pg_lookup_refunds.c
+++ b/src/backenddb/pg_lookup_refunds.c
@@ -66,7 +66,6 @@ lookup_refunds_cb (void *cls,
unsigned int num_results)
{
struct LookupRefundsContext *lrc = cls;
- struct PostgresClosure *pg = lrc->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -75,8 +74,8 @@ lookup_refunds_cb (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&coin_pub),
- TALER_PQ_RESULT_SPEC_AMOUNT ("refund_amount",
- &refund_amount),
+ TALER_PQ_result_spec_amount_with_currency ("refund_amount",
+ &refund_amount),
GNUNET_PQ_result_spec_end
};
diff --git a/src/backenddb/pg_lookup_reserves.c b/src/backenddb/pg_lookup_reserves.c
index 2e503bb3..48601e5b 100644
--- a/src/backenddb/pg_lookup_reserves.c
+++ b/src/backenddb/pg_lookup_reserves.c
@@ -79,7 +79,6 @@ lookup_reserves_cb (void *cls,
unsigned int num_results)
{
struct LookupReservesContext *lrc = cls;
- struct PostgresClosure *pg = lrc->pg;
for (unsigned int i = 0; i < num_results; i++)
{
@@ -98,14 +97,14 @@ lookup_reserves_cb (void *cls,
&creation_time),
GNUNET_PQ_result_spec_timestamp ("expiration",
&expiration_time),
- TALER_PQ_RESULT_SPEC_AMOUNT ("merchant_initial_balance",
- &merchant_initial_balance),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_initial_balance",
- &exchange_initial_balance),
- TALER_PQ_RESULT_SPEC_AMOUNT ("rewards_committed",
- &committed_amount),
- TALER_PQ_RESULT_SPEC_AMOUNT ("rewards_picked_up",
- &pickup_amount),
+ TALER_PQ_result_spec_amount_with_currency ("merchant_initial_balance",
+ &merchant_initial_balance),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_initial_balance",
+ &exchange_initial_balance),
+ TALER_PQ_result_spec_amount_with_currency ("rewards_committed",
+ &committed_amount),
+ TALER_PQ_result_spec_amount_with_currency ("rewards_picked_up",
+ &pickup_amount),
GNUNET_PQ_result_spec_auto_from_type ("active",
&active),
GNUNET_PQ_result_spec_end
diff --git a/src/backenddb/pg_lookup_transfers.c b/src/backenddb/pg_lookup_transfers.c
index 9fb5cdcb..57663729 100644
--- a/src/backenddb/pg_lookup_transfers.c
+++ b/src/backenddb/pg_lookup_transfers.c
@@ -72,7 +72,6 @@ lookup_transfers_cb (void *cls,
unsigned int num_results)
{
struct LookupTransfersContext *ltc = cls;
- struct PostgresClosure *pg = ltc->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -86,8 +85,8 @@ lookup_transfers_cb (void *cls,
uint8_t verified8;
uint8_t confirmed8;
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_RESULT_SPEC_AMOUNT ("credit_amount",
- &credit_amount),
+ TALER_PQ_result_spec_amount_with_currency ("credit_amount",
+ &credit_amount),
GNUNET_PQ_result_spec_auto_from_type ("wtid",
&wtid),
GNUNET_PQ_result_spec_string ("payto_uri",
diff --git a/src/backenddb/pg_select_exchange_keys.c b/src/backenddb/pg_select_exchange_keys.c
index 926319d1..b14da501 100644
--- a/src/backenddb/pg_select_exchange_keys.c
+++ b/src/backenddb/pg_select_exchange_keys.c
@@ -59,5 +59,10 @@ TMH_PG_select_exchange_keys (void *cls,
return qs;
*keys = TALER_EXCHANGE_keys_from_json (jkeys);
json_decref (jkeys);
+ if (NULL == *keys)
+ {
+ GNUNET_break (0);
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
return qs;
}
diff --git a/src/backenddb/pg_select_open_transfers.c b/src/backenddb/pg_select_open_transfers.c
index 44fdd695..40982011 100644
--- a/src/backenddb/pg_select_open_transfers.c
+++ b/src/backenddb/pg_select_open_transfers.c
@@ -67,7 +67,6 @@ open_transfers_cb (void *cls,
unsigned int num_results)
{
struct SelectOpenTransfersContext *plc = cls;
- struct PostgresClosure *pg = plc->pg;
for (unsigned int i = 0; i < num_results; i++)
{
@@ -89,8 +88,8 @@ open_transfers_cb (void *cls,
&payto_uri),
GNUNET_PQ_result_spec_auto_from_type ("wtid",
&wtid),
- TALER_PQ_RESULT_SPEC_AMOUNT ("credit_amount",
- &total),
+ TALER_PQ_result_spec_amount_with_currency ("credit_amount",
+ &total),
GNUNET_PQ_result_spec_absolute_time ("next_attempt",
&next_attempt),
GNUNET_PQ_result_spec_end
diff --git a/src/backenddb/pg_set_transfer_status_to_confirmed.c b/src/backenddb/pg_set_transfer_status_to_confirmed.c
index 9b53e987..0579162a 100644
--- a/src/backenddb/pg_set_transfer_status_to_confirmed.c
+++ b/src/backenddb/pg_set_transfer_status_to_confirmed.c
@@ -39,8 +39,8 @@ TMH_PG_set_transfer_status_to_confirmed (
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_auto_from_type (wtid),
GNUNET_PQ_query_param_string (exchange_url),
- TALER_PQ_query_param_amount (pg->conn,
- amount),
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
+ amount),
GNUNET_PQ_query_param_end
};
@@ -50,7 +50,7 @@ TMH_PG_set_transfer_status_to_confirmed (
"UPDATE merchant_transfers SET"
" confirmed=TRUE"
" WHERE wtid=$2"
- " AND credit_amount=cast($4 AS taler_amount)"
+ " AND credit_amount=cast($4 AS taler_amount_currency)"
" AND exchange_url=$3"
" AND account_serial IN"
" (SELECT account_serial"
diff --git a/src/backenddb/pg_store_wire_fee_by_exchange.c b/src/backenddb/pg_store_wire_fee_by_exchange.c
index ce5b48ca..5c002589 100644
--- a/src/backenddb/pg_store_wire_fee_by_exchange.c
+++ b/src/backenddb/pg_store_wire_fee_by_exchange.c
@@ -40,9 +40,9 @@ TMH_PG_store_wire_fee_by_exchange (
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (master_pub),
GNUNET_PQ_query_param_auto_from_type (h_wire_method),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&fees->wire),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&fees->closing),
GNUNET_PQ_query_param_timestamp (&start_date),
GNUNET_PQ_query_param_timestamp (&end_date),
diff --git a/src/backenddb/pg_update_instance.c b/src/backenddb/pg_update_instance.c
index e1f98d73..0f44c833 100644
--- a/src/backenddb/pg_update_instance.c
+++ b/src/backenddb/pg_update_instance.c
@@ -37,11 +37,7 @@ TMH_PG_update_instance (void *cls,
GNUNET_PQ_query_param_string (is->name),
TALER_PQ_query_param_json (is->address),
TALER_PQ_query_param_json (is->jurisdiction),
- TALER_PQ_query_param_amount (pg->conn,
- &is->default_max_deposit_fee),
- TALER_PQ_query_param_amount (pg->conn,
- &is->default_max_wire_fee),
- GNUNET_PQ_query_param_uint32 (&is->default_wire_fee_amortization),
+ GNUNET_PQ_query_param_bool (is->use_stefan),
GNUNET_PQ_query_param_relative_time (
&is->default_wire_transfer_delay),
GNUNET_PQ_query_param_relative_time (&is->default_pay_delay),
@@ -65,15 +61,13 @@ TMH_PG_update_instance (void *cls,
" merchant_name=$2"
",address=$3"
",jurisdiction=$4"
- ",default_max_deposit_fee=$5"
- ",default_max_wire_fee=$6"
- ",default_wire_fee_amortization=$7"
- ",default_wire_transfer_delay=$8"
- ",default_pay_delay=$9"
- ",website=$10"
- ",email=$11"
- ",logo=$12"
- ",user_type=$13"
+ ",use_stefan=$5"
+ ",default_wire_transfer_delay=$6"
+ ",default_pay_delay=$7"
+ ",website=$8"
+ ",email=$9"
+ ",logo=$10"
+ ",user_type=$11"
" WHERE merchant_id=$1");
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"update_instance",
diff --git a/src/backenddb/pg_update_product.c b/src/backenddb/pg_update_product.c
index d721c1fe..cd7c1857 100644
--- a/src/backenddb/pg_update_product.c
+++ b/src/backenddb/pg_update_product.c
@@ -41,7 +41,7 @@ TMH_PG_update_product (void *cls,
GNUNET_PQ_query_param_string (pd->unit),
GNUNET_PQ_query_param_string (pd->image), /* $6 */
TALER_PQ_query_param_json (pd->taxes),
- TALER_PQ_query_param_amount (pg->conn,
+ TALER_PQ_query_param_amount_with_currency (pg->conn,
&pd->price), /* $8 */
GNUNET_PQ_query_param_uint64 (&pd->total_stock), /* $9 */
GNUNET_PQ_query_param_uint64 (&pd->total_lost),
diff --git a/src/backenddb/plugin_merchantdb_postgres.c b/src/backenddb/plugin_merchantdb_postgres.c
index 016cb4e2..70a3e644 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -284,7 +284,6 @@ lookup_deposits_by_order_cb (void *cls,
unsigned int num_results)
{
struct LookupDepositsByOrderContext *ldoc = cls;
- struct PostgresClosure *pg = ldoc->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -301,10 +300,10 @@ lookup_deposits_by_order_cb (void *cls,
&exchange_url),
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
&h_wire),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
- &amount_with_fee),
- TALER_PQ_RESULT_SPEC_AMOUNT ("deposit_fee",
- &deposit_fee),
+ TALER_PQ_result_spec_amount_with_currency ("amount_with_fee",
+ &amount_with_fee),
+ TALER_PQ_result_spec_amount_with_currency ("deposit_fee",
+ &deposit_fee),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&coin_pub),
GNUNET_PQ_result_spec_end
@@ -412,7 +411,6 @@ lookup_transfer_details_by_order_cb (void *cls,
unsigned int num_results)
{
struct LookupTransferDetailsByOrderContext *ltdo = cls;
- struct PostgresClosure *pg = ltdo->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -432,10 +430,10 @@ lookup_transfer_details_by_order_cb (void *cls,
&exchange_url),
GNUNET_PQ_result_spec_auto_from_type ("wtid",
&wtid),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_deposit_value",
- &deposit_value),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_deposit_fee",
- &deposit_fee),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_deposit_value",
+ &deposit_value),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_deposit_fee",
+ &deposit_fee),
GNUNET_PQ_result_spec_auto_from_type ("transfer_confirmed",
&transfer_confirmed),
GNUNET_PQ_result_spec_end
@@ -568,7 +566,6 @@ lookup_refunds_detailed_cb (void *cls,
unsigned int num_results)
{
struct LookupRefundsDetailedContext *lrdc = cls;
- struct PostgresClosure *pg = lrdc->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -593,8 +590,8 @@ lookup_refunds_detailed_cb (void *cls,
&rtransaction_id),
GNUNET_PQ_result_spec_string ("reason",
&reason),
- TALER_PQ_RESULT_SPEC_AMOUNT ("refund_amount",
- &refund_amount),
+ TALER_PQ_result_spec_amount_with_currency ("refund_amount",
+ &refund_amount),
GNUNET_PQ_result_spec_auto_from_type ("pending",
&pending8),
GNUNET_PQ_result_spec_end
@@ -906,10 +903,10 @@ postgres_lookup_wire_fee (void *cls,
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_RESULT_SPEC_AMOUNT ("wire_fee",
- &fees->wire),
- TALER_PQ_RESULT_SPEC_AMOUNT ("closing_fee",
- &fees->closing),
+ TALER_PQ_result_spec_amount_with_currency ("wire_fee",
+ &fees->wire),
+ TALER_PQ_result_spec_amount_with_currency ("closing_fee",
+ &fees->closing),
GNUNET_PQ_result_spec_timestamp ("start_date",
start_date),
GNUNET_PQ_result_spec_timestamp ("end_date",
@@ -971,7 +968,6 @@ lookup_deposits_by_contract_and_coin_cb (void *cls,
unsigned int num_results)
{
struct LookupDepositsByCnCContext *ldcc = cls;
- struct PostgresClosure *pg = ldcc->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -988,14 +984,14 @@ lookup_deposits_by_contract_and_coin_cb (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_string ("exchange_url",
&exchange_url),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount_with_fee",
- &amount_with_fee),
- TALER_PQ_RESULT_SPEC_AMOUNT ("deposit_fee",
- &deposit_fee),
- TALER_PQ_RESULT_SPEC_AMOUNT ("refund_fee",
- &refund_fee),
- TALER_PQ_RESULT_SPEC_AMOUNT ("wire_fee",
- &wire_fee),
+ TALER_PQ_result_spec_amount_with_currency ("amount_with_fee",
+ &amount_with_fee),
+ TALER_PQ_result_spec_amount_with_currency ("deposit_fee",
+ &deposit_fee),
+ TALER_PQ_result_spec_amount_with_currency ("refund_fee",
+ &refund_fee),
+ TALER_PQ_result_spec_amount_with_currency ("wire_fee",
+ &wire_fee),
GNUNET_PQ_result_spec_auto_from_type ("h_wire",
&h_wire),
GNUNET_PQ_result_spec_timestamp ("deposit_timestamp",
@@ -1125,15 +1121,15 @@ postgres_lookup_transfer (
bool no_sig;
struct TALER_Amount credit_amount;
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_RESULT_SPEC_AMOUNT ("credit_amount",
- &credit_amount),
+ TALER_PQ_result_spec_amount_with_currency ("credit_amount",
+ &credit_amount),
GNUNET_PQ_result_spec_allow_null (
- TALER_PQ_RESULT_SPEC_AMOUNT ("wire_fee",
- wire_fee),
+ TALER_PQ_result_spec_amount_with_currency ("wire_fee",
+ wire_fee),
&no_sig),
GNUNET_PQ_result_spec_allow_null (
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_amount",
- exchange_amount),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_amount",
+ exchange_amount),
NULL),
GNUNET_PQ_result_spec_allow_null (
GNUNET_PQ_result_spec_timestamp ("execution_time",
@@ -1218,7 +1214,6 @@ lookup_transfer_summary_cb (void *cls,
unsigned int num_results)
{
struct LookupTransferSummaryContext *ltdc = cls;
- struct PostgresClosure *pg = ltdc->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -1228,10 +1223,10 @@ lookup_transfer_summary_cb (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_string ("order_id",
&order_id),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_deposit_value",
- &deposit_value),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_deposit_fee",
- &deposit_fee),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_deposit_value",
+ &deposit_value),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_deposit_fee",
+ &deposit_fee),
GNUNET_PQ_result_spec_end
};
@@ -1339,7 +1334,6 @@ lookup_transfer_details_cb (void *cls,
unsigned int num_results)
{
struct LookupTransferDetailsContext *ltdc = cls;
- struct PostgresClosure *pg = ltdc->pg;
for (unsigned int i = 0; i<num_results; i++)
{
@@ -1352,10 +1346,10 @@ lookup_transfer_details_cb (void *cls,
&ttd.h_contract_terms),
GNUNET_PQ_result_spec_auto_from_type ("coin_pub",
&ttd.coin_pub),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_deposit_value",
- &ttd.coin_value),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_deposit_fee",
- &ttd.coin_fee),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_deposit_value",
+ &ttd.coin_value),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_deposit_fee",
+ &ttd.coin_fee),
GNUNET_PQ_result_spec_end
};
@@ -1463,7 +1457,6 @@ lookup_pending_reserves_cb (void *cls,
unsigned int num_results)
{
struct LookupPendingReservesContext *lrc = cls;
- struct PostgresClosure *pg = lrc->pg;
for (unsigned int i = 0; i < num_results; i++)
{
@@ -1478,8 +1471,8 @@ lookup_pending_reserves_cb (void *cls,
&instance_id),
GNUNET_PQ_result_spec_string ("exchange_url",
&exchange_url),
- TALER_PQ_RESULT_SPEC_AMOUNT ("merchant_initial_balance",
- &merchant_initial_balance),
+ TALER_PQ_result_spec_amount_with_currency ("merchant_initial_balance",
+ &merchant_initial_balance),
GNUNET_PQ_result_spec_end
};
@@ -1579,7 +1572,6 @@ lookup_reserve_rewards_cb (void *cls,
unsigned int num_results)
{
struct LookupRewardsContext *ltc = cls;
- struct PostgresClosure *pg = ltc->pg;
GNUNET_array_grow (ltc->rewards,
ltc->rewards_length,
@@ -1592,8 +1584,8 @@ lookup_reserve_rewards_cb (void *cls,
&td->reason),
GNUNET_PQ_result_spec_auto_from_type ("reward_id",
&td->reward_id),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
- &td->total_amount),
+ TALER_PQ_result_spec_amount_with_currency ("amount",
+ &td->total_amount),
GNUNET_PQ_result_spec_end
};
@@ -1653,14 +1645,14 @@ postgres_lookup_reserve (void *cls,
&creation_time),
GNUNET_PQ_result_spec_timestamp ("expiration",
&expiration_time),
- TALER_PQ_RESULT_SPEC_AMOUNT ("merchant_initial_balance",
- &merchant_initial_balance),
- TALER_PQ_RESULT_SPEC_AMOUNT ("exchange_initial_balance",
- &exchange_initial_balance),
- TALER_PQ_RESULT_SPEC_AMOUNT ("rewards_picked_up",
- &pickup_amount),
- TALER_PQ_RESULT_SPEC_AMOUNT ("rewards_committed",
- &committed_amount),
+ TALER_PQ_result_spec_amount_with_currency ("merchant_initial_balance",
+ &merchant_initial_balance),
+ TALER_PQ_result_spec_amount_with_currency ("exchange_initial_balance",
+ &exchange_initial_balance),
+ TALER_PQ_result_spec_amount_with_currency ("rewards_picked_up",
+ &pickup_amount),
+ TALER_PQ_result_spec_amount_with_currency ("rewards_committed",
+ &committed_amount),
GNUNET_PQ_result_spec_auto_from_type ("master_pub",
&master_pub),
GNUNET_PQ_result_spec_bool ("active",
@@ -1955,10 +1947,10 @@ postgres_lookup_reward (void *cls,
GNUNET_PQ_query_param_end
};
struct GNUNET_PQ_ResultSpec rs[] = {
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
- total_authorized),
- TALER_PQ_RESULT_SPEC_AMOUNT ("picked_up",
- total_picked_up),
+ TALER_PQ_result_spec_amount_with_currency ("amount",
+ total_authorized),
+ TALER_PQ_result_spec_amount_with_currency ("picked_up",
+ total_picked_up),
GNUNET_PQ_result_spec_timestamp ("expiration",
expiration),
GNUNET_PQ_result_spec_string ("exchange_url",
@@ -2018,7 +2010,6 @@ lookup_rewards_cb (void *cls,
unsigned int num_results)
{
struct LookupMerchantRewardsContext *plc = cls;
- struct PostgresClosure *pg = plc->pg;
for (unsigned int i = 0; i < num_results; i++)
{
@@ -2030,8 +2021,8 @@ lookup_rewards_cb (void *cls,
&row_id),
GNUNET_PQ_result_spec_auto_from_type ("reward_id",
&reward_id),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
- &reward_amount),
+ TALER_PQ_result_spec_amount_with_currency ("amount",
+ &reward_amount),
GNUNET_PQ_result_spec_end
};
@@ -2154,7 +2145,6 @@ lookup_pickup_details_cb (void *cls,
unsigned int num_results)
{
struct LookupRewardDetailsContext *ltdc = cls;
- struct PostgresClosure *pg = ltdc->pg;
*ltdc->pickups_length = num_results;
*ltdc->pickups = GNUNET_new_array (num_results,
@@ -2166,8 +2156,8 @@ lookup_pickup_details_cb (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("pickup_id",
&pd->pickup_id),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
- &pd->requested_amount),
+ TALER_PQ_result_spec_amount_with_currency ("amount",
+ &pd->requested_amount),
GNUNET_PQ_result_spec_uint64 ("num_planchets",
&num_planchets),
GNUNET_PQ_result_spec_end
@@ -2232,10 +2222,10 @@ postgres_lookup_reward_details (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_uint64 ("reward_serial",
&reward_serial),
- TALER_PQ_RESULT_SPEC_AMOUNT ("amount",
- total_authorized),
- TALER_PQ_RESULT_SPEC_AMOUNT ("picked_up",
- total_picked_up),
+ TALER_PQ_result_spec_amount_with_currency ("amount",
+ total_authorized),
+ TALER_PQ_result_spec_amount_with_currency ("picked_up",
+ total_picked_up),
GNUNET_PQ_result_spec_string ("justification",
justification),
GNUNET_PQ_result_spec_timestamp ("expiration",
@@ -3550,10 +3540,11 @@ postgres_connect (void *cls)
",merchant_id"
",exchange_url"
",merchant_initial_balance"
- " FROM merchant_reward_reserves"
+ " FROM merchant_reward_reserves mrr"
" JOIN merchant_instances USING (merchant_serial)"
" JOIN merchant_reward_reserve_keys USING (reserve_serial)"
- " WHERE exchange_initial_balance=CAST((0,0) AS taler_amount)"),
+ " WHERE (mrr.exchange_initial_balance).val=0"
+ " AND (mrr.exchange_initial_balance).frac=0"),
/* For postgres_lookup_reserve() */
GNUNET_PQ_make_prepare ("lookup_reserve",
"SELECT"
@@ -4000,14 +3991,6 @@ libtaler_plugin_merchantdb_postgres_init (void *cls)
GNUNET_free (pg);
return NULL;
}
- if (GNUNET_OK !=
- TALER_config_get_currency (cfg,
- &pg->currency))
- {
- GNUNET_free (pg->sql_dir);
- GNUNET_free (pg);
- return NULL;
- }
plugin = GNUNET_new (struct TALER_MERCHANTDB_Plugin);
plugin->cls = pg;
plugin->connect = &postgres_connect;
@@ -4213,7 +4196,6 @@ libtaler_plugin_merchantdb_postgres_done (void *cls)
pg->conn = NULL;
}
GNUNET_free (pg->sql_dir);
- GNUNET_free (pg->currency);
GNUNET_free (pg);
GNUNET_free (plugin);
return NULL;
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index b471f805..58470786 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -117,15 +117,7 @@ make_instance (char *instance_id,
GNUNET_assert (NULL != instance->instance.jurisdiction);
GNUNET_assert (0 == json_array_append_new (instance->instance.jurisdiction,
json_string ("Ohio")));
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount ("EUR:1200.40",
- &instance->instance.
- default_max_deposit_fee));
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount ("EUR:1200.40",
- &instance->instance.
- default_max_wire_fee));
- instance->instance.default_wire_fee_amortization = 1;
+ instance->instance.use_stefan = true;
instance->instance.default_wire_transfer_delay =
GNUNET_TIME_relative_get_minute_ ();
instance->instance.default_pay_delay = GNUNET_TIME_relative_get_second_ ();
@@ -235,15 +227,7 @@ check_instances_equal (const struct TALER_MERCHANTDB_InstanceSettings *a,
b->address)) ||
(1 != json_equal (a->jurisdiction,
b->jurisdiction)) ||
- (GNUNET_OK != TALER_amount_cmp_currency (&a->default_max_deposit_fee,
- &b->default_max_deposit_fee)) ||
- (0 != TALER_amount_cmp (&a->default_max_deposit_fee,
- &b->default_max_deposit_fee)) ||
- (GNUNET_OK != TALER_amount_cmp_currency (&a->default_max_wire_fee,
- &b->default_max_wire_fee)) ||
- (0 != TALER_amount_cmp (&a->default_max_wire_fee,
- &b->default_max_wire_fee)) ||
- (a->default_wire_fee_amortization != b->default_wire_fee_amortization) ||
+ (a->use_stefan != b->use_stefan) ||
(a->default_wire_transfer_delay.rel_value_us !=
b->default_wire_transfer_delay.rel_value_us) ||
(a->default_pay_delay.rel_value_us != b->default_pay_delay.rel_value_us))
@@ -599,15 +583,7 @@ run_test_instances (struct TestInstances_Closure *cls)
json_array_append_new (cls->instances[0].instance.jurisdiction,
json_pack ("{s:s}",
"vegetables", "bad"));
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount ("EUR:0.04",
- &cls->instances[0].instance.
- default_max_deposit_fee));
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount ("EUR:1.23",
- &cls->instances[0].instance.
- default_max_wire_fee));
- cls->instances[0].instance.default_wire_fee_amortization = 2;
+ cls->instances[0].instance.use_stefan = false;
cls->instances[0].instance.default_wire_transfer_delay =
GNUNET_TIME_UNIT_HOURS;
cls->instances[0].instance.default_pay_delay = GNUNET_TIME_UNIT_MINUTES;
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index d427dc22..c41080be 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -559,9 +559,7 @@ struct TALER_MERCHANT_AccountConfig
* @param ut user type of the merchant instance
* @param address physical address of the merchant instance
* @param jurisdiction jurisdiction of the merchant instance
- * @param default_max_wire_fee default maximum wire fee merchant is willing to fully pay
- * @param default_wire_fee_amortization default amortization factor for excess wire fees
- * @param default_max_deposit_fee default maximum deposit fee merchant is willing to pay
+ * @param use_stefan use STEFAN curve for acceptable fees
* @param default_wire_transfer_delay default wire transfer delay merchant will ask for
* @param default_pay_delay default validity period for offers merchant makes
* @param auth_token authentication token to use for access control, NULL for external auth; MUST follow RFC 8959
@@ -581,9 +579,7 @@ TALER_MERCHANT_instances_post (
enum TALER_KYCLOGIC_KycUserType ut,
const json_t *address,
const json_t *jurisdiction,
- const struct TALER_Amount *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const struct TALER_Amount *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
const char *auth_token,
@@ -754,9 +750,7 @@ typedef void
* @param ut user type of the merchant instance
* @param address physical address of the merchant instance
* @param jurisdiction jurisdiction of the merchant instance
- * @param default_max_wire_fee default maximum wire fee merchant is willing to fully pay
- * @param default_wire_fee_amortization default amortization factor for excess wire fees
- * @param default_max_deposit_fee default maximum deposit fee merchant is willing to pay
+ * @param use_stefan use STEFAN curve for acceptable fees
* @param default_wire_transfer_delay default wire transfer delay merchant will ask for
* @param default_pay_delay default validity period for offers merchant makes
* @param cb function to call with the
@@ -775,9 +769,7 @@ TALER_MERCHANT_instance_patch (
enum TALER_KYCLOGIC_KycUserType ut,
const json_t *address,
const json_t *jurisdiction,
- const struct TALER_Amount *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const struct TALER_Amount *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
TALER_MERCHANT_InstancePatchCallback cb,
@@ -914,14 +906,10 @@ struct TALER_MERCHANT_InstanceDetails
const json_t *jurisdiction;
/**
- * default maximum wire fee merchant is willing to fully pay
+ * Are we using STEFAN curves to determine acceptable
+ * fees?
*/
- struct TALER_Amount default_max_wire_fee;
-
- /**
- * default maximum deposit fee merchant is willing to pay
- */
- struct TALER_Amount default_max_deposit_fee;
+ bool use_stefan;
/**
* default wire transfer delay merchant will ask for
@@ -934,11 +922,6 @@ struct TALER_MERCHANT_InstanceDetails
struct GNUNET_TIME_Relative default_pay_delay;
/**
- * Default amortization factor for excess wire fees
- */
- uint32_t default_wire_fee_amortization;
-
- /**
* User type for the instance.
*/
enum TALER_KYCLOGIC_KycUserType ut;
diff --git a/src/include/taler_merchant_testing_lib.h b/src/include/taler_merchant_testing_lib.h
index 752342ab..bc888fa7 100644
--- a/src/include/taler_merchant_testing_lib.h
+++ b/src/include/taler_merchant_testing_lib.h
@@ -92,7 +92,6 @@ TALER_TESTING_cmd_merchant_get_instances (const char *label,
* POST /instances request.
* @param instance_id the ID of the instance to create
* @param payto_uri payment URI to use
- * @param currency currency to use for default fees
* @param http_status expected HTTP response code.
* @return the command.
*/
@@ -101,7 +100,6 @@ TALER_TESTING_cmd_merchant_post_instances (const char *label,
const char *merchant_url,
const char *instance_id,
const char *payto_uri,
- const char *currency,
unsigned int http_status);
@@ -136,9 +134,7 @@ TALER_TESTING_cmd_merchant_post_instance_auth (const char *label,
* @param name name of the merchant instance
* @param address physical address of the merchant instance
* @param jurisdiction jurisdiction of the merchant instance
- * @param default_max_wire_fee default maximum wire fee merchant is willing to fully pay
- * @param default_wire_fee_amortization default amortization factor for excess wire fees
- * @param default_max_deposit_fee default maximum deposit fee merchant is willing to pay
+ * @param use_stefan enable STEFAN curve
* @param default_wire_transfer_delay default wire transfer delay merchant will ask for
* @param default_pay_delay default validity period for offers merchant makes
* @param auth_token authorization token needed to access the instance, can be NULL
@@ -155,9 +151,7 @@ TALER_TESTING_cmd_merchant_post_instances2 (
const char *name,
json_t *address,
json_t *jurisdiction,
- const char *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const char *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
const char *auth_token,
@@ -215,9 +209,7 @@ TALER_TESTING_cmd_merchant_delete_account (
* @param name name of the merchant instance
* @param address physical address of the merchant instance
* @param jurisdiction jurisdiction of the merchant instance
- * @param default_max_wire_fee default maximum wire fee merchant is willing to fully pay
- * @param default_wire_fee_amortization default amortization factor for excess wire fees
- * @param default_max_deposit_fee default maximum deposit fee merchant is willing to pay
+ * @param use_stefan use STEFAN curve
* @param default_wire_transfer_delay default wire transfer delay merchant will ask for
* @param default_pay_delay default validity period for offers merchant makes
* @param http_status expected HTTP response code.
@@ -233,9 +225,7 @@ TALER_TESTING_cmd_merchant_patch_instance (
const char *name,
json_t *address,
json_t *jurisdiction,
- const char *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const char *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
unsigned int http_status);
@@ -1909,9 +1899,7 @@ TALER_TESTING_cmd_checkserver2 (const char *label,
op (i18n_description, const json_t) \
op (taxes, const json_t) \
op (fee, const struct TALER_Amount) \
- op (max_wire_fee, const struct TALER_Amount) \
- op (max_deposit_fee, const struct TALER_Amount) \
- op (wire_fee_amortization, const uint32_t) \
+ op (use_stefan, const bool) \
op (jurisdiction, const json_t) \
op (wire_delay, const struct GNUNET_TIME_Relative) \
op (pay_delay, const struct GNUNET_TIME_Relative) \
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index 81f9804b..1c0cd37c 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -176,22 +176,10 @@ struct TALER_MERCHANTDB_InstanceSettings
json_t *jurisdiction;
/**
- * Default max deposit fee that the merchant is willing to
- * pay; if deposit costs more, then the customer will cover
- * the difference.
+ * Use STEFAN curves to determine acceptable
+ * fees by default (otherwise: accept no fees by default).
*/
- struct TALER_Amount default_max_deposit_fee;
-
- /**
- * Default maximum wire fee to assume, unless stated differently in the
- * proposal already.
- */
- struct TALER_Amount default_max_wire_fee;
-
- /**
- * Default factor for wire fee amortization.
- */
- uint32_t default_wire_fee_amortization;
+ bool use_stefan;
/**
* If the frontend does NOT specify an execution date, how long should
diff --git a/src/lib/merchant_api_get_instance.c b/src/lib/merchant_api_get_instance.c
index cf58f828..9cfbcf83 100644
--- a/src/lib/merchant_api_get_instance.c
+++ b/src/lib/merchant_api_get_instance.c
@@ -98,28 +98,27 @@ handle_get_instance_finished (void *cls,
const json_t *address;
const json_t *jurisdiction;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_array_const ("accounts",
- &accounts),
- GNUNET_JSON_spec_string ("name",
- &igr.details.ok.details.name),
- GNUNET_JSON_spec_string ("user_type",
- &uts),
+ GNUNET_JSON_spec_array_const (
+ "accounts",
+ &accounts),
+ GNUNET_JSON_spec_string (
+ "name",
+ &igr.details.ok.details.name),
+ GNUNET_JSON_spec_string (
+ "user_type",
+ &uts),
GNUNET_JSON_spec_fixed_auto (
"merchant_pub",
&igr.details.ok.details.merchant_pub),
- GNUNET_JSON_spec_object_const ("address",
- &address),
- GNUNET_JSON_spec_object_const ("jurisdiction",
- &jurisdiction),
- TALER_JSON_spec_amount_any (
- "default_max_wire_fee",
- &igr.details.ok.details.default_max_wire_fee),
- GNUNET_JSON_spec_uint32 (
- "default_wire_fee_amortization",
- &igr.details.ok.details.default_wire_fee_amortization),
- TALER_JSON_spec_amount_any (
- "default_max_deposit_fee",
- &igr.details.ok.details.default_max_deposit_fee),
+ GNUNET_JSON_spec_object_const (
+ "address",
+ &address),
+ GNUNET_JSON_spec_object_const (
+ "jurisdiction",
+ &jurisdiction),
+ GNUNET_JSON_spec_bool (
+ "use_stefan",
+ &igr.details.ok.details.use_stefan),
GNUNET_JSON_spec_relative_time (
"default_wire_transfer_delay",
&igr.details.ok.details.default_wire_transfer_delay),
diff --git a/src/lib/merchant_api_patch_instance.c b/src/lib/merchant_api_patch_instance.c
index 6a3c06c1..8b4b6205 100644
--- a/src/lib/merchant_api_patch_instance.c
+++ b/src/lib/merchant_api_patch_instance.c
@@ -164,9 +164,7 @@ TALER_MERCHANT_instance_patch (
enum TALER_KYCLOGIC_KycUserType ut,
const json_t *address,
const json_t *jurisdiction,
- const struct TALER_Amount *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const struct TALER_Amount *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
TALER_MERCHANT_InstancePatchCallback cb,
@@ -229,12 +227,8 @@ TALER_MERCHANT_instance_patch (
(json_t *) address),
GNUNET_JSON_pack_object_incref ("jurisdiction",
(json_t *) jurisdiction),
- TALER_JSON_pack_amount ("default_max_wire_fee",
- default_max_wire_fee),
- GNUNET_JSON_pack_uint64 ("default_wire_fee_amortization",
- default_wire_fee_amortization),
- TALER_JSON_pack_amount ("default_max_deposit_fee",
- default_max_deposit_fee),
+ GNUNET_JSON_pack_bool ("use_stefan",
+ use_stefan),
GNUNET_JSON_pack_time_rel ("default_wire_transfer_delay",
default_wire_transfer_delay),
GNUNET_JSON_pack_time_rel ("default_pay_delay",
diff --git a/src/lib/merchant_api_post_instances.c b/src/lib/merchant_api_post_instances.c
index 77168e2a..77336187 100644
--- a/src/lib/merchant_api_post_instances.c
+++ b/src/lib/merchant_api_post_instances.c
@@ -170,9 +170,7 @@ TALER_MERCHANT_instances_post (
enum TALER_KYCLOGIC_KycUserType ut,
const json_t *address,
const json_t *jurisdiction,
- const struct TALER_Amount *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const struct TALER_Amount *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
const char *auth_token,
@@ -267,12 +265,8 @@ TALER_MERCHANT_instances_post (
(json_t *) address),
GNUNET_JSON_pack_object_incref ("jurisdiction",
(json_t *) jurisdiction),
- TALER_JSON_pack_amount ("default_max_wire_fee",
- default_max_wire_fee),
- GNUNET_JSON_pack_uint64 ("default_wire_fee_amortization",
- default_wire_fee_amortization),
- TALER_JSON_pack_amount ("default_max_deposit_fee",
- default_max_deposit_fee),
+ GNUNET_JSON_pack_bool ("use_stefan",
+ use_stefan),
GNUNET_JSON_pack_time_rel ("default_wire_transfer_delay",
default_wire_transfer_delay),
GNUNET_JSON_pack_time_rel ("default_pay_delay",
diff --git a/src/merchant-tools/taler-merchant-benchmark.c b/src/merchant-tools/taler-merchant-benchmark.c
index ec3319cf..ce4491e0 100644
--- a/src/merchant-tools/taler-merchant-benchmark.c
+++ b/src/merchant-tools/taler-merchant-benchmark.c
@@ -183,7 +183,6 @@ run (void *cls,
merchant_url,
"default",
cred.user42_payto,
- currency,
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_admin_add_incoming (
@@ -261,14 +260,12 @@ run (void *cls,
merchant_url,
"default",
cred.user42_payto,
- currency,
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_instances (
"instance-create-alt",
merchant_url,
alt_instance_id,
cred.user42_payto,
- currency,
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_admin_add_incoming (
"create-reserve-1",
diff --git a/src/testing/test_key_rotation.sh b/src/testing/test_key_rotation.sh
index 2cd5569f..cf270b3c 100755
--- a/src/testing/test_key_rotation.sh
+++ b/src/testing/test_key_rotation.sh
@@ -190,7 +190,7 @@ echo "OK"
echo -n "Setting up merchant instance"
STATUS=$(curl -H "Content-Type: application/json" -X POST \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_kyc_api.c b/src/testing/test_kyc_api.c
index c93455e4..e26a1fd3 100644
--- a/src/testing/test_kyc_api.c
+++ b/src/testing/test_kyc_api.c
@@ -396,7 +396,6 @@ run (void *cls,
merchant_url,
"default",
merchant_payto,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_batch ("pay",
pay),
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 3c3c004b..32674332 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -224,7 +224,6 @@ run (void *cls,
merchant_url,
"default",
PAYTO_I1,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_kyc_get ("instance-create-kyc-0",
merchant_url,
@@ -233,13 +232,14 @@ run (void *cls,
EXCHANGE_URL,
MHD_HTTP_NO_CONTENT,
TALER_AML_NORMAL),
- TALER_TESTING_cmd_merchant_post_orders_no_claim ("create-proposal-bad-currency",
- merchant_url,
- MHD_HTTP_BAD_REQUEST,
- "4",
- GNUNET_TIME_UNIT_ZERO_TS,
- GNUNET_TIME_UNIT_FOREVER_TS,
- "CHF:5.0"),
+ TALER_TESTING_cmd_merchant_post_orders_no_claim (
+ "create-proposal-bad-currency",
+ merchant_url,
+ MHD_HTTP_BAD_REQUEST,
+ "4",
+ GNUNET_TIME_UNIT_ZERO_TS,
+ GNUNET_TIME_UNIT_FOREVER_TS,
+ "CHF:5.0"),
TALER_TESTING_cmd_merchant_post_orders_no_claim ("create-proposal-4",
merchant_url,
MHD_HTTP_OK,
@@ -940,7 +940,6 @@ run (void *cls,
merchant_url,
"i1a",
PAYTO_I1,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_get_product ("get-nx-product-i1a-1",
merchant_url_i1a,
@@ -1671,13 +1670,11 @@ run (void *cls,
merchant_url,
"default",
PAYTO_I1,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i1",
merchant_url,
"i1",
PAYTO_I1,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_get_instances ("instances-get-i1",
merchant_url,
@@ -1690,24 +1687,6 @@ run (void *cls,
"i1",
MHD_HTTP_OK,
"instance-create-i1"),
- TALER_TESTING_cmd_merchant_patch_instance ("instance-patch-i1-bad-currency",
- merchant_url,
- "i1",
- 2,
- payto_uris,
- "bob-the-merchant",
- json_pack ("{s:s}",
- "street",
- "bobstreet"),
- json_pack ("{s:s}",
- "street",
- "bobjuryst"),
- "USD:0.1",
- 4,
- "USD:0.5",
- GNUNET_TIME_UNIT_MINUTES,
- GNUNET_TIME_UNIT_MINUTES,
- MHD_HTTP_BAD_REQUEST),
TALER_TESTING_cmd_merchant_patch_instance ("instance-patch-i1",
merchant_url,
"i1",
@@ -1720,9 +1699,7 @@ run (void *cls,
json_pack ("{s:s}",
"street",
"bobjuryst"),
- "EUR:0.1",
- 4,
- "EUR:0.5",
+ true,
GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_MINUTES,
MHD_HTTP_NO_CONTENT),
@@ -1748,9 +1725,7 @@ run (void *cls,
json_pack ("{s:s}",
"street",
"bobjuryst"),
- "EUR:0.1",
- 4,
- "EUR:0.5",
+ true,
GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_MINUTES,
MHD_HTTP_NO_CONTENT),
@@ -1768,12 +1743,6 @@ 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_instances2 ("instance-create-ACL",
merchant_url,
"i-acl",
@@ -1783,9 +1752,7 @@ run (void *cls,
"shopcity"),
json_pack ("{s:s}", "city",
"lawyercity"),
- "EUR:0.1",
- 42,
- "EUR:0.2",
+ true,
GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_MINUTES,
// FIXME: change this back once
@@ -1805,9 +1772,7 @@ run (void *cls,
json_pack ("{s:s}",
"street",
"bobjuryst"),
- "EUR:0.1",
- 4,
- "EUR:0.5",
+ true,
GNUNET_TIME_UNIT_MINUTES,
GNUNET_TIME_UNIT_MINUTES,
MHD_HTTP_NO_CONTENT),
@@ -1815,19 +1780,16 @@ run (void *cls,
merchant_url,
"i2",
PAYTO_I1,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2-idem",
merchant_url,
"i2",
PAYTO_I1,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_instances ("instance-create-i2-non-idem",
merchant_url,
"i2",
"payto://other-method/?receiver-name=X",
- "EUR",
MHD_HTTP_CONFLICT),
TALER_TESTING_cmd_merchant_delete_instance ("instance-delete-i2",
merchant_url,
@@ -1863,7 +1825,6 @@ run (void *cls,
merchant_url,
"default",
PAYTO_I1,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_get_products ("get-products-empty",
merchant_url,
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1690997204 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1690997204
deleted file mode 100644
index 49c6ae9c..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1690997204
+++ /dev/null
@@ -1 +0,0 @@
-f>ktj DMDo#U\3%o \ No newline at end of file
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1691601704 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1691601704
deleted file mode 100644
index 82db7326..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_1/1691601704
+++ /dev/null
@@ -1 +0,0 @@
-HEJjbU@4i*“2:B |i' \ No newline at end of file
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1690997204 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1690997204
deleted file mode 100644
index a2dd2950..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1690997204
+++ /dev/null
Binary files differ
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1691601704 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1691601704
deleted file mode 100644
index 1bfbf308..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_5/1691601704
+++ /dev/null
@@ -1 +0,0 @@
-fxso{۰7IP8h+8-
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1690997204 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1690997204
deleted file mode 100644
index e029d401..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1690997204
+++ /dev/null
Binary files differ
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1691601704 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1691601704
deleted file mode 100644
index 38ec74ec..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_1/1691601704
+++ /dev/null
@@ -1 +0,0 @@
-D~C{ o{ˑ6(3 \ No newline at end of file
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1690997204 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1690997204
deleted file mode 100644
index 485fe9af..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1690997204
+++ /dev/null
@@ -1 +0,0 @@
-zF}Ϳs@OX 93  \ No newline at end of file
diff --git a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1691601704 b/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1691601704
deleted file mode 100644
index a33f018d..00000000
--- a/src/testing/test_merchant_api_home/taler/exchange-secmod-cs/keys/coin_eur_ct_10/1691601704
+++ /dev/null
@@ -1 +0,0 @@
-zj·g0è_w3/clNI \ No newline at end of file
diff --git a/src/testing/test_merchant_api_twisted.c b/src/testing/test_merchant_api_twisted.c
index 36a90980..b55388ab 100644
--- a/src/testing/test_merchant_api_twisted.c
+++ b/src/testing/test_merchant_api_twisted.c
@@ -338,7 +338,6 @@ run (void *cls,
twister_merchant_url,
"default",
PAYTO_I1,
- "EUR",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_batch ("pay",
pay),
@@ -352,7 +351,7 @@ run (void *cls,
* Make a reserve exist,
* according to the previous
* transfer.
- *///
+ */
CMD_EXEC_WIREWATCH ("wirewatch-1"),
TALER_TESTING_cmd_check_bank_admin_transfer ("check_bank_transfer-2",
"EUR:10.02",
diff --git a/src/testing/test_merchant_instance_auth.sh b/src/testing/test_merchant_instance_auth.sh
index 1a21c083..8c031e1d 100755
--- a/src/testing/test_merchant_instance_auth.sh
+++ b/src/testing/test_merchant_instance_auth.sh
@@ -42,7 +42,7 @@ echo -n "Configuring 'default' instance ..." >&2
STATUS=$(curl -H "Content-Type: application/json" -X POST \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"token","token":"secret-token:new_value"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"token","token":"secret-token:new_value"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
@@ -115,7 +115,7 @@ echo -n "Configuring 'second' instance ..." >&2
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer '$NEW_SECRET \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"token","token":"secret-token:second"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"second","name":"second","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"token","token":"secret-token:second"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"second","name":"second","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_instance_creation.sh b/src/testing/test_merchant_instance_creation.sh
index ed868b96..8d81ab8b 100755
--- a/src/testing/test_merchant_instance_creation.sh
+++ b/src/testing/test_merchant_instance_creation.sh
@@ -27,7 +27,7 @@ echo -n "Configuring a merchant instance before configuring the default instance
STATUS=$(curl -H "Content-Type: application/json" -X POST \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"first","name":"test","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"first","name":"test","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
@@ -43,7 +43,7 @@ echo -n "Configuring default instance ..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "401" ]
@@ -58,7 +58,7 @@ echo -n "Configuring a second merchant instance ..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"second","name":"test","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"second","name":"test","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "401" ]
diff --git a/src/testing/test_merchant_instance_purge.sh b/src/testing/test_merchant_instance_purge.sh
index dfebbc84..0d8c0c2c 100755
--- a/src/testing/test_merchant_instance_purge.sh
+++ b/src/testing/test_merchant_instance_purge.sh
@@ -27,7 +27,7 @@ echo -n "Configuring default instance ..." >&2
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
@@ -41,7 +41,7 @@ echo -n "Configuring merchant instance ..." >&2
STATUS=$(curl -H "Content-Type: application/json" -X POST \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"test","name":"test","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"test","name":"test","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_instance_response.sh b/src/testing/test_merchant_instance_response.sh
index b94f8dcf..b2eee199 100755
--- a/src/testing/test_merchant_instance_response.sh
+++ b/src/testing/test_merchant_instance_response.sh
@@ -45,7 +45,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
+ -d '{"auth":{"method":"token","token":"secret-token:other_secret"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 3600000000},"default_pay_delay":{"d_us": 3600000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_kyc.sh b/src/testing/test_merchant_kyc.sh
index e7b45ad0..c093d698 100755
--- a/src/testing/test_merchant_kyc.sh
+++ b/src/testing/test_merchant_kyc.sh
@@ -29,7 +29,7 @@ echo -n "Configuring a merchant instance before configuring the default instance
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost:8082/43"},{"payto_uri":"payto://x-taler-bank/localhost:8082/44"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost:8082/43"},{"payto_uri":"payto://x-taler-bank/localhost:8082/44"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_order_autocleanup.sh b/src/testing/test_merchant_order_autocleanup.sh
index c366036a..a5678ecf 100755
--- a/src/testing/test_merchant_order_autocleanup.sh
+++ b/src/testing/test_merchant_order_autocleanup.sh
@@ -60,7 +60,7 @@ FORTYTHREE=$(get_payto_uri fortythree x)
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
"http://localhost:9966/management/instances" \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_order_creation.sh b/src/testing/test_merchant_order_creation.sh
index 46b4b7fc..99b1c674 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -67,7 +67,7 @@ FORTYTHREE=$(get_payto_uri fortythree x)
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"},{"payto_uri":"payto://iban/SANDBOXX/DE270744?receiver-name=Forty+Four"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000000},"default_pay_delay":{"d_us": 60000000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"},{"payto_uri":"payto://iban/SANDBOXX/DE270744?receiver-name=Forty+Four"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000000},"default_pay_delay":{"d_us": 60000000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
@@ -80,7 +80,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X PATCH \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/instances/default/private/ \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000000},"default_pay_delay":{"d_us": 60000000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000000},"default_pay_delay":{"d_us": 60000000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_product_creation.sh b/src/testing/test_merchant_product_creation.sh
index 22b12c2c..1da57a04 100755
--- a/src/testing/test_merchant_product_creation.sh
+++ b/src/testing/test_merchant_product_creation.sh
@@ -40,7 +40,7 @@ echo -n "Configuring merchant instance ..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
"http://localhost:9966/management/instances" \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_reserve_creation.sh b/src/testing/test_merchant_reserve_creation.sh
index e0e7b722..a1a076a4 100755
--- a/src/testing/test_merchant_reserve_creation.sh
+++ b/src/testing/test_merchant_reserve_creation.sh
@@ -35,7 +35,7 @@ echo -n "Configuring merchant instance ..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost:18082/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"payto://x-taler-bank/localhost:18082/43"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_transfer_tracking.sh b/src/testing/test_merchant_transfer_tracking.sh
index 2e9957df..6ac079f3 100755
--- a/src/testing/test_merchant_transfer_tracking.sh
+++ b/src/testing/test_merchant_transfer_tracking.sh
@@ -78,7 +78,7 @@ GNUNET_PAYTO=$(get_payto_uri gnunet x)
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$TOR_PAYTO"'"},{"payto_uri":"'"$GNUNET_PAYTO"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$TOR_PAYTO"'"},{"payto_uri":"'"$GNUNET_PAYTO"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
@@ -95,7 +95,7 @@ TUTORIAL_PAYTO=$(get_payto_uri tutorial x)
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$SURVEY_PAYTO"'"},{"payto_uri":"'"$TUTORIAL_PAYTO"'"}],"id":"test","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$SURVEY_PAYTO"'"},{"payto_uri":"'"$TUTORIAL_PAYTO"'"}],"id":"test","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_wirewatch.sh b/src/testing/test_merchant_wirewatch.sh
index 2a6e5879..7834c1d0 100755
--- a/src/testing/test_merchant_wirewatch.sh
+++ b/src/testing/test_merchant_wirewatch.sh
@@ -165,7 +165,7 @@ GNUNET_PAYTO=$(get_payto_uri gnunet x)
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$GNUNET_PAYTO"'","credit_facade_url":"'"${FACADE_URL}"'","credit_facade_credentials":{"type":"basic","username":"'"$FACADE_USERNAME"'","password":"'"$FACADE_PASSWORD"'"}}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$GNUNET_PAYTO"'","credit_facade_url":"'"${FACADE_URL}"'","credit_facade_credentials":{"type":"basic","username":"'"$FACADE_USERNAME"'","password":"'"$FACADE_PASSWORD"'"}}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/testing_api_cmd_get_instance.c b/src/testing/testing_api_cmd_get_instance.c
index 1df08348..e706f85b 100644
--- a/src/testing/testing_api_cmd_get_instance.c
+++ b/src/testing/testing_api_cmd_get_instance.c
@@ -237,59 +237,16 @@ get_instance_cb (void *cls,
}
}
{
- const struct TALER_Amount *default_max_wire_fee;
+ const bool *use_stefan;
if (GNUNET_OK !=
- TALER_TESTING_get_trait_max_wire_fee (instance_cmd,
- &default_max_wire_fee))
+ TALER_TESTING_get_trait_use_stefan (instance_cmd,
+ &use_stefan))
TALER_TESTING_interpreter_fail (gis->is);
- if ((GNUNET_OK !=
- TALER_amount_cmp_currency (
- &details->default_max_wire_fee,
- default_max_wire_fee)) ||
- (0 != TALER_amount_cmp (&details->default_max_wire_fee,
- default_max_wire_fee)))
+ if (*use_stefan != details->use_stefan)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Instance default max wire fee does not match\n");
- TALER_TESTING_interpreter_fail (gis->is);
- return;
- }
- }
- {
- const uint32_t *default_wire_fee_amortization;
-
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_wire_fee_amortization (
- instance_cmd,
- &default_wire_fee_amortization))
- TALER_TESTING_interpreter_fail (gis->is);
- if (details->default_wire_fee_amortization !=
- *default_wire_fee_amortization)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Instance default wire fee amortization does not match\n");
- TALER_TESTING_interpreter_fail (gis->is);
- return;
- }
- }
- {
- const struct TALER_Amount *default_max_deposit_fee;
-
- if (GNUNET_OK !=
- TALER_TESTING_get_trait_max_deposit_fee (instance_cmd,
- &default_max_deposit_fee))
- TALER_TESTING_interpreter_fail (gis->is);
- if ( (GNUNET_OK !=
- TALER_amount_cmp_currency (
- &details->default_max_deposit_fee,
- default_max_deposit_fee)) ||
- (0 != TALER_amount_cmp (&details->default_max_deposit_fee,
- default_max_deposit_fee)) )
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Instance default max deposit fee %s does not match\n",
- TALER_amount2s (&details->default_max_deposit_fee));
+ "Instance use_stefan value does not match\n");
TALER_TESTING_interpreter_fail (gis->is);
return;
}
diff --git a/src/testing/testing_api_cmd_patch_instance.c b/src/testing/testing_api_cmd_patch_instance.c
index f069046a..59dcac07 100644
--- a/src/testing/testing_api_cmd_patch_instance.c
+++ b/src/testing/testing_api_cmd_patch_instance.c
@@ -80,19 +80,9 @@ struct PatchInstanceState
json_t *jurisdiction;
/**
- * Wire fee to use.
+ * Use STEFAN curve?
*/
- struct TALER_Amount default_max_wire_fee;
-
- /**
- * Amortization to use.
- */
- uint32_t default_wire_fee_amortization;
-
- /**
- * Deposit fee ceiling to use.
- */
- struct TALER_Amount default_max_deposit_fee;
+ bool use_stefan;
/**
* Wire transfer delay to use.
@@ -190,9 +180,7 @@ patch_instance_run (void *cls,
TALER_KYCLOGIC_KYC_UT_BUSINESS,
pis->address,
pis->jurisdiction,
- &pis->default_max_wire_fee,
- pis->default_wire_fee_amortization,
- &pis->default_max_deposit_fee,
+ pis->use_stefan,
pis->default_wire_transfer_delay,
pis->default_pay_delay,
&patch_instance_cb,
@@ -218,7 +206,7 @@ patch_instance_traits (void *cls,
unsigned int index)
{
struct PatchInstanceState *pis = cls;
- #define NUM_TRAITS (pis->payto_uris_length) + 11
+ #define NUM_TRAITS (pis->payto_uris_length) + 9
struct TALER_TESTING_Trait traits[NUM_TRAITS];
traits[0] =
TALER_TESTING_make_trait_instance_name (pis->name);
@@ -229,17 +217,12 @@ patch_instance_traits (void *cls,
traits[3] =
TALER_TESTING_make_trait_jurisdiction (pis->jurisdiction);
traits[4] =
- TALER_TESTING_make_trait_max_wire_fee (&pis->default_max_wire_fee);
+ TALER_TESTING_make_trait_use_stefan (&pis->use_stefan);
traits[5] =
- TALER_TESTING_make_trait_wire_fee_amortization (
- &pis->default_wire_fee_amortization);
- traits[6] =
- TALER_TESTING_make_trait_max_deposit_fee (&pis->default_max_deposit_fee);
- traits[7] =
TALER_TESTING_make_trait_wire_delay (&pis->default_wire_transfer_delay);
- traits[8] =
+ traits[6] =
TALER_TESTING_make_trait_pay_delay (&pis->default_pay_delay);
- traits[9] =
+ traits[7] =
TALER_TESTING_make_trait_payto_length (&pis->payto_uris_length);
traits[NUM_TRAITS - 1] =
TALER_TESTING_trait_end ();
@@ -293,9 +276,7 @@ TALER_TESTING_cmd_merchant_patch_instance (
const char *name,
json_t *address,
json_t *jurisdiction,
- const char *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const char *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
unsigned int http_status)
@@ -315,13 +296,7 @@ TALER_TESTING_cmd_merchant_patch_instance (
pis->name = name;
pis->address = address; /* ownership transfer! */
pis->jurisdiction = jurisdiction; /* ownership transfer! */
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (default_max_wire_fee,
- &pis->default_max_wire_fee));
- pis->default_wire_fee_amortization = default_wire_fee_amortization;
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (default_max_deposit_fee,
- &pis->default_max_deposit_fee));
+ pis->use_stefan = use_stefan;
pis->default_wire_transfer_delay = default_wire_transfer_delay;
pis->default_pay_delay = default_pay_delay;
{
diff --git a/src/testing/testing_api_cmd_post_instances.c b/src/testing/testing_api_cmd_post_instances.c
index e8c3dd3f..f90aacaf 100644
--- a/src/testing/testing_api_cmd_post_instances.c
+++ b/src/testing/testing_api_cmd_post_instances.c
@@ -85,19 +85,9 @@ struct PostInstancesState
const char *auth_token;
/**
- * Wire fee to use.
+ * Use STEFAN curves?
*/
- struct TALER_Amount default_max_wire_fee;
-
- /**
- * Amortization to use.
- */
- uint32_t default_wire_fee_amortization;
-
- /**
- * Deposit fee ceiling to use.
- */
- struct TALER_Amount default_max_deposit_fee;
+ bool use_stefan;
/**
* Wire transfer delay to use.
@@ -197,9 +187,7 @@ post_instances_run (void *cls,
TALER_KYCLOGIC_KYC_UT_BUSINESS,
pis->address,
pis->jurisdiction,
- &pis->default_max_wire_fee,
- pis->default_wire_fee_amortization,
- &pis->default_max_deposit_fee,
+ pis->use_stefan,
pis->default_wire_transfer_delay,
pis->default_pay_delay,
pis->auth_token,
@@ -231,7 +219,7 @@ post_instances_traits (void *cls,
unsigned int index)
{
struct PostInstancesState *pis = cls;
- #define NUM_TRAITS (pis->payto_uris_length) + 11
+ #define NUM_TRAITS (pis->payto_uris_length) + 9
struct TALER_TESTING_Trait traits[NUM_TRAITS];
traits[0] =
TALER_TESTING_make_trait_instance_name (pis->name);
@@ -242,17 +230,12 @@ post_instances_traits (void *cls,
traits[3] =
TALER_TESTING_make_trait_jurisdiction (pis->jurisdiction);
traits[4] =
- TALER_TESTING_make_trait_max_wire_fee (&pis->default_max_wire_fee);
+ TALER_TESTING_make_trait_use_stefan (&pis->use_stefan);
traits[5] =
- TALER_TESTING_make_trait_wire_fee_amortization (
- &pis->default_wire_fee_amortization);
- traits[6] =
- TALER_TESTING_make_trait_max_deposit_fee (&pis->default_max_deposit_fee);
- traits[7] =
TALER_TESTING_make_trait_wire_delay (&pis->default_wire_transfer_delay);
- traits[8] =
+ traits[6] =
TALER_TESTING_make_trait_pay_delay (&pis->default_pay_delay);
- traits[9] =
+ traits[7] =
TALER_TESTING_make_trait_payto_length (&pis->payto_uris_length);
traits[NUM_TRAITS - 1] =
TALER_TESTING_trait_end ();
@@ -306,9 +289,7 @@ TALER_TESTING_cmd_merchant_post_instances2 (
const char *name,
json_t *address,
json_t *jurisdiction,
- const char *default_max_wire_fee,
- uint32_t default_wire_fee_amortization,
- const char *default_max_deposit_fee,
+ bool use_stefan,
struct GNUNET_TIME_Relative default_wire_transfer_delay,
struct GNUNET_TIME_Relative default_pay_delay,
const char *auth_token,
@@ -329,13 +310,7 @@ TALER_TESTING_cmd_merchant_post_instances2 (
pis->name = name;
pis->address = address; /* ownership transfer! */
pis->jurisdiction = jurisdiction; /* ownership transfer! */
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (default_max_wire_fee,
- &pis->default_max_wire_fee));
- pis->default_wire_fee_amortization = default_wire_fee_amortization;
- GNUNET_assert (GNUNET_OK ==
- TALER_string_to_amount (default_max_deposit_fee,
- &pis->default_max_deposit_fee));
+ pis->use_stefan = use_stefan;
pis->default_wire_transfer_delay = default_wire_transfer_delay;
pis->default_pay_delay = default_pay_delay;
pis->auth_token = auth_token;
@@ -358,20 +333,11 @@ TALER_TESTING_cmd_merchant_post_instances (const char *label,
const char *merchant_url,
const char *instance_id,
const char *payto_uri,
- const char *currency,
unsigned int http_status)
{
const char *payto_uris[] = {
payto_uri
};
- struct TALER_Amount default_max_fee;
- const char *default_max_fee_s;
-
- GNUNET_assert (GNUNET_OK ==
- TALER_amount_set_zero (currency,
- &default_max_fee));
- default_max_fee.value = 1;
- default_max_fee_s = TALER_amount2s (&default_max_fee);
return TALER_TESTING_cmd_merchant_post_instances2 (
label,
@@ -382,9 +348,7 @@ TALER_TESTING_cmd_merchant_post_instances (const char *label,
instance_id,
json_pack ("{s:s}", "city", "shopcity"),
json_pack ("{s:s}", "city", "lawyercity"),
- default_max_fee_s,
- 10,
- default_max_fee_s,
+ true,
GNUNET_TIME_UNIT_ZERO, /* no wire transfer delay */
GNUNET_TIME_UNIT_MINUTES,
NULL,