russianpost

package
v0.0.0-...-b56df44 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2016 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressParameters

type AddressParameters struct {
	DestinationAddress DestinationAddress `xml:"DestinationAddress"`
	OperationAddress   OperationAddress   `xml:"OperationAddress"`
	MailDirect         MailDirect         `xml:"MailDirect"`
	CountryOper        CountryOper        `xml:"CountryOper"`
	CountryFrom        CountryFrom        `xml:"CountryFrom"`
}

AddressParameters Содержит адресные данные с операцией над отправлением

type AuthorizationHeader

type AuthorizationHeader struct {
	XMLName        xml.Name `xml:"data:AuthorizationHeader"`
	MustUnderstand string   `xml:"soapenv:mustUnderstand,attr"`
	Login          string   `xml:"data:login"`
	Password       string   `xml:"data:password"`
}

AuthorizationHeader Содержит элементы login и password. Атрибут soapenv:mustUnderstand элемента AuthorizationHeader должен содержать значение 1.

type Body

type Body struct {
	GetOperationHistoryResponse GetOperationHistoryResponse `xml:"getOperationHistoryResponse"`
}

Body тело ответа

type Client

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

A Client manages communication with the API.

func NewClient

func NewClient(serviceLogin, servicePassword string) *Client

NewClient returns a new API client. If a nil httpClient is provided, http.DefaultClient will be used.

func (*Client) Do

func (c *Client) Do(req *http.Request) ([]byte, error)

Do sends an API request and returns the API response.

func (*Client) GetOperationHistory

func (c *Client) GetOperationHistory(barcode, messegeType, language string) (Data, error)

GetOperationHistory возвращает историю операций над отправлением barcode - Идентификатор регистрируемого почтового отправления в одном из форматов:

  • внутрироссийский, состоящий из 14 символов (цифровой);
  • международный, состоящий из 13 символов (буквенно-цифровой) в формате S10.

messegeType - Тип сообщения. Возможные значения:

0 - история операций для отправления;
1 - история операций для заказного уведомления по данному отправлению.

language - Язык, на котором должны возвращаться названия операций/атрибутов и сообщения об ошибках. Допустимые значения:

RUS – использовать русский язык (используется по умолчанию);
ENG – использовать английский язык.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, body io.Reader) (*http.Request, error)

NewRequest creates an API request. A relative URL can be provided in urlStr, in which case it is resolved relative to the BaseURL of the Client.

type CountryFrom

type CountryFrom struct {
	ID     int `xml:"Id"`
	Code2A string
	Code3A string
	NameRU string
	NameEN string
}

CountryFrom Содержит данные о стране приема почтового отправления

type CountryOper

type CountryOper struct {
	ID     int `xml:"Id"`
	Code2A string
	Code3A string
	NameRU string
	NameEN string
}

CountryOper Содержит данные о стране проведения операции над почтовым отправлением

type Data

type Data struct {
	DataItems []DataItem
}

Data содержит данные об операциях над почтовым отправлением

type DataItem

type DataItem struct {
	DestinationAddress string // место назначения
	Mass               int    // вес отправления
	OperarationDate    string // дата проведения оперрации над отправлением
	Operation          string // операция над отправлением (тип и атрибут)
	OperationLocation  string // место проведения операции над отправлением (почтовый индекс, название)
}

DataItem содержит данные об операции над почтовым отправлением

type DestinationAddress

type DestinationAddress struct {
	Index       string `xml:"Index"`
	Description string `xml:"Description"`
}

DestinationAddress Содержит адресные данные места назначения пересылки отправления

type FinanceParameters

type FinanceParameters struct {
	Payment    int
	Value      int
	MassRate   int
	InsrRate   int
	AirRate    int
	Rate       int
	CustomDuty int
}

FinanceParameters Содержит финансовые данные, связанные с операцией над почтовым отправлением

type GetOperationHistoryResponse

type GetOperationHistoryResponse struct {
	OperationHistoryData OperationHistoryData `xml:"OperationHistoryData"`
}

GetOperationHistoryResponse элемент xml структуры

type HistoryRecord

type HistoryRecord struct {
	AddressParameters   AddressParameters   `xml:"AddressParameters"`
	FinanceParameters   FinanceParameters   `xml:"FinanceParameters"`
	ItemParameters      ItemParameters      `xml:"ItemParameters"`
	OperationParameters OperationParameters `xml:"OperationParameters"`
	UserParameters      UserParameters      `xml:"UserParameters"`
}

