diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-05-14 16:12:41 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2023-05-14 16:12:41 +0800 |
commit | 33c252c6b2f509b6420c24d610dd99a15cda5593 (patch) | |
tree | 62baab36017d868d455029181a290da07bdec88a /ord.c | |
parent | 8899052cef9b4e8d2682279ab9bc2d3ae09cb0ce (diff) |
Order can differentiate variant SKU from product
Diffstat (limited to 'ord.c')
-rw-r--r-- | ord.c | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -6,10 +6,23 @@ #include "interchange/member.h" #include "interchange/ord.h" -void interchange_ord_order(const char *sku, - void (*handler)(interchange_response *)) +void interchange_ord_order(const char *sku, const char *item, + const unsigned int quantity, + void (*parser)(interchange_response *)) { - request(handler, NULL, NULL, "%s%s", "order?mv_arg=", sku); + size_t length = 0; + unsigned int qty = quantity; + do { + length++; + } while ((qty /= 10)); + char qty_str[length + 1]; + sprintf(qty_str, "%d", quantity); + request(parser, NULL, &(struct body){ 4, { + { "mv_action", "refresh" }, + { "mv_sku", sku }, + { "mv_order_item", item }, + { "mv_order_quantity", qty_str } + }}, "%s", "ord/basket"); } void interchange_ord_update(const char *name, const unsigned int quantity, |