models

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CurrencyCZK = "CZK"
	CurrencyEUR = "EUR"
	CurrencyHUF = "HUF"
	CurrencyPLN = "PLN"
	CurrencyRON = "RON"
)
View Source
const (
	ResponseStatusOk    = "ok"
	ResponseStatusFault = "fault"
)

Variables

This section is empty.

Functions

func ValidateAttribute

func ValidateAttribute(key string, value string) (isValidated bool, errorsArray []validator.FieldError)

func ValidateClaimAttributes

func ValidateClaimAttributes() (isValidated bool, errorsArray []validator.FieldError)

func ValidateClaimWithPasswordAttributes

func ValidateClaimWithPasswordAttributes() (isValidated bool, errorsArray []validator.FieldError)

func ValidateCourierInfoItem

func ValidateCourierInfoItem() (isValidated bool, errorsArray []validator.FieldError)

func ValidateCourierTrackingUrl

func ValidateCourierTrackingUrl() (isValidated bool, errorsArray []validator.FieldError)

func ValidateCurrentStatusRecord

func ValidateCurrentStatusRecord() (isValidated bool, errorsArray []validator.FieldError)

func ValidatePacketAttributes

func ValidatePacketAttributes() (isValidated bool, errorsArray []validator.FieldError)

func ValidatePacketInfo

func ValidatePacketInfo() (isValidated bool, errorsArray []validator.FieldError)

func ValidateSize

func ValidateSize(s Size) (isValidated bool, errorsArray []validator.FieldError)

Types

type Attribute

type Attribute struct {
	Key   string `xml:"key" validate:"required"`
	Value string `xml:"value" validate:"required"`
}

func NewAttribute

func NewAttribute(Key string, Value string) *Attribute

type AttributeCollection

type AttributeCollection struct {
	Attribute []Attribute `xml:"attribute"`
}

func NewAttributeCollection

func NewAttributeCollection(Attribute []Attribute) *AttributeCollection

type BarcodePng

type BarcodePng struct {
	XMLName     xml.Name `xml:"barcodePng"`
	ApiPassword string   `xml:"apiPassword" validate:"required"`
	Barcode     string   `xml:"barcode" validate:"required"`
}

func NewBarcodePng

func NewBarcodePng(ApiPassword string, Barcode string) *BarcodePng

type ClaimAttributes

type ClaimAttributes struct {
	Id               int     `xml:"id,omitempty"`
	Number           string  `xml:"number" validate:"required"`
	Email            string  `xml:"email" validate:"required,email"`
	Phone            string  `xml:"phone" validate:"required"`
	Value            float32 `xml:"value" validate:"required"`
	Currency         string  `xml:"currency,omitempty"`
	Eshop            string  `xml:"eshop" validate:"required"` // Required when using more senders
	SendLabelToEmail bool    `xml:"SendLabelToEmail,omitempty"`
}

func NewClaimAttributes

func NewClaimAttributes(Id int, Number string, Email string, Phone string, Value float32, Currency string,
	Eshop string) *ClaimAttributes

func NewClaimAttributesRequired

func NewClaimAttributesRequired(Id int, Number string, Email string, Phone string, Value float32,
	Eshop string) *ClaimAttributes

type ClaimAttributesValid

type ClaimAttributesValid struct {
	XMLName         xml.Name        `xml:"packetClaimAttributesValid"`
	ApiPassword     string          `xml:"apiPassword" validate:"required"`
	ClaimAttributes ClaimAttributes `xml:"claimAttributes" validate:"required"`
}

func NewClaimAttributesValid

func NewClaimAttributesValid(ApiPassword string, ClaimAttributes ClaimAttributes) *ClaimAttributesValid

type ClaimWithPasswordAttributes

type ClaimWithPasswordAttributes struct {
	Id                  int     `xml:"id" validate:"required"`
	Number              string  `xml:"number" validate:"required"`
	Email               string  `xml:"email" validate:"required,email"`
	Phone               string  `xml:"phone" validate:"required"`
	Value               float32 `xml:"value" validate:"required"`
	Currency            string  `xml:"currency,omitempty"`
	Eshop               string  `xml:"eshop" validate:"required"`
	ConsignCountry      string  `xml:"consign_country" validate:"required"`
	SendEmailToCustomer bool    `xml:"send_email_to_customer,omitempty"`
}

