summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-helper-auditor-coins.c1
-rw-r--r--src/auditor/taler-helper-auditor-reserves.c1
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c30
-rw-r--r--src/exchange/taler-exchange-httpd_refund.c99
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c2
-rw-r--r--src/exchange/taler-exchange-httpd_withdraw.c4
-rw-r--r--src/include/taler_exchange_service.h4
-rw-r--r--src/include/taler_signatures.h24
-rw-r--r--src/include/taler_testing_lib.h4
-rw-r--r--src/lib/exchange_api_common.c34
-rw-r--r--src/lib/exchange_api_deposit.c4
-rw-r--r--src/lib/exchange_api_handle.c2
-rw-r--r--src/lib/exchange_api_refund.c21
-rw-r--r--src/lib/exchange_api_withdraw2.c2
-rw-r--r--src/testing/test_auditor_api.c1
-rw-r--r--src/testing/test_exchange_api.c5
-rw-r--r--src/testing/test_exchange_api_twisted.c10
-rw-r--r--src/testing/testing_api_cmd_refund.c26
18 files changed, 67 insertions, 207 deletions
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index 9d5e6670..2e32c569 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -1802,7 +1802,6 @@ refund_cb (void *cls,
.coin_pub = *coin_pub,
.merchant = *merchant_pub,
.rtransaction_id = GNUNET_htonll (rtransaction_id),
- .refund_fee = issue->fee_refund
};
TALER_amount_hton (&rr.refund_amount,
diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c
index 8879d495..3460515a 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -550,7 +550,6 @@ handle_reserve_out (void *cls,
}
/* check reserve_sig (first: setup remaining members of wsrd) */
- wsrd.withdraw_fee = issue->fee_withdraw;
TALER_amount_hton (&wsrd.amount_with_fee,
amount_with_fee);
if (GNUNET_OK !=
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 3f895857..65251863 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -90,10 +90,11 @@ reply_deposit_success (struct MHD_Connection *connection,
}
return TALER_MHD_reply_json_pack (connection,
MHD_HTTP_OK,
- "{s:s, s:o, s:o}",
- "status", "DEPOSIT_OK",
- "sig", GNUNET_JSON_from_data_auto (&sig),
- "pub", GNUNET_JSON_from_data_auto (&pub));
+ "{s:o, s:o}",
+ "exchange_sig",
+ GNUNET_JSON_from_data_auto (&sig),
+ "exchange_pub",
+ GNUNET_JSON_from_data_auto (&pub));
}
@@ -312,15 +313,22 @@ TEH_handler_deposit (struct MHD_Connection *connection,
struct GNUNET_HashCode my_h_wire;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_json ("wire", &wire),
- TALER_JSON_spec_amount ("contribution", &deposit.amount_with_fee),
+ TALER_JSON_spec_amount ("contribution",
+ &deposit.amount_with_fee),
GNUNET_JSON_spec_fixed_auto ("denom_pub_hash",
&deposit.coin.denom_pub_hash),
- TALER_JSON_spec_denomination_signature ("ub_sig", &deposit.coin.denom_sig),
- GNUNET_JSON_spec_fixed_auto ("merchant_pub", &deposit.merchant_pub),
- GNUNET_JSON_spec_fixed_auto ("h_contract_terms", &deposit.h_contract_terms),
- GNUNET_JSON_spec_fixed_auto ("h_wire", &deposit.h_wire),
- GNUNET_JSON_spec_fixed_auto ("coin_sig", &deposit.csig),
- GNUNET_JSON_spec_absolute_time ("timestamp", &deposit.timestamp),
+ TALER_JSON_spec_denomination_signature ("ub_sig",
+ &deposit.coin.denom_sig),
+ GNUNET_JSON_spec_fixed_auto ("merchant_pub",
+ &deposit.merchant_pub),
+ GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
+ &deposit.h_contract_terms),
+ GNUNET_JSON_spec_fixed_auto ("h_wire",
+ &deposit.h_wire),
+ GNUNET_JSON_spec_fixed_auto ("coin_sig",
+ &deposit.csig),
+ GNUNET_JSON_spec_absolute_time ("timestamp",
+ &deposit.timestamp),
GNUNET_JSON_spec_absolute_time ("refund_deadline",
&deposit.refund_deadline),
GNUNET_JSON_spec_absolute_time ("wire_transfer_deadline",
diff --git a/src/exchange/taler-exchange-httpd_refund.c b/src/exchange/taler-exchange-httpd_refund.c
index 7c2b149f..a6a2c3d6 100644
--- a/src/exchange/taler-exchange-httpd_refund.c
+++ b/src/exchange/taler-exchange-httpd_refund.c
@@ -73,12 +73,13 @@ reply_refund_success (struct MHD_Connection *connection,
TALER_EC_EXCHANGE_BAD_CONFIGURATION,
"no online signing key");
}
- return TALER_MHD_reply_json_pack (connection,
- MHD_HTTP_OK,
- "{s:s, s:o, s:o}",
- "status", "REFUND_OK",
- "sig", GNUNET_JSON_from_data_auto (&sig),
- "pub", GNUNET_JSON_from_data_auto (&pub));
+ return TALER_MHD_reply_json_pack (
+ connection,
+ MHD_HTTP_OK,
+ "{s:o, s:o, s:o}",
+ "refund_fee", TALER_JSON_from_amount (&refund->refund_fee),
+ "exchange_sig", GNUNET_JSON_from_data_auto (&sig),
+ "exchange_pub", GNUNET_JSON_from_data_auto (&pub));
}
@@ -246,18 +247,15 @@ refund_transaction (void *cls,
}
/* check currency is compatible */
- if ( (GNUNET_YES !=
- TALER_amount_cmp_currency (&refund->details.refund_amount,
- &dep->amount_with_fee)) ||
- (GNUNET_YES !=
- TALER_amount_cmp_currency (&refund->details.refund_fee,
- &dep->deposit_fee)) )
+ if (GNUNET_YES !=
+ TALER_amount_cmp_currency (&refund->details.refund_amount,
+ &dep->amount_with_fee))
{
GNUNET_break_op (0); /* currency mismatch */
TEH_plugin->free_coin_transaction_list (TEH_plugin->cls,
tl);
*mhd_ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_PRECONDITION_FAILED,
+ MHD_HTTP_BAD_REQUEST,
TALER_EC_REFUND_CURRENCY_MISMATCH,
"currencies involved do not match");
return GNUNET_DB_STATUS_HARD_ERROR;
@@ -339,15 +337,14 @@ refund_transaction (void *cls,
* the fee structure, so this is not done here.
*
* @param connection the MHD connection to handle
- * @param refund information about the refund
+ * @param[in,out] refund information about the refund
* @return MHD result code
*/
static MHD_RESULT
verify_and_execute_refund (struct MHD_Connection *connection,
- const struct TALER_EXCHANGEDB_Refund *refund)
+ struct TALER_EXCHANGEDB_Refund *refund)
{
struct GNUNET_HashCode denom_hash;
- struct TALER_Amount expect_fee;
{
struct TALER_RefundRequestPS rr = {
@@ -361,8 +358,6 @@ verify_and_execute_refund (struct MHD_Connection *connection,
TALER_amount_hton (&rr.refund_amount,
&refund->details.refund_amount);
- TALER_amount_hton (&rr.refund_fee,
- &refund->details.refund_fee);
if (GNUNET_OK !=
GNUNET_CRYPTO_eddsa_verify (TALER_SIGNATURE_MERCHANT_REFUND,
&rr,
@@ -429,43 +424,12 @@ verify_and_execute_refund (struct MHD_Connection *connection,
ec,
"denomination not found, but coin known");
}
- TALER_amount_ntoh (&expect_fee,
+ TALER_amount_ntoh (&refund->details.refund_fee,
&dki->issue.properties.fee_refund);
}
TEH_KS_release (key_state);
}
- /* Check refund fee matches fee of denomination key! */
- if (GNUNET_YES !=
- TALER_amount_cmp_currency (&expect_fee,
- &refund->details.refund_fee) )
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_REFUND_FEE_CURRENCY_MISMATCH,
- "refund_fee");
- }
- {
- int fee_cmp;
-
- fee_cmp = TALER_amount_cmp (&refund->details.refund_fee,
- &expect_fee);
- if (-1 == fee_cmp)
- {
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_REFUND_FEE_TOO_LOW,
- "refund_fee");
- }
- if (1 == fee_cmp)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Refund fee proposed by merchant is higher than necessary.\n");
- }
- }
-
-
/* Finally run the actual transaction logic */
{
MHD_RESULT mhd_ret;
@@ -502,16 +466,20 @@ TEH_handler_refund (struct MHD_Connection *connection,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
const json_t *root)
{
- struct TALER_EXCHANGEDB_Refund refund;
+ struct TALER_EXCHANGEDB_Refund refund = {
+ .details.refund_fee.currency = {0} /* set to invalid, just to be sure */
+ };
struct GNUNET_JSON_Specification spec[] = {
- TALER_JSON_spec_amount ("refund_amount", &refund.details.refund_amount),
- TALER_JSON_spec_amount ("refund_fee", &refund.details.refund_fee),
+ TALER_JSON_spec_amount ("refund_amount",
+ &refund.details.refund_amount),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
&refund.details.h_contract_terms),
- GNUNET_JSON_spec_fixed_auto ("merchant_pub", &refund.details.merchant_pub),
+ GNUNET_JSON_spec_fixed_auto ("merchant_pub",
+ &refund.details.merchant_pub),
GNUNET_JSON_spec_uint64 ("rtransaction_id",
&refund.details.rtransaction_id),
- GNUNET_JSON_spec_fixed_auto ("merchant_sig", &refund.details.merchant_sig),
+ GNUNET_JSON_spec_fixed_auto ("merchant_sig",
+ &refund.details.merchant_sig),
GNUNET_JSON_spec_end ()
};
@@ -527,27 +495,6 @@ TEH_handler_refund (struct MHD_Connection *connection,
if (GNUNET_NO == res)
return MHD_YES; /* failure */
}
- if (GNUNET_YES !=
- TALER_amount_cmp_currency (&refund.details.refund_amount,
- &refund.details.refund_fee) )
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_REFUND_FEE_CURRENCY_MISMATCH,
- "refund_amount or refund_fee");
- }
- if (-1 == TALER_amount_cmp (&refund.details.refund_amount,
- &refund.details.refund_fee) )
- {
- GNUNET_break_op (0);
- GNUNET_JSON_parse_free (spec);
- return TALER_MHD_reply_with_error (connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_REFUND_FEE_ABOVE_AMOUNT,
- "refund_amount");
- }
{
MHD_RESULT res;
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 06673afc..7924ad54 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -185,8 +185,6 @@ TEH_RESPONSE_compile_transaction_history (
TALER_amount_hton (&rr.refund_amount,
&refund->refund_amount);
- TALER_amount_hton (&rr.refund_fee,
- &refund->refund_fee);
#if ENABLE_SANITY_CHECKS
/* internal sanity check before we hand out a bogus sig... */
if (GNUNET_OK !=
diff --git a/src/exchange/taler-exchange-httpd_withdraw.c b/src/exchange/taler-exchange-httpd_withdraw.c
index 4d662e71..c4c72d6a 100644
--- a/src/exchange/taler-exchange-httpd_withdraw.c
+++ b/src/exchange/taler-exchange-httpd_withdraw.c
@@ -306,8 +306,6 @@ withdraw_transaction (void *cls,
#endif
wc->collectable.denom_pub_hash = wc->denom_pub_hash;
wc->collectable.amount_with_fee = wc->amount_required;
- TALER_amount_ntoh (&wc->collectable.withdraw_fee,
- &wc->dki->issue.properties.fee_withdraw);
wc->collectable.reserve_pub = wc->wsrd.reserve_pub;
wc->collectable.h_coin_envelope = wc->wsrd.h_coin_envelope;
wc->collectable.reserve_sig = wc->signature;
@@ -436,8 +434,6 @@ TEH_handler_withdraw (const struct TEH_RequestHandler *rh,
}
TALER_amount_hton (&wc.wsrd.amount_with_fee,
&wc.amount_required);
- TALER_amount_hton (&wc.wsrd.withdraw_fee,
- &fee_withdraw);
}
/* verify signature! */
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index f7fa7144..a57a2655 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -878,7 +878,6 @@ typedef void
* @param amount the amount to be refunded; must be larger than the refund fee
* (as that fee is still being subtracted), and smaller than the amount
* (with deposit fee) of the original deposit contribution of this coin
- * @param refund_fee fee applicable to this coin for the refund
* @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded
* @param coin_pub coin’s public key of the coin from the original deposit operation
* @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation);
@@ -894,7 +893,6 @@ typedef void
struct TALER_EXCHANGE_RefundHandle *
TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
- const struct TALER_Amount *refund_fee,
const struct GNUNET_HashCode *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t rtransaction_id,
@@ -922,7 +920,6 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
* @param amount the amount to be refunded; must be larger than the refund fee
* (as that fee is still being subtracted), and smaller than the amount
* (with deposit fee) of the original deposit contribution of this coin
- * @param refund_fee fee applicable to this coin for the refund
* @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded
* @param coin_pub coin’s public key of the coin from the original deposit operation
* @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation);
@@ -939,7 +936,6 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
struct TALER_EXCHANGE_RefundHandle *
TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
- const struct TALER_Amount *refund_fee,
const struct GNUNET_HashCode *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t rtransaction_id,
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index f55f0c2e..c346a6ce 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -317,19 +317,6 @@ struct TALER_WithdrawRequestPS
struct TALER_AmountNBO amount_with_fee;
/**
- * Withdrawal fee charged by the exchange. This must match the Exchange's
- * denomination key's withdrawal fee. If the client puts in an
- * invalid withdrawal fee (too high or too low) that does not match
- * the Exchange's denomination key, the withdraw operation is invalid
- * and will be rejected by the exchange. The @e amount_with_fee minus
- * the @e withdraw_fee is must match the value of the generated
- * coin. We include this in what is being signed so that we can
- * verify a exchange's accounting without needing to access the
- * respective denomination key information each time.
- */
- struct TALER_AmountNBO withdraw_fee;
-
- /**
* Hash of the denomination public key for the coin that is withdrawn.
*/
struct GNUNET_HashCode h_denomination_pub GNUNET_PACKED;
@@ -517,17 +504,6 @@ struct TALER_RefundRequestPS
*/
struct TALER_AmountNBO refund_amount;
- /**
- * Refund fee charged by the exchange. This must match the
- * Exchange's denomination key's refund fee. If the client puts in
- * an invalid refund fee (too high or too low) that does not match
- * the Exchange's denomination key, the refund operation is invalid
- * and will be rejected by the exchange. The @e amount_with_fee
- * minus the @e refund_fee is the amount that will be credited to
- * the original coin.
- */
- struct TALER_AmountNBO refund_fee;
-
};
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index 0696573e..9abb0cca 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -1670,7 +1670,6 @@ TALER_TESTING_cmd_check_bank_empty (const char *label);
* @param label command label.
* @param expected_response_code expected HTTP status code.
* @param refund_amount the amount to ask a refund for.
- * @param refund_fee expected refund fee.
* @param coin_reference reference to a command that can
* provide a coin to be refunded.
* @param refund_transaction_id transaction id to use
@@ -1682,7 +1681,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_refund_with_id (const char *label,
unsigned int expected_response_code,
const char *refund_amount,
- const char *refund_fee,
const char *deposit_reference,
uint64_t refund_transaction_id);
@@ -1693,7 +1691,6 @@ TALER_TESTING_cmd_refund_with_id (const char *label,
* @param label command label.
* @param expected_response_code expected HTTP status code.
* @param refund_amount the amount to ask a refund for.
- * @param refund_fee expected refund fee.
* @param coin_reference reference to a command that can
* provide a coin to be refunded.
*
@@ -1703,7 +1700,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_refund (const char *label,
unsigned int expected_response_code,
const char *refund_amount,
- const char *refund_fee,
const char *deposit_reference);
diff --git a/src/lib/exchange_api_common.c b/src/lib/exchange_api_common.c
index 07f5e187..dc44291d 100644
--- a/src/lib/exchange_api_common.c
+++ b/src/lib/exchange_api_common.c
@@ -146,11 +146,12 @@ TALER_EXCHANGE_parse_reserve_history (
{
struct TALER_ReserveSignatureP sig;
struct TALER_WithdrawRequestPS withdraw_purpose;
+ struct TALER_Amount withdraw_fee;
struct GNUNET_JSON_Specification withdraw_spec[] = {
GNUNET_JSON_spec_fixed_auto ("reserve_sig",
&sig),
- TALER_JSON_spec_amount_nbo ("withdraw_fee",
- &withdraw_purpose.withdraw_fee),
+ TALER_JSON_spec_amount ("withdraw_fee",
+ &withdraw_fee),
GNUNET_JSON_spec_fixed_auto ("h_denom_pub",
&withdraw_purpose.h_denomination_pub),
GNUNET_JSON_spec_fixed_auto ("h_coin_envelope",
@@ -189,26 +190,23 @@ TALER_EXCHANGE_parse_reserve_history (
{
const struct TALER_EXCHANGE_Keys *key_state;
const struct TALER_EXCHANGE_DenomPublicKey *dki;
- struct TALER_Amount fee;
key_state = TALER_EXCHANGE_get_keys (exchange);
dki = TALER_EXCHANGE_get_denomination_key_by_hash (key_state,
&withdraw_purpose.
h_denomination_pub);
- TALER_amount_ntoh (&fee,
- &withdraw_purpose.withdraw_fee);
if ( (GNUNET_YES !=
- TALER_amount_cmp_currency (&fee,
+ TALER_amount_cmp_currency (&withdraw_fee,
&dki->fee_withdraw)) ||
(0 !=
- TALER_amount_cmp (&fee,
+ TALER_amount_cmp (&withdraw_fee,
&dki->fee_withdraw)) )
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (withdraw_spec);
return GNUNET_SYSERR;
}
- rh->details.withdraw.fee = fee;
+ rh->details.withdraw.fee = withdraw_fee;
}
rh->details.withdraw.out_authorization_sig
= json_object_get (transaction,
@@ -634,9 +632,16 @@ TALER_EXCHANGE_verify_coin_history (
else if (0 == strcasecmp (type,
"REFUND"))
{
- struct TALER_RefundRequestPS rr;
struct TALER_MerchantSignatureP sig;
+ struct TALER_Amount refund_fee;
+ struct TALER_RefundRequestPS rr = {
+ .purpose.size = htonl (sizeof (rr)),
+ .purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND),
+ .coin_pub = *coin_pub
+ };
struct GNUNET_JSON_Specification spec[] = {
+ TALER_JSON_spec_amount ("refund_fee",
+ &refund_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_sig",
&sig),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
@@ -645,8 +650,6 @@ TALER_EXCHANGE_verify_coin_history (
&rr.merchant),
GNUNET_JSON_spec_uint64 ("rtransaction_id",
&rr.rtransaction_id),
- TALER_JSON_spec_amount_nbo ("refund_fee",
- &rr.refund_fee),
GNUNET_JSON_spec_end ()
};
@@ -658,9 +661,6 @@ TALER_EXCHANGE_verify_coin_history (
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- rr.purpose.size = htonl (sizeof (rr));
- rr.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND);
- rr.coin_pub = *coin_pub;
TALER_amount_hton (&rr.refund_amount,
&amount);
if (GNUNET_OK !=
@@ -683,13 +683,11 @@ TALER_EXCHANGE_verify_coin_history (
/* check that refund fee matches our expectations from /keys! */
if (NULL != dk)
{
- TALER_amount_ntoh (&fee,
- &rr.refund_fee);
if ( (GNUNET_YES !=
- TALER_amount_cmp_currency (&fee,
+ TALER_amount_cmp_currency (&refund_fee,
&dk->fee_refund)) ||
(0 !=
- TALER_amount_cmp (&fee,
+ TALER_amount_cmp (&refund_fee,
&dk->fee_refund)) )
{
GNUNET_break_op (0);
diff --git a/src/lib/exchange_api_deposit.c b/src/lib/exchange_api_deposit.c
index 5f374993..a5cf6c36 100644
--- a/src/lib/exchange_api_deposit.c
+++ b/src/lib/exchange_api_deposit.c
@@ -196,8 +196,8 @@ verify_deposit_signature_ok (struct TALER_EXCHANGE_DepositHandle *dh,
{
const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("sig", exchange_sig),
- GNUNET_JSON_spec_fixed_auto ("pub", exchange_pub),
+ GNUNET_JSON_spec_fixed_auto ("exchange_sig", exchange_sig),
+ GNUNET_JSON_spec_fixed_auto ("exchange_pub", exchange_pub),
GNUNET_JSON_spec_end ()
};
diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c
index c3ae1663..c9c1b09b 100644
--- a/src/lib/exchange_api_handle.c
+++ b/src/lib/exchange_api_handle.c
@@ -39,7 +39,7 @@
* Which version of the Taler protocol is implemented
* by this library? Used to determine compatibility.
*/
-#define EXCHANGE_PROTOCOL_CURRENT 7
+#define EXCHANGE_PROTOCOL_CURRENT 8
/**
* How many versions are we backwards compatible with?
diff --git a/src/lib/exchange_api_refund.c b/src/lib/exchange_api_refund.c
index c64dcc97..9cb8794d 100644
--- a/src/lib/exchange_api_refund.c
+++ b/src/lib/exchange_api_refund.c
@@ -81,14 +81,14 @@ struct TALER_EXCHANGE_RefundHandle
* Verify that the signature on the "200 OK" response
* from the exchange is valid.
*
- * @param rh refund handle
+ * @param[in,out] rh refund handle (refund fee added)
* @param json json reply with the signature
* @param[out] exchange_pub set to the exchange's public key
* @param[out] exchange_sig set to the exchange's signature
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
*/
static int
-verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh,
+verify_refund_signature_ok (struct TALER_EXCHANGE_RefundHandle *rh,
const json_t *json,
struct TALER_ExchangePublicKeyP *exchange_pub,
struct TALER_ExchangeSignatureP *exchange_sig)
@@ -96,8 +96,9 @@ verify_refund_signature_ok (const struct TALER_EXCHANGE_RefundHandle *rh,
{
const struct TALER_EXCHANGE_Keys *key_state;
struct GNUNET_JSON_Specification spec[] = {
- GNUNET_JSON_spec_fixed_auto ("sig", exchange_sig),
- GNUNET_JSON_spec_fixed_auto ("pub", exchange_pub),
+ GNUNET_JSON_spec_fixed_auto ("exchange_sig", exchange_sig),
+ GNUNET_JSON_spec_fixed_auto ("exchange_pub", exchange_pub),
+ TALER_JSON_spec_amount_nbo ("refund_fee", &rh->depconf.refund_fee),
GNUNET_JSON_spec_end ()
};
@@ -256,7 +257,6 @@ handle_refund_finished (void *cls,
* @param amount the amount to be refunded; must be larger than the refund fee
* (as that fee is still being subtracted), and smaller than the amount
* (with deposit fee) of the original deposit contribution of this coin
- * @param refund_fee fee applicable to this coin for the refund
* @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded
* @param coin_pub coin’s public key of the coin from the original deposit operation
* @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation);
@@ -272,7 +272,6 @@ handle_refund_finished (void *cls,
struct TALER_EXCHANGE_RefundHandle *
TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
- const struct TALER_Amount *refund_fee,
const struct GNUNET_HashCode *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t rtransaction_id,
@@ -294,14 +293,11 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
rr.rtransaction_id = GNUNET_htonll (rtransaction_id);
TALER_amount_hton (&rr.refund_amount,
amount);
- TALER_amount_hton (&rr.refund_fee,
- refund_fee);
GNUNET_CRYPTO_eddsa_sign (&merchant_priv->eddsa_priv,
&rr,
&merchant_sig.eddsa_sig);
return TALER_EXCHANGE_refund2 (exchange,
amount,
- refund_fee,
h_contract_terms,
coin_pub,
rtransaction_id,
@@ -329,7 +325,6 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
* @param amount the amount to be refunded; must be larger than the refund fee
* (as that fee is still being subtracted), and smaller than the amount
* (with deposit fee) of the original deposit contribution of this coin
- * @param refund_fee fee applicable to this coin for the refund
* @param h_contract_terms hash of the contact of the merchant with the customer that is being refunded
* @param coin_pub coin’s public key of the coin from the original deposit operation
* @param rtransaction_id transaction id for the transaction between merchant and customer (of refunding operation);
@@ -346,7 +341,6 @@ TALER_EXCHANGE_refund (struct TALER_EXCHANGE_Handle *exchange,
struct TALER_EXCHANGE_RefundHandle *
TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
const struct TALER_Amount *amount,
- const struct TALER_Amount *refund_fee,
const struct GNUNET_HashCode *h_contract_terms,
const struct TALER_CoinSpendPublicKeyP *coin_pub,
uint64_t rtransaction_id,
@@ -376,12 +370,11 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
"/coins/%s/refund",
pub_str);
}
- refund_obj = json_pack ("{s:o, s:o," /* amount/fee */
+ refund_obj = json_pack ("{s:o," /* amount */
" s:o," /* h_contract_terms */
" s:I," /* rtransaction id */
" s:o, s:o}", /* merchant_pub, merchant_sig */
"refund_amount", TALER_JSON_from_amount (amount),
- "refund_fee", TALER_JSON_from_amount (refund_fee),
"h_contract_terms", GNUNET_JSON_from_data_auto (
h_contract_terms),
"rtransaction_id", (json_int_t) rtransaction_id,
@@ -410,8 +403,6 @@ TALER_EXCHANGE_refund2 (struct TALER_EXCHANGE_Handle *exchange,
rh->depconf.rtransaction_id = GNUNET_htonll (rtransaction_id);
TALER_amount_hton (&rh->depconf.refund_amount,
amount);
- TALER_amount_hton (&rh->depconf.refund_fee,
- refund_fee);
eh = TALER_EXCHANGE_curl_easy_get_ (rh->url);
if ( (NULL == eh) ||
diff --git a/src/lib/exchange_api_withdraw2.c b/src/lib/exchange_api_withdraw2.c
index f9468927..25f66914 100644
--- a/src/lib/exchange_api_withdraw2.c
+++ b/src/lib/exchange_api_withdraw2.c
@@ -429,8 +429,6 @@ TALER_EXCHANGE_withdraw2 (
TALER_amount_hton (&req.amount_with_fee,
&wh->requested_amount);
- TALER_amount_hton (&req.withdraw_fee,
- &dk->fee_withdraw);
GNUNET_CRYPTO_hash (pd->coin_ev,
pd->coin_ev_size,
&req.h_coin_envelope);
diff --git a/src/testing/test_auditor_api.c b/src/testing/test_auditor_api.c
index 7b699626..0ff28b29 100644
--- a/src/testing/test_auditor_api.c
+++ b/src/testing/test_auditor_api.c
@@ -353,7 +353,6 @@ run (void *cls,
TALER_TESTING_cmd_refund ("refund-ok",
MHD_HTTP_OK,
"EUR:5",
- "EUR:0.01",
"deposit-refund-1"),
/**
* Spend 4.99 EUR of the refunded 4.99 EUR coin (1ct gone
diff --git a/src/testing/test_exchange_api.c b/src/testing/test_exchange_api.c
index 0c3f4837..a2bf9001 100644
--- a/src/testing/test_exchange_api.c
+++ b/src/testing/test_exchange_api.c
@@ -528,18 +528,15 @@ run (void *cls,
TALER_TESTING_cmd_refund ("refund-ok",
MHD_HTTP_OK,
"EUR:5",
- "EUR:0.01",
"deposit-refund-1"),
TALER_TESTING_cmd_refund ("refund-ok-double",
MHD_HTTP_OK,
"EUR:5",
- "EUR:0.01",
"deposit-refund-1"),
/* Previous /refund(s) had id == 0. */
TALER_TESTING_cmd_refund_with_id ("refund-conflicting",
MHD_HTTP_CONFLICT,
"EUR:5",
- "EUR:0.01",
"deposit-refund-1",
1),
/**
@@ -573,7 +570,6 @@ run (void *cls,
TALER_TESTING_cmd_refund ("refund-fail",
MHD_HTTP_GONE,
"EUR:4.99",
- "EUR:0.01",
"deposit-refund-2"),
TALER_TESTING_cmd_check_bank_empty ("check-empty-after-refund"),
/**
@@ -607,7 +603,6 @@ run (void *cls,
TALER_TESTING_cmd_refund ("refund-ok-fast",
MHD_HTTP_OK,
"EUR:5",
- "EUR:0.01",
"deposit-refund-1b"),
/**
* Run transfers. This will do the transfer as refund deadline
diff --git a/src/testing/test_exchange_api_twisted.c b/src/testing/test_exchange_api_twisted.c
index 9aac3d1e..05337219 100644
--- a/src/testing/test_exchange_api_twisted.c
+++ b/src/testing/test_exchange_api_twisted.c
@@ -173,12 +173,6 @@ run (void *cls,
TALER_TESTING_cmd_refund ("refund-currency-mismatch",
MHD_HTTP_BAD_REQUEST,
"USD:5",
- "USD:0.01",
- "deposit-refund-1"),
- TALER_TESTING_cmd_refund ("refund-fee-above-amount",
- MHD_HTTP_BAD_REQUEST,
- "EUR:5",
- "EUR:10",
"deposit-refund-1"),
TALER_TESTING_cmd_flip_upload ("flip-upload",
CONFIG_FILE,
@@ -186,7 +180,6 @@ run (void *cls,
TALER_TESTING_cmd_refund ("refund-bad-sig",
MHD_HTTP_FORBIDDEN,
"EUR:5",
- "EUR:0.01",
"deposit-refund-1"),
/* This next deposit CMD is only used to provide a
@@ -207,17 +200,14 @@ run (void *cls,
TALER_TESTING_cmd_refund ("refund-deposit-not-found",
MHD_HTTP_NOT_FOUND,
"EUR:5",
- "EUR:0.01",
"deposit-refund-to-fail"),
TALER_TESTING_cmd_refund ("refund-insufficient-funds",
MHD_HTTP_PRECONDITION_FAILED,
"EUR:50",
- "EUR:0.01",
"deposit-refund-1"),
TALER_TESTING_cmd_refund ("refund-fee-too-low",
MHD_HTTP_BAD_REQUEST,
"EUR:5",
- "EUR:0.000001",
"deposit-refund-1"),
TALER_TESTING_cmd_end ()
};
diff --git a/src/testing/testing_api_cmd_refund.c b/src/testing/testing_api_cmd_refund.c
index 47f5a060..c27311fb 100644
--- a/src/testing/testing_api_cmd_refund.c
+++ b/src/testing/testing_api_cmd_refund.c
@@ -44,11 +44,6 @@ struct RefundState
const char *refund_amount;
/**
- * Expected refund fee.
- */
- const char *refund_fee;
-
- /**
* Reference to any command that can provide a coin to refund.
*/
const char *coin_reference;
@@ -133,7 +128,6 @@ refund_run (void *cls,
struct TALER_CoinSpendPublicKeyP coin;
const json_t *contract_terms;
struct GNUNET_HashCode h_contract_terms;
- struct TALER_Amount refund_fee;
struct TALER_Amount refund_amount;
const struct TALER_MerchantPrivateKeyP *merchant_priv;
const struct TALER_TESTING_Command *coin_cmd;
@@ -153,19 +147,6 @@ refund_run (void *cls,
TALER_TESTING_interpreter_fail (is);
return;
}
- if (GNUNET_OK !=
- TALER_string_to_amount (rs->refund_fee,
- &refund_fee))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to parse amount `%s' at %u/%s\n",
- rs->refund_fee,
- is->ip,
- cmd->label);
- TALER_TESTING_interpreter_fail (is);
- return;
- }
-
coin_cmd = TALER_TESTING_interpreter_lookup_command (is,
rs->coin_reference);
if (NULL == coin_cmd)
@@ -211,7 +192,6 @@ refund_run (void *cls,
}
rs->rh = TALER_EXCHANGE_refund (rs->exchange,
&refund_amount,
- &refund_fee,
&h_contract_terms,
&coin,
rs->refund_transaction_id,
@@ -254,7 +234,6 @@ refund_cleanup (void *cls,
* @param label command label.
* @param expected_response_code expected HTTP status code.
* @param refund_amount the amount to ask a refund for.
- * @param refund_fee expected refund fee.
* @param coin_reference reference to a command that can
* provide a coin to be refunded.
*
@@ -264,7 +243,6 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_refund (const char *label,
unsigned int expected_response_code,
const char *refund_amount,
- const char *refund_fee,
const char *coin_reference)
{
struct RefundState *rs;
@@ -273,7 +251,6 @@ TALER_TESTING_cmd_refund (const char *label,
rs->expected_response_code = expected_response_code;
rs->refund_amount = refund_amount;
- rs->refund_fee = refund_fee;
rs->coin_reference = coin_reference;
{
struct TALER_TESTING_Command cmd = {
@@ -295,7 +272,6 @@ TALER_TESTING_cmd_refund (const char *label,
* @param label command label.
* @param expected_response_code expected HTTP status code.
* @param refund_amount the amount to ask a refund for.
- * @param refund_fee expected refund fee.
* @param coin_reference reference to a command that can
* provide a coin to be refunded.
* @param refund_transaction_id transaction id to use
@@ -308,7 +284,6 @@ TALER_TESTING_cmd_refund_with_id
(const char *label,
unsigned int expected_response_code,
const char *refund_amount,
- const char *refund_fee,
const char *coin_reference,
uint64_t refund_transaction_id)
{
@@ -317,7 +292,6 @@ TALER_TESTING_cmd_refund_with_id
rs = GNUNET_new (struct RefundState);
rs->expected_response_code = expected_response_code;
rs->refund_amount = refund_amount;
- rs->refund_fee = refund_fee;
rs->coin_reference = coin_reference;
rs->refund_transaction_id = refund_transaction_id;
{