From 583c01c6224dd317f9665e623b02a32b74fdf74a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 1 May 2023 00:09:55 +0200 Subject: first rough cut at merchant update for #7810 (still with known bugs) --- src/include/taler_merchant_service.h | 133 +++++++++++++++++++++++++++++------ 1 file changed, 111 insertions(+), 22 deletions(-) (limited to 'src/include/taler_merchant_service.h') diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 30f65a0f..1135cb38 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -3268,22 +3268,58 @@ TALER_MERCHANT_transfers_get_cancel ( struct TALER_MERCHANT_PostReservesHandle; -// FIXME: change signature! +/** + * Response to a POST /reserves request. + */ +struct TALER_MERCHANT_PostReservesResponse +{ + /** + * HTTP response details. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on HTTP status. + */ + union + { + /** + * Response on #MHD_HTTP_OK. + */ + struct + { + /** + * Public key of the created reserve. + */ + struct TALER_ReservePublicKeyP reserve_pub; + + /** + * Accounts to credit to for filling the reserve. + * Array of accounts of the exchange. + */ + const struct TALER_EXCHANGE_WireAccount *accounts; + + /** + * Length of @e accounts array. + */ + unsigned int accounts_len; + + } ok; + } details; +}; + + /** * Callbacks of this type are used to work the result of submitting a * POST /reserves request to a merchant * * @param cls closure - * @param hr HTTP response details - * @param reserve_pub public key of the created reserve, NULL on error - * @param payto_uri where to make the payment to for filling the reserve, NULL on error + * @param prr response details */ typedef void (*TALER_MERCHANT_PostReservesCallback) ( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - const struct TALER_ReservePublicKeyP *reserve_pub, - const char *payto_uri); + const struct TALER_MERCHANT_PostReservesResponse *prr); /** @@ -3455,29 +3491,82 @@ struct TALER_MERCHANT_TipDetails }; -// FIXME: change signature! +/** + * Response to a GET /reserves/$ID request. + */ +struct TALER_MERCHANT_ReserveGetResponse +{ + /** + * HTTP response. + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on HTTP status. + */ + union + { + + /** + * Details on #MHD_HTTP_OK. + */ + struct + { + + /** + * reserve summary for the reserve + */ + struct TALER_MERCHANT_ReserveSummary rs; + + /** + * URL of the exchange hosting the reserve, NULL if not @a active + */ + const char *exchange_url; + + /** + * Accounts to credit to for filling the reserve. + * Array of accounts of the exchange. Empty if + * already filled. + */ + const struct TALER_EXCHANGE_WireAccount *accounts; + + /** + * Length of @e accounts array. + */ + unsigned int accounts_len; + + /** + * Array with details about the tips granted. + */ + const struct TALER_MERCHANT_TipDetails *tips; + + /** + * Length of the @e tips array + */ + unsigned int tips_length; + + /** + * Is this reserve active (false if it was deleted but not purged) + */ + bool active; + + } ok; + + } details; + +}; + + /** * Callback to process a GET /reserve/$RESERVE_PUB request * * @param cls closure - * @param hr HTTP response details - * @param rs reserve summary for the reserve, NULL on error - * @param active is this reserve active (false if it was deleted but not purged) - * @param exchange_url URL of the exchange hosting the reserve, NULL if not @a active - * @param payto_uri URI to fill the reserve, NULL if not @a active or already filled - * @param tips_length length of the @a reserves array - * @param tips array with details about the tips granted, NULL on error + * @param rgr response details */ typedef void (*TALER_MERCHANT_ReserveGetCallback) ( void *cls, - const struct TALER_MERCHANT_HttpResponse *hr, - const struct TALER_MERCHANT_ReserveSummary *rs, - bool active, - const char *exchange_url, - const char *payto_uri, - unsigned int tips_length, - const struct TALER_MERCHANT_TipDetails tips[]); + const struct TALER_MERCHANT_ReserveGetResponse *rgr); /** -- cgit v1.2.3