trakpak

package module
v0.0.0-...-543a5a2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: LGPL-3.0 Imports: 10 Imported by: 0

README

trakpak

Go / Golang P2P Mailing Trak-pak client library.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessRequest

type AccessRequest struct {
	AccessLicenseNumber string `valid:"required,length(1|12)"`
	UserID              string `xml:"UserId" valid:"required,length(1|6)"`
	Password            string `valid:"required,length(1|20)"`
}

AccessRequest - TODO

type Client

type Client struct {
	*AccessRequest
	TestMode bool
	Verbose  bool
}

Client - a TrakPak API client

func NewClient

func NewClient(licenseNo, userID, password string) *Client

NewClient - returns a new TrakPak API client

func (*Client) BookShipment

func (c *Client) BookShipment(s *Shipment) (*ShipmentResponse, error)

BookShipment - Books a shipment. PDF Label is included in return.

func (*Client) VoidShipment

func (c *Client) VoidShipment(trackingNo string) error

VoidShipment - TODO

type Destination

type Destination struct {
	DestinationCompany     string `valid:"required,length(1|35)"`
	DestinationAddress1    string `valid:"required,length(1|35)"`
	DestinationAddress2    string `valid:"required,length(1|35)"`
	DestinationAddress3    string `valid:"length(10|35)"`
	DestinationCity        string `valid:"required,length(1|20)"`
	DestinationCounty      string `valid:"length(1|35)"`
	DestinationCountryCode string `valid:"required,length(2|2)"`
	DestinationPostCode    string `valid:"length(0|10)"`
	DestinationContact     string `valid:"required,length(1|40)"`
	DestinationPhone       string `valid:"length(0|20)"`
	DestinationVat         string `valid:"length(0|17)"`
	DestinationEmail       string `valid:"required,email,length(1|40)"`
}

Destination - TODO

type ItemInformation

type ItemInformation struct {
	ItemDescription string `valid:"required,length(1|255)"`
	ItemHsCode      string `valid:"length(1|10)"`
	ItemQuantity    int
	ItemValue       float64
	ItemSkuCode     string `valid:"length(1|10)"`
	ItemCOO         string `valid:"length(2|2)"`
}

ItemInformation - TODO

type Label

type Label string

Label - Base64 encoded label

func (*Label) Decode

func (l *Label) Decode() ([]byte, error)

Decode - Decodes Base64 data

type Shipment

type Shipment struct {
	ShipmentDate        Time // <ShipmentDate>2013-06-24 10:32:44</ShipmentDate>
	Shipper             *Shipper
	Destination         *Destination
	ShipmentInformation *ShipmentInformation
}

Shipment - TODO

type ShipmentBookingAck

type ShipmentBookingAck struct {
	xml.Name         `xml:"ack"`
	DateTimeStamp    Time
	ShipmentResponse *ShipmentResponse
	ErrorData        string
}

ShipmentBookingAck - wrapper for the the ShipmentBookingResponse

type ShipmentConfirmRequest

type ShipmentConfirmRequest struct {
	TrackingNumber string `valid:"required,length(1|50)"`
}

type ShipmentInformation

type ShipmentInformation struct {
	Service            string `valid:"required,length(1|4)"`
	TotalPieces        int
	TotalWeight        float64
	WeightID           string `xml:"WeightId" valid:"length(1|1)"`
	Length             int
	Width              int
	Height             int
	Product            string `valid:"required,length(3|3)"`
	DescriptionOfGoods string `valid:"required,length(1|70)"`
	Value              float64
	ValueCurrency      string `valid:"required,length(3|3)"`
	Terms              string `valid:"length(3|3)"`
	LabelImageFormat   string `valid:"length(3|3)"`
	ItemInformation    []ItemInformation
}

ShipmentInformation - TODO

type ShipmentResponse

type ShipmentResponse struct {
	Hawb               string `valid:"required,length(1|12)"`
	TrackingNumber     string `valid:"required,length(1|50)"`
	TrackingURL        string `valid:"required"`
	QuickTrackURL      string
	CarrierTrackingURL string `valid:"required"`
	LabelImage         Label  `valid:"required"`
	LabelImageFormat   string `valid:"required,length(3|3)"`
}

ShipmentResponse - the wrapped response to a ShipmentBookingRequest

type ShipmentVoidRequest

type ShipmentVoidRequest struct {
	TrackingNumber string `valid:"required,length(1|50)"`
}

type Shipper

type Shipper struct {
	ShipperCompany     string `valid:"required,length(1|35)"`
	ShipperAddress1    string `valid:"required,length(1|35)"`
	ShipperAddress2    string `valid:"required,length(1|35)"`
	ShipperAddress3    string `valid:"required,length(1|35)"`
	ShipperCity        string `valid:"required,length(1|20)"`
	ShipperCounty      string `valid:"length(1|35)"`
	ShipperCountryCode string `valid:"required,length(2|2)"`
	ShipperPostcode    string `valid:"required,length(1|10)"`
	ShipperContact     string `valid:"length(0|40)"`
	ShipperPhone       string `valid:"required,length(1|10)"`
	ShipperVat         string `valid:"required,length(0|17)"`
	ShipperEmail       string `valid:"email,length(1|40)"`
	ShipperReference   string `valid:"length(1|20)"`
	ShipperDept        string `valid:"length(1|17)"`
}

Shipper - TODO

type Time

type Time time.Time

Time - Marshalls time.Time to expected format.

func (Time) MarshalXML

func (t Time) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML - Marshals time to TrakPak format.

func (*Time) UnmarshalXML

func (t *Time) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

UnmarshalXML - Unmarshals time from TrakPak format.

Jump to

Keyboard shortcuts

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