summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-31 17:13:43 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2023-03-31 17:13:43 +0800
commita5a01231f31b56d1e5a7594cef32cdfdcfdc4b04 (patch)
tree50635ec2e40d51cf1fb74c6c2c7a0d6382ff3a6d
parent7b755e138c71a733e58e2c18c79d32343574ec8b (diff)
Function for removing an item from the cart
-rw-r--r--interchange/ord.h9
-rw-r--r--ord.c9
2 files changed, 18 insertions, 0 deletions
diff --git a/interchange/ord.h b/interchange/ord.h
index 8407704..dffd902 100644
--- a/interchange/ord.h
+++ b/interchange/ord.h
@@ -38,6 +38,15 @@ void interchange_ord_order(const char *sku,
void (*handler)(interchange_response *));
/*!
+ * \brief For removing an item from a cart.
+ * \param name The name given, in the cart, to the item.
+ * \param nextpage The page to expect response from, whatever the result is.
+ * \param parser Function for parsing the formatted response.
+ */
+void interchange_ord_remove(const char *name, const char *nextpage,
+ void (*parser)(interchange_response *));
+
+/*!
* \brief For checking out items in the cart.
* \param order_profile The order profile/method.
* \param member The member checking out.
diff --git a/ord.c b/ord.c
index 38a6aba..1dd8994 100644
--- a/ord.c
+++ b/ord.c
@@ -11,6 +11,15 @@ void interchange_ord_order(const char *sku,
request(handler, NULL, NULL, "%s%s", "order?mv_arg=", sku);
}
+void interchange_ord_remove(const char *name, const char *nextpage,
+ void (*parser)(interchange_response *))
+{
+ request(parser, NULL, &(struct body){ 1 + (nextpage ? 1 : 0), {
+ { name, "0" },
+ { "mv_nextpage", nextpage }
+ }}, "%s", "process");
+}
+
void interchange_ord_checkout(const char *order_profile,
struct interchange_member member,
void (*handler)(interchange_response *))