From 280bbb526c245ac69762e989816cb4c4848cd22c Mon Sep 17 00:00:00 2001 From: Jonathan Buchanan Date: Mon, 10 Aug 2020 16:10:52 -0400 Subject: implement parse refund uri (untested) & add more tests for pay uri --- src/include/taler_merchant_service.h | 54 ++++++++++++++++++++++++++++-------- 1 file changed, 43 insertions(+), 11 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 b33941aa..17d0f16f 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -196,23 +196,55 @@ TALER_MERCHANT_parse_pay_uri_free ( struct TALER_MERCHANT_PayUriData *parse_data); +/** + * Contains information gathered from parsing a taler://refund URI. + */ +struct TALER_MERCHANT_RefundUriData +{ + /** + * Hostname (and possibly port) of the merchant. + */ + char *merchant_host; + + /** + * Prefix to the base url of the merchant backend. May be NULL. + */ + char *merchant_prefix_path; + + /** + * The id of the order to pay. + */ + char *order_id; + + /** + * A WLAN SSID that the wallet can use to connect to the internet in order to + * to pay. May be NULL. + */ + char *ssid; +}; + + /** * Extracts information from a taler://refund URI. * * @param refund_uri the URI to parse. - * @param[out] merchant_host the hostname of the merchant. - * @param[out] merchant_prefix_path prefix of the base URL - * (NULL if not present). - * @param[out] order_id the id of the order to pay. - * @param[out] ssid the ssid for internet connectivity (NULL if not present). - * @return GNUNET_OK on success, GNUNET_SYSERR otherwise. + * @param[out] parse_data data extracted from the URI. Must be free'd. + * @return GNUNET_SYSERR if @e refund_uri is malformed, GNUNET_OK otherwise. */ int -TALER_MERCHANT_parse_refund_uri (const char *refund_uri, - const char **merchant_host, - const char **merchant_prefix_path, - const char **order_id, - const char **ssid); +TALER_MERCHANT_parse_refund_uri ( + const char *refund_uri, + struct TALER_MERCHANT_RefundUriData *parse_data); + + +/** + * Frees data contained in the result of parsing a taler://refund URI. + * + * @param parse_data the data to free. + */ +void +TALER_MERCHANT_parse_refund_uri_free ( + struct TALER_MERCHANT_RefundUriData *parse_data); /* ********************* /public/config ****************** */ -- cgit v1.2.3