forked from muh-hizbe/go-biteship
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtracking.go
32 lines (23 loc) · 852 Bytes
/
tracking.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package biteship
import (
"fmt"
"net/http"
)
func (bite *BiteshipImpl) TrackingOrder(orderId string) (*ResponseTrackingOrder, *Error) {
resp := &ResponseTrackingOrder{}
var url = fmt.Sprintf("%s/v1/trackings/%s", bite.Config.BiteshipUrl, orderId)
errRequest := bite.HttpRequest.Call(http.MethodGet, url, bite.Config.SecretKey, nil, resp)
if errRequest != nil {
return resp, errRequest
}
return resp, nil
}
func (bite *BiteshipImpl) TrackingOrderByWaybill(waybillId string, courierCode string) (*ResponseTrackingOrder, *Error) {
resp := &ResponseTrackingOrder{}
var url = fmt.Sprintf("%s/v1/trackings/%s/couriers/%s", bite.Config.BiteshipUrl, waybillId, courierCode)
errRequest := bite.HttpRequest.Call(http.MethodGet, url, bite.Config.SecretKey, nil, resp)
if errRequest != nil {
return resp, errRequest
}
return resp, nil
}