diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-05-08 12:57:00 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-05-08 12:57:00 +0200 |
commit | 2dcaffe4510410e568d637c1e251e230e2df41d9 (patch) | |
tree | 142801bc2b10b60ca367da9a2c99ee38ed36684e /src/wire | |
parent | 5e36e520a5a9d1461cf0efaee777238a46f1890b (diff) |
move responsibility of converting to wire subject to reserve_pub into wire plugin
Diffstat (limited to 'src/wire')
-rw-r--r-- | src/wire/plugin_wire_test.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/wire/plugin_wire_test.c b/src/wire/plugin_wire_test.c index 6f0acce4f..de3a6aba6 100644 --- a/src/wire/plugin_wire_test.c +++ b/src/wire/plugin_wire_test.c @@ -818,16 +818,36 @@ bhist_cb (void *cls, { struct TALER_WIRE_HistoryHandle *whh = cls; uint64_t bserial_id = GNUNET_htonll (serial_id); + struct TALER_WIRE_TransferDetails wd; if (MHD_HTTP_OK == http_status) { + wd.amount = details->amount; + wd.execution_date = details->execution_date; + /* NOTE: For a real bank, the subject should include a checksum! */ + if (GNUNET_OK != + GNUNET_STRINGS_string_to_data (details->wire_transfer_subject, + strlen (details->wire_transfer_subject), + &wd.reserve_pub, + sizeof (wd.reserve_pub))) + { + GNUNET_break (0); + /* NOTE: for a "real" bank, we would want to trigger logic to undo the + wire transfer. However, for the "demo" bank, it should currently + be "impossible" to do wire transfers with invalid subjects, and + equally we thus don't need to undo them (and there is no API to do + that nicely either right now). So we don't handle this case for now. */ + return; + } + wd.account_details = details->account_details; + if ( (NULL != whh->hres_cb) && (GNUNET_OK != whh->hres_cb (whh->hres_cb_cls, dir, &bserial_id, sizeof (bserial_id), - details)) ) + &wd)) ) whh->hres_cb = NULL; } else |