summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--interchange/ord.h13
-rw-r--r--ord.c6
2 files changed, 16 insertions, 3 deletions
diff --git a/interchange/ord.h b/interchange/ord.h
index c62bcf0..22bf81e 100644
--- a/interchange/ord.h
+++ b/interchange/ord.h
@@ -27,7 +27,18 @@ extern "C" {
*/
void interchange_ord_order(const char *sku, const struct interchange_catalog *catalog,
struct interchange_ord_order **order);
-void interchange_ord_checkout(const struct interchange_ord_order *order, const struct interchange_member *member);
+
+/*!
+ * \brief For checking out items in the cart.
+ * \param order The order to be checked out.
+ * \param member The member checking out.
+ * \param handler A pointer to the function when a custom handler is needed to
+ * arrange the data into the product.
+*/
+void interchange_ord_checkout(const struct interchange_ord_order *order,
+ const struct interchange_member *member,
+ void (*handler)(interchange_response *));
+
void interchange_ord_free(struct interchange_ord_order *order);
#ifdef __cplusplus
diff --git a/ord.c b/ord.c
index 5d2265a..615aedb 100644
--- a/ord.c
+++ b/ord.c
@@ -61,9 +61,11 @@ void interchange_ord_order(const char *sku, const struct interchange_catalog *ca
request(NULL, NULL, NULL, "%s%s", "order?mv_arg=", sku);
}
-void interchange_ord_checkout(const struct interchange_ord_order *order, const struct interchange_member *member)
+void interchange_ord_checkout(const struct interchange_ord_order *order,
+ const struct interchange_member *member,
+ void (*handler)(interchange_response *))
{
- request(NULL, NULL, &(struct body){ 14, {
+ request(handler, NULL, &(struct body){ 14, {
{ "mv_todo", "submit" },
{ "mv_action", "refresh" },
{ "mv_order_profile", order->profile },