21 lines
895 B
Bash
Executable file
21 lines
895 B
Bash
Executable file
#!/bin/bash
|
|
if ! session_verify ${cookies[sh_session]}; then
|
|
exit 0
|
|
fi
|
|
|
|
source "${cfg[namespace]}/code/common.sh"
|
|
|
|
data=$(curl -s -X POST -H "$(get_auth_string)" -H "Content-type: application/json" "https://api-inmobile-pl.easypack24.net/v1/collect/validate" --data '{"geoPoint":{"accuracy":"1","latitude":"'${post_data[lat]}'","longitude":"'${post_data[lon]}'"},"parcel":{"openCode":"'${post_data[openCode]}'","shipmentNumber":"'${post_data[id]}'"}}')
|
|
|
|
if [[ $(echo $data | jq .status) == "403" ]]; then
|
|
echo $data | jq "{status: .status, msg: .error}"
|
|
else
|
|
uuid=$(echo $data | jq -r ".sessionUuid")
|
|
data=$(curl -X POST -H "$(get_auth_string)" "https://api-inmobile-pl.easypack24.net/v1/collect/compartment/open/$uuid")
|
|
if [[ $(echo $data | jq ".compartment") != "" ]]; then
|
|
echo $data
|
|
else
|
|
jq -n '{status: $ARGS.positional[0], msg: $ARGS.positional[1]}' --args -1 "emptyPage"
|
|
fi
|
|
fi
|