diff --git a/order.go b/order.go index c5dbb42..ba64b14 100644 --- a/order.go +++ b/order.go @@ -11,14 +11,11 @@ type Order struct { ApiClient *ApiClient } -func (order *Order) AddComment(comment string) error { +func (order *Order) AddComment(statusHistory types.StatusHistory) error { endpoint := order.Route + orderComments httpClient := order.ApiClient.HttpClient - payLoad := types.StatusHistory{ - Comment: comment, - ParentID: order.ID, - } + payLoad := statusHistory resp, err := httpClient.R().SetBody(payLoad).Post(endpoint) if err != nil { diff --git a/types/status_history.go b/types/status_history.go index 33b6cf3..15ba834 100644 --- a/types/status_history.go +++ b/types/status_history.go @@ -1,13 +1,13 @@ package types type StatusHistory struct { - Comment string `json:"comment"` - CreatedAt string `json:"created_at"` - EntityID int `json:"entity_id"` - EntityName string `json:"entity_name"` - IsCustomerNotified int `json:"is_customer_notified"` - IsVisibleOnFront int `json:"is_visible_on_front"` - ParentID int `json:"parent_id"` - Status string `json:"status"` - ExtensionAttributes ExtensionAttributes `json:"extension_attributes"` + Comment string `json:"comment,omitempty"` + CreatedAt string `json:"created_at,omitempty"` + EntityID int `json:"entity_id,omitempty"` + EntityName string `json:"entity_name,omitempty"` + IsCustomerNotified int `json:"is_customer_notified,omitempty"` + IsVisibleOnFront int `json:"is_visible_on_front,omitempty"` + ParentID int `json:"parent_id,omitempty"` + Status string `json:"status,omitempty"` + ExtensionAttributes ExtensionAttributes `json:"extension_attributes,omitempty"` }