From 0eb10b52c3a65770617d391ebdf0596e845718ce Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 28 May 2023 23:00:37 +0200 Subject: implement new account api in libtalermerchant (for #7824) --- src/include/taler_merchant_service.h | 124 ++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 1 deletion(-) (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 33ef033f..114811be 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -480,7 +480,7 @@ struct TALER_MERCHANT_InstancesPostHandle; /** - * Function called with the result of the GET /instances/$ID operation. + * Function called with the result of the POST /instances/$ID operation. * * @param cls closure * @param hr HTTP response data @@ -570,6 +570,128 @@ TALER_MERCHANT_instances_post_cancel ( struct TALER_MERCHANT_InstancesPostHandle *iph); +/** + * Handle for a POST /instances/$ID/account operation. + */ +struct TALER_MERCHANT_AccountPostHandle; + + +/** + * Response for a POST /instances/$ID/account operation. + */ +struct TALER_MERCHANT_AccountPostResponse +{ + /** + * HTTP response data + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +/** + * Function called with the result of the POST /instances/$ID/account operation. + * + * @param cls closure + * @param par response data + */ +typedef void +(*TALER_MERCHANT_AccountPostCallback)( + void *cls, + const struct TALER_MERCHANT_AccountPostResponse *par); + + +/** + * Setup an new account for an instance in the backend. + * + * @param ctx the context + * @param backend_url HTTP base URL for the backend + * @param account the bank accounts to add to the merchant instance + * @param auth_token authentication token to use for access control, NULL for external auth; MUST follow RFC 8959 + * @param cb function to call with the response + * @param cb_cls closure for @a config_cb + * @return the instances handle; NULL upon error + */ +struct TALER_MERCHANT_AccountPostHandle * +TALER_MERCHANT_account_post ( + struct GNUNET_CURL_Context *ctx, + const char *backend_url, + const struct TALER_MERCHANT_AccountConfig *account, + TALER_MERCHANT_AccountPostCallback cb, + void *cb_cls); + + +/** + * Cancel /account request. Must not be called by clients after + * the callback was invoked. + * + * @param pah request to cancel. + */ +void +TALER_MERCHANT_account_post_cancel ( + struct TALER_MERCHANT_AccountPostHandle *pah); + + +/** + * Handle for a DELETE /instances/$ID/account/$H_WIRE operation. + */ +struct TALER_MERCHANT_AccountDeleteHandle; + + +/** + * Response for a DELETE /instances/$ID/account operation. + */ +struct TALER_MERCHANT_AccountDeleteResponse +{ + /** + * HTTP response data + */ + struct TALER_MERCHANT_HttpResponse hr; +}; + + +/** + * Function called with the result of the DELETE /instances/$ID/account/$H_WIRE operation. + * + * @param cls closure + * @param par response data + */ +typedef void +(*TALER_MERCHANT_AccountDeleteCallback)( + void *cls, + const struct TALER_MERCHANT_AccountDeleteResponse *par); + + +/** + * Remove bank account from an instance in the backend. + * + * @param ctx the context + * @param backend_url HTTP base URL for the backend + * @param h_wire wire hash of the bank accounts to delete + * @param auth_token authentication token to use for access control, NULL for external auth; MUST follow RFC 8959 + * @param cb function to call with the response + * @param cb_cls closure for @a config_cb + * @return the instances handle; NULL upon error + */ +struct TALER_MERCHANT_AccountDeleteHandle * +TALER_MERCHANT_account_delete ( + struct GNUNET_CURL_Context *ctx, + const char *backend_url, + const struct TALER_MerchantWireHashP *h_wire, + TALER_MERCHANT_AccountDeleteCallback cb, + void *cb_cls); + + +/** + * Cancel /account request. Must not be called by clients after + * the callback was invoked. + * + * @param pah request to cancel. + */ +void +TALER_MERCHANT_account_delete_cancel ( + struct TALER_MERCHANT_AccountDeleteHandle *pah); + + /** * Handle for a PATCH /instances/$ID operation. */ -- cgit v1.2.3