diff options
author | Christian Grothoff <christian@grothoff.org> | 2020-05-19 22:34:18 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2020-05-19 22:34:27 +0200 |
commit | 9af93eeae2a1fcd9eddf22e9ebeb7ad0aeb34505 (patch) | |
tree | 8e78be032d6ba3c0cde7b9452f3e7c48b7cb6046 /src/include | |
parent | 601abc17e4d63fed52de91402c15bb4d9ba3e014 (diff) | |
download | merchant-9af93eeae2a1fcd9eddf22e9ebeb7ad0aeb34505.tar.gz merchant-9af93eeae2a1fcd9eddf22e9ebeb7ad0aeb34505.tar.bz2 merchant-9af93eeae2a1fcd9eddf22e9ebeb7ad0aeb34505.zip |
expanding DB API
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 066c2b2d..f04f8736 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -454,6 +454,84 @@ typedef void bool confirmed); +/** + * 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 tips that were picked up from this reserve + * @param committed_amount total of tips 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_Absolute creation_time, + struct GNUNET_TIME_Absolute 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); + + +/** + * Details about a tip. + */ +struct TALER_MERCHANTDB_TipDetails +{ + /** + * ID of the tip. + */ + struct GNUNET_HashCode tip_id; + + /** + * Total amount of the tip. + */ + struct TALER_Amount total_amount; + + /** + * Reason given for granting the tip. + */ + char *reason; +}; + + +/** + * 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 pickup_amount total of tips that were picked up from this reserve + * @param committed_amount total of tips that the merchant committed to, but that were not + * picked up yet + * @param tips_length length of the @a tips array + * @param tips information about the tips created by this reserve + */ +typedef void +(*TALER_MERCHANTDB_ReserveDetailsCallback)( + void *cls, + struct GNUNET_TIME_Absolute creation_time, + struct GNUNET_TIME_Absolute 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, + unsigned int tips_length, + const struct TALER_MERCHANTDB_TipDetails *tips); + + /* **************** OLD: ******************** */ /** @@ -1482,6 +1560,76 @@ struct TALER_MERCHANTDB_Plugin const struct TALER_Amount *initial_balance, struct GNUNET_TIME_Absolute expiration); + + /** + * 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_Absolute created_after, + enum TALER_MERCHANTDB_YesNoAll active, + enum TALER_MERCHANTDB_YesNoAll failures, + TALER_MERCHANTDB_ReservesCallback 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_tips if true, also return information about tips + * @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_tips, + 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 tips 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); + + /* ****************** OLD API ******************** */ |