summaryrefslogtreecommitdiff
path: root/src/include/taler_merchantdb_plugin.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-05-30 18:53:06 +0200
committerChristian Grothoff <christian@grothoff.org>2020-05-30 18:53:06 +0200
commit059797b86a96e95ca4d61ccbcec690620957aaf9 (patch)
treec46cc5b799a4d277d71f4ac08a216d879f52b9ad /src/include/taler_merchantdb_plugin.h
parente0991aa684c7a4e9895834286dfdf98007e8cfa6 (diff)
downloadmerchant-059797b86a96e95ca4d61ccbcec690620957aaf9.tar.gz
merchant-059797b86a96e95ca4d61ccbcec690620957aaf9.tar.bz2
merchant-059797b86a96e95ca4d61ccbcec690620957aaf9.zip
fix DB use
Diffstat (limited to 'src/include/taler_merchantdb_plugin.h')
-rw-r--r--src/include/taler_merchantdb_plugin.h361
1 files changed, 27 insertions, 334 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index fe306b7c..ef557298 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -1560,6 +1560,33 @@ struct TALER_MERCHANTDB_Plugin
/**
+ * Store information about wire fees charged by an exchange,
+ * including signature (so we have proof).
+ *
+ * @param cls closure
+ * @param exchange_pub public key of the exchange
+ * @param h_wire_method hash of wire method
+ * @param wire_fee wire fee charged
+ * @param closing_fee closing fee charged (irrelevant for us,
+ * but needed to check signature)
+ * @param start_date start of fee being used
+ * @param end_date end of fee being used
+ * @param exchange_sig signature of exchange over fee structure
+ * @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);
+
+
+ /**
* Add @a credit to a reserve to be used for tipping. Note that
* this function does not actually perform any wire transfers to
* credit the reserve, it merely tells the merchant backend that
@@ -1812,340 +1839,6 @@ struct TALER_MERCHANTDB_Plugin
uint32_t offset,
const struct GNUNET_CRYPTO_RsaSignature *blind_sig);
-
- /* ****************** OLD API ******************** */
-
-
- /**
- * Retrieve proposal data given its hashcode
- *
- * @param cls closure
- * @param[out] contract_terms where to store the result
- * @param h_contract_terms hashcode used to lookup.
- * @param merchant_pub instance's public key.
- * @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);
-
-
- /**
- * Retrieve paid contract terms data given its hashcode.
- *
- * @param cls closure
- * @param[out] contract_terms where to store the result
- * @param h_contract_terms hashcode used to lookup.
- * @param merchant_pub instance's public key.
- * @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);
-
-
- /**
- * Return proposals whose timestamps are younger than `date`.
- * Among those proposals, only those ones being between the
- * start-th and (start-nrows)-th record are returned. The rows
- * are sorted having the youngest first.
- *
- * @param cls our plugin handle.
- * @param date only results younger than this date are returned.
- * @param merchant_pub instance's public key; only rows related to this
- * instance are returned.
- * @param start only rows with serial id less than start are returned.
- * @param nrows only nrows rows are returned.
- * @param past if set to #GNUNET_YES, retrieves rows older than `date`.
- * @param ascending if GNUNET_YES, then results will be sorted with youngest first.
- * This is typically used to show live updates on the merchant's backoffice
- * @param cb function to call with transaction data, can be NULL.
- * @param cb_cls closure for @a cb
- * @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);
-
- /**
- * Lookup for a proposal, respecting the signature used by the
- * /history's db methods.
- *
- * @param cls db plugin handle
- * @param order_id order id used to search for the proposal data
- * @param merchant_pub public key of the merchant using this method
- * @param cb the callback
- * @param cb_cls closure to pass to @a cb
- * @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);
-
-
- /**
- * Return proposals whose timestamp are older than `date`.
- * The rows are sorted having the youngest first.*
- *
- * @param cls our plugin handle.
- * @param date only results older than this date are returned.
- * @param merchant_pub instance's public key; only rows related to this
- * instance are returned.
- * @param nrows only nrows rows are returned.
- * @param cb function to call with transaction data, can be NULL.
- * @param cb_cls closure for @a cb
- * @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);
-
-
- /**
- * Insert mapping of @a coin_pub and @a h_contract_terms to
- * corresponding @a wtid.
- *
- * @param cls closure
- * @param h_contract_terms proposal data's hashcode
- * @param coin_pub public key of the coin
- * @param wtid identifier of the wire transfer in which the exchange
- * send us the money for the coin deposit
- * @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);
-
-
- /**
- * Insert wire transfer confirmation from the exchange into the database.
- *
- * @param cls closure
- * @param exchange_url from which exchange did we get the @a exchange_proof
- * @param wtid identifier of the wire transfer
- * @param execution_time when was @a wtid executed
- * @param signkey_pub public key used by the exchange for @a exchange_proof
- * @param exchange_proof proof from exchange about what the deposit was for
- * @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 information about wire fees charged by an exchange,
- * including signature (so we have proof).
- *
- * @param cls closure
- * @param exchange_pub public key of the exchange
- * @param h_wire_method hash of wire method
- * @param wire_fee wire fee charged
- * @param closing_fee closing fee charged (irrelevant for us,
- * but needed to check signature)
- * @param start_date start of fee being used
- * @param end_date end of fee being used
- * @param exchange_sig signature of exchange over fee structure
- * @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);
-
-
- /**
- * Lookup proof information about a wire transfer.
- *
- * @param cls closure
- * @param exchange_url from which exchange are we looking for proof
- * @param wtid wire transfer identifier for the search
- * @param cb function to call with proof data
- * @param cb_cls closure for @a cb
- * @return transaction status
- */
- enum GNUNET_DB_QueryStatus
- (*find_proof_by_wtid)(void *cls,
- const char *exchange_url,
- const struct TALER_WireTransferIdentifierRawP *wtid,
- TALER_MERCHANTDB_ProofCallback cb,
- void *cb_cls);
-
-
- /**
- * Obtain refund proofs associated with a refund operation on a
- * coin.
- *
- * @param cls closure, typically a connection to the db
- * @param merchant_pub public key of the merchant instance
- * @param h_contract_terms hash code of the contract
- * @param coin_pub public key of the coin
- * @param rtransaction_id identificator of the refund
- * @param[out] exchange_pub public key of the exchange affirming the refund
- * @param[out] exchange_sig signature of the exchange affirming the refund
- * @return transaction status
- */
- enum GNUNET_DB_QueryStatus
- (*get_refund_proof)(
- void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- uint64_t rtransaction_id,
- struct TALER_ExchangePublicKeyP *exchange_pub,
- struct TALER_ExchangeSignatureP *exchange_sig);
-
-
- /**
- * Store refund proofs associated with a refund operation on a
- * coin.
- *
- * @param cls closure, typically a connection to the db
- * @param merchant_pub public key of the merchant instance
- * @param h_contract_terms hash code of the contract
- * @param coin_pub public key of the coin
- * @param rtransaction_id identificator of the refund
- * @param exchange_pub public key of the exchange affirming the refund
- * @param exchange_sig signature of the exchange affirming the refund
- * @return transaction status
- */
- enum GNUNET_DB_QueryStatus
- (*put_refund_proof)(
- void *cls,
- const struct TALER_MerchantPublicKeyP *merchant_pub,
- const struct GNUNET_HashCode *h_contract_terms,
- const struct TALER_CoinSpendPublicKeyP *coin_pub,
- uint64_t rtransaction_id,
- const struct TALER_ExchangePublicKeyP *exchange_pub,
- const struct TALER_ExchangeSignatureP *exchange_sig);
-
-
- /**
- * Add @a credit to a reserve to be used for tipping. Note that
- * this function does not actually perform any wire transfers to
- * credit the reserve, it merely tells the merchant backend that
- * a reserve was topped up. This has to happen before tips can be
- * authorized.
- *
- * @param cls closure, typically a connection to the db
- * @param reserve_priv which reserve is topped up or created
- * @param credit_uuid unique identifier for the credit operation
- * @param credit how much money was added to the reserve
- * @param expiration when does the reserve expire?
- * @return transaction status, usually
- * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a credit_uuid already known
- */
- enum GNUNET_DB_QueryStatus
- (*enable_tip_reserve_TR)(void *cls,
- const struct TALER_ReservePrivateKeyP *reserve_priv,
- const struct GNUNET_HashCode *credit_uuid,
- const struct TALER_Amount *credit,
- struct GNUNET_TIME_Absolute expiration);
-
-
- /**
- * Get the total amount of authorized tips for a tipping reserve.
- *
- * @param cls closure, typically a connection to the db
- * @param reserve_priv which reserve to check
- * @param[out] authorzed_amount amount we've authorized so far for tips
- * @return transaction status, usually
- * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the reserve_priv
- * does not identify a known tipping reserve
- */
- enum GNUNET_DB_QueryStatus
- (*get_authorized_tip_amount)(void *cls,
- const struct
- TALER_ReservePrivateKeyP *reserve_priv,
- struct TALER_Amount *authorized_amount);
-
-
- /**
- * Find out tip authorization details associated with @a tip_id
- *
- * @param cls closure, typically a connection to the d
- * @param tip_id the unique ID for the tip
- * @param[out] exchange_url set to the URL of the exchange (unless NULL)
- * @param[out] extra extra data to pass to the wallet
- * @param[out] amount set to the authorized amount (unless NULL)
- * @param[out] amount_left set to the amount left (unless NULL)
- * @param[out] timestamp set to the timestamp of the tip authorization (unless NULL)
- * @return transaction status, usually
- * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success
- * #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if @a credit_uuid already known
- */
- enum GNUNET_DB_QueryStatus
- (*lookup_tip_by_id)(void *cls,
- const struct GNUNET_HashCode *tip_id,
- char **exchange_url,
- json_t **extra,
- struct TALER_Amount *amount,
- struct TALER_Amount *amount_left,
- struct GNUNET_TIME_Absolute *timestamp);
-
-
- /**
- * Pickup a tip over @a amount using pickup id @a pickup_id.
- *
- * @param cls closure, typically a connection to the db
- * @param amount how high is the amount picked up (with fees)
- * @param tip_id the unique ID from the tip authorization
- * @param pickup_id the unique ID identifying the pick up operation
- * (to allow replays, hash over the coin envelope and denomination key)
- * @param[out] reserve_priv which reserve key to use to sign
- * @return taler error code
- * #TALER_EC_TIP_PICKUP_ID_UNKNOWN if @a tip_id is unknown
- * #TALER_EC_TIP_PICKUP_NO_FUNDS if @a tip_id has insufficient funds left
- * #TALER_EC_TIP_PICKUP_DB_ERROR on database errors
- * #TALER_EC_NONE upon success (@a reserve_priv was set)
- */
- enum TALER_ErrorCode
- (*pickup_tip_TR)(void *cls,
- const struct TALER_Amount *amount,
- const struct GNUNET_HashCode *tip_id,
- const struct GNUNET_HashCode *pickup_id,
- struct TALER_ReservePrivateKeyP *reserve_priv);
-
-
};
#endif