ups

package
v0.0.0-...-70e54fd Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 9 Imported by: 0

README

UPS tracking info

Tracking number patterns

  • 1Z12345E6605272234
  • 1Z123456E660527223
  • 1Z4861WWE194914215
  • 1ZWX0692YP40636269
  • 123456789
  • 1234567890
  • 1234567890123456789012
  • cgish000116630

Documentation

documentation

For Authorization

  • YourLicenseNumber
  • YourUserID
  • YourPassword

UPS Environments

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 `xml:"AccessLicenseNumber"`
	UserId              string `xml:"UserId"`
	Password            string `xml:"Password"`
}

type Activity

type Activity struct {
	Date                              string `xml:"Date"`
	Time                              string `xml:"Time"`
	GMTDate                           string `xml:"GMTDate"`
	GMTTime                           string `xml:"GMTTime"`
	GMTOffset                         string `xml:"GMTOffset"`
	DeliveryDateFromManifestIndicator string `xml:"DeliveryDateFromManifestIndicator"`
	SensorEventIndicator              string `xml:"SensorEventIndicator"`

	NextScheduleActivity struct {
		Date string `xml:"Date"`
		Time string `xml:"Time"`
	} `xml:"NextScheduleActivity"`

	AlternateTrackingInfo struct {
		Type  string `xml:"Type"`
		Value string `xml:"Value"`
	} `xml:"AlternateTrackingInfo"`

	ActivityLocation struct {
		Address Address `xml:"Address"`

		AddressArtifactFormat struct {
			StreetNumberLow    string `xml:"StreetNumberLow"`
			StreetPrefix       string `xml:"StreetPrefix"`
			StreetName         string `xml:"StreetName"`
			StreetSuffix       string `xml:"StreetSuffix"`
			StreetType         string `xml:"StreetType"`
			PoliticalDivision2 string `xml:"PoliticalDivision2"`
			PoliticalDivision1 string `xml:"PoliticalDivision1"`
			PostcodePrimaryLow string `xml:"PostcodePrimaryLow"`
			CountryCode        string `xml:"CountryCode"`
		} `xml:"AddressArtifactFormat"`

		TransportFacility struct {
			Type  string `xml:"Type"`
			Value string `xml:"Value"`
		} `xml:"TransportFacility"`

		Code            string `xml:"Code"`
		Description     string `xml:"Description"`
		SignedForByName string `xml:"SignedForByName"`

		SignatureImage struct {
			GraphicImage string `xml:"GraphicImage"`
			ImageFormat  struct {
				Code        string `xml:"Code"`
				Description string `xml:"Description"`
			} `xml:"ImageFormat"`
		} `xml:"SignatureImage"`

		PODLetter struct {
			HTMLImage string `xml:"HTMLImage"`
		} `xml:"PODLetter"`

		ElectronicDeliveryNotification struct {
			Name string `xml:"Name"`
		} `xml:"ElectronicDeliveryNotification"`
	} `xml:"ActivityLocation"`

	Status struct {
		Date       string `xml:"Date"`
		Time       string `xml:"Time"`
		StatusType struct {
			Code        string `xml:"Code"`
			Description string `xml:"Description"`
		} `xml:"StatusType"`
		StatusCode struct {
			Code string `xml:"Code"`
		} `xml:"StatusCode"`
	} `xml:"Status"`
}

type Address

type Address struct {
	AddressLine1      string `xml:"AddressLine1"`
	AddressLine2      string `xml:"AddressLine2"`
	AddressLine3      string `xml:"AddressLine3"`
	City              string `xml:"City"`
	StateProvinceCode string `xml:"StateProvinceCode"`
	PostalCode        string `xml:"PostalCode"`
	CountryCode       string `xml:"CountryCode"`
}

type Api

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

func NewApi

func NewApi(apiURL, userId, accessLicenseNumber, password string) *Api

func (*Api) TrackByTrackingNumber

func (api *Api) TrackByTrackingNumber(trackingNumber string) (*TrackResponse, error)

type Carrier

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

func NewCarrier

func NewCarrier(api api) *Carrier

func (*Carrier) Detect

func (c *Carrier) Detect(trackId string) bool

func (*Carrier) Track

func (c *Carrier) Track(trackNumbers []string) ([]carriers.Parcel, error)

type Package

