summaryrefslogtreecommitdiff
path: root/src/exchange
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-26 16:38:59 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-26 16:38:59 +0200
commitc0451f0982bdb565f431417cea3ab0238342d125 (patch)
tree4a27b418a74acd0fa5d6bb789818ced43c4832d5 /src/exchange
parent3f468773e71b68e9ceb5431e797941b1cc086e68 (diff)
downloadexchange-c0451f0982bdb565f431417cea3ab0238342d125.tar.gz
exchange-c0451f0982bdb565f431417cea3ab0238342d125.tar.bz2
exchange-c0451f0982bdb565f431417cea3ab0238342d125.zip
fix #4533 for exchange (breaks interaction with bank for /admin/add/incoming)
Diffstat (limited to 'src/exchange')
-rw-r--r--src/exchange/taler-exchange-httpd_admin.c13
-rw-r--r--src/exchange/taler-exchange-httpd_db.c13
-rw-r--r--src/exchange/taler-exchange-httpd_db.h6
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c2
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c5
-rw-r--r--src/exchange/test_taler_exchange_aggregator.c12
6 files changed, 30 insertions, 21 deletions
diff --git a/src/exchange/taler-exchange-httpd_admin.c b/src/exchange/taler-exchange-httpd_admin.c
index 6b28e9cc1..618a76583 100644
--- a/src/exchange/taler-exchange-httpd_admin.c
+++ b/src/exchange/taler-exchange-httpd_admin.c
@@ -114,13 +114,15 @@ TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh,
struct TALER_ReservePublicKeyP reserve_pub;
struct TALER_Amount amount;
struct GNUNET_TIME_Absolute at;
- json_t *wire;
+ json_t *sender_account_details;
+ json_t *transfer_details;
json_t *root;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_fixed_auto ("reserve_pub", &reserve_pub),
TALER_JSON_spec_amount ("amount", &amount),
GNUNET_JSON_spec_absolute_time ("execution_date", &at),
- GNUNET_JSON_spec_json ("wire", &wire),
+ GNUNET_JSON_spec_json ("sender_account_details", &sender_account_details),
+ GNUNET_JSON_spec_json ("transfer_details", &transfer_details),
GNUNET_JSON_spec_end ()
};
int res;
@@ -148,19 +150,20 @@ TMH_ADMIN_handler_admin_add_incoming (struct TMH_RequestHandler *rh,
return (GNUNET_SYSERR == res) ? MHD_NO : MHD_YES;
}
if (GNUNET_YES !=
- TMH_json_validate_wireformat (wire,
+ TMH_json_validate_wireformat (sender_account_details,
GNUNET_NO))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return TMH_RESPONSE_reply_arg_unknown (connection,
- "wire");
+ "sender_account_details");
}
res = TMH_DB_execute_admin_add_incoming (connection,
&reserve_pub,
&amount,
at,
- wire);
+ sender_account_details,
+ transfer_details);
GNUNET_JSON_parse_free (spec);
return res;
}
diff --git a/src/exchange/taler-exchange-httpd_db.c b/src/exchange/taler-exchange-httpd_db.c
index 7e3ce0a44..43de27e9c 100644
--- a/src/exchange/taler-exchange-httpd_db.c
+++ b/src/exchange/taler-exchange-httpd_db.c
@@ -1253,7 +1253,7 @@ check_commitment (struct MHD_Connection *connection,
struct GNUNET_HashCode h_msg;
char *buf;
size_t buf_len;
-
+
TALER_refresh_decrypt (&commit_coins[j].refresh_link,
&shared_secret,
&link_data);
@@ -1275,7 +1275,7 @@ check_commitment (struct MHD_Connection *connection,
"Blinding error"))
? GNUNET_NO : GNUNET_SYSERR;
}
-
+
if ( (buf_len != commit_coins[j].coin_ev_size) ||
(0 != memcmp (buf,
commit_coins[j].coin_ev,
@@ -1690,7 +1690,8 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection,
* @param reserve_pub public key of the reserve
* @param amount amount to add to the reserve
* @param execution_time when did we receive the wire transfer
- * @param wire details about the wire transfer
+ * @param sender_account_details which account send the funds
+ * @param transfer_details information that uniquely identifies the transfer
* @return MHD result code
*/
int
@@ -1698,7 +1699,8 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute execution_time,
- json_t *wire)
+ const json_t *sender_account_details,
+ const json_t *transfer_details)
{
struct TALER_EXCHANGEDB_Session *session;
int ret;
@@ -1713,7 +1715,8 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection,
reserve_pub,
amount,
execution_time,
- wire);
+ sender_account_details,
+ transfer_details);
if (GNUNET_SYSERR == ret)
{
GNUNET_break (0);
diff --git a/src/exchange/taler-exchange-httpd_db.h b/src/exchange/taler-exchange-httpd_db.h
index c0fd110b6..e22d39d81 100644
--- a/src/exchange/taler-exchange-httpd_db.h
+++ b/src/exchange/taler-exchange-httpd_db.h
@@ -191,7 +191,8 @@ TMH_DB_execute_refresh_link (struct MHD_Connection *connection,
* @param reserve_pub public key of the reserve
* @param amount amount to add to the reserve
* @param execution_time when did we receive the wire transfer
- * @param wire details about the wire transfer
+ * @param sender_account_details which account send the funds
+ * @param transfer_details information that uniquely identifies the transfer
* @return MHD result code
*/
int
@@ -199,7 +200,8 @@ TMH_DB_execute_admin_add_incoming (struct MHD_Connection *connection,
const struct TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *amount,
struct GNUNET_TIME_Absolute execution_time,
- json_t *wire);
+ const json_t *sender_account_details,
+ const json_t *transfer_details);
/**
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index c59f9a6ae..3515a4549 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -228,7 +228,7 @@ TMH_DEPOSIT_handler_deposit (struct TMH_RequestHandler *rh,
TALER_amount_ntoh (&deposit.deposit_fee,
&dki->issue.properties.fee_deposit);
TMH_KS_release (ks);
- deposit.wire = wire;
+ deposit.receiver_wire_account = wire;
deposit.amount_with_fee = amount;
if (-1 == TALER_amount_cmp (&deposit.amount_with_fee,
&deposit.deposit_fee))
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 91b54b0b2..aec2ac27b 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -602,9 +602,10 @@ compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHistory *rh,
}
ret = 1;
json_array_append_new (json_history,
- json_pack ("{s:s, s:O, s:o}",
+ json_pack ("{s:s, s:O, s:O, s:o}",
"type", "DEPOSIT",
- "wire", pos->details.bank->wire,
+ "sender_account_details", pos->details.bank->sender_account_details,
+ "transfer_details", pos->details.bank->transfer_details,
"amount", TALER_JSON_from_amount (&pos->details.bank->amount)));
break;
case TALER_EXCHANGEDB_RO_WITHDRAW_COIN:
diff --git a/src/exchange/test_taler_exchange_aggregator.c b/src/exchange/test_taler_exchange_aggregator.c
index c9756dad4..7802c8230 100644
--- a/src/exchange/test_taler_exchange_aggregator.c
+++ b/src/exchange/test_taler_exchange_aggregator.c
@@ -432,12 +432,12 @@ do_deposit (struct Command *cmd)
}
fake_coin (&deposit.coin);
/* Build JSON for wire details */
- deposit.wire = json_pack ("{s:s, s:s, s:I}",
- "type", "test",
- "bank_uri", "http://localhost:8082/",
- "account_number", (json_int_t) cmd->details.deposit.merchant_account);
+ deposit.receiver_wire_account = json_pack ("{s:s, s:s, s:I}",
+ "type", "test",
+ "bank_uri", "http://localhost:8082/",
+ "account_number", (json_int_t) cmd->details.deposit.merchant_account);
GNUNET_assert (GNUNET_OK ==
- TALER_JSON_hash (deposit.wire,
+ TALER_JSON_hash (deposit.receiver_wire_account,
&deposit.h_wire));
deposit.transaction_id = cmd->details.deposit.transaction_id;
deposit.timestamp = GNUNET_TIME_absolute_get ();
@@ -458,7 +458,7 @@ do_deposit (struct Command *cmd)
else
ret = GNUNET_OK;
GNUNET_CRYPTO_rsa_signature_free (deposit.coin.denom_sig.rsa_signature);
- json_decref (deposit.wire);
+ json_decref (deposit.receiver_wire_account);
return ret;
}