summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-03-04 16:49:33 +0100
committerChristian Grothoff <christian@grothoff.org>2017-03-04 16:49:33 +0100
commit6ab67a3a76ee5ce8f8dec910dae7da524f066d2a (patch)
treee9f0a94960ad977eef19332bf836666e12aa38f2 /src/include
parentf406f96129766c144c1531dc853969664f410d8c (diff)
downloadexchange-6ab67a3a76ee5ce8f8dec910dae7da524f066d2a.tar.gz
exchange-6ab67a3a76ee5ce8f8dec910dae7da524f066d2a.tar.bz2
exchange-6ab67a3a76ee5ce8f8dec910dae7da524f066d2a.zip
implementing #4929
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_error_codes.h15
-rw-r--r--src/include/taler_exchange_service.h2
-rw-r--r--src/include/taler_exchangedb_plugin.h50
-rw-r--r--src/include/taler_signatures.h5
4 files changed, 71 insertions, 1 deletions
diff --git a/src/include/taler_error_codes.h b/src/include/taler_error_codes.h
index 770a8ad67..4b90281f0 100644
--- a/src/include/taler_error_codes.h
+++ b/src/include/taler_error_codes.h
@@ -779,6 +779,19 @@ enum TALER_ErrorCode
*/
TALER_EC_TRACK_TRANSFER_WTID_NOT_FOUND = 1702,
+ /**
+ * The exchange did not find information about the wire transfer
+ * fees it charged. This response is
+ * provided with HTTP status code MHD_HTTP_INTERNAL_SERVER_ERROR.
+ */
+ TALER_EC_TRACK_TRANSFER_WIRE_FEE_NOT_FOUND = 1703,
+
+ /**
+ * The exchange found a wire fee that was above the total transfer
+ * value (and thus could not have been charged). This response is
+ * provided with HTTP status code MHD_HTTP_INTERNAL_SERVER_ERROR.
+ */
+ TALER_EC_TRACK_TRANSFER_WIRE_FEE_INCONSISTENT = 1704,
/**
* The exchange found internally inconsistent fee data when
@@ -1145,7 +1158,7 @@ enum TALER_ErrorCode
/**
* The backend encountered an error while trying to store the
- * h_proposal_data into the database.
+ * h_proposal_data into the database.
* The response is provided with HTTP status code MHD_HTTP_INTERNAL_SERVER_ERROR.
*/
TALER_EC_PROPOSAL_STORE_DB_ERROR = 2501,
diff --git a/src/include/taler_exchange_service.h b/src/include/taler_exchange_service.h
index 05256ddb9..3ac4069f3 100644
--- a/src/include/taler_exchange_service.h
+++ b/src/include/taler_exchange_service.h
@@ -1130,6 +1130,7 @@ struct TALER_EXCHANGE_TrackTransferHandle;
* @param execution_time time when the exchange claims to have performed the wire transfer
* @param total_amount total amount of the wire transfer, or NULL if the exchange could
* not provide any @a wtid (set only if @a http_status is #MHD_HTTP_OK)
+ * @param wire_fee wire fee that was charged by the exchange
* @param details_length length of the @a details array
* @param details array with details about the combined transactions
*/
@@ -1142,6 +1143,7 @@ typedef void
const struct GNUNET_HashCode *h_wire,
struct GNUNET_TIME_Absolute execution_time,
const struct TALER_Amount *total_amount,
+ const struct TALER_Amount *wire_fee,
unsigned int details_length,
const struct TALER_TrackTransferDetails *details);
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index fa0c48a8b..e7ba06f4c 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -762,6 +762,7 @@ typedef void
*
* @param cls closure
* @param merchant_pub public key of the merchant (should be same for all callbacks with the same @e cls)
+ * @param wire_method which wire plugin was used for the transfer?
* @param h_wire hash of wire transfer details of the merchant (should be same for all callbacks with the same @e cls)
* @param exec_time execution time of the wire transfer (should be same for all callbacks with the same @e cls)
* @param h_proposal_data which proposal was this payment about
@@ -772,6 +773,7 @@ typedef void
typedef void
(*TALER_EXCHANGEDB_WireTransferDataCallback)(void *cls,
const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const char *wire_method,
const struct GNUNET_HashCode *h_wire,
struct GNUNET_TIME_Absolute exec_time,
const struct GNUNET_HashCode *h_proposal_data,
@@ -1521,6 +1523,54 @@ struct TALER_EXCHANGEDB_Plugin
/**
+ * Insert wire transfer fee into database.
+ *
+ * @param cls closure
+ * @param session database connection
+ * @param wire_method which wire method is the fee about?
+ * @param start_date when does the fee go into effect
+ * @param end_date when does the fee end being valid
+ * @param wire_fee how high is the wire transfer fee
+ * @param master_sig signature over the above by the exchange master key
+ * @return #GNUNET_OK on success, #GNUNET_NO if the record exists,
+ * #GNUNET_SYSERR on failure
+ */
+ int
+ (*insert_wire_fee)(void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const char *wire_method,
+ struct GNUNET_TIME_Absolute start_date,
+ struct GNUNET_TIME_Absolute end_date,
+ const struct TALER_Amount *wire_fee,
+ const struct TALER_MasterSignatureP *master_sig);
+
+
+ /**
+ * Obtain wire fee from database.
+ *
+ * @param cls closure
+ * @param session database connection
+ * @param type type of wire transfer the fee applies for
+ * @param date for which date do we want the fee?
+ * @param[out] start_date when does the fee go into effect
+ * @param[out] end_date when does the fee end being valid
+ * @param[out] wire_fee how high is the wire transfer fee
+ * @param[out] master_sig signature over the above by the exchange master key
+ * @return #GNUNET_OK on success, #GNUNET_NO if no fee is known
+ * #GNUNET_SYSERR on failure
+ */
+ int
+ (*get_wire_fee) (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const char *type,
+ struct GNUNET_TIME_Absolute date,
+ struct GNUNET_TIME_Absolute *start_date,
+ struct GNUNET_TIME_Absolute *end_date,
+ struct TALER_Amount *wire_fee,
+ struct TALER_MasterSignatureP *master_sig);
+
+
+ /**
* Function called to insert wire transfer commit data into the DB.
*
* @param cls closure
diff --git a/src/include/taler_signatures.h b/src/include/taler_signatures.h
index 35967399d..8659deb3a 100644
--- a/src/include/taler_signatures.h
+++ b/src/include/taler_signatures.h
@@ -1004,6 +1004,11 @@ struct TALER_WireDepositDataPS
struct TALER_AmountNBO total;
/**
+ * Wire fee that was charged.
+ */
+ struct TALER_AmountNBO wire_fee;
+
+ /**
* Public key of the merchant (for all aggregated transactions).
*/
struct TALER_MerchantPublicKeyP merchant_pub;