func NewClaimWithPasswordAttributes

func NewClaimWithPasswordAttributes(Id int, Number string, Email string, Phone string, Value float32, Currency string,
	Eshop string, ConsignCountry string) *ClaimWithPasswordAttributes

func NewClaimWithPasswordAttributesRequired

func NewClaimWithPasswordAttributesRequired(Id int, Number string, Email string, Phone string, Value float32,
	Eshop string, ConsignCountry string) *ClaimWithPasswordAttributes

type CourierBarcodes

type CourierBarcodes struct {
	XMLName        xml.Name `xml:"courierBarcodes"`
	CourierBarcode string   `xml:"courierBarcode" validate:"required"`
}

type CourierInfo

type CourierInfo struct {
	XMLName         xml.Name          `xml:"courierInfo"`
	CourierInfoItem []CourierInfoItem `xml:"courierInfoItem"`
}

type CourierInfoItem

type CourierInfoItem struct {
	XMLName                xml.Name                 `xml:"courierInfoItem"`
	CourierId              int                      `xml:"courierId" validate:"required"`
	CourierName            string                   `xml:"courierName" validate:"required"`
	CourierNumbers         []CourierNumbers         `xml:"courierNumbers,omitempty"`
	CourierBarcodes        []CourierBarcodes        `xml:"courierBarcodes,omitempty"`
	CourierTrackingNumbers []CourierTrackingNumbers `xml:"courierTrackingNumbers,omitempty"`
	CourierTrackingUrls    []CourierTrackingUrls    `xml:"courierTrackingUrls,omitempty"`
}

func NewCourierInfoItem

func NewCourierInfoItem(CourierId int, CourierName string, CourierNumbers []CourierNumbers,
	CourierBarcodes []CourierBarcodes, CourierTrackingNumbers []CourierTrackingNumbers,
	CourierTrackingUrls []CourierTrackingUrls) *CourierInfoItem

func NewCourierInfoItemRequired

func NewCourierInfoItemRequired(CourierId int, CourierName string) *CourierInfoItem

type CourierNumbers

type CourierNumbers struct {
	XMLName       xml.Name `xml:"courierNumbers"`
	CourierNumber string   `xml:"courierNumber" validate:"required"`
}

type CourierTrackingNumbers

type CourierTrackingNumbers struct {
	XMLName               xml.Name `xml:"courierTrackingNumbers"`
	CourierTrackingNumber string   `xml:"courierTrackingNumber" validate:"required"`
}

type CourierTrackingUrl

type CourierTrackingUrl struct {
	XMLName xml.Name `xml:"courierTrackingUrl"`
	Lang    string   `xml:"lang" validate:"required"`
	Url     string   `xml:"url" validate:"required"`
}

func NewCourierTrackingUrls

func NewCourierTrackingUrls(Lang string, Url string) *CourierTrackingUrl

type CourierTrackingUrls

type CourierTrackingUrls struct {
	XMLName            xml.Name           `xml:"courierTrackingUrls"`
	CourierTrackingUrl CourierTrackingUrl `xml:"courierTrackingUrl"`
}

type CreatePacket

type CreatePacket struct {
	XMLName          xml.Name         `xml:"createPacket"`
	ApiPassword      string           `xml:"apiPassword" validate:"required"`
	PacketAttributes PacketAttributes `xml:"packetAttributes" validate:"required"`
}

func NewCreatePacket

func NewCreatePacket(ApiPassword string, PacketAttributes PacketAttributes) *CreatePacket

type CreatePacketClaim

type CreatePacketClaim struct {
	XMLName         xml.Name        `xml:"createPacketClaim"`
	ApiPassword     string          `xml:"apiPassword" validate:"required"`
	ClaimAttributes ClaimAttributes `xml:"claimAttributes" validate:"required"`
}

func NewCreatePacketClaim

func NewCreatePacketClaim(apiPassword string, ClaimAttributes ClaimAttributes) *CreatePacketClaim

type CreatePacketClaimWithPassword

type CreatePacketClaimWithPassword struct {
	XMLName                       xml.Name                    `xml:"createPacketClaimWithPassword"`
	ApiPassword                   string                      `xml:"apiPassword" validate:"required"`
	CreatePacketClaimWithPassword ClaimWithPasswordAttributes `xml:"createPacketClaimWithPassword" validate:"required"`
}

