CDEK: github.com/vseinstrumentiru/CDEK Index | Examples | Files

package cdek

import "github.com/vseinstrumentiru/CDEK"

Index

Examples

Package Files

calculator-models.go calculator-req-builder.go calculator-service.go city-filter.go city-models.go city-service.go client.go delete-order-models.go delete-order-req-builder.go delete-order-service.go error-response.go pvzlist-filter.go pvzlist-models.go pvzlist-service.go region-filter.go region-models.go region-service.go register-order-models.go register-order-req-builder.go register-order-service.go secure.go status-report-models.go status-report-req-builder.go status-report-service.go test-helper.go update-order-models.go update-order-req-builder.go update-order-service.go

Constants

const (
    //TypePvz только склады СДЭК
    TypePvz string = "PVZ"

    //TypePostomat постоматы партнёра
    TypePostomat string = "POSTOMAT"

    //TypeAll все ПВЗ не зависимо от их типа
    TypeAll string = "ALL"
)

type AddService Uses

type AddService struct {
    ServiceCode *int `xml:"ServiceCode,attr"`
    Count       *int `xml:"Count,attr,omitempty"`
}

AddService Additional services

func NewAddService Uses

func NewAddService(serviceCode int) *AddService

NewAddService Additional services builder serviceCode: Type of additional service

func (*AddService) SetCount Uses

func (addService *AddService) SetCount(count int) *AddService

SetCount Number of packages. It is used and is mandatory only for the additional service "Package 1".

type Address Uses

type Address struct {
    Street  *string `xml:"Street,attr"`
    House   *string `xml:"House,attr"`
    Flat    *string `xml:"Flat,attr,omitempty"`
    Phone   *string `xml:"Phone,attr,omitempty"`
    PvzCode *string `xml:"PvzCode,attr,omitempty"`
}

Address Address of pickup

func NewAddress Uses

func NewAddress(street string, house string) *Address

NewAddress Address of pickup builder

func (*Address) SetFlat Uses

func (address *Address) SetFlat(flat string) *Address

SetFlat Flat/office

func (*Address) SetPhone Uses

func (address *Address) SetPhone(phone string) *Address

SetPhone Sender's phone

func (*Address) SetPvzCode Uses

func (address *Address) SetPvzCode(pvzCode string) *Address

SetPvzCode Pickup code. The attribute is required only for orders with the delivery mode “to warehouse”, provided that no additional service “Delivery in the receiver's city” is ordered. If the specified pickup point is closed at the time of order creation, the order will be accepted for the nearest functioning pickup point. The receiver will be notified about change of the pickup point via SMS. If all pickup points in the city that can provide the selected service are closed, order registration will be impossible. The relevant error message will be sent.

type Alert Uses

type Alert struct {
    Type      string
    Msg       string
    ErrorCode string
}

Alert CDEK Alert model

func (*Alert) Error Uses

func (a *Alert) Error() string

type AlertResponse Uses

type AlertResponse struct {
    Alerts []*Alert
}

AlertResponse CDEK Alerts model

type Attempt Uses

type Attempt struct {
    ID                  *int    `xml:"ID,attr"`
    ScheduleCode        *int    `xml:"ScheduleCode,attr"`
    ScheduleDescription *string `xml:"ScheduleDescription,attr"`
}

Attempt Delivery time taken from the delivery schedule

type Call Uses

type Call struct {
    CallGood  *CallGood  `xml:"CallGood"`
    CallFail  *CallFail  `xml:"CallFail"`
    CallDelay *CallDelay `xml:"CallDelay"`
}

Call History of notification calls to the receiver

type CallCourier Uses

type CallCourier struct {
    Call *CourierCallReq `xml:"Call"`
}

CallCourier Call courier

func NewCallCourier Uses

func NewCallCourier(call CourierCallReq) *CallCourier

NewCallCourier Call courier builder call: Waiting for a courier

type CallDelay Uses

type CallDelay struct {
    Delay []*CallDelayItem `xml:"Delay"`
}

CallDelay History of call reschedules

type CallDelayItem Uses

type CallDelayItem struct {
    Date     *string `xml:"Date,attr"`
    DateNext *string `xml:"DateNext,attr"`
}

CallDelayItem Call reschedule

type CallFail Uses

type CallFail struct {
    Fail []*CallFailItem `xml:"Fail"`
}

CallFail History of failed calls

type CallFailItem Uses

type CallFailItem struct {
    Date              *string `xml:"Date,attr"`
    ReasonCode        *int    `xml:"ReasonCode,attr"`
    ReasonDescription *string `xml:"ReasonDescription,attr"`
}

CallFailItem Failed call

type CallGood Uses

type CallGood struct {
    Good []*CallGoodItem `xml:"Good"`
}

CallGood History of successful calls

type CallGoodItem Uses

type CallGoodItem struct {
    Date      *string `xml:"Date,attr"`
    DateDeliv *string `xml:"DateDeliv,attr"`
}

CallGoodItem Successful call

type ChangePeriod Uses

type ChangePeriod struct {
    DateFirst *string `xml:"DateFirst,attr"`
    DateLast  *string `xml:"DateLast,attr"`
}

ChangePeriod The period during which the order status has changed.

func NewChangePeriod Uses

func NewChangePeriod(dateFirst time.Time) *ChangePeriod

NewChangePeriod ChangePeriod builder dateFirst: start date of requested period

func (*ChangePeriod) SetDateLast Uses

func (changePeriod *ChangePeriod) SetDateLast(date time.Time) *ChangePeriod

SetDateLast End date of requested period

type City Uses

type City struct {
    CityUUID       *string  `json:"cityUuid"`
    CityName       *string  `json:"cityName"`
    CityCode       *string  `json:"cityCode"`
    Region         *string  `json:"region"`
    RegionCodeExt  *int     `json:"regionCodeExt,string"`
    RegionCode     *int     `json:"regionCode,string"`
    SubRegion      *string  `json:"subRegion"`
    Country        *string  `json:"country"`
    CountryCode    *string  `json:"countryCode"`
    Latitude       *float64 `json:"latitude"`
    Longitude      *float64 `json:"longitude"`
    Kladr          *string  `json:"kladr"`
    FiasGUID       *string  `json:"fiasGuid"`
    RegionFiasGUID *string  `json:"regionFiasGuid"`
    PaymentLimit   *float64 `json:"paymentLimit"`
}

City CDEK city model

type CityFilter Uses

type CityFilter string

CityFilter filter key for "List of Cities" request

const (
    //CityFilterRegionCodeExt Код региона
    CityFilterRegionCodeExt CityFilter = "regionCodeExt"

    //CityFilterRegionCode Код региона в ИС СДЭК
    CityFilterRegionCode CityFilter = "regionCode"

    //CityFilterRegionFiasGUID Код региона из ФИАС
    CityFilterRegionFiasGUID CityFilter = "regionFiasGuid"

    //CityFilterPage Номер страницы выборки результата.По умолчанию 0
    CityFilterPage CityFilter = "page"

    //CityFilterSize Ограничение выборки результата.По умолчанию 1000
    CityFilterSize CityFilter = "size"

    //CityFilterCountryCode Код страны в формате ISO 3166-1 alpha-2
    CityFilterCountryCode CityFilter = "countryCode"

    //CityFilterCityName Название города
    CityFilterCityName CityFilter = "cityName"

    //CityFilterPostcode Почтовый индекс
    CityFilterPostcode CityFilter = "postcode"
)

type CityFilterBuilder Uses

type CityFilterBuilder struct {
    // contains filtered or unexported fields
}

CityFilterBuilder builder for filer for "List of Cities" request

func (*CityFilterBuilder) AddFilter Uses

func (filterBuilder *CityFilterBuilder) AddFilter(filter CityFilter, value string) *CityFilterBuilder

AddFilter add filter to set of filters for "List of Cities" request

func (*CityFilterBuilder) Filter Uses

func (filterBuilder *CityFilterBuilder) Filter() map[CityFilter]string

Filter returns complete CityFilter for "List of Cities" request

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

Client SDK Client configuration

func (Client) CalculateDelivery Uses

func (c Client) CalculateDelivery(req GetCostReq) (*GetCostRespResult, error)

CalculateDelivery Cost calculation on tariffs with priority.

