-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbiteship.go
39 lines (29 loc) · 1.11 KB
/
biteship.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
33
34
35
36
37
38
39
package biteship
import "github.com/go-playground/validator/v10"
var validate *validator.Validate
type Biteship interface {
GetCourier() (*ResponseListCourier, *Error)
GetRatesCouriers(request *RequestCourierRates) (*ResponseListRatesCouriers, *Error)
CreateOrder(request *CreateOrderRequestParam) (*ResponseCreateOrder, *Error)
RetrieveOrder(orderId string) (*ResponseRetrieveOrder, *Error)
UpdateOrder(orderId string, request interface{}) (*ResponseCreateOrder, *Error)
ConfirmOrder(orderId string) (*ResponseCreateOrder, *Error)
CancelOrder(orderId string, reason string) (*ResponseCancelOrder, *Error)
TrackingOrder(orderId string) (*ResponseTrackingOrder, *Error)
TrackingOrderByWaybill(waybillId string, courierCode string) (*ResponseTrackingOrder, *Error)
}
type BiteshipImpl struct {
Config *ConfigOption
HttpRequest *HttpRequestImpl
}
func New(key string, config ...ConfigOption) Biteship {
defaultConfig := DefaultConfig(key)
if len(config) > 0 {
defaultConfig = &config[0]
defaultConfig.SecretKey = key
}
//fmt.Println(defaultConfig)
return &BiteshipImpl{
Config: defaultConfig,
}
}