summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-17 11:05:19 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-07-17 11:05:19 +0800
commitdfa57092e26c242c2ab64dc1d029e5dff44eee67 (patch)
tree420bb28a358dfb288f2f491a25af5709bf4990c5
parent3eb347f32335a58c681d1777dfeef8c6dc1c76d5 (diff)
Rename trx_id to order_number
-rw-r--r--anteraja.c8
-rw-r--r--pikul.c8
-rw-r--r--pikul.h2
-rw-r--r--pikul.i2
4 files changed, 10 insertions, 10 deletions
diff --git a/anteraja.c b/anteraja.c
index 65f7206..b49c07c 100644
--- a/anteraja.c
+++ b/anteraja.c
@@ -94,7 +94,7 @@ size_t anteraja_services_handle(const char *contents, size_t size, size_t nmemb,
return realsize;
}
-void anteraja_order(const char *trx_id, const char *service, const char *sender_name,
+void anteraja_order(const char *order_number, const char *service, const char *sender_name,
const char *sender_phone, const char *origin, const char *sender_address,
const char *receiver_name, const char *receiver_phone, const char *destination,
const char *receiver_address, int nitems, char **items[], _Bool insurance, double subtotal,
@@ -128,13 +128,13 @@ void anteraja_order(const char *trx_id, const char *service, const char *sender_
else
json[strlen(json)] = '\0';
}
- *post = malloc(strlen(ORDER_POST) + strlen(prefix) + strlen(trx_id) + strlen(service)
+ *post = malloc(strlen(ORDER_POST) + strlen(prefix) + strlen(order_number) + strlen(service)
+ ORDER_WEIGHT + strlen(sender_name) + strlen(sender_phone) + strlen(origin)
+ strlen(sender_address) + strlen(receiver_name) + strlen(receiver_phone)
+ strlen(destination) + strlen(receiver_address) + strlen(json) + ORDER_INSURANCE
+ ORDER_SUBTOTAL - 13 * strlen("%s") - 2 * strlen("%d") + 1);
- sprintf(*post, ORDER_POST, prefix, trx_id, service, (int)total_weight, sender_name, sender_phone,
- origin, sender_address, receiver_name, receiver_phone, destination,
+ sprintf(*post, ORDER_POST, prefix, order_number, service, (int)total_weight, sender_name,
+ sender_phone, origin, sender_address, receiver_name, receiver_phone, destination,
receiver_address, json, insurance ? "true" : "false", (int)subtotal);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, *post);
}
diff --git a/pikul.c b/pikul.c
index a08b101..5f04136 100644
--- a/pikul.c
+++ b/pikul.c
@@ -112,7 +112,7 @@ double pikul_cost(const char *origin, const char *destination, double weight, co
return cost;
}
-char *pikul_order(const char *trx_id, const char *service, const char *sender_name,
+char *pikul_order(const char *order_number, const char *service, const char *sender_name,
const char *sender_phone, const char *origin, const char *sender_address,
const char *receiver_name, const char *receiver_phone, const char *destination,
const char *receiver_address, int nitems, char **items[], _Bool insurance, double subtotal)
@@ -123,9 +123,9 @@ char *pikul_order(const char *trx_id, const char *service, const char *sender_na
size_t (*handler)(const char *, size_t, size_t, char **);
switch (shipping.company) {
case PIKUL_ANTERAJA:
- anteraja_order(trx_id, service, sender_name, sender_phone, origin, sender_address,
- receiver_name, receiver_phone, destination, receiver_address,
- nitems, items, insurance, subtotal, &url, &post);
+ anteraja_order(order_number, service, sender_name, sender_phone, origin,
+ sender_address, receiver_name, receiver_phone, destination,
+ receiver_address, nitems, items, insurance, subtotal, &url, &post);
handler = anteraja_order_handle;
break;
default:
diff --git a/pikul.h b/pikul.h
index e2c6331..623c87a 100644
--- a/pikul.h
+++ b/pikul.h
@@ -25,7 +25,7 @@ void pikul_init(enum pikul_company company, char *provisions[]);
struct pikul_services *pikul_services(const char *origin, const char *destination, double weight);
void pikul_free_services(struct pikul_services *services);
double pikul_cost(const char *origin, const char *destination, double weight, const char *service);
-char *pikul_order(const char *trx_id, const char *service, const char *sender_name,
+char *pikul_order(const char *order_number, const char *service, const char *sender_name,
const char *sender_phone, const char *origin, const char *sender_address,
const char *receiver_name, const char *receiver_phone, const char *destination,
const char *receiver_address, int nitems, char **items[], _Bool insurance, double subtotal);
diff --git a/pikul.i b/pikul.i
index e2d363f..9defe86 100644
--- a/pikul.i
+++ b/pikul.i
@@ -48,7 +48,7 @@
%rename("%(strip:[pikul_])s") "";
void pikul_init(enum pikul_company company, char *provisions[]);
double pikul_cost(const char *origin, const char *destination, double weight, const char *service);
-char *pikul_order(const char *trx_id, const char *service, const char *sender_name,
+char *pikul_order(const char *order_number, const char *service, const char *sender_name,
const char *sender_phone, const char *origin, const char *sender_address,
const char *receiver_name, const char *receiver_phone, const char *destination,
const char *receiver_address, int nitems, char **items[], _Bool insurance, double subtotal);