func NewCreatePacketClaimWithPassword

func NewCreatePacketClaimWithPassword(apiPassword string, c ClaimWithPasswordAttributes) *CreatePacketClaimWithPassword

type CreatePacketResponse added in v0.0.3

type CreatePacketResponse struct {
	XMLName xml.Name           `xml:"response"`
	Status  string             `xml:"status"`
	Result  CreatePacketResult `xml:"result"`
}

type CreatePacketResult added in v0.0.3

type CreatePacketResult struct {
	Id          int    `xml:"id"`
	Barcode     string `xml:"barcode"`
	BarcodeText string `xml:"barcodeText"`
}

type CurrentStatusRecord

type CurrentStatusRecord struct {
	DateTime             ZasilkovnaDateTime `xml:"dateTime" validate:"required"`
	StatusCode           int                `xml:"statusCode" validate:"required"`
	CodeText             string             `xml:"codeText" validate:"required"`
	StatusText           string             `xml:"statusText" validate:"required"`
	BranchId             int                `xml:"branchId" validate:"required"`
	DestinationBranchId  int                `xml:"destinationBranchId" validate:"required"`
	ExternalTrackingCode string             `xml:"externalTrackingCode,omitempty"`
	IsReturning          *bool              `xml:"isReturning" validate:"required"` // *bool bcs of required
	StoredUntil          ZasilkovnaDate     `xml:"storedUntil" validate:"required"`
	CarrierId            int                `xml:"carrierId,omitempty"`
	CarrierName          string             `xml:"carrierName,omitempty"`
}

func NewCurrentStatusRecord

func NewCurrentStatusRecord(DateTime ZasilkovnaDateTime, StatusCode int, CodeText string, StatusText string,
	BranchId int, DestinationBranchId int, ExternalTrackingCode string, IsReturning *bool, StoredUntil ZasilkovnaDate,
	CarrierId int, CarrierName string) *CurrentStatusRecord

func NewCurrentStatusRecordRequired

func NewCurrentStatusRecordRequired(DateTime ZasilkovnaDateTime, StatusCode int, CodeText string, StatusText string,
	BranchId int, DestinationBranchId int, IsReturning *bool, StoredUntil ZasilkovnaDate) *CurrentStatusRecord

type Detail

type Detail struct {
	Attributes ErrorAttributes `xml:"attributes"`
}

type ErrorAttributes

type ErrorAttributes struct {
	Fault []Fault `xml:"fault"`
}

type Fault

type Fault struct {
	Name  string `xml:"name"`
	Fault string `xml:"fault"`
}

type Ids

type Ids struct {
	PacketIds []int `xml:"id" validate:"required"`
}

type Item

type Item struct {
	Attribute Attribute `xml:"attribute"`
}

func NewItem

func NewItem(Attribute Attribute) *Item

type ItemCollection

type ItemCollection struct {
	Item []Item `xml:"item"`
}

func NewItemCollection

func NewItemCollection(Item []Item) *ItemCollection

type PacketAttributes

type PacketAttributes struct {
	Id                  int                 `xml:"id,omitempty"`
	Number              string              `xml:"number" validate:"required"`
	Name                string              `xml:"name" validate:"required"`
	Surname             string              `xml:"surname" validate:"required"`
	Company             string              `xml:"company,omitempty"`
	Email               string              `xml:"email" validate:"required"` //Required email or phone
	Phone               string              `xml:"phone" validate:"required"` //Required email or phone
	AddressId           int                 `xml:"addressId" validate:"required"`
	Currency            string              `xml:"currency,omitempty"`
	Cod                 float32             `xml:"cod,omitempty"`
	Value               float32             `xml:"value" validate:"required"`
	Weight              float32             `xml:"weight" validate:"max=10"`
	DeliverOn           ZasilkovnaDate      `xml:"deliverOn,omitempty"`
	Eshop               string              `xml:"eshop" validate:"required"`
	AdultContent        bool                `xml:"adultContent,omitempty"`
	Note                string              `xml:"note,omitempty"`
	Street              string              `xml:"street"`
	HouseNumber         string              `xml:"houseNumber"`
	City                string              `xml:"city"`
	Province            string              `xml:"province,omitempty"`
	Zip                 string              `xml:"zip"`
	CarrierService      string              `xml:"carrierService,omitempty"`
	CustomerBarcode     string              `xml:"customerBarcode,omitempty"`
	CarrierPickupPoint  string              `xml:"carrierPickupPoint"`  // Required for some carriers
	CustomsDeclaration  ItemCollection      `xml:"customsDeclaration"`  // Required on address delivery outside EU
	Size                Size                `xml:"size"`                // Required for some carriers
	AttributeCollection AttributeCollection `xml:"attributeCollection"` // Required for some carriers
	Items               ItemCollection      `xml:"items"`               // Required for some carriers
}