type Package struct {
	TrackingNumber          string `xml:"TrackingNumber"`
	DeliveryIndicator       string `xml:"DeliveryIndicator"`
	DeliveryDate            string `xml:"DeliveryDate"`
	RescheduledDeliveryDate string `xml:"RescheduledDeliveryDate"`
	RescheduledDeliveryTime string `xml:"RescheduledDeliveryTime"`
	SRSizeCode              string `xml:"SRSizeCode"`
	Redirect                struct {
		CompanyName  string  `xml:"CompanyName"`
		LocationID   string  `xml:"LocationID"`
		PickupDate   string  `xml:"PickupDate"`
		UPSAPAddress Address `xml:"UPSAPAddress"`
	} `xml:"Redirect"`
	Reroute struct {
		Address Address `xml:"Address"`
	} `xml:"Reroute"`

	ReturnTo struct {
		Address Address `xml:"Address"`
	} `xml:"ReturnTo"`
	PackageServiceOptions struct {
		ImportControl            string `xml:"ImportControl"`
		CommercialInvoiceRemoval string `xml:"CommercialInvoiceRemoval"`
		UPScarbonneutral         string `xml:"UPScarbonneutral"`
		USPSPICNumber            string `xml:"USPSPICNumber"`
		ExchangeBased            string `xml:"ExchangeBased"`
		PackAndCollect           string `xml:"PackAndCollect"`
		COD                      struct {
			ControlNumber string `xml:"ControlNumber"`
			CODStatus     string `xml:"CODStatus"`
			CODAmount     struct {
				CurrencyCode  string `xml:"CurrencyCode"`
				MonetaryValue string `xml:"MonetaryValue"`
			} `xml:"CODAmount"`
		} `xml:"COD"`
		SignatureRequired struct {
			Code string `xml:"Code"`
		} `xml:"SignatureRequired"`
	} `xml:"PackageServiceOptions"`

	Activity []Activity `xml:"Activity"`

	Message struct {
		Code        string   `xml:"Code"`
		Description struct{} `xml:"Description"`
	} `xml:"Message"`

	ReferenceNumber struct {
		Code  string   `xml:"Code"`
		Value struct{} `xml:"Value"`
	} `xml:"ReferenceNumber"`

	ProductType struct {
		Code        string   `xml:"Code"`
		Description struct{} `xml:"Description"`
	} `xml:"ProductType"`

	Accessorial struct {
		Code        string   `xml:"Code"`
		Description struct{} `xml:"Description"`
	} `xml:"Accessorial"`

	AlternateTrackingInfo struct {
		Type  string   `xml:"Type"`
		Value struct{} `xml:"Value"`
	} `xml:"AlternateTrackingInfo"`

	PackageWeight struct {
		Weight            string `xml:"Weight"`
		UnitOfMeasurement struct {
			Code        string `xml:"Code"`
			Description string `xml:"Description"`
		} `xml:"UnitOfMeasurement"`
	} `xml:"PackageWeight"`

	LocationAssured                string `xml:"LocationAssured"`
	AlternateTrackingNumber        string `xml:"AlternateTrackingNumber"`
	DimensionalWeightScanIndicator string `xml:"DimensionalWeightScanIndicator"`

	PreauthorizedReturnInformation struct {
		ReturnEligibilityIndicator string `xml:"ReturnEligibilityIndicator"`
		ReturnExpirationDate       string `xml:"ReturnExpirationDate"`
		ReturnRequestURL           string `xml:"ReturnRequestURL"`
		OriginalTrackingNumber     string `xml:"OriginalTrackingNumber"`
		ReturnTrackingNumber       string `xml:"ReturnTrackingNumber"`
	} `xml:"PreauthorizedReturnInformation"`

	UPSPremierAccessorial struct {
		UPSPremierCode        string `xml:"UPSPremierCode"`
		UPSPremierDescription string `xml:"UPSPremierDescription"`
	} `xml:"UPSPremierAccessorial"`
}

type PickupDateRange

type PickupDateRange struct {
	BeginDate string `xml:"BeginDate,omitempty"`
	EndDate   string `xml:"EndDate,omitempty"`
}

type ReferenceNumber

type ReferenceNumber struct {
	Value string `xml:"Value,omitempty"`
}

type Request

type Request struct {
	RequestAction        string               `xml:"RequestAction,omitempty"`
	RequestOption        string               `xml:"RequestOption,omitempty"`
	SubVersion           string               `xml:"SubVersion,omitempty"`
	TransactionReference TransactionReference `xml:"TransactionReference,omitempty"`
}

type ShipTo

type ShipTo struct {
	Address Address `xml:"Address"`
}

type Shipment