Code:

client := NewClient("https://integration.edu.cdek.ru/")
client.SetAuth("z9GRRu7FxmO53CQ9cFfI6qiy32wpfTkd", "w24JTCv4MnAcuRTx0oHjHLDtyt3I6IBq")

result, err := client.CalculateDelivery(*NewGetCostReq(61208, 2108, 10))

_, _ = result, err

func (Client) DeleteOrder Uses

func (c Client) DeleteOrder(req DeleteOrderReq) (*DeleteOrderResp, error)

DeleteOrder The method is designed to cancel/delete an order at the client's initiative.

Code:

client := NewClient("https://integration.edu.cdek.ru/")
client.SetAuth("z9GRRu7FxmO53CQ9cFfI6qiy32wpfTkd", "w24JTCv4MnAcuRTx0oHjHLDtyt3I6IBq")

result, err := client.DeleteOrder(*NewDeleteOrderReq(
    "number-soOEl0",
    1,
    *NewDeleteOrder().SetNumber("number-soOEl0"),
))

_, _ = result, err

func (Client) GetCities Uses

func (c Client) GetCities(filter map[CityFilter]string) (*GetCitiesResp, error)

GetCities This method is used to load detailed information on cities.

Code:

client := NewClient("https://integration.edu.cdek.ru/")
client.SetAuth("z9GRRu7FxmO53CQ9cFfI6qiy32wpfTkd", "w24JTCv4MnAcuRTx0oHjHLDtyt3I6IBq")

result, err := client.GetCities(map[CityFilter]string{
    CityFilterPage: "3",
})

_, _ = result, err

func (Client) GetPvzList Uses

func (c Client) GetPvzList(filter map[PvzListFilter]string) ([]*Pvz, error)

GetPvzList The method is used to load the list of active pickup points, from which the client can pick up its order.

Code:

client := NewClient("https://integration.edu.cdek.ru/")
client.SetAuth("z9GRRu7FxmO53CQ9cFfI6qiy32wpfTkd", "w24JTCv4MnAcuRTx0oHjHLDtyt3I6IBq")

result, err := client.GetPvzList(map[PvzListFilter]string{
    PvzListFilterCityID: "44",
})

_, _ = result, err

func (Client) GetRegions Uses

func (c Client) GetRegions(filter map[RegionFilter]string) (*GetRegionsResp, error)

GetRegions This method is used to load detailed information on regions.

Code:

client := NewClient("https://integration.edu.cdek.ru/")
client.SetAuth("z9GRRu7FxmO53CQ9cFfI6qiy32wpfTkd", "w24JTCv4MnAcuRTx0oHjHLDtyt3I6IBq")

result, err := client.GetRegions(map[RegionFilter]string{
    RegionFilterPage: "3",
})

_, _ = result, err

func (Client) GetStatusReport Uses

func (c Client) GetStatusReport(statusReportReq StatusReport) (*StatusReportResp, error)

GetStatusReport This method is used to generate an order status report, including order change history.

func (Client) RegisterOrder Uses

func (c Client) RegisterOrder(req RegisterOrderReq) (*RegisterOrderResp, error)

RegisterOrder This method is used to register orders to be delivered to clients.

Code:

client := NewClient("https://integration.edu.cdek.ru/")
client.SetAuth("z9GRRu7FxmO53CQ9cFfI6qiy32wpfTkd", "w24JTCv4MnAcuRTx0oHjHLDtyt3I6IBq")

exampleOrder := NewOrderReq("number-soOEl0", "name-soOEl0", "+79138739944", 139).
    SetSendCityCode(44).
    SetRecCityCode(44).
    SetComment("comment-soOEl0").
    SetDeliveryRecipientCost(0).
    SetDeliveryRecipientVATRate("VATX").
    SetDeliveryRecipientVATSum(0).
    SetRecipientEmail("no-reply@cdek.ru").
    SetAddress(*NewAddress("street-soOEl0", "house-soOEl0").
        SetFlat("flat-soOEl0"),
    ).
    SetSender(*NewSender().
        SetCompany("company-soOEl0").
        SetName("Отправителев").
        SetAddress(*NewAddress("street-soOEl0", "house-soOEl0").
            SetFlat("flat-soOEl0"),
        ).
        AddPhone("+79138739946").
        AddPhone("+79138739945"),
    ).
    SetSeller(*NewSeller().
        SetAddress("street_soOEl0 1").
        SetName("seller-soOEl0").
        SetINN("111111111111").
        SetPhone("+79138739947").
        SetOwnershipForm(249),
    ).
    AddPackage(*NewOrderPackage("soOEl00", "barcode-soOEl00", 100).
        SetSize(2, 3, 4).
        AddItem(*NewOrderPackageItem(2, "warekey-soOEl000", 8, 10, 1, "comment-soOEl000").
            SetPaymentVATRate("VATX").
            SetPaymentVATSum(0),
        ),
    ).
    SetDeliveryRecipientCostAdv(*NewDeliveryRecipientCostAdv(2000, 150).
        SetVATRate("vat10").
        SetVATSum(13.64),
    ).
    SetAddService(*NewAddService(30)).
    SetSchedule(*NewSchedule().
        AddAttempt(*NewScheduleAttempt("soOEl00", time.Date(2019, 7, 19, 12, 0, 0, 0, time.UTC)).
            SetAddress(*NewAddress("street-prozvon_adr", "house-prozvon_adr").
                SetFlat("flat-prozvon_adr"),
            ).
            SetTimeBeg("11:00:00").
            SetTimeEnd("13:00:00"),
        ),
    )

result, err := client.RegisterOrder(*NewDeliveryRequest("soOEl", 1, exampleOrder))

_, _ = result, err

func (*Client) SetAuth Uses

func (c *Client) SetAuth(account, secure string) ServiceProvider

SetAuth set auth data

func (*Client) SetCalculatorURL Uses

func (c *Client) SetCalculatorURL(calculatorURL string) ServiceProvider

SetCalculatorURL url for delivery calculation

func (Client) UpdateOrder Uses

func (c Client) UpdateOrder(req UpdateOrderReq) (*UpdateOrderResp, error)

UpdateOrder This method is used to change a created order.

Code:

client := NewClient("https://integration.edu.cdek.ru/")
client.SetAuth("z9GRRu7FxmO53CQ9cFfI6qiy32wpfTkd", "w24JTCv4MnAcuRTx0oHjHLDtyt3I6IBq")

exampleOrderToUpdate := NewUpdateOrder().
    SetDeliveryRecipientCost(10.02).
    SetDeliveryRecipientVATRate("VATX").
    SetDeliveryRecipientVATSum(0.0).
    SetNumber("number-s785558445").
    SetPackage(*NewOrderPackage("soOEl00", "barcode-soOEl00", 100).
        SetSize(2, 3, 4).
        AddItem(*NewOrderPackageItem(2, "warekey-soOEl000", 8, 10, 1, "comment-soOEl000").
            SetPaymentVATRate("VATX").
            SetPaymentVATSum(0),
        ),
    )

result, err := client.UpdateOrder(*NewUpdateOrderReq("soOEl", 1, *exampleOrderToUpdate))

_, _ = result, err

type CourierCallReq Uses

type CourierCallReq struct {
    Date             *string  `xml:"Date,attr"`
    TimeBeg          *string  `xml:"TimeBeg,attr"`
    TimeEnd          *string  `xml:"TimeEnd,attr"`
    LunchBeg         *string  `xml:"LunchBeg,attr"`
    LunchEnd         *string  `xml:"LunchEnd,attr"`
    SendCityCode     *int     `xml:"SendCityCode,attr"`
    SendCityPostCode *string  `xml:"SendCityPostCode,attr"`
    SendCountryCode  *string  `xml:"SendCountryCode,attr"`
    SendCityName     *string  `xml:"SendCityName,attr"`
    SendPhone        *string  `xml:"SendPhone,attr"`
    SenderName       *string  `xml:"SenderName,attr"`
    Comment          *string  `xml:"Comment,attr"`
    SendAddress      *Address `xml:"SendAddress"`
}

CourierCallReq Waiting for a courier

func NewCourierCall Uses

