aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/Makefile.am2
-rw-r--r--src/include/taler_auditordb_plugin.h18
-rw-r--r--src/include/taler_bank_service.h313
-rw-r--r--src/include/taler_exchangedb_lib.h9
-rw-r--r--src/include/taler_exchangedb_plugin.h18
-rw-r--r--src/include/taler_fakebank_lib.h25
-rw-r--r--src/include/taler_mhd_lib.h2
-rw-r--r--src/include/taler_testing_bank_lib.h44
-rw-r--r--src/include/taler_testing_lib.h159
-rw-r--r--src/include/taler_wire_lib.h59
-rw-r--r--src/include/taler_wire_plugin.h259
11 files changed, 439 insertions, 469 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index af91f1178..25bc67b25 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -31,8 +31,6 @@ talerinclude_HEADERS = \
taler_mhd_lib.h \
taler_pq_lib.h \
taler_signatures.h \
- taler_wire_lib.h \
- taler_wire_plugin.h \
taler_testing_bank_lib.h
endif
diff --git a/src/include/taler_auditordb_plugin.h b/src/include/taler_auditordb_plugin.h
index 03a1c6d47..14d477d30 100644
--- a/src/include/taler_auditordb_plugin.h
+++ b/src/include/taler_auditordb_plugin.h
@@ -870,7 +870,6 @@ struct TALER_AUDITORDB_Plugin
* @param pp where is the auditor in processing
* @param in_wire_off how far are we in the incoming wire transaction history
* @param out_wire_off how far are we in the outgoing wire transaction history
- * @param wire_off_size how many bytes do @a in_wire_off and @a out_wire_off take?
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -883,9 +882,8 @@ struct TALER_AUDITORDB_Plugin
const struct
TALER_AUDITORDB_WireAccountProgressPoint
*pp,
- const void *in_wire_off,
- const void *out_wire_off,
- size_t wire_off_size);
+ uint64_t in_wire_off,
+ uint64_t out_wire_off);
/**
@@ -899,7 +897,6 @@ struct TALER_AUDITORDB_Plugin
* @param pp where is the auditor in processing
* @param in_wire_off how far are we in the incoming wire transaction history
* @param out_wire_off how far are we in the outgoing wire transaction history
- * @param wire_off_size how many bytes do @a in_wire_off and @a out_wire_off take?
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -912,9 +909,8 @@ struct TALER_AUDITORDB_Plugin
const struct
TALER_AUDITORDB_WireAccountProgressPoint
*pp,
- const void *in_wire_off,
- const void *out_wire_off,
- size_t wire_off_size);
+ uint64_t in_wire_off,
+ uint64_t out_wire_off);
/**
@@ -927,7 +923,6 @@ struct TALER_AUDITORDB_Plugin
* @param[out] pp where is the auditor in processing
* @param[out] in_wire_off how far are we in the incoming wire transaction history
* @param[out] out_wire_off how far are we in the outgoing wire transaction history
- * @param[out] wire_off_size how many bytes do @a in_wire_off and @a out_wire_off take?
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -939,9 +934,8 @@ struct TALER_AUDITORDB_Plugin
struct
TALER_AUDITORDB_WireAccountProgressPoint
*pp,
- void **in_wire_off,
- void **out_wire_off,
- size_t *wire_off_size);
+ uint64_t *in_wire_off,
+ uint64_t *out_wire_off);
/**
diff --git a/src/include/taler_bank_service.h b/src/include/taler_bank_service.h
index a7246ad2d..a2eec49aa 100644
--- a/src/include/taler_bank_service.h
+++ b/src/include/taler_bank_service.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015, 2016, 2017 Taler Systems SA
+ Copyright (C) 2015-2020 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
@@ -25,6 +25,7 @@
#include <jansson.h>
#include <gnunet/gnunet_curl_lib.h>
#include "taler_util.h"
+#include "taler_wire_lib.h"
#include "taler_error_codes.h"
@@ -122,13 +123,11 @@ typedef void
* to the operators of the bank.
*
* @param ctx curl context for the event loop
- * @param bank_base_url URL of the bank (used to execute this request)
+ * @param account_base_url URL of the account (used to execute this request)
* @param auth authentication data to use
- * @param exchange_base_url base URL of the exchange (for tracking)
- * @param subject wire transfer subject for the transfer
+ * @param reserve_pub wire transfer subject for the transfer
* @param amount amount that was deposited
- * @param debit_account_no account number to withdraw from (53 bits at most)
- * @param credit_account_no account number to deposit into (53 bits at most)
+ * @param credit_account account to deposit into
* @param res_cb the callback to call when the final result for this request is available
* @param res_cb_cls closure for the above callback
* @return NULL
@@ -137,13 +136,12 @@ typedef void
*/
struct TALER_BANK_AdminAddIncomingHandle *
TALER_BANK_admin_add_incoming (struct GNUNET_CURL_Context *ctx,
- const char *bank_base_url,
+ const char *account_base_url,
const struct TALER_BANK_AuthenticationData *auth,
- const char *exchange_base_url,
- const char *subject,
+ const struct
+ TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *amount,
- uint64_t debit_account_no,
- uint64_t credit_account_no,
+ const char *credit_account,
TALER_BANK_AdminAddIncomingResultCallback res_cb,
void *res_cb_cls);
@@ -159,53 +157,103 @@ TALER_BANK_admin_add_incoming_cancel (struct
TALER_BANK_AdminAddIncomingHandle *aai);
+/* ********************* /taler/transfer *********************** */
+
/**
- * Which types of transactions should be (or is being) returned?
+ * Prepare for exeuction of a wire transfer.
+ *
+ * @param destination_account_url payto:// URL identifying where to send the money
+ * @param amount amount to transfer, already rounded
+ * @param exchange_base_url base URL of this exchange (included in subject
+ * to facilitate use of tracking API by merchant backend)
+ * @param wtid wire transfer identifier to use
+ * @param buf[out] set to transaction data to persist, NULL on error
+ * @param buf_size[out] set to number of bytes in @a buf, 0 on error
*/
-enum TALER_BANK_Direction
-{
+void
+TALER_BANK_prepare_wire_transfer (const char *destination_account_url,
+ const struct TALER_Amount *amount,
+ const char *exchange_base_url,
+ const struct
+ TALER_WireTransferIdentifierRawP *wtid,
+ void **buf,
+ size_t *buf_size);
- /**
- * Base case, used to indicate errors or end of list.
- */
- TALER_BANK_DIRECTION_NONE = 0,
- /**
- * Transactions where the bank account receives money.
- */
- TALER_BANK_DIRECTION_CREDIT = 1,
+/**
+ * Handle for active wire transfer.
+ */
+struct TALER_BANK_WireExecuteHandle;
- /**
- * Transactions where the bank account looses money.
- */
- TALER_BANK_DIRECTION_DEBIT = 2,
- /**
- * Return both types of transactions.
- */
- TALER_BANK_DIRECTION_BOTH = (TALER_BANK_DIRECTION_CREDIT
- | TALER_BANK_DIRECTION_DEBIT),
+/**
+ * Function called with the result from the execute step.
+ *
+ * @param cls closure
+ * @param response_code HTTP status code
+ * @param ec taler error code
+ * @param row_id unique ID of the wire transfer in the bank's records
+ * @param timestamp when did the transaction go into effect
+ */
+typedef void
+(*TALER_BANK_ConfirmationCallback)(void *cls,
+ unsigned int response_code,
+ enum TALER_ErrorCode ec,
+ uint64_t row_id,
+ struct GNUNET_TIME_Absolute timestamp);
- /**
- * Bit mask that is applied to view transactions that have been
- * cancelled. The bit is set for cancelled transactions that are
- * returned from /history, and must also be set in order for
- * cancelled transactions to show up in the /history.
- */
- TALER_BANK_DIRECTION_CANCEL = 4
-};
+/**
+
+ * Execute a wire transfer.
+ *
+ * @param ctx context for HTTP interaction
+ * @param bank_base_url URL of the base INCLUDING account number
+ * @param buf buffer with the prepared execution details
+ * @param buf_size number of bytes in @a buf
+ * @param cc function to call upon success
+ * @param cc_cls closure for @a cc
+ * @return NULL on error
+ */
+struct TALER_BANK_WireExecuteHandle *
+TALER_BANK_execute_wire_transfer (struct GNUNET_CURL_Context *ctx,
+ const char *bank_base_url,
+ const struct
+ TALER_BANK_AuthenticationData *auth,
+ const void *buf,
+ size_t buf_size,
+ TALER_BANK_ConfirmationCallback cc,
+ void *cc_cls);
/**
- * Handle for querying the bank's transaction history.
+ * Abort execution of a wire transfer. For example, because we are
+ * shutting down. Note that if an execution is aborted, it may or
+ * may not still succeed. The caller MUST run @e
+ * execute_wire_transfer again for the same request as soon as
+ * possilbe, to ensure that the request either ultimately succeeds
+ * or ultimately fails. Until this has been done, the transaction is
+ * in limbo (i.e. may or may not have been committed).
+ *
+ * @param eh execution to cancel
*/
-struct TALER_BANK_HistoryHandle;
+void
+TALER_BANK_execute_wire_transfer_cancel (struct
+ TALER_BANK_WireExecuteHandle *eh);
+
+
+/* ********************* /taler/credits *********************** */
/**
- * Details about a wire transfer.
+ * Handle for querying the bank for transactions
+ * made to the exchange.
*/
-struct TALER_BANK_TransferDetails
+struct TALER_BANK_CreditHistoryHandle;
+
+/**
+ * Details about a wire transfer to the exchange.
+ */
+struct TALER_BANK_CreditDetails
{
/**
* Amount that was transferred
@@ -218,21 +266,22 @@ struct TALER_BANK_TransferDetails
struct GNUNET_TIME_Absolute execution_date;
/**
- * Wire transfer subject. Usually a reserve public key
- * followed by the base URL of the exchange.
+ * Reserve public key encoded in the wire
+ * transfer subject.
*/
- char *wire_transfer_subject;
+ struct TALER_ReservePublicKeyP reserve_pub;
/**
- * payto://-URL of the other account that was involved
+ * payto://-URL of the source account that
+ * send the funds.
*/
- char *account_url;
+ const char *account_url;
};
/**
* Callbacks of this type are used to serve the result of asking
- * the bank for the transaction history.
+ * the bank for the credit transaction history.
*
* @param cls closure
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
@@ -241,31 +290,27 @@ struct TALER_BANK_TransferDetails
* last callback is always of this status (even if `abs(num_results)` were
* already returned).
* @param ec detailed error code
- * @param dir direction of the transfer
* @param serial_id monotonically increasing counter corresponding to the transaction
* @param details details about the wire transfer
* @param json detailed response from the HTTPD, or NULL if reply was not in JSON
+ * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
*/
-typedef void
-(*TALER_BANK_HistoryResultCallback) (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec,
- enum TALER_BANK_Direction dir,
- uint64_t serial_id,
- const struct
- TALER_BANK_TransferDetails *details,
- const json_t *json);
+typedef int
+(*TALER_BANK_CreditResultCallback) (void *cls,
+ unsigned int http_status,
+ enum TALER_ErrorCode ec,
+ uint64_t serial_id,
+ const struct
+ TALER_BANK_CreditDetails *details,
+ const json_t *json);
/**
- * Request the wire transfer history of a bank account.
+ * Request the wire credit history of an exchange's bank account.
*
* @param ctx curl context for the event loop
- * @param bank_base_url URL of the bank (used to execute this request)
+ * @param account_base_url URL of the base INCLUDING account number
* @param auth authentication data to use
- * @param account_number which account number should we query
- * @param direction what kinds of wire transfers should be returned
- * @param ascending if GNUNET_YES, history elements will be returned in chronological order.
* @param start_row from which row on do we want to get results, use UINT64_MAX for the latest; exclusive
* @param num_results how many results do we want; negative numbers to go into the past,
* positive numbers to go into the future starting at @a start_row;
@@ -276,17 +321,14 @@ typedef void
* if the inputs are invalid (i.e. zero value for @e num_results).
* In this case, the callback is not called.
*/
-struct TALER_BANK_HistoryHandle *
-TALER_BANK_history (struct GNUNET_CURL_Context *ctx,
- const char *bank_base_url,
- const struct TALER_BANK_AuthenticationData *auth,
- uint64_t account_number,
- enum TALER_BANK_Direction direction,
- unsigned int ascending,
- uint64_t start_row,
- int64_t num_results,
- TALER_BANK_HistoryResultCallback hres_cb,
- void *hres_cb_cls);
+struct TALER_BANK_CreditHistoryHandle *
+TALER_BANK_credit_history (struct GNUNET_CURL_Context *ctx,
+ const char *account_base_url,
+ const struct TALER_BANK_AuthenticationData *auth,
+ uint64_t start_row,
+ int64_t num_results,
+ TALER_BANK_CreditResultCallback hres_cb,
+ void *hres_cb_cls);
/**
@@ -297,64 +339,127 @@ TALER_BANK_history (struct GNUNET_CURL_Context *ctx,
* @param hh the history request handle
*/
void
-TALER_BANK_history_cancel (struct TALER_BANK_HistoryHandle *hh);
+TALER_BANK_credit_history_cancel (struct TALER_BANK_CreditHistoryHandle *hh);
+
+/* ********************* /taler/debits *********************** */
/**
- * Handle for #TALER_BANK_reject() operation.
+ * Handle for querying the bank for transactions
+ * made from the exchange to merchants.
*/
-struct TALER_BANK_RejectHandle;
+struct TALER_BANK_DebitHistoryHandle;
+
+/**
+ * Details about a wire transfer made by the exchange
+ * to a merchant.
+ */
+struct TALER_BANK_DebitDetails
+{
+ /**
+ * Amount that was transferred
+ */
+ struct TALER_Amount amount;
+
+ /**
+ * Time of the the transfer
+ */
+ struct GNUNET_TIME_Absolute execution_date;
+
+ /**
+ * Wire transfer identifier used by the exchange.
+ */
+ struct TALER_WireTransferIdentifierRawP wtid;
+
+ /**
+ * Exchange's base URL as given in the wire transfer.
+ */
+ const char *exchange_base_url;
+
+ /**
+ * payto://-URL of the source account that
+ * send the funds.
+ */
+ const char *account_url;
+};
/**
* Callbacks of this type are used to serve the result of asking
- * the bank to reject an incoming wire transfer.
+ * the bank for the debit transaction history.
*
* @param cls closure
- * @param http_status HTTP response code, #MHD_HTTP_NO_CONTENT (204) for successful status request;
- * #MHD_HTTP_NOT_FOUND if the rowid is unknown;
+ * @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful status request
* 0 if the bank's reply is bogus (fails to follow the protocol),
+ * #MHD_HTTP_NO_CONTENT if there are no more results; on success the
+ * last callback is always of this status (even if `abs(num_results)` were
+ * already returned).
* @param ec detailed error code
+ * @param serial_id monotonically increasing counter corresponding to the transaction
+ * @param details details about the wire transfer
+ * @param json detailed response from the HTTPD, or NULL if reply was not in JSON
+ * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
*/
-typedef void
-(*TALER_BANK_RejectResultCallback) (void *cls,
- unsigned int http_status,
- enum TALER_ErrorCode ec);
+typedef int
+(*TALER_BANK_DebitResultCallback) (void *cls,
+ unsigned int http_status,
+ enum TALER_ErrorCode ec,
+ uint64_t serial_id,
+ const struct
+ TALER_BANK_DebitDetails *details,
+ const json_t *json);
/**
- * Request rejection of a wire transfer, marking it as cancelled and voiding
- * its effects.
+ * Request the wire credit history of an exchange's bank account.
*
* @param ctx curl context for the event loop
- * @param bank_base_url URL of the bank (used to execute this request)
+ * @param bank_base_url URL of the base INCLUDING account number
* @param auth authentication data to use
* @param account_number which account number should we query
- * @param rowid transfer to reject
- * @param rcb the callback to call with the operation result
- * @param rcb_cls closure for @a rcb
+ * @param start_row from which row on do we want to get results, use UINT64_MAX for the latest; exclusive
+ * @param num_results how many results do we want; negative numbers to go into the past,
+ * positive numbers to go into the future starting at @a start_row;
+ * must not be zero.
+ * @param hres_cb the callback to call with the transaction history
+ * @param hres_cb_cls closure for the above callback
* @return NULL
- * if the inputs are invalid.
+ * if the inputs are invalid (i.e. zero value for @e num_results).
* In this case, the callback is not called.
*/
-struct TALER_BANK_RejectHandle *
-TALER_BANK_reject (struct GNUNET_CURL_Context *ctx,
- const char *bank_base_url,
- const struct TALER_BANK_AuthenticationData *auth,
- uint64_t account_number,
- uint64_t rowid,
- TALER_BANK_RejectResultCallback rcb,
- void *rcb_cls);
+struct TALER_BANK_DebitHistoryHandle *
+TALER_BANK_debit_history (struct GNUNET_CURL_Context *ctx,
+ const char *bank_base_url,
+ const struct TALER_BANK_AuthenticationData *auth,
+ uint64_t start_row,
+ int64_t num_results,
+ TALER_BANK_DebitResultCallback hres_cb,
+ void *hres_cb_cls);
/**
- * Cancel an reject request. This function cannot be used on a request
- * handle if the response was is already served for it.
+ * Cancel an history request. This function cannot be used on a request
+ * handle if the last response (anything with a status code other than
+ * 200) is already served for it.
*
- * @param rh the reject request handle
+ * @param hh the history request handle
*/
void
-TALER_BANK_reject_cancel (struct TALER_BANK_RejectHandle *rh);
+TALER_BANK_debit_history_cancel (struct TALER_BANK_DebitHistoryHandle *hh);
+
+
+/**
+ * Convenience method for parsing configuration section with bank account data.
+ *
+ * @param cfg configuration to parse
+ * @param section the section with the configuration data
+ * @param acc[out] set to the account details
+ * @return #GNUNET_OK on success
+ */
+int
+TALER_BANK_account_parse_cfg (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ const char *section,
+ struct TALER_Account *acc);
/**
diff --git a/src/include/taler_exchangedb_lib.h b/src/include/taler_exchangedb_lib.h
index e63640628..1681c45aa 100644
--- a/src/include/taler_exchangedb_lib.h
+++ b/src/include/taler_exchangedb_lib.h
@@ -425,12 +425,12 @@ TALER_EXCHANGEDB_fees_read (const struct GNUNET_CONFIGURATION_Handle *cfg,
/**
* Convert @a af to @a wf.
*
- * @param wireplugin name of the wire plugin the fees are for
+ * @param wiremethod name of the wire method the fees are for
* @param[in,out] af aggregate fees, host format (updated to round time)
* @param[out] wf aggregate fees, disk / signature format
*/
void
-TALER_EXCHANGEDB_fees_2_wf (const char *wireplugin,
+TALER_EXCHANGEDB_fees_2_wf (const char *wiremethod,
struct TALER_EXCHANGEDB_AggregateFees *af,
struct TALER_MasterWireFeePS *wf);
@@ -470,10 +470,9 @@ struct TALER_EXCHANGEDB_AccountInfo
const char *section_name;
/**
- * Name of the wire plugin that should be used to access
- * the account.
+ * Name of the wire method used by this account.
*/
- const char *plugin_name;
+ const char *method;
/**
* payto://-URL of the account.
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 0dcf4b841..09e3b1800 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -960,8 +960,7 @@ typedef int
* @param reserve_pub public key of the reserve (also the WTID)
* @param credit amount that was received
* @param sender_account_details information about the sender's bank account, in payto://-format
- * @param wire_reference unique identifier for the wire transfer (plugin-specific format)
- * @param wire_reference_size number of bytes in @a wire_reference
+ * @param wire_reference unique identifier for the wire transfer
* @param execution_date when did we receive the funds
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
@@ -972,8 +971,7 @@ typedef int
TALER_ReservePublicKeyP *reserve_pub,
const struct TALER_Amount *credit,
const char *sender_account_details,
- const void *wire_reference,
- size_t wire_reference_size,
+ uint64_t wire_reference,
struct GNUNET_TIME_Absolute
execution_date);
@@ -1500,8 +1498,7 @@ struct TALER_EXCHANGEDB_Plugin
* @param balance the amount that has to be added to the reserve
* @param execution_time when was the amount added
* @param sender_account_details information about the sender's bank account, in payto://-format
- * @param wire_reference unique reference identifying the wire transfer (binary blob)
- * @param wire_reference_size number of bytes in @a wire_reference
+ * @param wire_reference unique reference identifying the wire transfer
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
@@ -1512,8 +1509,7 @@ struct TALER_EXCHANGEDB_Plugin
struct GNUNET_TIME_Absolute execution_time,
const char *sender_account_details,
const char *exchange_account_name,
- const void *wire_reference,
- size_t wire_reference_size);
+ uint64_t wire_reference);
/**
@@ -1521,16 +1517,14 @@ struct TALER_EXCHANGEDB_Plugin
*
* @param cls the @e cls of this struct with the plugin-specific state
* @param db the database connection handle
- * @param[out] wire_reference set to unique reference identifying the wire transfer (binary blob)
- * @param[out] wire_reference_size set to number of bytes in @a wire_reference
+ * @param[out] wire_ref set to unique reference identifying the wire transfer
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
(*get_latest_reserve_in_reference)(void *cls,
struct TALER_EXCHANGEDB_Session *db,
const char *exchange_account_name,
- void **wire_reference,
- size_t *wire_reference_size);
+ uint64_t *wire_ref);
/**
diff --git a/src/include/taler_fakebank_lib.h b/src/include/taler_fakebank_lib.h
index f3f92534d..474c6627d 100644
--- a/src/include/taler_fakebank_lib.h
+++ b/src/include/taler_fakebank_lib.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2016 Inria and GNUnet e.V.
+ (C) 2016-2020 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
@@ -74,8 +74,8 @@ TALER_FAKEBANK_check_empty (struct TALER_FAKEBANK_Handle *h);
*/
uint64_t
TALER_FAKEBANK_make_transfer (struct TALER_FAKEBANK_Handle *h,
- uint64_t debit_account,
- uint64_t credit_account,
+ const char *debit_account,
+ const char *credit_account,
const struct TALER_Amount *amount,
const char *subject,
const char *exchange_base_url);
@@ -101,28 +101,13 @@ TALER_FAKEBANK_make_transfer (struct TALER_FAKEBANK_Handle *h,
int
TALER_FAKEBANK_check (struct TALER_FAKEBANK_Handle *h,
const struct TALER_Amount *want_amount,
- uint64_t want_debit,
- uint64_t want_credit,
+ const char *want_debit,
+ const char *want_credit,
const char *exchange_base_url,
char **subject);
/**
- * Reject incoming wire transfer to account @a credit_account
- * as identified by @a rowid.
- *
- * @param h fake bank handle
- * @param rowid identifies transfer to reject
- * @param credit_account account number of owner of credited account
- * @return #GNUNET_YES on success, #GNUNET_NO if the wire transfer was not found
- */
-int
-TALER_FAKEBANK_reject_transfer (struct TALER_FAKEBANK_Handle *h,
- uint64_t rowid,
- uint64_t credit_account);
-
-
-/**
* Stop running the fake bank.
*
* @param h bank to stop
diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h
index 6aefbd778..c836e4469 100644
--- a/src/include/taler_mhd_lib.h
+++ b/src/include/taler_mhd_lib.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014 GNUnet e.V.
+ Copyright (C) 2014-2020 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free Software
diff --git a/src/include/taler_testing_bank_lib.h b/src/include/taler_testing_bank_lib.h
index 350aca3b7..43d12d336 100644
--- a/src/include/taler_testing_bank_lib.h
+++ b/src/include/taler_testing_bank_lib.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2018 Taler Systems SA
+ (C) 2018-2020 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
@@ -103,46 +103,42 @@ TALER_TESTING_has_in_name (const char *prog,
/* ************** Specific interpreter commands ************ */
/**
- * Make a "history" CMD.
+ * Make a credit "history" CMD.
*
* @param label command label.
- * @param bank_url base URL of the bank offering the "history"
+ * @param account_url base URL of the account offering the "history"
* operation.
- * @param account_no bank account number to ask the history for.
- * @param direction which direction this operation is interested
- * @param ascending if #GNUNET_YES, it ask the bank to return results
- * in chronological order.
* @param start_row_reference reference to a command that can
* offer a row identifier, to be used as the starting row
* to accept in the result.
- * @param num_results how many rows we want in the result.
+ * @param num_results how many rows we want in the result,
+ * and ascending/descending call
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_bank_history (const char *label,
- const char *bank_url,
- uint64_t account_no,
- enum TALER_BANK_Direction direction,
- unsigned int ascending,
+TALER_TESTING_cmd_bank_credits (const char *label,
+ const char *account_url,
const char *start_row_reference,
- unsigned long long num_results);
+ long long num_results);
/**
- * Create a "reject" CMD.
+ * Make a debit "history" CMD.
*
* @param label command label.
- * @param bank_url base URL of the bank implementing the
- * "reject" operation.
- * @param deposit_reference reference to a command that will
- * provide a "row id" and credit (bank) account to craft
- * the "reject" request.
- *
+ * @param account_url base URL of the account offering the "history"
+ * operation.
+ * @param start_row_reference reference to a command that can
+ * offer a row identifier, to be used as the starting row
+ * to accept in the result.
+ * @param num_results how many rows we want in the result.
* @return the command.
*/
struct TALER_TESTING_Command
-TALER_TESTING_cmd_bank_reject (const char *label,
- const char *bank_url,
- const char *deposit_reference);
+TALER_TESTING_cmd_bank_debits (const char *label,
+ const char *account_url,
+ const char *start_row_reference,
+ long long num_results);
+
#endif
diff --git a/src/include/taler_testing_lib.h b/src/include/taler_testing_lib.h
index a039f0ec6..33f070701 100644
--- a/src/include/taler_testing_lib.h
+++ b/src/include/taler_testing_lib.h
@@ -48,23 +48,24 @@
} while (0)
+#define TALER_TESTING_GET_TRAIT_ROW_ID(cmd,out) \
+ TALER_TESTING_get_trait_uint64 (cmd, 3, out)
+
+#define TALER_TESTING_MAKE_TRAIT_ROW_ID(data) \
+ TALER_TESTING_make_trait_uint64 (3, data)
+
+
#define TALER_TESTING_GET_TRAIT_CREDIT_ACCOUNT(cmd,out) \
- TALER_TESTING_get_trait_uint64 (cmd, 0, out)
+ TALER_TESTING_get_trait_string (cmd, 4, out)
#define TALER_TESTING_MAKE_TRAIT_CREDIT_ACCOUNT(data) \
- TALER_TESTING_make_trait_uint64 (0, data)
+ TALER_TESTING_make_trait_string (4, data)
#define TALER_TESTING_GET_TRAIT_DEBIT_ACCOUNT(cmd,out) \
- TALER_TESTING_get_trait_uint64 (cmd, 1, out)
+ TALER_TESTING_get_trait_string (cmd, 5, out)
#define TALER_TESTING_MAKE_TRAIT_DEBIT_ACCOUNT(data) \
- TALER_TESTING_make_trait_uint64 (1, data)
-
-#define TALER_TESTING_GET_TRAIT_ROW_ID(cmd,out) \
- TALER_TESTING_get_trait_uint64 (cmd, 3, out)
-
-#define TALER_TESTING_MAKE_TRAIT_ROW_ID(data) \
- TALER_TESTING_make_trait_uint64 (3, data)
+ TALER_TESTING_make_trait_string (5, data)
/**
@@ -715,13 +716,9 @@ TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb,
*
* @param label command label.
* @param amount amount to transfer.
- * @param bank_url base URL of the bank that implements this
- * wire transer. For simplicity, both credit and debit
- * bank account exist at the same bank.
- * @param debit_account_no which account (expressed as a number)
- * gives money.
- * @param credit_account_no which account (expressed as a number)
- * receives money.
+ * @param account_base_url base URL of the account that implements this
+ * wire transer (which account gives money).
+ * @param payto_credit_account which account receives money.
* @param auth_username username identifying the @a
* debit_account_no at the bank.
* @param auth_password password for @a auth_username.
@@ -734,51 +731,14 @@ TALER_TESTING_setup_with_auditor_and_exchange (TALER_TESTING_Main main_cb,
struct TALER_TESTING_Command
TALER_TESTING_cmd_fakebank_transfer (const char *label,
const char *amount,
- const char *bank_url,
- uint64_t debit_account_no,
- uint64_t credit_account_no,
+ const char *account_base_url,
+ const char *payto_credit_account,
const char *auth_username,
const char *auth_password,
const char *exchange_url);
/**
- * Create "fakebank transfer" CMD, letting the caller specifying
- * the subject line.
- *
- * @param label command label.
- * @param amount amount to transfer.
- * @param bank_url base URL of the bank that implements this
- * wire transer. For simplicity, both credit and debit
- * bank account exist at the same bank.
- * @param debit_account_no which account (expressed as a number)
- * gives money.
- * @param credit_account_no which account (expressed as a number)
- * receives money.
- *
- * @param auth_username username identifying the @a
- * debit_account_no at the bank.
- * @param auth_password password for @a auth_username.
- * @param subject wire transfer's subject line.
- * @param exchange_url which exchange is involved in this transfer.
- * This data is used for tracking purposes (FIXME: explain
- * _how_).
- *
- * @return the command.
- */
-struct TALER_TESTING_Command
-TALER_TESTING_cmd_fakebank_transfer_with_subject (const char *label,
- const char *amount,
- const char *bank_url,
- uint64_t debit_account_no,
- uint64_t credit_account_no,
- const char *auth_username,
- const char *auth_password,
- const char *subject,
- const char *exchange_url);
-
-
-/**
* Create "fakebank transfer" CMD, letting the caller specify
* a reference to a command that can offer a reserve private key.
* This private key will then be used to construct the subject line
@@ -786,11 +746,9 @@ TALER_TESTING_cmd_fakebank_transfer_with_subject (const char *label,
*
* @param label command label.
* @param amount the amount to transfer.
- * @param bank_url base URL of the bank running the transfer.
- * @param debit_account_no which account (expressed as a number)
- * gives money.
- * @param credit_account_no which account (expressed as a number)
- * receives money.
+ * @param account_base_url base URL of the account that implements this
+ * wire transer (which account gives money).
+ * @param payto_credit_account which account receives money.
* @param auth_username username identifying the @a
* debit_account_no at the bank.
* @param auth_password password for @a auth_username.
@@ -804,9 +762,9 @@ TALER_TESTING_cmd_fakebank_transfer_with_subject (const char *label,
struct TALER_TESTING_Command
TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label,
const char *amount,
- const char *bank_url,
- uint64_t debit_account_no,
- uint64_t credit_account_no,
+ const char *account_base_url,
+ const char *payto_credit_account,
+
const char *auth_username,
const char *auth_password,
const char *ref,
@@ -822,14 +780,9 @@ TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label,
*
* @param label command label.
* @param amount amount to transfer.
- * @param bank_url base URL of the bank that implements this
- * wire transer. For simplicity, both credit and debit
- * bank account exist at the same bank.
- * @param debit_account_no which account (expressed as a number)
- * gives money.
- * @param credit_account_no which account (expressed as a number)
- * receives money.
- *
+ * @param account_base_url base URL of the account that implements this
+ * wire transer (which account gives money).
+ * @param payto_credit_account which account receives money.
* @param auth_username username identifying the @a
* debit_account_no at the bank.
* @param auth_password password for @a auth_username.
@@ -847,9 +800,9 @@ TALER_TESTING_cmd_fakebank_transfer_with_ref (const char *label,
struct TALER_TESTING_Command
TALER_TESTING_cmd_fakebank_transfer_with_instance (const char *label,
const char *amount,
- const char *bank_url,
- uint64_t debit_account_no,
- uint64_t credit_account_no,
+ const char *account_base_url,
+ const char *
+ payto_credit_account,
const char *auth_username,
const char *auth_password,
const char *instance,
@@ -1268,8 +1221,8 @@ struct TALER_TESTING_Command
TALER_TESTING_cmd_check_bank_transfer (const char *label,
const char *exchange_base_url,
const char *amount,
- uint64_t debit_account,
- uint64_t credit_account);
+ const char *debit_account,
+ const char *credit_account);
/**
@@ -1617,7 +1570,6 @@ TALER_TESTING_get_trait (const struct TALER_TESTING_Trait *traits,
*
* @return the trait.
*/
-
struct TALER_TESTING_Trait
TALER_TESTING_make_trait_reserve_priv (unsigned int index,
const struct
@@ -1641,6 +1593,34 @@ TALER_TESTING_get_trait_reserve_priv (const struct TALER_TESTING_Command *cmd,
/**
+ * Offer a reserve public key.
+ *
+ * @param index reserve pubs's index number.
+ * @param reserve_priv reserve public key to offer.
+ * @return the trait.
+ */
+struct TALER_TESTING_Trait
+TALER_TESTING_make_trait_reserve_pub (unsigned int index,
+ const struct
+ TALER_ReservePublicKeyP *reserve_pub);
+
+
+/**
+ * Obtain a reserve public key from a @a cmd.
+ *
+ * @param cmd command to extract the reserve pub from.
+ * @param index reserve pub's index number.
+ * @param reserve_pub[out] set to the reserve pub.
+ * @return #GNUNET_OK on success.
+ */
+int
+TALER_TESTING_get_trait_reserve_pub (const struct TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const struct
+ TALER_ReservePublicKeyP **reserve_pub);
+
+
+/**
* Make a trait for a exchange signature.
*
* @param index index number to associate to the offered exchange pub.
@@ -2129,34 +2109,34 @@ TALER_TESTING_make_trait_peer_key_pub (unsigned int index,
/**
- * Obtain a transfer subject from @a cmd.
+ * Obtain a string from @a cmd.
*
* @param cmd command to extract the subject from.
* @param index index number associated with the transfer
* subject to offer.
- * @param transfer_subject[out] where to write the offered
- * transfer subject.
+ * @param s[out] where to write the offered
+ * string.
*
* @return #GNUNET_OK on success.
*/
int
-TALER_TESTING_get_trait_transfer_subject (const struct
- TALER_TESTING_Command *cmd,
- unsigned int index,
- const char **transfer_subject);
+TALER_TESTING_get_trait_string (const struct
+ TALER_TESTING_Command *cmd,
+ unsigned int index,
+ const char **s);
/**
- * Offer transfer subject.
+ * Offer string subject.
*
* @param index index number associated with the transfer
* subject being offered.
- * @param transfer_subject transfer subject to offer.
+ * @param s string to offer.
* @return the trait.
*/
struct TALER_TESTING_Trait
-TALER_TESTING_make_trait_transfer_subject (unsigned int index,
- const char *transfer_subject);
+TALER_TESTING_make_trait_string (unsigned int index,
+ const char *s);
/**
@@ -2223,7 +2203,6 @@ TALER_TESTING_get_trait_amount (const struct TALER_TESTING_Command *cmd,
* @param index which url is to be picked,
* in case multiple are offered.
* @param url the url to offer.
- *
* @return the trait.
*/
struct TALER_TESTING_Trait
diff --git a/src/include/taler_wire_lib.h b/src/include/taler_wire_lib.h
index 3c8510919..c7d9f78d8 100644
--- a/src/include/taler_wire_lib.h
+++ b/src/include/taler_wire_lib.h
@@ -22,7 +22,7 @@
#define TALER_WIRE_H
#include <gnunet/gnunet_util_lib.h>
-#include "taler_wire_plugin.h"
+
/**
* Different account types supported by payto://.
@@ -46,6 +46,7 @@ enum TALER_PaytoAccountType
TALER_PAC_IBAN
};
+
/**
* Information about an account extracted from a payto://-URL.
*/
@@ -71,19 +72,15 @@ struct TALER_Account
{
/**
- * Hostname of the bank (possibly including port).
+ * Bank account base URL.
*/
- char *hostname;
+ char *account_base_url;
/**
- * Bank account number.
+ * Only the hostname of the bank.
*/
- unsigned long long no;
+ char *hostname;
- /**
- * Base URL of the bank hosting the account above.
- */
- char *bank_base_url;
} x_taler_bank;
/**
@@ -114,6 +111,18 @@ TALER_WIRE_account_free (struct TALER_Account *acc);
/**
+ * Round the amount to something that can be
+ * transferred on the wire.
+ *
+ * @param[in,out] amount amount to round down
+ * @return #GNUNET_OK on success, #GNUNET_NO if rounding was unnecessary,
+ * #GNUNET_SYSERR if the amount or currency was invalid
+ */
+int
+TALER_WIRE_amount_round (struct TALER_Amount *amount);
+
+
+/**
* Parse @a payto_url and store the result in @a acc
*
* @param payto_url URL to parse
@@ -135,36 +144,4 @@ char *
TALER_WIRE_payto_get_method (const char *payto_url);
-/**
- * Get the plugin name from the payment method.
- *
- * @param method the method implemented by the plugin (for
- * simplicity, we assume 1 method is implemented by 1 plugin).
- * @return the plugin name, NULL if not found.
- */
-const char *
-TALER_WIRE_get_plugin_from_method (const char *method);
-
-
-/**
- * Load a WIRE plugin.
- *
- * @param cfg configuration to use
- * @param plugin_name name of the plugin to load
- * @return #GNUNET_OK on success
- */
-struct TALER_WIRE_Plugin *
-TALER_WIRE_plugin_load (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const char *plugin_name);
-
-
-/**
- * Unload a WIRE plugin.
- *
- * @param plugin the plugin to unload
- */
-void
-TALER_WIRE_plugin_unload (struct TALER_WIRE_Plugin *plugin);
-
-
#endif
diff --git a/src/include/taler_wire_plugin.h b/src/include/taler_wire_plugin.h
index ffc7adf59..b5621e686 100644
--- a/src/include/taler_wire_plugin.h
+++ b/src/include/taler_wire_plugin.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2016, 2017 GNUnet e.V. & Inria
+ Copyright (C) 2016-2020 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
@@ -41,22 +41,9 @@ typedef void
/**
- * Callback to process a merchant registration outcome.
- *
- * @param cls closure
- * @param status GNUNET_OK if the registration succeeded,
- * GNUNET_NO otherwise.
- */
-typedef void
-(*TALER_WIRE_MerchantRegisterCallback) (void *cls,
- unsigned int status);
-
-/**
* Details about a valid wire transfer to the exchange.
- * It is the plugin's responsibility to filter and undo
- * invalid transfers.
*/
-struct TALER_WIRE_TransferDetails
+struct TALER_WIRE_CreditDetails
{
/**
* Amount that was transferred
@@ -69,22 +56,44 @@ struct TALER_WIRE_TransferDetails
struct GNUNET_TIME_Absolute execution_date;
/**
- * Binary data that was encoded in the wire transfer subject, if
- * it decoded properly. Otherwise all-zeros and @e wtid_s is set.
+ * Binary data that was encoded in the wire transfer subject.
*/
- struct TALER_WireTransferIdentifierRawP wtid;
+ struct TALER_ReservePublicKeyP reserve_pub;
+
+ /**
+ * payto://-URL of the source's account (used
+ * when the reserve is closed or for debugging).
+ */
+ const char *source_account_url;
+};
+
+
+/**
+ * Details about a valid wire transfer made by the
+ * exchange's aggregator to a merchant.
+ */
+struct TALER_WIRE_DebitDetails
+{
+ /**
+ * Amount that was transferred
+ */
+ struct TALER_Amount amount;
/**
- * Wire transfer identifer as a string. Set to NULL if the
- * identifier was properly Base32 encoded and this @e wtid could be
- * set instead.
+ * Time of the the transfer
+ */
+ struct GNUNET_TIME_Absolute execution_date;
+
+ /**
+ * Binary data that was encoded in the wire transfer subject.
*/
- char *wtid_s;
+ struct TALER_WireTransferIdentifierRawP wtid;
/**
- * payto://-URL of the other account that was involved
+ * payto://-URL of the target account which received
+ * the funds.
*/
- char *account_url;
+ const char *target_account_url;
};
@@ -96,33 +105,40 @@ struct TALER_WIRE_TransferDetails
*
* @param cls closure
* @param ec taler error code
- * @param dir direction of the transfer, #TALER_BANK_DIRECTION_NONE when
- * the iteration is complete
* @param row_off identification of the position at which we are querying
* @param row_off_size number of bytes in @a row_off
* @param details details about the wire transfer
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
*/
typedef int
-(*TALER_WIRE_HistoryResultCallback) (void *cls,
- enum TALER_ErrorCode ec,
- enum TALER_BANK_Direction dir,
- const void *row_off,
- size_t row_off_size,
- const struct
- TALER_WIRE_TransferDetails *details);
+(*TALER_WIRE_CreditResultCallback) (void *cls,
+ enum TALER_ErrorCode ec,
+ const void *row_off,
+ size_t row_off_size,
+ const struct
+ TALER_WIRE_CreditDetails *details);
/**
* Callbacks of this type are used to serve the result of asking
- * the bank to reject a wire transfer.
+ * the bank for the transaction history. NOTE: this function will
+ * NOT get the list of history elements, but rather get (iteratively)
+ * called for each (parsed) history element.
*
* @param cls closure
- * @param ec status of the operation, #TALER_EC_NONE on success
+ * @param ec taler error code
+ * @param row_off identification of the position at which we are querying
+ * @param row_off_size number of bytes in @a row_off
+ * @param details details about the wire transfer
+ * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
*/
-typedef void
-(*TALER_WIRE_RejectTransferCallback) (void *cls,
- enum TALER_ErrorCode ec);
+typedef int
+(*TALER_WIRE_DebitResultCallback) (void *cls,
+ enum TALER_ErrorCode ec,
+ const void *row_off,
+ size_t row_off_size,
+ const struct
+ TALER_WIRE_DebitDetails *details);
/**
@@ -136,9 +152,14 @@ struct TALER_WIRE_PrepareHandle;
struct TALER_WIRE_ExecuteHandle;
/**
- * Handle returned for querying the transaction history.
+ * Handle returned for querying the credit transaction history.
*/
-struct TALER_WIRE_HistoryHandle;
+struct TALER_WIRE_CreditHistoryHandle;
+
+/**
+ * Handle returned for querying the debit transaction history.
+ */
+struct TALER_WIRE_DebitHistoryHandle;
/**
@@ -146,7 +167,8 @@ struct TALER_WIRE_HistoryHandle;
*
* @param cls closure
* @param success #GNUNET_OK on success, #GNUNET_SYSERR on failure
- * @param serial_id unique ID of the wire transfer in the bank's records; UINT64_MAX on error
+ * @param row_id unique ID of the wire transfer in the bank's records; NULL on error
+ * @param row_id_size number of bytes in @e row_id
* @param emsg NULL on success, otherwise an error message
*/
typedef void
@@ -156,6 +178,7 @@ typedef void
size_t row_id_size,
const char *emsg);
+
/**
* @brief The plugin API, returned from the plugin's "init" function.
* The argument given to "init" is simply a configuration handle.
@@ -176,11 +199,10 @@ struct TALER_WIRE_Plugin
/**
* Which wire method (payto://METHOD/") is supported by this plugin?
- * For example, "iban" or "x-taler-bank".
+ * For example, "x-taler-bank" or "iban".
*/
const char *method;
-
/**
* Round amount DOWN to the amount that can be transferred via the wire
* method. For example, Taler may support 0.000001 EUR as a unit of
@@ -210,80 +232,7 @@ struct TALER_WIRE_Plugin
/**
- * Prepare for exeuction of a wire transfer.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param origin_account_section configuration section specifying the origin
- * account of the exchange to use
- * @param destination_account_url payto:// URL identifying where to send the money
- * @param amount amount to transfer, already rounded
- * @param exchange_base_url base URL of this exchange (included in subject
- * to facilitate use of tracking API by merchant backend)
- * @param wtid wire transfer identifier to use
- * @param ptc function to call with the prepared data to persist
- * @param ptc_cls closure for @a ptc
- * @return NULL on failure
- */
- struct TALER_WIRE_PrepareHandle *
- (*prepare_wire_transfer) (void *cls,
- const char *origin_account_section,
- const char *destination_account_url,
- const struct TALER_Amount *amount,
- const char *exchange_base_url,
- const struct TALER_WireTransferIdentifierRawP *wtid,
- TALER_WIRE_PrepareTransactionCallback ptc,
- void *ptc_cls);
-
-
- /**
- * Abort preparation of a wire transfer. For example,
- * because we are shutting down.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param pth preparation to cancel
- */
- void
- (*prepare_wire_transfer_cancel) (void *cls,
- struct TALER_WIRE_PrepareHandle *pth);
-
-
- /**
- * Execute a wire transfer.
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param buf buffer with the prepared execution details
- * @param buf_size number of bytes in @a buf
- * @param cc function to call upon success
- * @param cc_cls closure for @a cc
- * @return NULL on error
- */
- struct TALER_WIRE_ExecuteHandle *
- (*execute_wire_transfer) (void *cls,
- const char *buf,
- size_t buf_size,
- TALER_WIRE_ConfirmationCallback cc,
- void *cc_cls);
-
-
- /**
- * Abort execution of a wire transfer. For example, because we are
- * shutting down. Note that if an execution is aborted, it may or
- * may not still succeed. The caller MUST run @e
- * execute_wire_transfer again for the same request as soon as
- * possilbe, to ensure that the request either ultimately succeeds
- * or ultimately fails. Until this has been done, the transaction is
- * in limbo (i.e. may or may not have been committed).
- *
- * @param cls the @e cls of this struct with the plugin-specific state
- * @param eh execution to cancel
- */
- void
- (*execute_wire_transfer_cancel) (void *cls,
- struct TALER_WIRE_ExecuteHandle *eh);
-
-
- /**
- * Query transfer history of an account. We use the variable-size
+ * Query credits made to exchange account. We use the variable-size
* @a start_off to indicate which transfers we are interested in as
* different banking systems may have different ways to identify
* transfers. The @a start_off value must thus match the value of
@@ -295,7 +244,6 @@ struct TALER_WIRE_Plugin
* @param cls the @e cls of this struct with the plugin-specific state
* @param account_section specifies the configuration section which
* identifies the account for which we should get the history
- * @param direction what kinds of wire transfers should be returned
* @param start_off from which row on do we want to get results, use NULL for the latest; exclusive
* @param start_off_len number of bytes in @a start_off
* @param num_results how many results do we want; negative numbers to go into the past,
@@ -304,70 +252,65 @@ struct TALER_WIRE_Plugin
* @param hres_cb the callback to call with the transaction history
* @param hres_cb_cls closure for the above callback
*/
- struct TALER_WIRE_HistoryHandle *
- (*get_history) (void *cls,
+ struct TALER_WIRE_CreditHistoryHandle *
+ (*get_credits) (void *cls,
const char *account_section,
- enum TALER_BANK_Direction direction,
const void *start_off,
size_t start_off_len,
int64_t num_results,
- TALER_WIRE_HistoryResultCallback hres_cb,
+ TALER_WIRE_CreditResultCallback hres_cb,
void *hres_cb_cls);
/**
* Cancel going over the account's history.
*
* @param cls plugins' closure
- * @param whh operation to cancel
+ * @param chh operation to cancel
*/
void
- (*get_history_cancel) (void *cls,
- struct TALER_WIRE_HistoryHandle *whh);
+ (*get_credits_cancel) (void *cls,
+ struct TALER_WIRE_CreditHistoryHandle *chh);
/**
- * Reject an incoming wire transfer that was obtained from the
- * history. This function can be used to transfer funds back to
- * the sender if the WTID was malformed (i.e. due to a typo).
- *
- * Calling `reject_transfer` twice on the same wire transfer should
- * be idempotent, i.e. not cause the funds to be wired back twice.
- * Furthermore, the transfer should henceforth be removed from the
- * results returned by @e get_history.
+ * Query debits (transfers to merchants) made by an exchange. We use the
+ * variable-size @a start_off to indicate which transfers we are interested
+ * in as different banking systems may have different ways to identify
+ * transfers. The @a start_off value must thus match the value of a
+ * `row_off` argument previously given to the @a hres_cb. Use NULL to query
+ * transfers from the beginning of time (with positive @a num_results) or
+ * from the latest committed transfers (with negative @a num_results).
*
- * @param cls plugin's closure
+ * @param cls the @e cls of this struct with the plugin-specific state
* @param account_section specifies the configuration section which
- * identifies the account to use to reject the transfer
- * @param start_off offset of the wire transfer in plugin-specific format
+ * identifies the account for which we should get the history
+ * @param start_off from which row on do we want to get results, use NULL for the latest; exclusive
* @param start_off_len number of bytes in @a start_off
- * @param rej_cb function to call with the result of the operation
- * @param rej_cb_cls closure for @a rej_cb
- * @return handle to cancel the operation
+ * @param num_results how many results do we want; negative numbers to go into the past,
+ * positive numbers to go into the future starting at @a start_row;
+ * must not be zero.
+ * @param hres_cb the callback to call with the transaction history
+ * @param hres_cb_cls closure for the above callback
*/
- struct TALER_WIRE_RejectHandle *
- (*reject_transfer)(void *cls,
- const char *account_section,
- const void *start_off,
- size_t start_off_len,
- TALER_WIRE_RejectTransferCallback rej_cb,
- void *rej_cb_cls);
-
+ struct TALER_WIRE_DebitHistoryHandle *
+ (*get_debits) (void *cls,
+ const char *account_section,
+ const void *start_off,
+ size_t start_off_len,
+ int64_t num_results,
+ TALER_WIRE_DebitResultCallback hres_cb,
+ void *hres_cb_cls);
/**
- * Cancel ongoing reject operation. Note that the rejection may still
- * proceed. Basically, if this function is called, the rejection may
- * have happened or not. This function is usually used during shutdown
- * or system upgrades. At a later point, the application must call
- * @e reject_transfer again for this wire transfer, unless the
- * @e get_history shows that the wire transfer no longer exists.
+ * Cancel going over the account's history.
*
* @param cls plugins' closure
- * @param rh operation to cancel
- * @return closure of the callback of the operation
+ * @param dhh operation to cancel
*/
- void *
- (*reject_transfer_cancel)(void *cls,
- struct TALER_WIRE_RejectHandle *rh);
+ void
+ (*get_debits_cancel) (void *cls,
+ struct TALER_WIRE_DebitHistoryHandle *dhh);
+
};