summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-19 19:06:13 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-19 19:06:13 +0800
commitacd4ab68d1f9521983390bfff88dce3980633038 (patch)
tree3bf2b8d9e6be3237c09c8ba63473fc1b8371cf1d
parent3533297ec2cf539672a362ff931d0b15c9cb38ff (diff)
parent0f4b2281ee59811e72a9975dd019891eb334683e (diff)
Merge branch 'master' into sicepat
-rw-r--r--anteraja.c9
-rw-r--r--pikul.c7
2 files changed, 10 insertions, 6 deletions
diff --git a/anteraja.c b/anteraja.c
index 87438dd..a2e4562 100644
--- a/anteraja.c
+++ b/anteraja.c
@@ -138,10 +138,11 @@ void anteraja_order(const char *order_number, const char *service, const char *s
+ strlen(receiver_phone) + strlen(destination) + strlen(receiver_address)
+ strlen(receiver_postal) + strlen(json) + ORDER_INSURANCE + ORDER_SUBTOTAL
- 15 * strlen("%s") - 2 * strlen("%d") + 1);
- sprintf(shipping.post, ORDER_POST, prefix, order_number, service, (int)total_weight, sender_name,
- sender_phone, origin, sender_address, sender_postal, receiver_name, receiver_phone,
- destination, receiver_address, receiver_postal, json,
- total_weight < 1000.0 ? "true" : "false", subtotal < 1000.0 ? 1000 : (int)subtotal);
+ sprintf(shipping.post, ORDER_POST, prefix, order_number, service,
+ total_weight < 1000.0 ? 1000 : (int)total_weight, sender_name, sender_phone,
+ origin, sender_address, sender_postal, receiver_name, receiver_phone, destination,
+ receiver_address, receiver_postal, json, total_weight < 1000.0 ? "true" : "false",
+ subtotal < 1000.0 ? 1000 : (int)subtotal);
static const char *trail[] = {
"content",
"waybill_no",
diff --git a/pikul.c b/pikul.c
index dfb6af8..452a3e4 100644
--- a/pikul.c
+++ b/pikul.c
@@ -220,9 +220,12 @@ char *pikul_order(const char *order_number, const char *service, const char *sen
break;
}
curl_easy_setopt(curl, CURLOPT_URL, shipping.url);
- if (shipping.post)
+ if (shipping.post) {
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, shipping.post);
- else
+#ifdef DEBUG
+ fprintf(stderr, "POST: %s\n", shipping.post);
+#endif
+ } else
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
shipping.mode = ORDER;
curl_easy_perform(curl);