func NewCourierCall(
    date time.Time,
    timeBeg string,
    timeEnd string,
    sendPhone string,
    senderName string,
    sendAddress Address,
) *CourierCallReq

NewCourierCall NewCourierCall builder date: Date of courier waiting timeBeg: Start time of courier waiting timeEnd: End time of courier waiting sendPhone: Sender's contact phone senderName: Sender (full name) sendAddress: Sender's address

func (*CourierCallReq) SetComment Uses

func (call *CourierCallReq) SetComment(comment string) *CourierCallReq

SetComment Comment for courier

func (*CourierCallReq) SetLunchBeg Uses

func (call *CourierCallReq) SetLunchBeg(lunchBeg string) *CourierCallReq

SetLunchBeg Start time of a lunch break, if it is within a time range [TimeBeg; TimeEnd]

func (*CourierCallReq) SetLunchEnd Uses

func (call *CourierCallReq) SetLunchEnd(lunchEnd string) *CourierCallReq

SetLunchEnd End time of a lunch break, if it is within a time range [TimeBeg; TimeEnd]

func (*CourierCallReq) SetSendCityCode Uses

func (call *CourierCallReq) SetSendCityCode(sendCityCode int) *CourierCallReq

SetSendCityCode Sender's city code from the CDEK base

func (*CourierCallReq) SetSendCityName Uses

func (call *CourierCallReq) SetSendCityName(sendCityName string) *CourierCallReq

SetSendCityName Name of sender's city

func (*CourierCallReq) SetSendCityPostCode Uses

func (call *CourierCallReq) SetSendCityPostCode(sendCityPostCode string) *CourierCallReq

SetSendCityPostCode Postal code of the sender's city

func (*CourierCallReq) SetSendCountryCode Uses

func (call *CourierCallReq) SetSendCountryCode(sendCountryCode string) *CourierCallReq

SetSendCountryCode Sender's country code to identify a country by postal code

type CourierCallResp Uses

type CourierCallResp struct {
    Error
    Number *string `xml:"Number,attr"`
}

CourierCallResp Call courier

type DelayReason Uses

type DelayReason struct {
    Date        string  `xml:"Date,attr"`
    Code        int     `xml:"Code,attr"`
    Description string  `xml:"Description,attr"`
    State       []State `xml:"State"`
}

DelayReason Current delay reason

type DeleteOrder Uses

type DeleteOrder struct {
    Number         *string `xml:"Number,attr"`
    DispatchNumber *int    `xml:"DispatchNumber,attr"`
}

DeleteOrder order model for deleting request

func NewDeleteOrder Uses

func NewDeleteOrder() *DeleteOrder

NewDeleteOrder DeleteOrder constructor

func (*DeleteOrder) SetDispatchNumber Uses

func (o *DeleteOrder) SetDispatchNumber(dispatchNumber int) *DeleteOrder

SetDispatchNumber CDEK order number

func (*DeleteOrder) SetNumber Uses

func (o *DeleteOrder) SetNumber(number string) *DeleteOrder

SetNumber Client's shipment number. Order identifier in the IS of the CDEK client.

type DeleteOrderReq Uses

type DeleteOrderReq struct {
    XMLName    xml.Name     `xml:"DeleteRequest"`
    Number     *string      `xml:"Number,attr"`
    OrderCount *int         `xml:"OrderCount,attr"`
    Order      *DeleteOrder `xml:"Order"`
    // contains filtered or unexported fields
}

DeleteOrderReq request structure for deleting order from CDEK

func NewDeleteOrderReq Uses

func NewDeleteOrderReq(number string, orderCount int, order DeleteOrder) *DeleteOrderReq

NewDeleteOrderReq DeleteOrderReq constructor

type DeleteOrderResp Uses

type DeleteOrderResp struct {
    Order []*OrderResp `xml:"Order"`
}

DeleteOrderResp response structure of deleting order from CDEK

type DeliveryRecipientCostAdv Uses

type DeliveryRecipientCostAdv struct {
    Threshold *int     `xml:"Threshold,attr"`
    Sum       *float64 `xml:"Sum,attr"`
    VATRate   *string  `xml:"VATRate,attr,omitempty"`
    VATSum    *float64 `xml:"VATSum,attr,omitempty"`
}

DeliveryRecipientCostAdv Additional charge for delivery (E-shop charges the receiver), depending on the order’s sum

func NewDeliveryRecipientCostAdv Uses

func NewDeliveryRecipientCostAdv(threshold int, sum float64) *DeliveryRecipientCostAdv

NewDeliveryRecipientCostAdv DeliveryRecipientCostAdv builder threshold: Goods price threshold (valid by condition less than or equal to), in even monetary units sum: Additional charge for delivery with total amount that falls within the interval

func (*DeliveryRecipientCostAdv) SetVATRate Uses

func (d *DeliveryRecipientCostAdv) SetVATRate(vatRate string) *DeliveryRecipientCostAdv

SetVATRate VAT rate included in the additional charge for delivery. If the value is unknown, then default value “No VAT” is applied

func (*DeliveryRecipientCostAdv) SetVATSum Uses

func (d *DeliveryRecipientCostAdv) SetVATSum(vatSum float64) *DeliveryRecipientCostAdv

SetVATSum VAT sum included in the additional charge for delivery

type Error Uses

type Error struct {
    ErrorCode *string `xml:"ErrorCode,attr,omitempty" json:"code"`
    Msg       *string `xml:"Msg,attr,omitempty" json:"text"`
}

Error error values in responses

func (Error) Error Uses

func (e Error) Error() string

func (*Error) IsErroneous Uses

func (e *Error) IsErroneous() bool

IsErroneous check if struct has error

type GetCitiesResp Uses

type GetCitiesResp []*City

GetCitiesResp response struct for CDEK cities getter

type GetCostReq Uses

type GetCostReq struct {
    Version        *string       `json:"version"`
    SenderCityID   *int          `json:"senderCityId"`
    ReceiverCityID *int          `json:"receiverCityId"`
    TariffID       *int          `json:"tariffId"`
    Goods          []*Good       `json:"goods"`
    Services       []*ServiceReq `json:"services,omitempty"`
    // contains filtered or unexported fields
}

GetCostReq Cost calculation on tariffs with priority request

func NewGetCostReq Uses

func NewGetCostReq(senderCityID int, receiverCityID int, tariffID int) *GetCostReq

NewGetCostReq create new instance of GetCostReq

func (*GetCostReq) AddGood Uses

func (getCostReq *GetCostReq) AddGood(good Good) *GetCostReq

AddGood add good to request

func (*GetCostReq) AddService Uses

func (getCostReq *GetCostReq) AddService(service ServiceReq) *GetCostReq

AddService add service to request

type GetCostRespResult Uses

type GetCostRespResult struct {
    Price             float64       `json:"price,string"`
    DeliveryPeriodMin int           `json:"deliveryPeriodMin"`
    DeliveryPeriodMax int           `json:"deliveryPeriodMax"`
    DeliveryDateMin   string        `json:"deliveryDateMin"`
    DeliveryDateMax   string        `json:"deliveryDateMax"`
    TariffID          int           `json:"tariffId"`
    CashOnDelivery    float64       `json:"cashOnDelivery"`
    PriceByCurrency   float64       `json:"priceByCurrency"`
    Currency          string        `json:"currency"`
    PercentVAT        int           `json:"percentVAT"`
    Services          []ServiceResp `json:"services"`
}

GetCostRespResult Cost calculation on tariffs with priority result response

type GetRegionsResp Uses

type GetRegionsResp []Region

GetRegionsResp List of Regions response

type Good Uses

type Good struct {
    Weight float64 `json:"weight"`
    Length int     `json:"length"`
    Width  int     `json:"width"`
    Height int     `json:"height"`
    Volume float64 `json:"volume"`
}

Good Location's dimension

type Item Uses

type Item struct {
    WareKey     *string `xml:"WareKey,attr"`
    Amount      *int    `xml:"Amount,attr"`
    DelivAmount *int    `xml:"DelivAmount,attr"`
}

Item Items

type OfficeImage Uses

type OfficeImage struct {
    URL *string `xml:"url,attr"`
}

OfficeImage All photos of the office (except for a photo showing how to get to it)

type OrderPackage Uses