HistoryRecord содержит информацию об одной операции над отправлением.

type ItemParameters

type ItemParameters struct {
	Barcode         string
	Internum        string
	ValidRuType     string
	ValidEnType     string
	ComplexItemName string
	MailRank        MailRank `xml:"MailRank"`
	MailType        MailType `xml:"MailType"`
	Mass            int
	MaxMassRu       int
	MaxMassEn       int
}

ItemParameters Содержит данные о почтовом отправлении

type MailCtg

type MailCtg struct {
	ID   int `xml:"Id"`
	Name string
}

MailCtg Содержит данные о категории почтового отправления.

type MailDirect

type MailDirect struct {
	ID     int `xml:"Id"`
	Code2A string
	Code3A string
	NameRU string
	NameEN string
}

MailDirect Содержит данные о стране места назначения пересылки отправления

type MailRank

type MailRank struct {
	ID   int `xml:"Id"`
	Name string
}

MailRank Содержит информацию о разряде почтового отправления

type MailType

type MailType struct {
	ID   int `xml:"Id"`
	Name string
}

MailType Содержит данные о виде почтового отправления

type OperAttr

type OperAttr struct {
	ID   int `xml:"Id"`
	Name string
}

OperAttr Содержит информацию об атрибуте операции над отправлением

type OperType

type OperType struct {
	ID   int `xml:"Id"`
	Name string
}

OperType Содержит информацию об операции над отправлением

type OperationAddress

type OperationAddress struct {
	Index       string `xml:"Index"`
	Description string `xml:"Description"`
}

OperationAddress Содержит адресные данные места проведения операции над отправлением

type OperationHistoryData

type OperationHistoryData struct {
	HistoryRecords []HistoryRecord `xml:"historyRecord"`
}

OperationHistoryData содержит список элементов historyRecord. Каждый из них содержит информацию об одной операции над отправлением Если над отправлением еще не зарегистрировано ни одной операции, то возвращается пустой список элементов historyRecord

type OperationHistoryRequest

type OperationHistoryRequest struct {
	XMLName     xml.Name `xml:"data:OperationHistoryRequest"`
	Barcode     string   `xml:"data:Barcode"`
	MessageType string   `xml:"data:MessageType"`
	Language    string   `xml:"data:Language"`
}

OperationHistoryRequest Содержит элементы Barcode, MessageType, Language

type OperationParameters

type OperationParameters struct {
	OperType OperType `xml:"OperType"`
	OperAttr OperAttr `xml:"OperAttr"`
	OperDate string
}

OperationParameters Cодержит параметры операции над отправлением

type Result

type Result struct {
	XMLName xml.Name `xml:"Envelope"`
	Body    Body     `xml:"Body"`
}

Result результат запроса

type SendCtg

type SendCtg struct {
	ID   int `xml:"Id"`
	Name string
}

SendCtg Содержит информацию о категории отправителя.

type SoapRequest

type SoapRequest struct {
	XMLName     xml.Name `xml:"soap:Envelope"`
	SoapAttr    string   `xml:"xmlns:soap,attr"`
	OperAttr    string   `xml:"xmlns:oper,attr"`
	DataAttr    string   `xml:"xmlns:data,attr"`
	SoapEnvAttr string   `xml:"xmlns:soapenv,attr"`
	Header      string   `xml:"soap:Header"`
	Body        SoapRequestBody
}

SoapRequest структура soap запроса

type SoapRequestBody

type SoapRequestBody struct {
	XMLName xml.Name `xml:"soap:Body"`
	Oper    SoapRequestOper
}

SoapRequestBody тело запроса

type SoapRequestOper

type SoapRequestOper struct {
	XMLName     xml.Name `xml:"oper:getOperationHistory"`
	OperHistReq OperationHistoryRequest
	AuthHeader  AuthorizationHeader
}

SoapRequestOper вид операции, передаваемой в запросе

type UserParameters

type UserParameters struct {
	SendCtg SendCtg `xml:"SendCtg"`
	Sndr    string
	Rcpn    string
}

UserParameters Содержит данные субъектов, связанных с операцией над почтовым отправлением

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL