From b53957a8fd25bcce8eb98f71b6e9e711b48ce605 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: Sun, 18 Jul 2021 11:59:55 +0800 Subject: Insurance is not determined by user's decision It depends on some weight threshhold. --- anteraja.c | 8 ++++---- pikul.c | 6 +++--- pikul.h | 2 +- pikul.i | 6 +----- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/anteraja.c b/anteraja.c index 8c151ff..81b709a 100644 --- a/anteraja.c +++ b/anteraja.c @@ -100,7 +100,7 @@ void anteraja_order(const char *order_number, const char *service, const char *s const char *sender_phone, const char *origin, const char *sender_address, const char *sender_postal, const char *receiver_name, const char *receiver_phone, const char *destination, const char *receiver_address, const char *receiver_postal, - int nitems, char **items[], _Bool insurance, double subtotal, char **url, char **post) + int nitems, char **items[], double subtotal, char **url, char **post) { *url = malloc(strlen(shipping.base) + strlen(ORDER_PATH) + 1); sprintf(*url, "%s%s", shipping.base, ORDER_PATH); @@ -142,9 +142,9 @@ void anteraja_order(const char *order_number, const char *service, const char *s + strlen(receiver_postal) + strlen(json) + ORDER_INSURANCE + ORDER_SUBTOTAL - 15 * strlen("%s") - 2 * strlen("%d") + 1); sprintf(*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, insurance ? "true" : "false", - subtotal < 1000.0 ? 1000 :(int)subtotal); + 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); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, *post); } diff --git a/pikul.c b/pikul.c index ed11d9c..8d776a4 100644 --- a/pikul.c +++ b/pikul.c @@ -14,7 +14,7 @@ extern void anteraja_services(const char *, const char *, double, char **, char extern size_t anteraja_services_handle(const char *, size_t, size_t, struct pikul_services **); extern void anteraja_order(const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, - const char *, int, char **[], _Bool, double, char **, char **); + const char *, int, char **[], double, char **, char **); extern size_t anteraja_order_handle(const char *, size_t size, size_t nmemb, char **); extern void anteraja_cleanup(); @@ -115,7 +115,7 @@ char *pikul_order(const char *order_number, const char *service, const char *sen const char *sender_phone, const char *origin, const char *sender_address, const char *sender_postal, const char *receiver_name, const char *receiver_phone, const char *destination, const char *receiver_address, const char *receiver_postal, - int nitems, char **items[], _Bool insurance, double subtotal) + int nitems, char **items[], double subtotal) { char *tracking_number = NULL; curl_easy_setopt(curl, CURLOPT_WRITEDATA, &tracking_number); @@ -127,7 +127,7 @@ char *pikul_order(const char *order_number, const char *service, const char *sen anteraja_order(order_number, service, sender_name, sender_phone, origin, sender_address, sender_postal, receiver_name, receiver_phone, destination, receiver_address, receiver_postal, nitems, items, - insurance, subtotal, &url, &post); + subtotal, &url, &post); handler = anteraja_order_handle; break; default: diff --git a/pikul.h b/pikul.h index 07db738..fde0483 100644 --- a/pikul.h +++ b/pikul.h @@ -29,7 +29,7 @@ char *pikul_order(const char *order_number, const char *service, const char *sen const char *sender_phone, const char *origin, const char *sender_address, const char *sender_postal, const char *receiver_name, const char *receiver_phone, const char *destination, const char *receiver_address, const char *receiver_postal, - int nitems, char **items[], _Bool insurance, double subtotal); + int nitems, char **items[], double subtotal); void pikul_cleanup(); #ifdef __cplusplus diff --git a/pikul.i b/pikul.i index e2938ac..331cfcb 100644 --- a/pikul.i +++ b/pikul.i @@ -41,14 +41,10 @@ free($1); } -%typemap(in) _Bool { - $1 = $input; -} - %rename("%(strip:[pikul_])s") ""; void pikul_init(enum pikul_company, char *[]); double pikul_cost(const char *, const char *, double, const char *); char *pikul_order(const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, const char *, int, - char **[], _Bool, double); + char **[], double); void pikul_cleanup(); -- cgit v1.2.3