Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions parcel.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package sendcloud

import (
"encoding/json"
"strconv"
"time"
)

Expand Down Expand Up @@ -34,6 +35,9 @@ type ParcelParams struct {
ExternalID string
ToServicePointID int64
Weight string
Length uint
Width uint
Height uint
OrderNumber string
SenderID int64
Items []CreateParcelItemRequest
Expand Down Expand Up @@ -123,6 +127,9 @@ type ParcelRequest struct {
CountryState string `json:"country_state"`
Country string `json:"country"`
Weight string `json:"weight,omitempty"`
Length string `json:"length,omitempty"`
Width string `json:"width,omitempty"`
Height string `json:"height,omitempty"`
Telephone string `json:"telephone"`
Email string `json:"email"`
RequestLabel bool `json:"request_label"`
Expand Down Expand Up @@ -257,6 +264,15 @@ func (p *ParcelParams) GetPayload() interface{} {
if p.Weight != "" {
parcel.Weight = p.Weight
}
if p.Length != 0 {
parcel.Length = strconv.FormatUint(uint64(p.Length), 10)
}
if p.Width != 0 {
parcel.Width = strconv.FormatUint(uint64(p.Width), 10)
}
if p.Height != 0 {
parcel.Height = strconv.FormatUint(uint64(p.Height), 10)
}

ar := ParcelRequestContainer{Parcel: parcel}
return ar
Expand Down
Loading