func NewPacketAttributes

func NewPacketAttributes(Id int, Number string, Name string, Surname string,
	Company string, Email string, Phone string, AddressId int, Currency string, Cod float32,
	Value float32, Weight float32, DeliverOn ZasilkovnaDate, Eshop string,
	AdultContent bool, Note string, Street string, HouseNumber string, City string, Province string,
	Zip string, CarrierService string, CustomerBarcode string, CarrierPickupPoint string,
	CustomsDeclaration ItemCollection, Size Size, AttributeCollection AttributeCollection,
	Items ItemCollection) *PacketAttributes

func NewPacketAttributesRequired

func NewPacketAttributesRequired(Number string, Name string, Surname string, Email string, Phone string, AddressId int,
	Value float32, Weight float32, Eshop string, Street string, HouseNumber string, City string,
	Zip string, CarrierPickupPoint string,
	CustomsDeclaration ItemCollection, Size Size, AttributeCollection AttributeCollection,
	Items ItemCollection) *PacketAttributes

type PacketAttributesFault added in v0.1.0

type PacketAttributesFault struct {
	XMLName xml.Name `xml:"response"`
	Status  string   `xml:"status"`
	Fault   string   `xml:"fault"`
	String  string   `xml:"string"`
	Detail  Detail   `xml:"detail"`
}

func ToErrorResponse added in v0.1.0

func ToErrorResponse(err error) PacketAttributesFault

func (PacketAttributesFault) Error added in v0.1.0

func (e PacketAttributesFault) Error() string

Error - Returns error string.

func (*PacketAttributesFault) ToRfc7807Error added in v0.1.0

func (e *PacketAttributesFault) ToRfc7807Error(code int) error

type PacketAttributesValid

type PacketAttributesValid struct {
	XMLName          xml.Name         `xml:"packetAttributesValid"`
	ApiPassword      string           `xml:"apiPassword" validate:"required"`
	PacketAttributes PacketAttributes `xml:"packetAttributes" validate:"required"`
}

func NewPacketAttributesValid

func NewPacketAttributesValid(ApiPassword string, PacketAttributes PacketAttributes) *PacketAttributesValid

type PacketDetail

type PacketDetail struct {
	XMLName     xml.Name `xml:"packetIdDetail"`
	Id          int      `xml:"id"`
	Barcode     string   `xml:"barcode"`
	BarcodeText string   `xml:"barcodeText"`
	Password    string   `xml:"password"`
}

type PacketGetStoredUntil

type PacketGetStoredUntil struct {
	XMLName     xml.Name `xml:"packetGetStoredUntil"`
	ApiPassword string   `xml:"apiPassword" validate:"required"`
	PacketId    int      `xml:"packetId" validate:"required"`
}

func NewPacketGetStoredUntil

func NewPacketGetStoredUntil(apiPassword string, packetId int) *PacketGetStoredUntil

type PacketIdDetail

type PacketIdDetail struct {
	XMLName     xml.Name `xml:"packetIdDetail"`
	Id          int      `xml:"id"`
	Barcode     string   `xml:"barcode"`
	BarcodeText string   `xml:"barcodeText"`
}

func NewPacketIdDetail

func NewPacketIdDetail(Id int, Barcode string, BarcodeText string) *PacketIdDetail

type PacketInfo

type PacketInfo struct {
	XMLName     xml.Name `xml:"packetInfo"`
	ApiPassword string   `xml:"apiPassword" validate:"required"`
	PacketId    int      `xml:"packetId" validate:"required"`
}

func NewPacketInfo

func NewPacketInfo(ApiPassword string, PacketId int) *PacketInfo

