rates

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DomesticRates

type DomesticRates struct {
	Status string `json:"status"`
	Data   struct {
		Title           string `json:"title"`
		Content         string `json:"content"`
		Rule            string `json:"rule"`
		OriginArea      string `json:"originArea"`
		DestinationArea string `json:"destinationArea"`
		Rates           struct {
			Logistic struct {
				Express  []courier `json:"express"`
				Regular  []courier `json:"regular"`
				Trucking []courier `json:"trucking"`
				SameDay  []courier `json:"same day"`
				Instant  []courier `json:"instant"`
			} `json:"logistic"`
		} `json:"rates"`
		StatusCode int `json:"statusCode"`
	} `json:"data"`
}

DomesticRates struct contains response from API GetDomesticRates.

func GetDomesticRates

func GetDomesticRates(params *DomesticRatesParams) (DomesticRates, error)

GetDomesticRates gets available rates based on origin and destination area.

func GetDomesticRatesWithContext

func GetDomesticRatesWithContext(ctx context.Context, params *DomesticRatesParams) (DomesticRates, error)

GetDomesticRatesWithContext gets available rates based on origin and destination area with context.

type DomesticRatesParams

type DomesticRatesParams struct {
	Origin         int     `json:"o" validate:"required"`
	Destination    int     `json:"d" validate:"required"`
	Length         float64 `json:"l" validate:"required"`
	Width          float64 `json:"w" validate:"required"`
	Height         float64 `json:"h" validate:"required"`
	WeightTotal    float64 `json:"wt" validate:"required"`
	Value          float64 `json:"v" validate:"required"`
	Type           int     `json:"type"`
	COD            bool    `json:"cod"`
	Order          int     `json:"order"`
	ForOrder       bool    `json:"for_order"`
	OriginLat      string  `json:"origin_lat"`
	OriginLng      string  `json:"origin_lng"`
	DestinationLat string  `json:"destination_lat"`
	DestinationLng string  `json:"destination_lng"`
}

DomesticRatesParams struct contains request parameter for API GetDomesticRates.

func (*DomesticRatesParams) ToDomesticRatesParamsV3 added in v1.0.0

func (r *DomesticRatesParams) ToDomesticRatesParamsV3() DomesticRatesParamsV3

ToDomesticRatesParamsV3 convert v1 to v3

type DomesticRatesParamsV3 added in v1.0.0

type DomesticRatesParamsV3 struct {
	Destination struct {
		AreaId   int    `json:"area_id"`
		Lat      string `json:"lat"`
		Lng      string `json:"lng"`
		SuburbId int    `json:"suburb_id"`
	} `json:"destination"`
	Origin struct {
		AreaId   int    `json:"area_id"`
		Lat      string `json:"lat"`
		Lng      string `json:"lng"`
		SuburbId int    `json:"suburb_id"`
	} `json:"origin"`
	Cod       bool    `json:"cod"`
	ForOrder  bool    `json:"for_order"`
	Height    float64 `json:"height"`
	ItemValue float64 `json:"item_value"`
	Length    float64 `json:"length"`
	Weight    float64 `json:"weight"`
	Width     float64 `json:"width"`
}

DomesticRatesParamsV3 struct contains request parameter for API GetDomesticRates.

type DomesticRatesV3 added in v1.0.0

