-
Notifications
You must be signed in to change notification settings - Fork 0
/
webhook.go
68 lines (57 loc) · 2.65 KB
/
webhook.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
package ingram
import "time"
type WebhookEvent string
type WebhookEventType string
type WebhookLineStatus string
const (
UpdateEvent WebhookEvent = "im::updated"
OrderShipped WebhookEventType = "IM::order_shipped"
OrderInvoiced WebhookEventType = "IM::order_invoiced"
OrderHold WebhookEventType = "IM::order_hold"
OrderVoided WebhookEventType = "IM::order_voided"
LineShipped WebhookLineStatus = "IM::SHIPPED"
LineSalesHold WebhookLineStatus = "IM::SALES_HOLD"
LineOnlineHold WebhookLineStatus = "IM::IM_ONLINE_HOLD"
)
type Webhook struct {
Topic string `json:"topic"`
Event string `json:"event"`
EventTimeStamp time.Time `json:"eventTimeStamp"`
EventID string `json:"eventId"`
Resource WebhookResource `json:"resource"`
}
type WebhookResource struct {
EventType WebhookEventType `json:"eventType"`
OrderNumber string `json:"orderNumber"`
CustomerPoNumber string `json:"customerPoNumber"`
OrderEntryTimeStamp time.Time `json:"orderEntryTimeStamp"`
Lines []WebhookResourceLine `json:"lines"`
}
type WebhookResourceLine struct {
LineNumber string `json:"lineNumber"`
SubOrderNumber string `json:"subOrderNumber"`
LineStatus string `json:"lineStatus"`
IngramPartNumber string `json:"ingramPartNumber"`
VendorPartNumber string `json:"vendorPartNumber"`
RequestedQuantity float64 `json:"requestedQuantity"`
ShippedQuantity float64 `json:"shippedQuantity"`
BackOrderedQuantity float64 `json:"backOrderedQuantity"`
ShipmentDetails WebhookShipmentDetail `json:"shipmentDetails"`
SerialNumberDetails []WebhookSerialNumberDetail `json:"serialNumberDetails"`
}
type WebhookShipmentDetail struct {
ShipmentDate *string `json:"shipmentDate"`
ShipFromWarehouseID string `json:"shipFromWarehouseId"`
WarehouseName string `json:"warehouseName"`
CarrierCode string `json:"carrierCode"`
CarrierName string `json:"carrierName"`
PackageDetails []WebhookShipmentPackageDetail `json:"packageDetails"`
}
type WebhookShipmentPackageDetail struct {
CartonNumber string `json:"cartonNumber"`
QuantityInbox float64 `json:"quantityInbox"`
TrackingNumber string `json:"trackingNumber"`
}
type WebhookSerialNumberDetail struct {
SerialNumber string `json:"serialNumber"`
}