summaryrefslogtreecommitdiff
path: root/src/include/taler_merchantdb_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/taler_merchantdb_plugin.h')
-rw-r--r--src/include/taler_merchantdb_plugin.h232
1 files changed, 111 insertions, 121 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index 38c18863..cc2e6bd9 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014-2017 INRIA
+ 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 Lesser General Public License as published by the Free Software
@@ -58,16 +58,14 @@ typedef void
* @param total_amount total amount we receive for the contract after fees
*/
typedef void
-(*TALER_MERCHANTDB_TransactionCallback)(void *cls,
- const struct
- TALER_MerchantPublicKeyP *merchant_pub,
- const struct
- GNUNET_HashCode *h_contract_terms,
- const struct GNUNET_HashCode *h_wire,
- struct GNUNET_TIME_Absolute timestamp,
- struct GNUNET_TIME_Absolute refund,
- const struct
- TALER_Amount *total_amount);
+(*TALER_MERCHANTDB_TransactionCallback)(
+ void *cls,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct GNUNET_HashCode *h_wire,
+ struct GNUNET_TIME_Absolute timestamp,
+ struct GNUNET_TIME_Absolute refund,
+ const struct TALER_Amount *total_amount);
/**
@@ -85,18 +83,16 @@ typedef void
* matches the `interface DepositSuccess` of the documentation.
*/
typedef void
-(*TALER_MERCHANTDB_CoinDepositCallback)(void *cls,
- const struct
- GNUNET_HashCode *h_contract_terms,
- const struct
- TALER_CoinSpendPublicKeyP *coin_pub,
- const char *exchange_url,
- const struct
- TALER_Amount *amount_with_fee,
- const struct TALER_Amount *deposit_fee,
- const struct TALER_Amount *refund_fee,
- const struct TALER_Amount *wire_fee,
- const json_t *exchange_proof);
+(*TALER_MERCHANTDB_CoinDepositCallback)(
+ void *cls,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const char *exchange_url,
+ const struct TALER_Amount *amount_with_fee,
+ const struct TALER_Amount *deposit_fee,
+ const struct TALER_Amount *refund_fee,
+ const struct TALER_Amount *wire_fee,
+ const json_t *exchange_proof);
/**
@@ -117,15 +113,13 @@ typedef void
* NULL if we have not asked for this signature
*/
typedef void
-(*TALER_MERCHANTDB_TransferCallback)(void *cls,
- const struct
- GNUNET_HashCode *h_contract_terms,
- const struct
- TALER_CoinSpendPublicKeyP *coin_pub,
- const struct
- TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute execution_time,
- const json_t *exchange_proof);
+(*TALER_MERCHANTDB_TransferCallback)(
+ void *cls,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
+ struct GNUNET_TIME_Absolute execution_time,
+ const json_t *exchange_proof);
/**
@@ -150,13 +144,13 @@ typedef void
* @param refund_fee cost of this refund operation
*/
typedef void
-(*TALER_MERCHANTDB_RefundCallback)(void *cls,
- const struct
- TALER_CoinSpendPublicKeyP *coin_pub,
- uint64_t rtransaction_id,
- const char *reason,
- const struct TALER_Amount *refund_amount,
- const struct TALER_Amount *refund_fee);
+(*TALER_MERCHANTDB_RefundCallback)(
+ void *cls,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ uint64_t rtransaction_id,
+ const char *reason,
+ const struct TALER_Amount *refund_amount,
+ const struct TALER_Amount *refund_fee);
/**
@@ -325,12 +319,11 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*find_contract_terms_from_hash)(void *cls,
- json_t **contract_terms,
- const struct
- GNUNET_HashCode *h_contract_terms,
- const struct
- TALER_MerchantPublicKeyP *merchant_pub);
+ (*find_contract_terms_from_hash)(
+ void *cls,
+ json_t **contract_terms,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct TALER_MerchantPublicKeyP *merchant_pub);
/**
@@ -343,12 +336,11 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*find_paid_contract_terms_from_hash)(void *cls,
- json_t **contract_terms,
- const struct
- GNUNET_HashCode *h_contract_terms,
- const struct
- TALER_MerchantPublicKeyP *merchant_pub);
+ (*find_paid_contract_terms_from_hash)(
+ void *cls,
+ json_t **contract_terms,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct TALER_MerchantPublicKeyP *merchant_pub);
/**
@@ -371,18 +363,16 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*find_contract_terms_by_date_and_range)(void *cls,
- struct GNUNET_TIME_Absolute date,
- const struct
- TALER_MerchantPublicKeyP *
- merchant_pub,
- uint64_t start,
- uint64_t nrows,
- int past,
- unsigned int ascending,
- TALER_MERCHANTDB_ProposalDataCallback
- cb,
- void *cb_cls);
+ (*find_contract_terms_by_date_and_range)(
+ void *cls,
+ struct GNUNET_TIME_Absolute date,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ uint64_t start,
+ uint64_t nrows,
+ int past,
+ unsigned int ascending,
+ TALER_MERCHANTDB_ProposalDataCallback cb,
+ void *cb_cls);
/**
* Lookup for a proposal, respecting the signature used by the
@@ -396,12 +386,12 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*find_contract_terms_history)(void *cls,
- const char *order_id,
- const struct
- TALER_MerchantPublicKeyP *merchant_pub,
- TALER_MERCHANTDB_ProposalDataCallback cb,
- void *cb_cls);
+ (*find_contract_terms_history)(
+ void *cls,
+ const char *order_id,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ TALER_MERCHANTDB_ProposalDataCallback cb,
+ void *cb_cls);
/**
@@ -418,13 +408,13 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*find_contract_terms_by_date)(void *cls,
- struct GNUNET_TIME_Absolute date,
- const struct
- TALER_MerchantPublicKeyP *merchant_pub,
- uint64_t nrows,
- TALER_MERCHANTDB_ProposalDataCallback cb,
- void *cb_cls);
+ (*find_contract_terms_by_date)(
+ void *cls,
+ struct GNUNET_TIME_Absolute date,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ uint64_t nrows,
+ TALER_MERCHANTDB_ProposalDataCallback cb,
+ void *cb_cls);
/**
@@ -468,11 +458,11 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*store_coin_to_transfer)(void *cls,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- const struct
- TALER_WireTransferIdentifierRawP *wtid);
+ (*store_coin_to_transfer)(
+ void *cls,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ const struct TALER_WireTransferIdentifierRawP *wtid);
/**
@@ -487,13 +477,13 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*store_transfer_to_proof)(void *cls,
- const char *exchange_url,
- const struct
- TALER_WireTransferIdentifierRawP *wtid,
- struct GNUNET_TIME_Absolute execution_time,
- const struct TALER_ExchangePublicKeyP *signkey_pub,
- const json_t *exchange_proof);
+ (*store_transfer_to_proof)(
+ void *cls,
+ const char *exchange_url,
+ const struct TALER_WireTransferIdentifierRawP *wtid,
+ struct GNUNET_TIME_Absolute execution_time,
+ const struct TALER_ExchangePublicKeyP *signkey_pub,
+ const json_t *exchange_proof);
/**
@@ -512,16 +502,15 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status code
*/
enum GNUNET_DB_QueryStatus
- (*store_wire_fee_by_exchange)(void *cls,
- const struct
- TALER_MasterPublicKeyP *exchange_pub,
- const struct GNUNET_HashCode *h_wire_method,
- const struct TALER_Amount *wire_fee,
- const struct TALER_Amount *closing_fee,
- struct GNUNET_TIME_Absolute start_date,
- struct GNUNET_TIME_Absolute end_date,
- const struct
- TALER_MasterSignatureP *exchange_sig);
+ (*store_wire_fee_by_exchange)(
+ void *cls,
+ const struct TALER_MasterPublicKeyP *exchange_pub,
+ const struct GNUNET_HashCode *h_wire_method,
+ const struct TALER_Amount *wire_fee,
+ const struct TALER_Amount *closing_fee,
+ struct GNUNET_TIME_Absolute start_date,
+ struct GNUNET_TIME_Absolute end_date,
+ const struct TALER_MasterSignatureP *exchange_sig);
/**
@@ -556,15 +545,13 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*find_payments_by_hash_and_coin)(void *cls,
- const struct
- GNUNET_HashCode *h_contract_terms,
- const struct
- TALER_MerchantPublicKeyP *merchant_pub,
- const struct
- TALER_CoinSpendPublicKeyP *coin_pub,
- TALER_MERCHANTDB_CoinDepositCallback cb,
- void *cb_cls);
+ (*find_payments_by_hash_and_coin)(
+ void *cls,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct TALER_CoinSpendPublicKeyP *coin_pub,
+ TALER_MERCHANTDB_CoinDepositCallback cb,
+ void *cb_cls);
/**
@@ -663,15 +650,19 @@ struct TALER_MERCHANTDB_Plugin
* @param reason 0-terminated UTF-8 string giving the reason why the customer
* got a refund (free form, business-specific)
* @return transaction status
+ * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a refund is ABOVE the amount we
+ * were originally paid and thus the transaction failed;
+ * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT if the request is valid,
+ * regardless of whether it actually increased the refund beyond
+ * what was already refunded (idempotency!)
*/
enum GNUNET_DB_QueryStatus
- (*increase_refund_for_contract_NT)(void *cls,
- const struct
- GNUNET_HashCode *h_contract_terms,
- const struct
- TALER_MerchantPublicKeyP *merchant_pub,
- const struct TALER_Amount *refund,
- const char *reason);
+ (*increase_refund_for_contract_NT)(
+ void *cls,
+ const struct GNUNET_HashCode *h_contract_terms,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct TALER_Amount *refund,
+ const char *reason);
/**
@@ -685,13 +676,12 @@ struct TALER_MERCHANTDB_Plugin
* @return transaction status
*/
enum GNUNET_DB_QueryStatus
- (*get_refunds_from_contract_terms_hash)(void *cls,
- const struct
- TALER_MerchantPublicKeyP *merchant_pub,
- const struct
- GNUNET_HashCode *h_contract_terms,
- TALER_MERCHANTDB_RefundCallback rc,
- void *rc_cls);
+ (*get_refunds_from_contract_terms_hash)(
+ void *cls,
+ const struct TALER_MerchantPublicKeyP *merchant_pub,
+ const struct GNUNET_HashCode *h_contract_terms,
+ TALER_MERCHANTDB_RefundCallback rc,
+ void *rc_cls);
/**
* Add @a credit to a reserve to be used for tipping. Note that