type DomesticRatesV3 struct {
	Metadata structs.Metadata `json:"metadata"`
	Data     struct {
		Origin struct {
			AreaId       int     `json:"area_id"`
			AreaName     string  `json:"area_name"`
			SuburbId     int     `json:"suburb_id"`
			SuburbName   string  `json:"suburb_name"`
			CityId       int     `json:"city_id"`
			CityName     string  `json:"city_name"`
			ProvinceId   int     `json:"province_id"`
			ProvinceName string  `json:"province_name"`
			CountryId    int     `json:"country_id"`
			CountryName  string  `json:"country_name"`
			Lat          float64 `json:"lat"`
			Lng          float64 `json:"lng"`
		} `json:"origin"`
		Destination struct {
			AreaId       int     `json:"area_id"`
			AreaName     string  `json:"area_name"`
			SuburbId     int     `json:"suburb_id"`
			SuburbName   string  `json:"suburb_name"`
			CityId       int     `json:"city_id"`
			CityName     string  `json:"city_name"`
			ProvinceId   int     `json:"province_id"`
			ProvinceName string  `json:"province_name"`
			CountryId    int     `json:"country_id"`
			CountryName  string  `json:"country_name"`
			Lat          float64 `json:"lat"`
			Lng          float64 `json:"lng"`
		} `json:"destination"`
		Pricings []struct {
			Logistic struct {
				Id          int    `json:"id"`
				Name        string `json:"name"`
				LogoUrl     string `json:"logo_url"`
				Code        string `json:"code"`
				CompanyName string `json:"company_name"`
			} `json:"logistic"`
			Rate struct {
				Id              int    `json:"id"`
				Name            string `json:"name"`
				Type            string `json:"type"`
				Description     string `json:"description"`
				FullDescription string `json:"full_description"`
				IsHubless       bool   `json:"is_hubless"`
			} `json:"rate"`
			Weight           float64 `json:"weight"`
			Volume           float64 `json:"volume"`
			VolumeWeight     float64 `json:"volume_weight"`
			FinalWeight      float64 `json:"final_weight"`
			MinDay           int     `json:"min_day"`
			MaxDay           int     `json:"max_day"`
			UnitPrice        int     `json:"unit_price"`
			TotalPrice       int     `json:"total_price"`
			Discount         float64 `json:"discount"`
			DiscountValue    int     `json:"discount_value"`
			DiscountedPrice  int     `json:"discounted_price"`
			InsuranceFee     int     `json:"insurance_fee"`
			MustUseInsurance bool    `json:"must_use_insurance"`
			LiabilityValue   int     `json:"liability_value"`
			FinalPrice       int     `json:"final_price"`
			Currency         string  `json:"currency"`
			InsuranceApplied bool    `json:"insurance_applied"`
			BasePrice        int     `json:"base_price"`
			SurchargeFee     int     `json:"surcharge_fee"`
		} `json:"pricings"`
	} `json:"data"`
	Pagination struct {
		CurrentPage     int      `json:"current_page"`
		CurrentElements int      `json:"current_elements"`
		TotalPages      int      `json:"total_pages"`
		TotalElements   int      `json:"total_elements"`
		SortBy          []string `json:"sort_by"`
	} `json:"pagination"`
}

DomesticRatesV3 struct contains response from API GetDomesticRates.

func (*DomesticRatesV3) ToDomesticRates added in v1.0.0

func (r *DomesticRatesV3) ToDomesticRates() DomesticRates

ToDomesticRates convert V3 to V1

type InternationalRates

type InternationalRates struct {
	Status string `json:"status"`
	Data   struct {
		Title           string `json:"title"`
		Content         string `json:"content"`
		Rule            string `json:"rule"`
		OriginArea      string `json:"originArea"`
		DestinationArea string `json:"destinationArea"`
		Rates           struct {
			Logistic struct {
				International []courier `json:"international"`
			} `json:"logistic"`
		} `json:"rates"`
		StatusCode int `json:"statusCode"`
	} `json:"data"`
}

InternationalRates struct contains response from API GetInternationalRates.

func GetInternationalRates

func GetInternationalRates(params *InternationalRatesParams) (InternationalRates, error)

GetInternationalRates gets available rates based on origin and destination country.

func GetInternationalRatesWithContext

func GetInternationalRatesWithContext(ctx context.Context, params *InternationalRatesParams) (InternationalRates, error)

GetInternationalRatesWithContext gets available rates based on origin and destination country with context.

type InternationalRatesParams

type InternationalRatesParams struct {
	Origin      int     `json:"o" validate:"required"`
	Destination int     `json:"d" validate:"required"`
	Length      float64 `json:"l" validate:"required"`
	Width       float64 `json:"w" validate:"required"`
	Height      float64 `json:"h" validate:"required"`
	WeightTotal float64 `json:"wt" validate:"required"`
	Value       float64 `json:"v" validate:"required"`
	Type        int     `json:"type"`
	Order       int     `json:"order"`
}

InternationalRatesParams struct contains request parameter for API GetInternationalRates.

Jump to

Keyboard shortcuts

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