type Shipment struct {
	ShipmentIdentificationNumber string `xml:"ShipmentIdentificationNumber"`
	CandidateBookmark            string `xml:"CandidateBookmark"`
	PickupDate                   string `xml:"PickupDate"`
	BillToName                   string `xml:"BillToName"`
	NumberOfPieces               string `xml:"NumberOfPieces"`
	NumberOfPallets              string `xml:"NumberOfPallets"`
	SignedForByName              string `xml:"SignedForByName"`
	DescriptionOfGoods           string `xml:"DescriptionOfGoods"`
	GraphicImage                 string `xml:"GraphicImage"`
	ScheduledDeliveryDate        string `xml:"ScheduledDeliveryDate"`
	ScheduledDeliveryTime        string `xml:"ScheduledDeliveryTime"`
	FileNumber                   string `xml:"FileNumber"`

	ReferenceNumber struct {
		Code        string `xml:"Code"`
		Description string `xml:"Description"`
		Value       string `xml:"Value"`
	} `xml:"ReferenceNumber"`

	CurrentStatus struct {
		Code        string `xml:"Code"`
		Description string `xml:"Description"`
	} `xml:"CurrentStatus"`

	InquiryNumber struct {
		Code        string `xml:"Code"`
		Description string `xml:"Description"`
		Value       string `xml:"Value"`
	} `xml:"InquiryNumber"`

	ShipmentType struct {
		Code        string `xml:"Code"`
		Description string `xml:"Description"`
	} `xml:"ShipmentType"`

	Shipper Shipper `xml:"Shipper"`

	ShipTo ShipTo `xml:"ShipTo"`

	ShipmentWeight struct {
		Weight            string `xml:"Weight"`
		UnitOfMeasurement struct {
			Code        string `xml:"Code"`
			Description string `xml:"Description"`
		} `xml:"UnitOfMeasurement"`
	} `xml:"ShipmentWeight"`

	DeliveryDetails struct {
		DeliveryDate struct {
			Date string `xml:"Date"`
			Time string `xml:"Time"`
		} `xml:"DeliveryDate"`

		ServiceCenter struct {
			City              string `xml:"City"`
			StateProvinceCode string `xml:"StateProvinceCode"`
		} `xml:"ServiceCenter"`
	} `xml:"DeliveryDetails"`

	DeliveryDateTime struct {
		Date string `xml:"Date"`
		Type struct {
			Code        string `xml:"Code"`
			Description string `xml:"Description"`
		} `xml:"Type"`
	} `xml:"DeliveryDateTime"`

	Volume struct {
		Code        string `xml:"Code"`
		Description string `xml:"Description"`
		Value       string `xml:"Value"`
	} `xml:"Volume"`

	PickUpServiceCenter struct {
		City              string `xml:"City"`
		StateProvinceCode string `xml:"StateProvinceCode"`
	} `xml:"PickUpServiceCenter"`

	ShipmentServiceOptions struct {
		COD struct {
			CODAmount struct {
				CurrencyCode  string `xml:"CurrencyCode"`
				MonetaryValue string `xml:"MonetaryValue"`
			} `xml:"CODAmount"`
		} `xml:"COD"`
	} `xml:"ShipmentServiceOptions"`

	EstimatedDeliveryDetails struct {
		Date          string `xml:"Date"`
		Time          string `xml:"Time"`
		ServiceCenter struct {
			City              string `xml:"City"`
			StateProvinceCode string `xml:"StateProvinceCode"`
		} `xml:"ServiceCenter"`
	} `xml:"EstimatedDeliveryDetails"`

	Service struct {
		Code        string `xml:"Code"`
		Description string `xml:"Description"`
	} `xml:"Service"`

	Activity struct {
		Description      string `xml:"Description"`
		Date             string `xml:"Date"`
		Time             string `xml:"Time"`
		Trailer          string `xml:"Trailer"`
		ActivityLocation struct {
			Address struct {
				City              string `xml:"City"`
				PostalCode        string `xml:"PostalCode"`
				StateProvinceCode string `xml:"StateProvinceCode"`
				CountryCode       string `xml:"CountryCode"`
			} `xml:"Address"`
		} `xml:"ActivityLocation"`
	} `xml:"Activity"`

	OriginPortDetails struct {
		OriginPort         string `xml:"OriginPort"`
		EstimatedDeparture struct {
			Date string `xml:"Date"`
			Time string `xml:"Time"`
		} `xml:"EstimatedDeparture"`
	} `xml:"OriginPortDetails"`

	DestinationPortDetails struct {
		DestinationPort  string `xml:"DestinationPort"`
		EstimatedArrival struct {
			Date string `xml:"Date"`
			Time string `xml:"Time"`
		} `xml:"EstimatedArrival"`
	} `xml:"DestinationPortDetails"`

	CargoReady struct {
		Date string `xml:"Date"`
		Time string `xml:"Time"`
	} `xml:"CargoReady"`

	Manifest struct {
		Date string `xml:"Date"`
		Time string `xml:"Time"`
	} `xml:"Manifest"`

	CarrierActivityInformation struct {
		CarrierId       string `xml:"CarrierId"`
		Description     string `xml:"Description"`
		Status          string `xml:"Status"`
		OriginPort      string `xml:"OriginPort"`
		DestinationPort string `xml:"DestinationPort"`
		Arrival         struct {
			Date string `xml:"Date"`
			Time string `xml:"Time"`
		} `xml:"Arrival"`
		Departure struct {
			Date string `xml:"Date"`
			Time string `xml:"Time"`
		} `xml:"Departure"`
	} `xml:"CarrierActivityInformation"`

	Document struct {
		Type struct {
			Code        string `xml:"Code"`
			Description string `xml:"Description"`
		} `xml:"Type"`
		Format struct {
			Code        string `xml:"Code"`
			Description string `xml:"Description"`
		} `xml:"Format"`
	} `xml:"Document"`

	DeliveryDateUnavailable struct {
		Type        string `xml:"Type"`
		Description string `xml:"Description"`
	} `xml:"DeliveryDateUnavailable"`

	Appointment struct {
		BeginTime string `xml:"BeginTime"`
		EndTime   string `xml:"EndTime"`
		Made      struct {
			Date string `xml:"Date"`
			Time string `xml:"Time"`
		} `xml:"Made"`
		Requested struct {
			Date string `xml:"Date"`
			Time string `xml:"Time"`
		} `xml:"Requested"`
	} `xml:"Appointment"`

	Package Package `xml:"Package"`
}

type ShipmentType

type ShipmentType struct {
	Code        string `xml:"Code,omitempty"`
	Description string `xml:"Description,omitempty"`
}

type Shipper

type Shipper struct {
	ShipperNumber string  `xml:"ShipperNumber"`
	Address       Address `xml:"Address"`
}

type ShipperAccountInfo

type ShipperAccountInfo struct {
	PostalCode  string `xml:"PostalCode,omitempty"`
	CountryCode string `xml:"CountryCode,omitempty"`
}

type TrackRequest

type TrackRequest struct {
	TrackingNumber                     string              `xml:"TrackingNumber"`
	ShipmentIdentificationNumber       string              `xml:"ShipmentIdentificationNumber,omitempty"`
	CandidateBookmark                  string              `xml:"CandidateBookmark,omitempty"`
	ShipperNumber                      string              `xml:"ShipperNumber,omitempty"`
	DestinationPostalCode              string              `xml:"DestinationPostalCode,omitempty"`
	DestinationCountryCode             string              `xml:"DestinationCountryCode,omitempty"`
	OriginPostalCode                   string              `xml:"OriginPostalCode,omitempty"`
	OriginCountryCode                  string              `xml:"OriginCountryCode,omitempty"`
	IncludeMailInnovationIndicator     string              `xml:"IncludeMailInnovationIndicator,omitempty"`
	TrackingOption                     string              `xml:"TrackingOption,omitempty"`
	UPSWorldWideExpressFreightShipment string              `xml:"UPSWorldWideExpressFreightShipment,omitempty"`
	IncludeFreight                     string              `xml:"IncludeFreight,omitempty"`
	PreauthorizedReturnIndicator       string              `xml:"PreauthorizedReturnIndicator,omitempty"`
	Request                            *Request            `xml:"Request,omitempty"`
	ShipperAccountInfo                 *ShipperAccountInfo `xml:"ShipperAccountInfo,omitempty"`
	ShipmentType                       *ShipmentType       `xml:"ShipmentType,omitempty"`
	ReferenceNumber                    *ReferenceNumber    `xml:"ReferenceNumber,omitempty"`
	PickupDateRange                    *PickupDateRange    `xml:"PickupDateRange,omitempty"`
}

type TrackResponse

type TrackResponse struct {
	Response struct {
		ResponseStatusCode        string `xml:"ResponseStatusCode"`
		ResponseStatusDescription string `xml:"ResponseStatusDescription"`
		TransactionReference      struct {
			CustomerContext string `xml:"CustomerContext"`
			XpciVersion     string `xml:"XpciVersion"`
		} `xml:"TransactionReference"`
		Error struct {
			ErrorSeverity       string `xml:"ErrorSeverity"`
			ErrorCode           string `xml:"ErrorCode"`
			ErrorDescription    string `xml:"ErrorDescription"`
			MinimumRetrySeconds string `xml:"MinimumRetrySeconds"`
			ErrorDigest         string `xml:"ErrorDigest"`
			ErrorLocation       struct {
				ErrorLocationElementName   string `xml:"ErrorLocationElementName"`
				ErrorLocationAttributeName string `xml:"ErrorLocationAttributeName"`
			} `xml:"ErrorLocation"`
		} `xml:"Error"`
	} `xml:"Response"`
	Shipment Shipment `xml:"Shipment"`
}

type TransactionReference

type TransactionReference struct {
	CustomerContext       string `xml:"CustomerContext,omitempty"`
	TransactionIdentifier string `xml:"TransactionIdentifier,omitempty"`
	ToolVersion           string `xml:"ToolVersion,omitempty"`
}

Jump to

Keyboard shortcuts

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