diff options
-rw-r--r-- | anteraja.c | 10 | ||||
-rw-r--r-- | pikul.c | 6 | ||||
-rw-r--r-- | pikul.h | 2 | ||||
-rw-r--r-- | pikul.i | 2 |
4 files changed, 11 insertions, 9 deletions
@@ -31,9 +31,11 @@ \"items\":[\ %s\ ],\ +\"use_insurance\":%s,\ \"declared_value\":%d\ }" #define ORDER_WEIGHT 5 +#define ORDER_INSURANCE strlen("false") #define ORDER_SUBTOTAL 9 #define ORDER_ITEM \ @@ -95,7 +97,7 @@ size_t anteraja_services_handle(const char *contents, size_t size, size_t nmemb, void anteraja_order(const char *trx_id, 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[], double subtotal, + const char *receiver_address, int nitems, char **items[], _Bool insurance, double subtotal, char **url, char **post) { *url = malloc(strlen(shipping.base) + strlen(ORDER_PATH) + 1); @@ -129,11 +131,11 @@ void anteraja_order(const char *trx_id, const char *service, const char *sender_ *post = malloc(strlen(ORDER_POST) + strlen(prefix) + strlen(trx_id) + 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_SUBTOTAL - - 12 * strlen("%s") - 2 * strlen("%d") + 1); + + 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, - receiver_address, json, (int)subtotal); + receiver_address, json, insurance ? "true" : "false", (int)subtotal); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, *post); } @@ -15,7 +15,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 *, int, - char **[], double, char **, char **); + char **[], _Bool, 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 @@ double pikul_cost(const char *origin, const char *destination, double weight, co char *pikul_order(const char *trx_id, 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[], double subtotal) + const char *receiver_address, int nitems, char **items[], _Bool insurance, double subtotal) { curl_easy_setopt(curl, CURLOPT_WRITEDATA, &waybill); char *url; @@ -125,7 +125,7 @@ char *pikul_order(const char *trx_id, const char *service, const char *sender_na case PIKUL_ANTERAJA: anteraja_order(trx_id, service, sender_name, sender_phone, origin, sender_address, receiver_name, receiver_phone, destination, receiver_address, - nitems, items, subtotal, &url, &post); + nitems, items, insurance, subtotal, &url, &post); handler = anteraja_order_handle; break; default: @@ -28,7 +28,7 @@ double pikul_cost(const char *origin, const char *destination, double weight, co char *pikul_order(const char *trx_id, 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[], double subtotal); + const char *receiver_address, int nitems, char **items[], _Bool insurance, double subtotal); void pikul_cleanup(); #ifdef __cplusplus @@ -24,5 +24,5 @@ double pikul_cost(const char *origin, const char *destination, double weight, co char *pikul_order(const char *trx_id, 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[], double subtotal); + const char *receiver_address, int nitems, char **items[], _Bool insurance, double subtotal); void pikul_cleanup(); |