type OrderPackage struct {
    Number  *string             `xml:"Number,attr"`
    BarCode *string             `xml:"BarCode,attr"`
    Weight  *int                `xml:"Weight,attr"`
    SizeA   *int                `xml:"SizeA,attr,omitempty"`
    SizeB   *int                `xml:"SizeB,attr,omitempty"`
    SizeC   *int                `xml:"SizeC,attr,omitempty"`
    Item    []*OrderPackageItem `xml:"Item"`
}

OrderPackage Package (all packages are sent with different Package tags)

func NewOrderPackage Uses

func NewOrderPackage(number string, barCode string, weight int) *OrderPackage

NewOrderPackage OrderPackage builder number: Package number (ordinal package number or order number can be used), unique for this order. Order identifier in the Client's IS. barCode: Package barcode, package identifier (if any); otherwise, transmit a value of the package number: Packege.Number). The parameter is used to handle the cargo at CDEK warehouses), unique for this order. Package identifier in the Client's IS. weight: Total weight (in grams)

func (*OrderPackage) AddItem Uses

func (orderPackage *OrderPackage) AddItem(item OrderPackageItem) *OrderPackage

AddItem Add OrderPackageItem to OrderPackageItems list

func (*OrderPackage) SetSize Uses

func (orderPackage *OrderPackage) SetSize(length int, width int, height int) *OrderPackage

SetSize Package dimensions length: Length (in centimeters) width: Width (in centimeters) height: Height (in centimeters)

type OrderPackageItem Uses

type OrderPackageItem struct {
    Amount         *int     `xml:"Amount,attr"`
    WareKey        *string  `xml:"WareKey,attr"`
    Cost           *float64 `xml:"Cost,attr"`
    Payment        *float64 `xml:"Payment,attr"`
    PaymentVATRate *string  `xml:"PaymentVATRate,attr,omitempty"`
    PaymentVATSum  *float64 `xml:"PaymentVATSum,attr,omitempty"`
    Weight         *int     `xml:"Weight,attr"`
    Comment        *string  `xml:"Comment,attr"`
    WeightBrutto   *int     `xml:"WeightBrutto,attr,omitempty"`
    CommentEx      *string  `xml:"CommentEx,attr,omitempty"`
    Link           *string  `xml:"Link,attr,omitempty"`
}

OrderPackageItem Items (goods)

func NewOrderPackageItem Uses

func NewOrderPackageItem(
    amount int,
    wareKey string,
    cost float64,
    payment float64,
    weight int,
    comment string,
) *OrderPackageItem

NewOrderPackageItem OrderPackageItem builder amount: Quantity of goods of the same type (pcs). The maximum number is 999. wareKey: Identifier/item number of the goods (Unique for this Package). cost: Declared value of the goods (per item in the specified currency, value >=0). This value is used to calculate the amount of insurance. payment: Cash on delivery (per item in the specified currency, value >=0) — cash on delivery; in case of prepayment, value = 0. weight: Weight (per item, in grams) comment: Name of the goods (may contain description of the goods: size, color)

func (*OrderPackageItem) SetCommentEx Uses

func (item *OrderPackageItem) SetCommentEx(commentEx string) *OrderPackageItem

SetCommentEx Name of the goods, in English (also can contain description of the goods, such as size and color). Only for international orders.

func (item *OrderPackageItem) SetLink(link string) *OrderPackageItem

SetLink Link to the e-shop’s website with the goods’ description. Only for international orders.

func (*OrderPackageItem) SetPaymentVATRate Uses

func (item *OrderPackageItem) SetPaymentVATRate(paymentVATRate string) *OrderPackageItem

SetPaymentVATRate VAT rate included in the value of the goods

func (*OrderPackageItem) SetPaymentVATSum Uses

func (item *OrderPackageItem) SetPaymentVATSum(paymentVATSum float64) *OrderPackageItem

SetPaymentVATSum VAT amount included in the value (payment) of the goods.

func (*OrderPackageItem) SetWeightBrutto Uses

func (item *OrderPackageItem) SetWeightBrutto(weightBrutto int) *OrderPackageItem

SetWeightBrutto Gross weight (for one unit of goods, in grams). Only for international orders.

type OrderReq Uses

type OrderReq struct {
    Number                   *string                   `xml:"Number,attr"`
    SendCityCode             *int                      `xml:"SendCityCode,attr"`
    RecCityCode              *int                      `xml:"RecCityCode,attr"`
    SendCityPostCode         *int                      `xml:"SendCityPostCode,attr"`
    RecCityPostCode          *int                      `xml:"RecCityPostCode,attr"`
    SendCountryCode          *int                      `xml:"SendCountryCode,attr,omitempty"`
    RecCountryCode           *int                      `xml:"RecCountryCode,attr,omitempty"`
    SendCityName             *string                   `xml:"SendCityName,attr,omitempty"`
    RecCityName              *string                   `xml:"RecCityName,attr,omitempty"`
    RecipientINN             *string                   `xml:"RecipientINN,attr,omitempty"`
    DateInvoice              *string                   `xml:"DateInvoice,attr,omitempty"`
    ShipperName              *string                   `xml:"ShipperName,attr,omitempty"`
    ShipperAddress           *string                   `xml:"ShipperAddress,attr,omitempty"`
    Passport                 *Passport                 `xml:"Passport,omitempty"`
    Sender                   *Sender                   `xml:"Sender,omitempty"`
    RecipientName            *string                   `xml:"RecipientName,attr"`
    RecipientEmail           *string                   `xml:"RecipientEmail,attr,omitempty"`
    Phone                    *string                   `xml:"Phone,attr"`
    TariffTypeCode           *int                      `xml:"TariffTypeCode,attr"`
    DeliveryRecipientCost    *float64                  `xml:"DeliveryRecipientCost,attr,omitempty"`
    DeliveryRecipientVATRate *string                   `xml:"DeliveryRecipientVATRate,attr,omitempty"`
    DeliveryRecipientVATSum  *float64                  `xml:"DeliveryRecipientVATSum,attr,omitempty"`
    RecipientCurrency        *string                   `xml:"RecipientCurrency,attr,omitempty"`
    ItemsCurrency            *string                   `xml:"ItemsCurrency,attr,omitempty"`
    Seller                   *Seller                   `xml:"Seller,omitempty"`
    Comment                  *string                   `xml:"Comment,attr,omitempty"`
    Address                  *Address                  `xml:"Address,omitempty"`
    Package                  []*OrderPackage           `xml:"Package,omitempty"`
    DeliveryRecipientCostAdv *DeliveryRecipientCostAdv `xml:"DeliveryRecipientCostAdv,omitempty"`
    AddService               *AddService               `xml:"AddService,omitempty"`
    Schedule                 *Schedule                 `xml:"Schedule,omitempty"`
}

OrderReq Shipment (order)

func NewOrderReq Uses

func NewOrderReq(number string, recipientName string, phone string, tariffTypeCode int) *OrderReq

NewOrderReq Shipment (order) builder number: Client shipment number (unique for orders of a particular Client). Order identifier in the Client's IS recipientName: Receiver (full name). At least 3 characters. phone: Receiver's phone tariffTypeCode: Code of tariff type

func (*OrderReq) AddPackage Uses

func (orderReq *OrderReq) AddPackage(pack OrderPackage) *OrderReq

AddPackage Package (all packages are sent with different Package tags)

func (*OrderReq) SetAddService Uses

func (orderReq *OrderReq) SetAddService(addService AddService) *OrderReq

SetAddService Additional services

func (*OrderReq) SetAddress Uses

func (orderReq *OrderReq) SetAddress(address Address) *OrderReq

