diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-17 22:47:56 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-17 22:47:56 +0800 |
commit | ba54930b22390f34ca9a445753c5ed8acde17549 (patch) | |
tree | 67a786543b6a7037d0ab185265236ee6713b1d22 | |
parent | e9e2ea78fa012e909aff1b0f0838c321e496fb67 (diff) |
Correct previous commit
-rw-r--r-- | anteraja.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -113,6 +113,8 @@ void anteraja_order(const char *order_number, const char *service, const char *s + strlen(","); char item[length + 1]; int quantity = atoi(items[i][QUANTITY]); + if (quantity > 1) + nitems -= quantity - 1; double price = atof(items[i][PRICE]); if (price < 1000.0) price = 1000.0; @@ -132,7 +134,6 @@ void anteraja_order(const char *order_number, const char *service, const char *s strcat(json, ","); else json[strlen(json)] = '\0'; - i += quantity - 1; } *post = malloc(strlen(ORDER_POST) + strlen(prefix) + strlen(order_number) + strlen(service) + ORDER_WEIGHT + strlen(sender_name) + strlen(sender_phone) + strlen(origin) @@ -145,6 +146,7 @@ void anteraja_order(const char *order_number, const char *service, const char *s destination, receiver_address, receiver_postal, json, insurance ? "true" : "false", subtotal < 1000.0 ? 1000 :(int)subtotal); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, *post); + printf("POST: %s\n", *post); } size_t anteraja_order_handle(const char *contents, size_t size, size_t nmemb, char **tracking_number) |