From ba54930b22390f34ca9a445753c5ed8acde17549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sat, 17 Jul 2021 22:47:56 +0800 Subject: Correct previous commit --- anteraja.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'anteraja.c') diff --git a/anteraja.c b/anteraja.c index a3bc1c3..422b2d0 100644 --- a/anteraja.c +++ b/anteraja.c @@ -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) -- cgit v1.2.3