SetAddress Depending on a delivery mode, it is necessary to specify either Street, House, Flat attributes (delivery to the receiver's address) or PvzCode (pickup)

func (*OrderReq) SetComment Uses

func (orderReq *OrderReq) SetComment(comment string) *OrderReq

SetComment Comments (special notes on the order)

func (*OrderReq) SetDateInvoice Uses

func (orderReq *OrderReq) SetDateInvoice(dateInvoice time.Time) *OrderReq

SetDateInvoice Invoice date. Only for international orders.

func (*OrderReq) SetDeliveryRecipientCost Uses

func (orderReq *OrderReq) SetDeliveryRecipientCost(deliveryRecipientCost float64) *OrderReq

SetDeliveryRecipientCost Extra delivery charge collected by the online store from the receiver (in the specified currency)

func (*OrderReq) SetDeliveryRecipientCostAdv Uses

func (orderReq *OrderReq) SetDeliveryRecipientCostAdv(deliveryRecipientCostAdv DeliveryRecipientCostAdv) *OrderReq

SetDeliveryRecipientCostAdv Additional charge for delivery (E-shop charges the receiver), depending on the order’s sum

func (*OrderReq) SetDeliveryRecipientVATRate Uses

func (orderReq *OrderReq) SetDeliveryRecipientVATRate(deliveryRecipientVATRate string) *OrderReq

SetDeliveryRecipientVATRate VAT rate included in the extra delivery charge

func (*OrderReq) SetDeliveryRecipientVATSum Uses

func (orderReq *OrderReq) SetDeliveryRecipientVATSum(deliveryRecipientVATSum float64) *OrderReq

SetDeliveryRecipientVATSum VAT amount included in the extra delivery charge

func (*OrderReq) SetItemsCurrency Uses

func (orderReq *OrderReq) SetItemsCurrency(itemsCurrency string) *OrderReq

SetItemsCurrency Code of declared value currency (all items in the order). Currency of settlements with the CDEK Client under contract.

func (*OrderReq) SetPassport Uses

func (orderReq *OrderReq) SetPassport(passport Passport) *OrderReq

SetPassport Details of the receiver’s passport. Used to print waybills. Only for international orders.

func (*OrderReq) SetRecCityCode Uses

func (orderReq *OrderReq) SetRecCityCode(recCityCode int) *OrderReq

SetRecCityCode Receiver's city code from the CDEK base

func (*OrderReq) SetRecCityName Uses

func (orderReq *OrderReq) SetRecCityName(recCityName string) *OrderReq

SetRecCityName Name of receiver's city

func (*OrderReq) SetRecCityPostCode Uses

func (orderReq *OrderReq) SetRecCityPostCode(recCityPostCode int) *OrderReq

SetRecCityPostCode Postal code of the receiver's city

func (*OrderReq) SetRecCountryCode Uses

func (orderReq *OrderReq) SetRecCountryCode(recCountryCode int) *OrderReq

SetRecCountryCode Receiver's country code to identify a country by postal code. Default value: RU

func (*OrderReq) SetRecipientCurrency Uses

func (orderReq *OrderReq) SetRecipientCurrency(recipientCurrency string) *OrderReq

SetRecipientCurrency Code of cash-on-delivery currency: extra delivery charge and payment for the goods to be collected from the receiver. The currency is considered to be a currency of the receiver's country

func (*OrderReq) SetRecipientEmail Uses

func (orderReq *OrderReq) SetRecipientEmail(recipientEmail string) *OrderReq

SetRecipientEmail Receiver's email for sending order status notifications and contacting in case of failed calls

func (*OrderReq) SetRecipientINN Uses

func (orderReq *OrderReq) SetRecipientINN(recipientINN string) *OrderReq

SetRecipientINN TIN of the receiver. Only for international orders.

func (*OrderReq) SetSchedule Uses

func (orderReq *OrderReq) SetSchedule(schedule Schedule) *OrderReq

SetSchedule Schedule for delivery/pickup

func (*OrderReq) SetSeller Uses

func (orderReq *OrderReq) SetSeller(seller Seller) *OrderReq

SetSeller Requisites of the real seller

func (*OrderReq) SetSendCityCode Uses

func (orderReq *OrderReq) SetSendCityCode(sendCityCode int) *OrderReq

SetSendCityCode Sender's city code from the CDEK base

func (*OrderReq) SetSendCityName Uses

func (orderReq *OrderReq) SetSendCityName(sendCityName string) *OrderReq

SetSendCityName Name of sender's city

func (*OrderReq) SetSendCityPostCode Uses

func (orderReq *OrderReq) SetSendCityPostCode(sendCityPostCode int) *OrderReq

SetSendCityPostCode Postal code of the sender's city

func (*OrderReq) SetSendCountryCode Uses

func (orderReq *OrderReq) SetSendCountryCode(sendCountryCode int) *OrderReq

SetSendCountryCode Sender's country code to identify a country by postal code. Default value: RU

func (*OrderReq) SetSender Uses

func (orderReq *OrderReq) SetSender(sender Sender) *OrderReq

SetSender Sender. Must be defined if it is different from the online store Client. If the online store is a sender, the Sender tag is not available.

func (*OrderReq) SetShipperAddress Uses

func (orderReq *OrderReq) SetShipperAddress(shipperAddress string) *OrderReq

SetShipperAddress Shipper’s address. Used to print waybills. Only for international orders

func (*OrderReq) SetShipperName Uses

func (orderReq *OrderReq) SetShipperName(shipperName string) *OrderReq

SetShipperName Shipper. Used to print waybills. Only for international orders.

type OrderResp Uses

type OrderResp struct {
    Error
    DispatchNumber *int    `xml:"DispatchNumber,attr"`
    Number         *string `xml:"Number,attr"`
}

OrderResp Order

func (*OrderResp) GetError Uses

func (o *OrderResp) GetError() error

GetError returns error supplemented with order data

type Package Uses

type Package struct {
    Number  *string `xml:"Number,attr"`
    BarCode *string `xml:"BarCode,attr"`
    Item    []*Item `xml:"Item"`
}

Package Package

type Passport Uses

type Passport struct {
    Series    *string `xml:"Series,attr"`
    Number    *string `xml:"Number,attr"`
    IssueDate *string `xml:"IssueDate,attr"`
    IssuedBy  *string `xml:"IssuedBy,attr"`
    DateBirth *string `xml:"DateBirth,attr"`
}

Passport Details of the receiver’s passport. Used to print waybills. Only for international orders.

func NewPassport Uses

func NewPassport() *Passport

NewPassport Passport builder

func (*Passport) SetDateBirth Uses

func (passport *Passport) SetDateBirth(dateBirth time.Time) *Passport

SetDateBirth The receiver’s birthdate

func (*Passport) SetIssueDate Uses

func (passport *Passport) SetIssueDate(issueDate time.Time) *Passport

SetIssueDate Date of issue of the receiver’s passport.

func (*Passport) SetIssuedBy Uses

func (passport *Passport) SetIssuedBy(issuedBy string) *Passport

SetIssuedBy Issuing authority of the receiver’s passport.

func (*Passport) SetNumber Uses

func (passport *Passport) SetNumber(number string) *Passport

SetNumber Number of the receiver’s passport.

func (*Passport) SetSeries Uses

func (passport *Passport) SetSeries(series string) *Passport

SetSeries Series of the receiver’s passport.

type Pvz Uses

type Pvz struct {
    Code           *string        `xml:"Code,attr"`
    PostalCode     *string        `xml:"PostalCode,attr"`
    Name           *string        `xml:"Name,attr"`
    CountryCode    *string        `xml:"CountryCode,attr"`
    CountryCodeIso *string        `xml:"countryCodeIso,attr"`
    CountryName    *string        `xml:"CountryName,attr"`
    RegionCode     *string        `xml:"RegionCode,attr"`
    RegionName     *string        `xml:"RegionName,attr"`
    CityCode       *int           `xml:"CityCode,attr"`
    City           *string        `xml:"City,attr"`
    WorkTime       *string        `xml:"WorkTime,attr"`
    Address        *string        `xml:"Address,attr"`
    FullAddress    *string        `xml:"FullAddress,attr"`
    AddressComment *string        `xml:"AddressComment,attr"`
    Phone          *string        `xml:"Phone,attr"`
    Email          *string        `xml:"Email,attr"`
    QqID           *string        `xml:"qqId,attr"`
    Note           *string        `xml:"Note,attr"`
    CoordX         *float64       `xml:"coordX,attr"`
    CoordY         *float64       `xml:"coordY,attr"`
    Type           *string        `xml:"Type,attr"`
    OwnerCode      *string        `xml:"ownerCode,attr"`
    IsDressingRoom *bool          `xml:"IsDressingRoom,attr"`
    HaveCashless   *bool          `xml:"HaveCashless,attr"`
    AllowedCod     *bool          `xml:"AllowedCod,attr"`
    NearestStation *string        `xml:"NearestStation,attr"`
    MetroStation   *string        `xml:"MetroStation,attr"`
    Site           *string        `xml:"Site,attr"`
    OfficeImage    []*OfficeImage `xml:"OfficeImage"`
    WorkTimeY      []*WorkTimeY   `xml:"WorkTimeY"`
    WeightLimit    *WeightLimit   `xml:"WeightLimit"`
}

Pvz List of Pickup Points

type PvzListFilter Uses

type PvzListFilter string

PvzListFilter key for filtering pvzList

const (
    //PvzListFilterCityPostCode Почтовый индекс города, для которого необходим список ПВЗ
    PvzListFilterCityPostCode PvzListFilter = "citypostcode"

    //PvzListFilterCityID Код города по базе СДЭК
    PvzListFilterCityID PvzListFilter = "cityid"

    //PvzListFilterType Тип пункта выдачи, по умолчанию «PVZ».
    PvzListFilterType PvzListFilter = "type"

    //PvzListFilterCountryID Код страны по базе СДЭК
    PvzListFilterCountryID PvzListFilter = "countryid"

    //PvzListFilterCountryIso Код страны в формате ISO_3166-1_alpha-2
    PvzListFilterCountryIso PvzListFilter = "countryiso"

    //PvzListFilterRegionID Код региона по базе СДЭК
    PvzListFilterRegionID PvzListFilter = "regionid"

    //PvzListFilterHaveCashless Наличие терминала оплаты («1», «true» - есть; «0», «false» - нет.)
    PvzListFilterHaveCashless PvzListFilter = "havecashless"

    //PvzListFilterAllowedCod Разрешен наложенный платеж («1», «true» - да; «0», «false» - нет.)
    PvzListFilterAllowedCod PvzListFilter = "allowedcod"

    //PvzListFilterIsDressingRoom Наличие примерочной («1», «true» - есть; «0», «false» - нет.)
    PvzListFilterIsDressingRoom PvzListFilter = "isdressingroom"

    //PvzListFilterWeightMax Максимальный вес, который может принять ПВЗ
    PvzListFilterWeightMax PvzListFilter = "weightmax"

    //PvzListFilterLang Локализация ПВЗ. По-умолчанию "rus"
    PvzListFilterLang PvzListFilter = "lang"

    //PvzListFilterTakeOnly Является ли ПВЗ только пунктом выдачи («1», «true» - да; «0», «false» - нет.)
    PvzListFilterTakeOnly PvzListFilter = "takeonly"
)

type PvzListFilterBuilder Uses

type PvzListFilterBuilder struct {
    // contains filtered or unexported fields
}

PvzListFilterBuilder builder for pvzList filter

func (*PvzListFilterBuilder) AddFilter Uses

func (filterBuilder *PvzListFilterBuilder) AddFilter(filter PvzListFilter, value string) *PvzListFilterBuilder

AddFilter adds filter for pvzList filter

func (PvzListFilterBuilder) Filter Uses

func (filterBuilder PvzListFilterBuilder) Filter() map[PvzListFilter]string

Filter returns complete filter

type Reason Uses

type Reason struct {
    Date        string `xml:"Date,attr"`
    Code        int    `xml:"Code,attr"`
    Description string `xml:"Description,attr"`
}

Reason Current additional status

type Region Uses

type Region struct {
    RegionUUID     *string `json:"regionUuid"`
    RegionName     *string `json:"regionName"`
    Prefix         *string `json:"prefix,omitempty"`
    RegionCodeExt  *int    `json:"regionCodeExt,string,omitempty"`
    RegionCode     *int    `json:"regionCode,string,omitempty"`
    RegionFiasGUID *string `json:"regionFiasGuid,omitempty"`
    CountryName    *string `json:"countryName"`
    CountryCode    *string `json:"countryCode,omitempty"`
    CountryCodeExt *int    `json:"countryCodeExt,omitempty,string"`
}

Region Region response

type RegionFilter Uses

type RegionFilter string

RegionFilter filter key for "List of Regions" request

const (
    //RegionFilterRegionCodeExt  Region code
    RegionFilterRegionCodeExt RegionFilter = "regionCodeExt"

    //RegionFilterRegionCode Region code in the CDEK IS
    RegionFilterRegionCode RegionFilter = "regionCode"

    //RegionFilterRegionFiasGUID Region code according to the Federal Information Address System
    RegionFilterRegionFiasGUID RegionFilter = "regionFiasGuid"

    //RegionFilterCountryCode Country code in the CDEK IS
    RegionFilterCountryCode RegionFilter = "countryCode"

    //RegionFilterCountryCodeExt Code according to the Russian Classifier of Countries of the World
    RegionFilterCountryCodeExt RegionFilter = "countryCodeExt"

    //RegionFilterPage Number of the results page. Default value: 0
    RegionFilterPage RegionFilter = "page"

    //RegionFilterSize Limitation on the number of results displayed. Default value: 1,000
    RegionFilterSize RegionFilter = "size"
)

type RegionFilterBuilder Uses

type RegionFilterBuilder struct {
    // contains filtered or unexported fields
}

RegionFilterBuilder builder for filer for "List of Regions" request

func (*RegionFilterBuilder) AddFilter Uses

func (filterBuilder *RegionFilterBuilder) AddFilter(filter RegionFilter, value string) *RegionFilterBuilder

AddFilter add filter to set of filters for "List of Regions" request

func (*RegionFilterBuilder) Filter Uses

func (filterBuilder *RegionFilterBuilder) Filter() map[RegionFilter]string

Filter compile RegionFilterBuilder for "List of Regions" request

type RegisterOrderReq Uses

type RegisterOrderReq struct {
    XMLName     xml.Name     `xml:"DeliveryRequest"`
    Number      *string      `xml:"Number,attr"`
    OrderCount  *int         `xml:"OrderCount,attr"`
    Currency    *string      `xml:"Currency,attr,omitempty"`
    Order       *OrderReq    `xml:"Order"`
    CallCourier *CallCourier `xml:"CallCourier"`
    // contains filtered or unexported fields
}

RegisterOrderReq Order registration request

func NewDeliveryRequest Uses

func NewDeliveryRequest(number string, orderCount int, order *OrderReq) *RegisterOrderReq

NewDeliveryRequest Order registration request builder number: ID number of the acceptance certificate/waybill, accompanying document attached upon the transfer of the cargo to CDEK, generated in the online store's system. Identifier of the list of cargoes in the IS of the CDEK Client. By default, you can use 1. orderCount: The total number of orders in a document, default value: 1. order: Shipment (order)

func (*RegisterOrderReq) SetCallCourier Uses

func (registerOrderReq *RegisterOrderReq) SetCallCourier(callCourier CallCourier) *RegisterOrderReq

SetCallCourier Call courier

func (*RegisterOrderReq) SetCurrency Uses

func (registerOrderReq *RegisterOrderReq) SetCurrency(currency string) *RegisterOrderReq

SetCurrency Currency identifier for prices, RUB is a default parameter. Only for international orders

type RegisterOrderResp Uses

type RegisterOrderResp struct {
    Order []*OrderResp       `xml:"Order,omitempty"`
    Call  []*CourierCallResp `xml:"Call,omitempty"`
}

RegisterOrderResp Order registration response structure

type ReturnOrder Uses

type ReturnOrder struct {
    ActNumber      *string      `xml:"ActNumber,attr"`
    Number         *string      `xml:"Number,attr"`
    DispatchNumber *int         `xml:"DispatchNumber,attr"`
    DeliveryDate   *string      `xml:"DeliveryDate,attr"`
    RecipientName  *string      `xml:"RecipientName,attr"`
    Status         *Status      `xml:"Status"`
    Reason         *Reason      `xml:"Reason"`
    DelayReason    *DelayReason `xml:"DelayReason"`
}

ReturnOrder Return shipment

type Schedule Uses

type Schedule struct {
    Attempt []*ScheduleAttempt `xml:"Attempt"`
}

Schedule Schedule for delivery/pickup

func NewSchedule Uses

func NewSchedule() *Schedule

NewSchedule Schedule for delivery/pickup builder

func (*Schedule) AddAttempt Uses

func (schedule *Schedule) AddAttempt(attempt ScheduleAttempt) *Schedule

AddAttempt add Time of delivery

type ScheduleAttempt Uses

type ScheduleAttempt struct {
    ID      *string  `xml:"ID,attr"`
    Date    *string  `xml:"Date,attr"`
    Comment *string  `xml:"Comment,attr"`
    TimeBeg *string  `xml:"TimeBeg,attr"`
    TimeEnd *string  `xml:"TimeEnd,attr"`
    Address *Address `xml:"Address"`
}

ScheduleAttempt Time of delivery (one time interval not less than 3 hours is permitted for one day)

func NewScheduleAttempt Uses

func NewScheduleAttempt(id string, date time.Time) *ScheduleAttempt

NewScheduleAttempt Time of delivery builder id: ID number of a schedule from the online store's database. You may use 1 as a default value date: Date of delivery as agreed by the receiver

func (*ScheduleAttempt) SetAddress Uses

func (scheduleAttempt *ScheduleAttempt) SetAddress(address Address) *ScheduleAttempt

SetAddress New delivery address (if change is required). Depending on a delivery mode, Street or House attributes should be specified. Flat – delivery to the receiver's address, or PvzCode – pickup

func (*ScheduleAttempt) SetComment Uses

func (scheduleAttempt *ScheduleAttempt) SetComment(comment string) *ScheduleAttempt

SetComment Comment

func (*ScheduleAttempt) SetTimeBeg Uses

func (scheduleAttempt *ScheduleAttempt) SetTimeBeg(timeBeg string) *ScheduleAttempt

SetTimeBeg Start of a delivery time range (receiver's time)

func (*ScheduleAttempt) SetTimeEnd Uses

func (scheduleAttempt *ScheduleAttempt) SetTimeEnd(timeEnd string) *ScheduleAttempt

SetTimeEnd End of a delivery time range (receiver's time)

type Seller Uses

type Seller struct {
    Address       *string `xml:"Address,attr,omitempty"`
    Name          *string `xml:"Name,attr,omitempty"`
    INN           *string `xml:"INN,attr,omitempty"`
    Phone         *string `xml:"Phone,attr,omitempty"`
    OwnershipForm *int    `xml:"OwnershipForm,attr,omitempty"`
}

Seller Requisites of the real seller

func NewSeller Uses

func NewSeller() *Seller

NewSeller Requisites of the real seller builder

func (*Seller) SetAddress Uses

func (seller *Seller) SetAddress(address string) *Seller

SetAddress Real seller’s address. Used to print invoices to display the address of the true seller or trade name. Only for international orders.

func (*Seller) SetINN Uses

func (seller *Seller) SetINN(inn string) *Seller

SetINN ITN (Individual Taxpayer Number) of the real seller

func (*Seller) SetName Uses

func (seller *Seller) SetName(name string) *Seller

SetName Real seller

func (*Seller) SetOwnershipForm Uses

func (seller *Seller) SetOwnershipForm(ownershipForm int) *Seller

SetOwnershipForm Code of type ownership

func (*Seller) SetPhone Uses

func (seller *Seller) SetPhone(phone string) *Seller

SetPhone Telephone of the real seller

type Sender Uses

type Sender struct {
    Company *string   `xml:"Company,attr"`
    Name    *string   `xml:"Name,attr"`
    Address *Address  `xml:"Address,omitempty"`
    Phone   []*string `xml:"Phone,omitempty"`
}

Sender Sender. Must be defined if it is different from the online store Client. If the online store is a sender, the Sender tag is not available.

func NewSender Uses

func NewSender() *Sender

NewSender Sender builder

func (*Sender) AddPhone Uses

func (sender *Sender) AddPhone(phone string) *Sender

AddPhone Sender's phone

func (*Sender) SetAddress Uses

func (sender *Sender) SetAddress(address Address) *Sender

SetAddress Address of pickup builder

func (*Sender) SetCompany Uses

func (sender *Sender) SetCompany(company string) *Sender

SetCompany Name of sender's company

func (*Sender) SetName Uses

func (sender *Sender) SetName(name string) *Sender

SetName Sender's contact person

type ServiceAccessСonfigurator Uses

type ServiceAccessСonfigurator interface {
    SetAuth(account, secure string) ServiceProvider
    SetCalculatorURL(calculatorURL string) ServiceProvider
}

ServiceAccessСonfigurator allows to configure client for the service

type ServiceProvider Uses

type ServiceProvider interface {
    ServiceAccessСonfigurator

    CalculateDelivery(req GetCostReq) (*GetCostRespResult, error)
    GetCities(filter map[CityFilter]string) (*GetCitiesResp, error)
    GetPvzList(filter map[PvzListFilter]string) ([]*Pvz, error)
    GetRegions(filter map[RegionFilter]string) (*GetRegionsResp, error)
    RegisterOrder(req RegisterOrderReq) (*RegisterOrderResp, error)
    UpdateOrder(req UpdateOrderReq) (*UpdateOrderResp, error)
    DeleteOrder(req DeleteOrderReq) (*DeleteOrderResp, error)
    GetStatusReport(statusReportReq StatusReport) (*StatusReportResp, error)
}

ServiceProvider provides CDEK API functionality

func NewClient Uses

func NewClient(apiURL string) ServiceProvider

NewClient Client constructor with defaults

Code:

client := NewClient("https://integration.edu.cdek.ru/")
client.SetAuth("z9GRRu7FxmO53CQ9cFfI6qiy32wpfTkd", "w24JTCv4MnAcuRTx0oHjHLDtyt3I6IBq")

type ServiceReq Uses

type ServiceReq struct {
    ID    int `json:"id"`
    Param int `json:"param,omitempty"`
}

ServiceReq List of additional service

type ServiceResp Uses

type ServiceResp struct {
    ID    int     `json:"id"`
    Title string  `json:"title"`
    Price float64 `json:"price"`
    Rate  float64 `json:"rate,omitempty"`
}

ServiceResp List of transmitted additional services

type State Uses

type State struct {
    Date        *string `xml:"Date,attr"`
    Code        *int    `xml:"Code,attr"`
    Description *string `xml:"Description,attr"`
    CityCode    *int    `xml:"CityCode,attr,omitempty"`
    CityName    *string `xml:"CityName,attr,omitempty"`
}

State Status change history

type Status Uses

type Status struct {
    Date        *string  `xml:"Date,attr"`
    Code        *int     `xml:"Code,attr"`
    Description *string  `xml:"Description,attr"`
    CityCode    *int     `xml:"CityCode,attr"`
    CityName    *string  `xml:"CityName,attr"`
    State       []*State `xml:"State"`
}

Status Current order status

type StatusReport Uses

type StatusReport struct {
    ShowHistory            *int                    `xml:"ShowHistory,attr"`
    ShowReturnOrder        *bool                   `xml:"ShowReturnOrder,attr"`
    ShowReturnOrderHistory *bool                   `xml:"ShowReturnOrderHistory,attr"`
    ChangePeriod           *ChangePeriod           `xml:"ChangePeriod"`
    Order                  []*StatusReportOrderReq `xml:"Order"`
    // contains filtered or unexported fields
}

StatusReport Order Status Report request

func NewStatusReportReq Uses

func NewStatusReportReq() *StatusReport

NewStatusReportReq Order Status Report builder

func (*StatusReport) AddOrder Uses

func (req *StatusReport) AddOrder(order StatusReportOrderReq) *StatusReport

AddOrder Add Shipment (order)

func (*StatusReport) SetChangePeriod Uses

func (req *StatusReport) SetChangePeriod(changePeriod ChangePeriod) *StatusReport

SetChangePeriod The period during which the order status has changed.

func (*StatusReport) SetShowHistory Uses

func (req *StatusReport) SetShowHistory(showHistory int) *StatusReport

SetShowHistory The attribute indicating that the order history must be loaded (1 – yes, 0 – no)

func (*StatusReport) SetShowReturnOrder Uses

func (req *StatusReport) SetShowReturnOrder(showReturnOrder bool) *StatusReport

SetShowReturnOrder The attribute indicating that the list of return orders must be loaded (1 – yes, 0 – no)

func (*StatusReport) SetShowReturnOrderHistory Uses

func (req *StatusReport) SetShowReturnOrderHistory(showReturnOrderHistory bool) *StatusReport

SetShowReturnOrderHistory The attribute indicating that the history of return orders must be loaded (1 – yes, 0 – no)

type StatusReportContentForResp Uses

type StatusReportContentForResp struct {
    DateFirst *string `xml:"DateFirst,attr"`
    DateLast  *string `xml:"DateLast,attr"`
}

StatusReportContentForResp The period during which the order status has changed.

type StatusReportOrderReq Uses

type StatusReportOrderReq struct {
    DispatchNumber *int    `xml:"DispatchNumber,attr"`
    Number         *string `xml:"Number,attr"`
    Date           *string `xml:"Date,attr"`
}

StatusReportOrderReq Shipment (order)

func NewStatusReportByCDEKIdentifierReq Uses

func NewStatusReportByCDEKIdentifierReq(dispatchNumber int) *StatusReportOrderReq

NewStatusReportByCDEKNumberReq StatusReportOrderReq builder by CDEK order number

func NewStatusReportByClientIdentifierReq Uses

func NewStatusReportByClientIdentifierReq(number string, date time.Time) *StatusReportOrderReq

NewStatusReportByClientNumberReq StatusReportOrderReq builder by client order number

type StatusReportOrderResp Uses

type StatusReportOrderResp struct {
    ActNumber            *string     `xml:"ActNumber,attr"`
    Number               *string     `xml:"Number,attr"`
    DispatchNumber       *int        `xml:"DispatchNumber,attr"`
    DeliveryDate         string      `xml:"DeliveryDate,attr"`
    RecipientName        string      `xml:"RecipientName,attr"`
    ReturnDispatchNumber *int        `xml:"ReturnDispatchNumber,attr"`
    Status               *Status     `xml:"Status"`
    Reason               Reason      `xml:"Reason"`
    DelayReason          DelayReason `xml:"DelayReason"`
    Package              *Package    `xml:"Package"`
    Attempt              *Attempt    `xml:"Attempt"`
    Call                 *Call       `xml:"Call"`
}

StatusReportOrderResp Shipment (order)

type StatusReportResp Uses

type StatusReportResp struct {
    Error
    StatusReport *StatusReportContentForResp `xml:"StatusReport"`
    Order        []*StatusReportOrderResp    `xml:"Order"`
    ReturnOrder  []*ReturnOrder              `xml:"ReturnOrder,omitempty"`
}

StatusReportResp Order Status Report response

type UpdateOrder Uses

type UpdateOrder struct {
    Number                   *string                   `xml:"Number,attr"`
    DispatchNumber           *int                      `xml:"DispatchNumber,attr"`
    DeliveryRecipientCost    *float64                  `xml:"DeliveryRecipientCost,attr"`
    DeliveryRecipientVATRate *string                   `xml:"DeliveryRecipientVATRate,attr"`
    DeliveryRecipientVATSum  *float64                  `xml:"DeliveryRecipientVATSum,attr"`
    RecipientName            *string                   `xml:"RecipientName,attr"`
    RecipientEmail           *string                   `xml:"RecipientEmail,attr"`
    Phone                    *string                   `xml:"Phone,attr"`
    RecipientINN             *string                   `xml:"RecipientINN,attr"`
    DateInvoice              *string                   `xml:"DateInvoice,attr"`
    Passport                 *Passport                 `xml:"Passport"`
    Address                  *Address                  `xml:"Address"`
    DeliveryRecipientCostAdv *DeliveryRecipientCostAdv `xml:"DeliveryRecipientCostAdv"`
    Package                  *OrderPackage             `xml:"Package"`
}

UpdateOrder Order Change request

func NewUpdateOrder Uses

func NewUpdateOrder() *UpdateOrder

NewUpdateOrder UpdateOrder builder

func (*UpdateOrder) SetAddress Uses

func (updateOrder *UpdateOrder) SetAddress(address Address) *UpdateOrder

SetAddress Delivery address.

func (*UpdateOrder) SetDateInvoice Uses

func (updateOrder *UpdateOrder) SetDateInvoice(dateInvoice string) *UpdateOrder

SetDateInvoice Invoice date. Only for international orders.

func (*UpdateOrder) SetDeliveryRecipientCost Uses

func (updateOrder *UpdateOrder) SetDeliveryRecipientCost(deliveryRecipientCost float64) *UpdateOrder

SetDeliveryRecipientCost Additional delivery charge collected by the online store from the receiver (in the specified currency)

func (*UpdateOrder) SetDeliveryRecipientCostAdv Uses

func (updateOrder *UpdateOrder) SetDeliveryRecipientCostAdv(v DeliveryRecipientCostAdv) *UpdateOrder

SetDeliveryRecipientCostAdv Additional charge for delivery

func (*UpdateOrder) SetDeliveryRecipientVATRate Uses

func (updateOrder *UpdateOrder) SetDeliveryRecipientVATRate(deliveryRecipientVATRate string) *UpdateOrder

SetDeliveryRecipientVATRate VAT rate included in the extra delivery charge

func (*UpdateOrder) SetDeliveryRecipientVATSum Uses

func (updateOrder *UpdateOrder) SetDeliveryRecipientVATSum(deliveryRecipientVATSum float64) *UpdateOrder

SetDeliveryRecipientVATSum VAT amount included in the extra. delivery charge

func (*UpdateOrder) SetDispatchNumber Uses

func (updateOrder *UpdateOrder) SetDispatchNumber(dispatchNumber int) *UpdateOrder

SetDispatchNumber CDEK order number

func (*UpdateOrder) SetNumber Uses

func (updateOrder *UpdateOrder) SetNumber(number string) *UpdateOrder

SetNumber Client shipment number (unique for orders of a particular Client). Order identifier in the Client's IS.

func (*UpdateOrder) SetPackage Uses

func (updateOrder *UpdateOrder) SetPackage(pack OrderPackage) *UpdateOrder

SetPackage Package

func (*UpdateOrder) SetPassport Uses

func (updateOrder *UpdateOrder) SetPassport(passport Passport) *UpdateOrder

SetPassport Details of the receiver’s passport.

func (*UpdateOrder) SetPhone Uses

func (updateOrder *UpdateOrder) SetPhone(phone string) *UpdateOrder

SetPhone Receiver's phone

func (*UpdateOrder) SetRecipientEmail Uses

func (updateOrder *UpdateOrder) SetRecipientEmail(recipientEmail string) *UpdateOrder

SetRecipientEmail Receiver's email for sending order status notifications and contacting in case of failed calls

func (*UpdateOrder) SetRecipientINN Uses

func (updateOrder *UpdateOrder) SetRecipientINN(recipientINN string) *UpdateOrder

SetRecipientINN TIN of the receiver. Only for international orders.

func (*UpdateOrder) SetRecipientName Uses

func (updateOrder *UpdateOrder) SetRecipientName(recipientName string) *UpdateOrder

SetRecipientName Receiver (full name). At least 3 characters.

type UpdateOrderReq Uses

type UpdateOrderReq struct {
    XMLName    xml.Name     `xml:"UpdateRequest"`
    Number     *string      `xml:"Number,attr"`
    OrderCount *int         `xml:"OrderCount,attr"`
    Order      *UpdateOrder `xml:"Order"`
    // contains filtered or unexported fields
}

UpdateOrderReq Order Change request structure

func NewUpdateOrderReq Uses

func NewUpdateOrderReq(number string, orderCount int, order UpdateOrder) *UpdateOrderReq

NewUpdateOrderReq UpdateOrderReq builder

type UpdateOrderResp Uses

type UpdateOrderResp struct {
    Order []*OrderResp `xml:"Order"`
}

UpdateOrderResp Order Change response

type WeightLimit Uses

type WeightLimit struct {
    WeightMin *float64 `xml:"WeightMin,attr"`
    WeightMax *float64 `xml:"WeightMax,attr"`
}

WeightLimit Weight limits for a pickup point (the tag is used only if limits are set)

type WorkTimeY Uses

type WorkTimeY struct {
    Day     *int    `xml:"day,attr"`
    Periods *string `xml:"periods,attr"`
}

WorkTimeY Opening hours for every day

Package cdek imports 14 packages (graph). Updated 2020-08-07. Refresh now. Tools for package owners.