-
Notifications
You must be signed in to change notification settings - Fork 1
/
response.go
213 lines (195 loc) · 8.08 KB
/
response.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
package biteship
import "net/http"
type ResponseWithMap map[string]interface{}
type Shipper struct {
Name string `json:"name"`
Email string `json:"email"`
Phone string `json:"phone"`
Organization string `json:"organization"`
}
type Origin struct {
Coordinate Coordinate `json:"coordinate"`
PostalCode uint `json:"postal_code"`
ContactName string `json:"contact_name"`
ContactPhone string `json:"contact_phone"`
Address string `json:"address"`
Note string `json:"note"`
}
type Destination struct {
Coordinate Coordinate `json:"coordinate"`
PostalCode uint `json:"postal_code"`
ContactName string `json:"contact_name"`
ContactPhone string `json:"contact_phone"`
ContactEmail string `json:"contact_email"`
Address string `json:"address,omitempty"`
Location string `json:"location,omitempty"`
Note string `json:"note"`
}
type Courier struct {
TrackingId *string `json:"tracking_id"`
WaybillId *string `json:"waybill_id"`
Company string `json:"company"`
Name *string `json:"name"`
Phone *string `json:"phone"`
Type string `json:"type"`
Link *string `json:"link"`
Status *string `json:"status,omitempty"`
History []struct {
ServiceType string `json:"service_type"`
Status string `json:"status"`
Note string `json:"note"`
UpdatedAt string `json:"updated_at"`
} `json:"history,omitempty"`
}
type ResponseCreateOrder struct {
Success bool `json:"success"`
Message string `json:"message"`
Object string `json:"object"`
Id string `json:"id"`
Shipper Shipper `json:"shipper"`
Origin Origin `json:"origin"`
Destination Destination `json:"destination"`
Courier Courier `json:"courier"`
Items []ProductItem `json:"items"`
Price uint `json:"price"`
Note string `json:"note"`
Status string `json:"status"`
}
type Delivery struct {
Type string `json:"type"`
Datetime string `json:"datetime"`
Note *string `json:"note"`
}
// ResponseRetrieveOrder RESPONSE RETRIEVE ORDER
type ResponseRetrieveOrder struct {
Success bool `json:"success"`
Message string `json:"message"`
Object string `json:"object"`
Id string `json:"id"`
Shipper Shipper `json:"shipper"`
Origin Origin `json:"origin"`
Delivery Delivery `json:"delivery"`
Destination Destination `json:"destination"`
Courier Courier `json:"courier"`
Items []ProductItem `json:"items"`
Price uint `json:"price"`
Note string `json:"note"`
Status string `json:"status"`
}
type ResponseCancelOrder struct {
Success bool `json:"success"`
Message string `json:"message"`
Object string `json:"object"`
Id string `json:"id"`
Status string `json:"status"`
CancellationReason string `json:"cancellation_reason"`
}
// PricingRate RATES COURIER
type PricingRate struct {
Company string `json:"company"`
CourierName string `json:"courier_name"`
CourierCode string `json:"courier_code"`
CourierServiceName string `json:"courier_service_name"`
CourierServiceCode string `json:"courier_service_code"`
Type string `json:"type"`
Description string `json:"description"`
Duration string `json:"duration"`
ShipmentDurationRange string `json:"shipment_duration_range"`
ShipmentDurationUnit string `json:"shipment_duration_unit"`
ServiceType string `json:"service_type"`
ShippingType string `json:"shipping_type"`
Price uint `json:"price"`
}
type OriginRate struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
PostalCode uint `json:"postal_code"`
CountryName string `json:"country_name"`
CountryCode string `json:"country_code"`
AdministrativeDivisionLevel1Name string `json:"administrative_division_level_1_name"`
AdministrativeDivisionLevel1Type string `json:"administrative_division_level_1_type"`
AdministrativeDivisionLevel2Name string `json:"administrative_division_level_2_name"`
AdministrativeDivisionLevel2Type string `json:"administrative_division_level_2_type"`
AdministrativeDivisionLevel3Name string `json:"administrative_division_level_3_name"`
AdministrativeDivisionLevel3Type string `json:"administrative_division_level_3_type"`
AdministrativeDivisionLevel4Name string `json:"administrative_division_level_4_name"`
AdministrativeDivisionLevel4Type string `json:"administrative_division_level_4_type"`
}
type DestinationRate struct {
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
PostalCode uint `json:"postal_code"`
CountryName string `json:"country_name"`
CountryCode string `json:"country_code"`
AdministrativeDivisionLevel1Name string `json:"administrative_division_level_1_name"`
AdministrativeDivisionLevel1Type string `json:"administrative_division_level_1_type"`
AdministrativeDivisionLevel2Name string `json:"administrative_division_level_2_name"`
AdministrativeDivisionLevel2Type string `json:"administrative_division_level_2_type"`
AdministrativeDivisionLevel3Name string `json:"administrative_division_level_3_name"`
AdministrativeDivisionLevel3Type string `json:"administrative_division_level_3_type"`
AdministrativeDivisionLevel4Name string `json:"administrative_division_level_4_name"`
AdministrativeDivisionLevel4Type string `json:"administrative_division_level_4_type"`
}
type ResponseListRatesCouriers struct {
Success bool `json:"success"`
Message string `json:"message"`
Origin OriginRate `json:"origin"`
Destination DestinationRate `json:"destination"`
Pricing []PricingRate `json:"pricing"`
}
type ResponseCourier struct {
AvailableForCashOnDelivery bool `json:"available_for_cash_on_delivery"`
AvailableForProofOfDelivery bool `json:"available_for_proof_of_delivery"`
AvailableForInstantWaybillId bool `json:"available_for_instant_waybill_id"`
CourierName string `json:"courier_name"`
CourierCode string `json:"courier_code"`
CourierServiceName string `json:"courier_service_name"`
CourierServiceCode string `json:"courier_service_code"`
Tier string `json:"tier"`
Description string `json:"description"`
ServiceType string `json:"service_type"`
ShippingType string `json:"shipping_type"`
ShipmentDurationRange string `json:"shipment_duration_range"`
ShipmentDurationUnit string `json:"shipment_duration_unit"`
}
type ResponseListCourier struct {
Success bool `json:"success"`
Object string `json:"object"`
Couriers []ResponseCourier `json:"couriers"`
}
type ResponseTrackingOrder struct {
Success bool `json:"success"`
Message string `json:"message"`
Object string `json:"object"`
Id string `json:"id"`
WaybillId string `json:"waybill_id"`
Courier struct {
Company string `json:"company"`
Name *string `json:"name"`
Phone *string `json:"phone"`
} `json:"courier"`
Origin struct {
ContactName string `json:"contact_name"`
Address string `json:"address"`
} `json:"origin"`
Destination struct {
ContactName string `json:"contact_name"`
Address string `json:"address"`
}
History []struct {
Note string `json:"note"`
Status string `json:"status"`
UpdatedAt string `json:"updated_at"`
} `json:"history"`
Link string `json:"link"`
OrderId *string `json:"order_id"`
Status string `json:"status"`
}
type ApiResponse struct {
Status string
StatusCode int
Proto string
Header http.Header
RawBody []byte
Request *http.Request
}