diff options
author | Christian Grothoff <christian@grothoff.org> | 2024-02-09 20:05:25 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2024-02-09 20:05:38 +0100 |
commit | 49bbea1c6bbc64f48ccffa6595acbde204c2e867 (patch) | |
tree | 60cfa2fd371b4d6d101175c4a08428bf1e15b6c6 /src/include | |
parent | 231d1b19d14e8aba67795e3d147a58331bafc9aa (diff) |
remove reserve/rewards
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 461 |
1 files changed, 2 insertions, 459 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 640bbdd7..1983f732 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -911,74 +911,6 @@ typedef void /** - * Callback with reserve details. - * - * @param cls closure - * @param reserve_pub public key of the reserve - * @param creation_time time when the reserve was setup - * @param expiration_time time when the reserve will be closed by the exchange - * @param merchant_initial_amount initial amount that the merchant claims to have filled the - * reserve with - * @param exchange_initial_amount initial amount that the exchange claims to have received - * @param pickup_amount total of rewards that were picked up from this reserve - * @param committed_amount total of rewards that the merchant committed to, but that were not - * picked up yet - * @param active true if the reserve is still active (we have the private key) - */ -typedef void -(*TALER_MERCHANTDB_ReservesCallback)( - void *cls, - const struct TALER_ReservePublicKeyP *reserve_pub, - struct GNUNET_TIME_Timestamp creation_time, - struct GNUNET_TIME_Timestamp expiration_time, - const struct TALER_Amount *merchant_initial_amount, - const struct TALER_Amount *exchange_initial_amount, - const struct TALER_Amount *pickup_amount, - const struct TALER_Amount *committed_amount, - bool active); - - -/** - * Callback with details about a reserve pending exchange confirmation. - * - * @param cls closure - * @param instance_id for which instance is this reserve - * @param exchange_url base URL of the exchange - * @param reserve_pub public key of the reserve - * @param expected_amount how much do we expect to see in the reserve - */ -typedef void -(*TALER_MERCHANTDB_PendingReservesCallback)( - void *cls, - const char *instance_id, - const char *exchange_url, - const struct TALER_ReservePublicKeyP *reserve_pub, - const struct TALER_Amount *expected_amount); - - -/** - * Details about a reward. - */ -struct TALER_MERCHANTDB_RewardDetails -{ - /** - * ID of the reward. - */ - struct TALER_RewardIdentifierP reward_id; - - /** - * Total amount of the reward. - */ - struct TALER_Amount total_amount; - - /** - * Reason given for granting the reward. - */ - char *reason; -}; - - -/** * Function called with information about a coin that was deposited. * * @param cls closure @@ -1001,55 +933,6 @@ typedef void /** - * Callback with reserve details. - * - * @param cls closure - * @param creation_time time when the reserve was setup - * @param expiration_time time when the reserve will be closed by the exchange - * @param merchant_initial_amount initial amount that the merchant claims to have filled the - * reserve with - * @param exchange_initial_amount initial amount that the exchange claims to have received - * @param picked_up_amount total of rewards that were picked up from this reserve - * @param committed_amount total of rewards that the merchant committed to, but that were not - * picked up yet - * @param active true if the reserve is still active (we have the private key) - * @param master_pub master public key of the exchange - * @param exchange_url base URL of the exchange hosting the reserve, NULL if not @a active - * @param rewards_length length of the @a rewards array - * @param rewards information about the rewards created by this reserve - */ -typedef void -(*TALER_MERCHANTDB_ReserveDetailsCallback)( - void *cls, - struct GNUNET_TIME_Timestamp creation_time, - struct GNUNET_TIME_Timestamp expiration_time, - const struct TALER_Amount *merchant_initial_amount, - const struct TALER_Amount *exchange_initial_amount, - const struct TALER_Amount *picked_up_amount, - const struct TALER_Amount *committed_amount, - bool active, - const struct TALER_MasterPublicKeyP *master_pub, - const char *exchange_url, - unsigned int rewards_length, - const struct TALER_MERCHANTDB_RewardDetails *rewards); - - -/** - * Typically called by `lookup_rewards`. - * - * @param cls closure - * @param row_id row of the reward in the database - * @param reward_id id of the reward - * @param amount amount of the reward - */ -typedef void -(*TALER_MERCHANTDB_RewardsCallback)(void *cls, - uint64_t row_id, - struct TALER_RewardIdentifierP reward_id, - struct TALER_Amount amount); - - -/** * Function called with information about a coin that was deposited. * * @param cls closure @@ -1080,28 +963,6 @@ typedef void /** - * Details about a pickup operation executed by the merchant. - */ -struct TALER_MERCHANTDB_PickupDetails -{ - /** - * Identifier for the pickup operation. - */ - struct TALER_PickupIdentifierP pickup_id; - - /** - * Total amount requested for this @e pickup_id. - */ - struct TALER_Amount requested_amount; - - /** - * Number of planchets involved in the request. - */ - unsigned int num_planchets; - -}; - -/** * Possible token family kinds. */ enum TALER_MERCHANTDB_TokenFamilyKind @@ -1306,7 +1167,7 @@ struct TALER_MERCHANTDB_Plugin * @param es specification of the event to listen for * @param timeout how long to wait for the event * @param cb function to call when the event happens, possibly - * mulrewardle times (until cancel is invoked) + * multiple times (until cancel is invoked) * @param cb_cls closure for @a cb * @return handle useful to cancel the listener */ @@ -2425,7 +2286,7 @@ struct TALER_MERCHANTDB_Plugin * Function called when some backoffice staff decides to award or * increase the refund on an existing contract. This function * MUST be called from within a transaction scope setup by the - * caller as it executes mulrewardle SQL statements. + * caller as it executes multiple SQL statements. * * @param cls closure * @param instance_id instance identifier @@ -2891,324 +2752,6 @@ struct TALER_MERCHANTDB_Plugin /** - * Add @a credit to a reserve to be used for rewardping. Note that - * this function does not actually perform any wire transfers to - * credit the reserve, it merely tells the merchant backend that - * a reserve now exists. This has to happen before rewards can be - * authorized. - * - * @param cls closure, typically a connection to the db - * @param instance_id which instance is the reserve tied to - * @param reserve_priv which reserve is topped up or created - * @param reserve_pub which reserve is topped up or created - * @param master_pub master public key of the exchange - * @param exchange_url what URL is the exchange reachable at where the reserve is located - * @param initial_balance how much money will be added to the reserve - * @param expiration when does the reserve expire? - * @return transaction status, usually - * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success - */ - enum TALER_ErrorCode - (*insert_reserve)(void *cls, - const char *instance_id, - const struct TALER_ReservePrivateKeyP *reserve_priv, - const struct TALER_ReservePublicKeyP *reserve_pub, - const struct TALER_MasterPublicKeyP *master_pub, - const char *exchange_url, - const struct TALER_Amount *initial_balance, - struct GNUNET_TIME_Timestamp expiration); - - - /** - * Confirms @a credit as the amount the exchange claims to have received and - * thus really 'activates' the reserve. This has to happen before rewards can - * be authorized. - * - * @param cls closure, typically a connection to the db - * @param instance_id which instance is the reserve tied to - * @param reserve_pub which reserve is topped up or created - * @param initial_exchange_balance how much money was be added to the reserve - * according to the exchange - * @return transaction status, usually - * #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT for success - */ - enum GNUNET_DB_QueryStatus - (*activate_reserve)(void *cls, - const char *instance_id, - const struct TALER_ReservePublicKeyP *reserve_pub, - const struct TALER_Amount *initial_exchange_balance); - - - /** - * Lookup reserves. - * - * @param cls closure - * @param instance_id instance to lookup payments for - * @param created_after filter by reserves created after this date - * @param active filter by active reserves - * @param failures filter by reserves with a disagreement on the initial balance - * @param cb function to call with reserve summary data - * @param cb_cls closure for @a cb - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*lookup_reserves)(void *cls, - const char *instance_id, - struct GNUNET_TIME_Timestamp created_after, - enum TALER_EXCHANGE_YesNoAll active, - enum TALER_EXCHANGE_YesNoAll failures, - TALER_MERCHANTDB_ReservesCallback cb, - void *cb_cls); - - - /** - * Lookup reserves pending activation across all instances. - * - * @param cls closure - * @param cb function to call with reserve data - * @param cb_cls closure for @a cb - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*lookup_pending_reserves)(void *cls, - TALER_MERCHANTDB_PendingReservesCallback cb, - void *cb_cls); - - - /** - * Lookup reserve details. - * - * @param cls closure - * @param instance_id instance to lookup payments for - * @param reserve_pub public key of the reserve to inspect - * @param fetch_rewards if true, also return information about rewards - * @param cb function to call with reserve summary data - * @param cb_cls closure for @a cb - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*lookup_reserve)(void *cls, - const char *instance_id, - const struct TALER_ReservePublicKeyP *reserve_pub, - bool fetch_rewards, - TALER_MERCHANTDB_ReserveDetailsCallback cb, - void *cb_cls); - - - /** - * Delete private key of a reserve. - * - * @param cls closure - * @param instance_id instance to lookup payments for - * @param reserve_pub public key of the reserve to delete - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*delete_reserve)(void *cls, - const char *instance_id, - const struct TALER_ReservePublicKeyP *reserve_pub); - - /** - * Purge all information about a reserve (including rewards from it). - * - * @param cls closure - * @param instance_id instance to lookup payments for - * @param reserve_pub public key of the reserve to purge - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*purge_reserve)(void *cls, - const char *instance_id, - const struct TALER_ReservePublicKeyP *reserve_pub); - - - /** - * Authorize a reward over @a amount from reserve @a reserve_pub. Remember - * the authorization under @a reward_id for later, together with the - * @a justification. - * - * @param cls closure, typically a connection to the db - * @param instance_id which instance should generate the reward - * @param reserve_pub which reserve is debited, NULL to pick one in the DB - * @param amount how high is the reward (with fees) - * @param justification why was the reward approved - * @param next_url where to send the URL post reward pickup - * @param[out] reward_id set to the unique ID for the reward - * @param[out] expiration set to when the reward expires - * @return transaction status, - * #TALER_EC_MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_EXPIRED if the reserve is known but has expired - * #TALER_EC_MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_RESERVE_NOT_FOUND if the reserve is not known - * #TALER_EC_MERCHANT_PRIVATE_POST_REWARD_AUTHORIZE_INSUFFICIENT_FUNDS if the reserve has insufficient funds left - * #TALER_EC_GENERIC_DB_START_FAILED on hard DB errors - * #TALER_EC_GENERIC_DB_FETCH_FAILED on hard DB errors - * #TALER_EC_GENERIC_DB_STORE_FAILED on hard DB errors - * #TALER_EC_GENERIC_DB_INVARIANT_FAILURE on hard DB errors - * #TALER_EC_GENERIC_DB_SOFT_FAILURE on soft DB errors (client should retry) - * #TALER_EC_NONE upon success - */ - enum TALER_ErrorCode - (*authorize_reward)(void *cls, - const char *instance_id, - const struct TALER_ReservePublicKeyP *reserve_pub, - const struct TALER_Amount *amount, - const char *justification, - const char *next_url, - struct TALER_RewardIdentifierP *reward_id, - struct GNUNET_TIME_Timestamp *expiration); - - - /** - * Lookup pickup details for pickup @a pickup_id. - * - * @param cls closure, typically a connection to the db - * @param instance_id which instance should we lookup reward details for - * @param reward_id which reward should we lookup details on - * @param pickup_id which pickup should we lookup details on - * @param[out] exchange_url which exchange is the reward withdrawn from - * @param[out] reserve_priv private key the reward is withdrawn from (set if still available!) - * @param sigs_length length of the @a sigs array - * @param[out] sigs set to the (blind) signatures we have for this @a pickup_id, - * those that are unavailable are left at NULL - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*lookup_pickup)(void *cls, - const char *instance_id, - const struct TALER_RewardIdentifierP *reward_id, - const struct TALER_PickupIdentifierP *pickup_id, - char **exchange_url, - struct TALER_ReservePrivateKeyP *reserve_priv, - unsigned int sigs_length, - struct TALER_BlindedDenominationSignature sigs[]); - - - /** - * Lookup reward details for reward @a reward_id. - * - * @param cls closure, typically a connection to the db - * @param instance_id which instance should we lookup reward details for - * @param reward_id which reward should we lookup details on - * @param[out] total_authorized amount how high is the reward (with fees) - * @param[out] total_picked_up how much of the reward was so far picked up (with fees) - * @param[out] expiration set to when the reward expires - * @param[out] exchange_url set to the exchange URL where the reserve is - * @param[out] next_url set to the URL where the wallet should navigate to after getting the reward - * @param[out] reserve_priv set to private key of reserve to be debited - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*lookup_reward)(void *cls, - const char *instance_id, - const struct TALER_RewardIdentifierP *reward_id, - struct TALER_Amount *total_authorized, - struct TALER_Amount *total_picked_up, - struct GNUNET_TIME_Timestamp *expiration, - char **exchange_url, - char **next_url, - struct TALER_ReservePrivateKeyP *reserve_priv); - - - /** - * Lookup rewards - * - * @param cls closure, typically a connection to the db - * @param instance_id which instance should we lookup rewards for - * @param expired should we include expired rewards? - * @param limit maximum number of results to return, positive for - * ascending row id, negative for descending - * @param offset row id to start returning results from - * @param cb function to call with reward data - * @param cb_cls closure for @a cb - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*lookup_rewards)(void *cls, - const char *instance_id, - enum TALER_EXCHANGE_YesNoAll expired, - int64_t limit, - uint64_t offset, - TALER_MERCHANTDB_RewardsCallback cb, - void *cb_cls); - - - /** - * Lookup reward details for reward @a reward_id. - * - * @param cls closure, typically a connection to the db - * @param instance_id which instance should we lookup reward details for - * @param reward_id which reward should we lookup details on - * @param fpu should we fetch details about individual pickups - * @param[out] total_authorized amount how high is the reward (with fees) - * @param[out] total_picked_up how much of the reward was so far picked up (with fees) - * @param[out] justification why was the reward approved - * @param[out] expiration set to when the reward expires - * @param[out] reserve_pub set to which reserve is debited - * @param[out] pickups_length set to the length of @e pickups - * @param[out] pickups if @a fpu is true, set to details about the pickup operations - * @return transaction status - */ - enum GNUNET_DB_QueryStatus - (*lookup_reward_details)(void *cls, - const char *instance_id, - const struct TALER_RewardIdentifierP *reward_id, - bool fpu, - struct TALER_Amount *total_authorized, - struct TALER_Amount *total_picked_up, - char **justification, - struct GNUNET_TIME_Timestamp *expiration, - struct TALER_ReservePublicKeyP *reserve_pub, - unsigned int *pickups_length, - struct TALER_MERCHANTDB_PickupDetails **pickups); - - - /** - * Insert details about a reward pickup operation. The @a total_picked_up - * UPDATES the total amount under the @a reward_id, while the @a total_requested - * is the amount to be associated with this @a pickup_id. - * While there is usually only one pickup event that picks up the entire - * amount, our schema allows for wallets to pick up the amount incrementally - * over mulrewardle pick up operations. - * - * @param cls closure, typically a connection to the db - * @param reward_id the unique ID for the reward - * @param total_picked_up how much was picked up overall at this - * point (includes @a total_requested) - * @param pickup_id unique ID for the operation - * @param total_requested how much is being picked up in this operation - * @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 - (*insert_pickup)(void *cls, - const char *instance_id, - const struct TALER_RewardIdentifierP *reward_id, - const struct TALER_Amount *total_picked_up, - const struct TALER_PickupIdentifierP *pickup_id, - const struct TALER_Amount *total_requested); - - - /** - * Insert blind signature obtained from the exchange during a - * reward pickup operation. - * - * @param cls closure, typically a connection to the db - * @param pickup_id unique ID for the operation - * @param offset offset of the blind signature for the pickup - * @param blind_sig the blind signature - * @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 - (*insert_pickup_blind_signature)( - void *cls, - const struct TALER_PickupIdentifierP *pickup_id, - uint32_t offset, - const struct TALER_BlindedDenominationSignature *blind_sig); - - - /** * Lookup all of the templates the given instance has configured. * * @param cls closure |