diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-25 11:48:32 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-07-25 11:48:32 +0800 |
commit | 017f4c4312444c1ba386d6e0f6192fdc40f03c01 (patch) | |
tree | 3cf9ff0db673e3990363a3f154bf3df02d02fbc3 /sicepat.c | |
parent | 6e7d2c8ef7394e31f18b7193fb1957d3242c72aa (diff) |
Origin & destination info retrieval implementations
Diffstat (limited to 'sicepat.c')
-rw-r--r-- | sicepat.c | 42 |
1 files changed, 42 insertions, 0 deletions
@@ -3,6 +3,8 @@ #include "private.h" #define BASE "http://api.sicepat.com/customer/" +#define ORIGINS "origin" +#define DESTINATIONS "destination" const char **sicepat_init(char *provisions[]) { @@ -20,6 +22,46 @@ const char **sicepat_init(char *provisions[]) return fields; } +const char **sicepat_origins() +{ + struct shipping *shipping = shipping_list[PIKUL_SICEPAT]; + shipping->url = malloc(strlen(BASE) + strlen(ORIGINS) + 1); + sprintf(shipping->url, "%s%s", BASE, ORIGINS); + static const char *trail[] = { + "sicepat", + "results", + NULL + }; + shipping->trail = trail; + static const char *attributes[] = { + "origin_code", + NULL, + "origin_name", + NULL + }; + return attributes; +} + +const char **sicepat_destinations() +{ + struct shipping *shipping = shipping_list[PIKUL_SICEPAT]; + shipping->url = malloc(strlen(BASE) + strlen(DESTINATIONS) + 1); + sprintf(shipping->url, "%s%s", BASE, DESTINATIONS); + static const char *trail[] = { + "sicepat", + "results", + NULL + }; + shipping->trail = trail; + static const char *attributes[] = { + "destination_code", + "subdistrict", + "city", + "province" + }; + return attributes; +} + const char **sicepat_services(const char *origin, const char *destination, double weight) { struct shipping *shipping = shipping_list[PIKUL_SICEPAT]; |