type PacketInfoResponse

type PacketInfoResponse struct {
	XMLName xml.Name         `xml:"response"`
	Status  string           `xml:"status"`
	Result  PacketInfoResult `xml:"result"`
}

func NewPacketInfoResponse

func NewPacketInfoResponse(Status string, Result PacketInfoResult) *PacketInfoResponse

type PacketInfoResult

type PacketInfoResult struct {
	XMLName             xml.Name    `xml:"result"`
	BranchId            int         `xml:"branchId" validate:"required"`
	InvoicedWeightGrams int         `xml:"invoicedWeightGrams"`
	CourierInfo         CourierInfo `xml:"courierInfo"`
}

func NewPacketInfoResult

func NewPacketInfoResult(BranchId int, InvoicedWeightGrams int, CourierInfo CourierInfo) *PacketInfoResult

type PacketLabelPdf

type PacketLabelPdf struct {
	XMLName     xml.Name `xml:"packetLabelPdf"`
	ApiPassword string   `xml:"apiPassword" validate:"required"`
	PacketId    int      `xml:"packetId" validate:"required"`
	Format      string   `xml:"format" validate:"required"`
	Offset      int      `xml:"offset" validate:"required"`
}

func NewPacketLabelPdf

func NewPacketLabelPdf(ApiPassword string, PacketId int, Format string, Offset int) *PacketLabelPdf

type PacketStatus

type PacketStatus struct {
	XMLName     xml.Name `xml:"packetStatus"`
	ApiPassword string   `xml:"apiPassword" validate:"required"`
	PacketId    int      `xml:"packetId" validate:"required"`
}

func NewPacketStatus

func NewPacketStatus(apiPassword string, packetId int) *PacketStatus

type PacketTracking

type PacketTracking struct {
	XMLName     xml.Name `xml:"packetTracking"`
	ApiPassword string   `xml:"apiPassword" validate:"required"`
	PacketId    int      `xml:"packetId"`
}

type PacketsLabelsPdf

type PacketsLabelsPdf struct {
	XMLName     xml.Name `xml:"packetsLabelsPdf"`
	ApiPassword string   `xml:"apiPassword" validate:"required"`
	PacketIds   Ids      `xml:"packetIds" validate:"required"`
	Format      string   `xml:"format" validate:"required"`
	Offset      int      `xml:"offset" validate:"required"`
}

func NewPacketsLabelsPdf

func NewPacketsLabelsPdf(ApiPassword string, PacketIds Ids, Format string, Offset int) *PacketsLabelsPdf

type Size

type Size struct {
	Length int `xml:"length" validate:"required,max=120,min=10"`
	Width  int `xml:"width" validate:"required,max=120,min=7"`
	Height int `xml:"height" validate:"required,max=120,min=1"`
}

func NewSize

func NewSize(Length int, Width int, Height int) *Size

type StatusRecord

type StatusRecord struct {
	XMLName              xml.Name           `xml:"statusRecord"`
	DateTime             ZasilkovnaDateTime `xml:"dateTime" validate:"required"`
	StatusCode           int                `xml:"statusCode" validate:"required"`
	CodeText             string             `xml:"codeText" validate:"required"`
	StatusText           string             `xml:"statusText" validate:"required"`
	BranchId             int                `xml:"branchId" validate:"required"`
	DestinationBranchId  int                `xml:"destinationBranchId" validate:"required"`
	ExternalTrackingCode string             `xml:"externalTrackingCode,omitempty"`
}

func NewStatusRecord

func NewStatusRecord(DateTime ZasilkovnaDateTime, StatusCode int, CodeText string, StatusText string,
	BranchId int, DestinationBranchId int, ExternalTrackingCode string) *StatusRecord

func NewStatusRecordRequired

func NewStatusRecordRequired(DateTime ZasilkovnaDateTime, StatusCode int, CodeText string, StatusText string,
	BranchId int, DestinationBranchId int) *StatusRecord

type StatusRecords

type StatusRecords struct {
	StatusRecord []StatusRecord `xml:"statusRecords"`
}

type ZasilkovnaDate

type ZasilkovnaDate time.Time

type ZasilkovnaDateTime

type ZasilkovnaDateTime time.Time

Jump to

Keyboard shortcuts

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