From 890b7b8d46677fb55f7fcee4ae428e5f51780138 Mon Sep 17 00:00:00 2001 From: Andrew Chau Date: Thu, 26 Oct 2023 13:57:10 +1100 Subject: [PATCH 1/5] Add line_items_by_fulfillment_order --- fulfillment.go | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/fulfillment.go b/fulfillment.go index 1c7d44a8..adcaffdb 100644 --- a/fulfillment.go +++ b/fulfillment.go @@ -43,22 +43,28 @@ type FulfillmentServiceOp struct { // Fulfillment represents a Shopify fulfillment. type Fulfillment struct { - ID int64 `json:"id,omitempty"` - OrderID int64 `json:"order_id,omitempty"` - LocationID int64 `json:"location_id,omitempty"` - Status string `json:"status,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - Service string `json:"service,omitempty"` - UpdatedAt *time.Time `json:"updated_at,omitempty"` - TrackingCompany string `json:"tracking_company,omitempty"` - ShipmentStatus string `json:"shipment_status,omitempty"` - TrackingNumber string `json:"tracking_number,omitempty"` - TrackingNumbers []string `json:"tracking_numbers,omitempty"` - TrackingUrl string `json:"tracking_url,omitempty"` - TrackingUrls []string `json:"tracking_urls,omitempty"` - Receipt Receipt `json:"receipt,omitempty"` - LineItems []LineItem `json:"line_items,omitempty"` - NotifyCustomer bool `json:"notify_customer"` + ID int64 `json:"id,omitempty"` + OrderID int64 `json:"order_id,omitempty"` + LocationID int64 `json:"location_id,omitempty"` + Status string `json:"status,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Service string `json:"service,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + TrackingCompany string `json:"tracking_company,omitempty"` + ShipmentStatus string `json:"shipment_status,omitempty"` + TrackingNumber string `json:"tracking_number,omitempty"` + TrackingNumbers []string `json:"tracking_numbers,omitempty"` + TrackingUrl string `json:"tracking_url,omitempty"` + TrackingUrls []string `json:"tracking_urls,omitempty"` + Receipt Receipt `json:"receipt,omitempty"` + LineItems []LineItem `json:"line_items,omitempty"` + LineItemsByFulfillmentOrder []LineItemByFulfillmentOrder `json:"line_items_by_fulfillment_order,omitempty"` + NotifyCustomer bool `json:"notify_customer"` +} + +type LineItemByFulfillmentOrder struct { + FulfillmentOrderID int64 `json:"fulfillment_order_id,omitempty"` + FulfillmentOrderLineItems []LineItem `json:"fulfillment_order_line_items,omitempty"` } // Receipt represents a Shopify receipt. From db29d570732933b5282cc6b5a8a3073950291a66 Mon Sep 17 00:00:00 2001 From: Andrew Chau Date: Thu, 26 Oct 2023 15:13:50 +1100 Subject: [PATCH 2/5] Add line_items_by_fulfillment_order --- fulfillment.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fulfillment.go b/fulfillment.go index adcaffdb..a54de918 100644 --- a/fulfillment.go +++ b/fulfillment.go @@ -62,6 +62,8 @@ type Fulfillment struct { NotifyCustomer bool `json:"notify_customer"` } +// LineItemByFulfillmentOrder represents a Shopify line item for fulfillment. +// https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments type LineItemByFulfillmentOrder struct { FulfillmentOrderID int64 `json:"fulfillment_order_id,omitempty"` FulfillmentOrderLineItems []LineItem `json:"fulfillment_order_line_items,omitempty"` From 12f483c9c9ba678781072c0d523e3fec33f138ca Mon Sep 17 00:00:00 2001 From: Andrew Chau Date: Thu, 26 Oct 2023 15:23:55 +1100 Subject: [PATCH 3/5] Add tracking_info to Fulfillment --- fulfillment.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fulfillment.go b/fulfillment.go index a54de918..f5fd6f12 100644 --- a/fulfillment.go +++ b/fulfillment.go @@ -52,6 +52,7 @@ type Fulfillment struct { UpdatedAt *time.Time `json:"updated_at,omitempty"` TrackingCompany string `json:"tracking_company,omitempty"` ShipmentStatus string `json:"shipment_status,omitempty"` + TrackingInfo FulfillmentTrackingInfo `json:"tracking_info,omitempty"` TrackingNumber string `json:"tracking_number,omitempty"` TrackingNumbers []string `json:"tracking_numbers,omitempty"` TrackingUrl string `json:"tracking_url,omitempty"` @@ -62,13 +63,21 @@ type Fulfillment struct { NotifyCustomer bool `json:"notify_customer"` } -// LineItemByFulfillmentOrder represents a Shopify line item for fulfillment. +// LineItemByFulfillmentOrder represents the FulfillmentOrders (and optionally the items) used to create a Fulfillment. // https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments type LineItemByFulfillmentOrder struct { FulfillmentOrderID int64 `json:"fulfillment_order_id,omitempty"` FulfillmentOrderLineItems []LineItem `json:"fulfillment_order_line_items,omitempty"` } +// FulfillmentTrackingInfo represents the tracking information used to create a Fulfillment. +// https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments +type FulfillmentTrackingInfo struct { + Company string `json:"company,omitempty"` + Number string `json:"number,omitempty"` + Url string `json:"url,omitempty"` +} + // Receipt represents a Shopify receipt. type Receipt struct { TestCase bool `json:"testcase,omitempty"` From e22a44e0dff8716da97698273522657ce9c4e4cb Mon Sep 17 00:00:00 2001 From: Andrew Chau Date: Fri, 10 Nov 2023 09:14:28 +0800 Subject: [PATCH 4/5] Use FulfillmentOrderLineItemQuantity struct for LineItemByFulfillmentOrder fulfillment_order_line_items --- fulfillment.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fulfillment.go b/fulfillment.go index f5fd6f12..1f7c4a3c 100644 --- a/fulfillment.go +++ b/fulfillment.go @@ -66,8 +66,8 @@ type Fulfillment struct { // LineItemByFulfillmentOrder represents the FulfillmentOrders (and optionally the items) used to create a Fulfillment. // https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments type LineItemByFulfillmentOrder struct { - FulfillmentOrderID int64 `json:"fulfillment_order_id,omitempty"` - FulfillmentOrderLineItems []LineItem `json:"fulfillment_order_line_items,omitempty"` + FulfillmentOrderID int64 `json:"fulfillment_order_id,omitempty"` + FulfillmentOrderLineItems []FulfillmentOrderLineItemQuantity `json:"fulfillment_order_line_items,omitempty"` } // FulfillmentTrackingInfo represents the tracking information used to create a Fulfillment. From bbd38c41246840e3f12eea656f944daca2bdada1 Mon Sep 17 00:00:00 2001 From: Andrew Chau Date: Tue, 14 Nov 2023 09:46:11 +0800 Subject: [PATCH 5/5] Create separate LineItemByFulfillmentOrderItemQuantity struct --- fulfillment.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/fulfillment.go b/fulfillment.go index 1f7c4a3c..8416fadd 100644 --- a/fulfillment.go +++ b/fulfillment.go @@ -63,13 +63,6 @@ type Fulfillment struct { NotifyCustomer bool `json:"notify_customer"` } -// LineItemByFulfillmentOrder represents the FulfillmentOrders (and optionally the items) used to create a Fulfillment. -// https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments -type LineItemByFulfillmentOrder struct { - FulfillmentOrderID int64 `json:"fulfillment_order_id,omitempty"` - FulfillmentOrderLineItems []FulfillmentOrderLineItemQuantity `json:"fulfillment_order_line_items,omitempty"` -} - // FulfillmentTrackingInfo represents the tracking information used to create a Fulfillment. // https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments type FulfillmentTrackingInfo struct { @@ -78,6 +71,19 @@ type FulfillmentTrackingInfo struct { Url string `json:"url,omitempty"` } +// LineItemByFulfillmentOrder represents the FulfillmentOrders (and optionally the items) used to create a Fulfillment. +// https://shopify.dev/docs/api/admin-rest/2023-01/resources/fulfillment#post-fulfillments +type LineItemByFulfillmentOrder struct { + FulfillmentOrderID int64 `json:"fulfillment_order_id,omitempty"` + FulfillmentOrderLineItems []LineItemByFulfillmentOrderItemQuantity `json:"fulfillment_order_line_items,omitempty"` +} + +// LineItemByFulfillmentOrderItemQuantity represents the quantity to fulfill for one item. +type LineItemByFulfillmentOrderItemQuantity struct { + Id int64 `json:"id"` + Quantity int64 `json:"quantity"` +} + // Receipt represents a Shopify receipt. type Receipt struct { TestCase bool `json:"testcase,omitempty"`