diff options
Diffstat (limited to 'src/include/taler_merchant_service.h')
-rw-r--r-- | src/include/taler_merchant_service.h | 176 |
1 files changed, 174 insertions, 2 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index 263a6fec..057c9eff 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -34,7 +34,7 @@ /** * Library version (in hex) for compatibility tests. */ -#define TALER_MERCHANT_SERVICE_VERSION 0x00090403 +#define TALER_MERCHANT_SERVICE_VERSION 0x00100000 /** @@ -949,7 +949,7 @@ TALER_MERCHANT_instance_delete_cancel ( * @param arg request to cancel. */ #define TALER_MERCHANT_instance_purge_cancel(arg) \ - TALER_MERCHANT_instance_delete_cancel (arg) + TALER_MERCHANT_instance_delete_cancel (arg) /* *************** Accounts **************** */ @@ -1895,6 +1895,172 @@ TALER_MERCHANT_product_delete_cancel ( struct TALER_MERCHANT_ProductDeleteHandle *pdh); +/* ********************* /tokenfamilies ************************** */ + +/** + * Handle for a GET /tokenfamilies/$SLUG operation. + */ +struct TALER_MERCHANT_TokenFamilyGetHandle; + + +/** + * Response to GET /tokenfamilies/$SLUG operation. + */ +struct TALER_MERCHANT_TokenFamilyGetResponse +{ + /** + * HTTP response details + */ + struct TALER_MERCHANT_HttpResponse hr; + + /** + * Details depending on HTTP status. + */ + union + { + /** + * Details for #MHD_HTTP_OK. + */ + struct + { + + /** + * Identifier for the token family consisting of unreserved characters + * according to RFC 3986. + */ + const char *slug; + + /** + * Human-readable name for the token family. + */ + const char *name; + + /** + * description of the token family + */ + const char *description; + + /** + * Optional map from IETF BCP 47 language tags to localized descriptions. + */ + const json_t *description_i18n; + + /** + * Start time of the token family's validity period. + */ + struct GNUNET_TIME_Timestamp valid_after; + + /** + * End time of the token family's validity period. + */ + struct GNUNET_TIME_Timestamp valid_before; + + /** + * Validity duration of an issued token. + */ + struct GNUNET_TIME_Relative duration; + + /** + * Kind of token family, "subscription" or "discount". + */ + const char *kind; + + /** + * How many tokens have been issued for this family. + */ + uint64_t issued; + + /** + * How many tokens have been redeemed for this family. + */ + uint64_t redeemed; + } ok; + + } details; + +}; + +/** + * Cancel GET /tokenfamilies/$SLUG operation. + * + * @param handle operation to cancel + */ +void +TALER_MERCHANT_token_family_get_cancel ( + struct TALER_MERCHANT_TokenFamilyGetHandle *handle); + + +/** + * Function called with the result of the GET /tokenfamilies/$SLUG operation. + * + * @param cls closure + * @param pgr response details + */ +typedef void +(*TALER_MERCHANT_TokenFamilyGetCallback)( + void *cls, + const struct TALER_MERCHANT_TokenFamilyGetResponse *pgr); + +/** + * Handle for a POST /tokenfamilies operation. + */ +struct TALER_MERCHANT_TokenFamiliesPostHandle; + + +/** + * Function called with the result of the POST /tokenfamilies operation. + * + * @param cls closure + * @param hr HTTP response details + */ +typedef void +(*TALER_MERCHANT_TokenFamiliesPostCallback)( + void *cls, + const struct TALER_MERCHANT_HttpResponse *hr); + + +/** + * Make a POST /tokenfamilies request to add a token family to the + * merchant instance. + * + * @param ctx the context + * @param backend_url HTTP base URL for the backend + * @param slug short, url-safe identifier for the token family + * @param name human-readable name for the token family + * @param description description of the token family + * @param description_i18n Map from IETF BCP 47 language tags to localized descriptions + * @param valid_after when the token family becomes valid + * @param valid_before when the token family expires + * @param duration how long tokens issued by this token family are valid for + * @param kind kind of token family, "subscription" or "discount" + * @param cb function to call with the backend's result + * @param cb_cls closure for @a cb + * @return the request handle; NULL upon error + */ +struct TALER_MERCHANT_TokenFamiliesPostHandle * +TALER_MERCHANT_token_families_post ( + struct GNUNET_CURL_Context *ctx, + const char *backend_url, + const char *slug, + const char *name, + const char *description, + const json_t *description_i18n, + struct GNUNET_TIME_Timestamp valid_after, + struct GNUNET_TIME_Timestamp valid_before, + struct GNUNET_TIME_Relative duration, + const char *kind, + TALER_MERCHANT_TokenFamiliesPostCallback cb, + void *cb_cls); + +/** + * Cancel POST /tokenfamilies operation. + * + * @param handle operation to cancel + */ +void +TALER_MERCHANT_token_families_post_cancel ( + struct TALER_MERCHANT_TokenFamiliesPostHandle *handle); + /* ********************* /orders ************************** */ @@ -2664,6 +2830,12 @@ struct TALER_MERCHANT_OrderStatusResponse */ bool wired; + /** + * Time of the last payment made on this order. + * Only available if the server supports protocol + * **v14** or higher, otherwise zero. + */ + struct GNUNET_TIME_Timestamp last_payment; } paid; /** |