Documentation ¶
Index ¶
- Constants
- type ApiResponse
- type Area
- type Biteship
- type Client
- func (client *Client) CancelOrder(orderId string, reason string) (*ResponseCancelOrder, *Error)
- func (client *Client) ConfirmOrder(orderId string) (*ResponseCreateOrder, *Error)
- func (client *Client) CreateOrder(request *CreateOrderRequestParam) (*ResponseCreateOrder, *Error)
- func (client *Client) GetCourierRates(request *RequestCourierRates) (*ResponseListRatesCouriers, *Error)
- func (client *Client) GetCouriers() (*ResponseListCourier, *Error)
- func (client *Client) RetrieveArea(countries, input string) (*RetrieveAreaResponse, *Error)
- func (client *Client) RetrieveAreaByID(id string) (*RetrieveAreaResponse, *Error)
- func (client *Client) RetrieveOrder(orderId string) (*ResponseRetrieveOrder, *Error)
- func (client *Client) TrackOrder(orderId string) (*ResponseTrackingOrder, *Error)
- func (client *Client) TrackOrderByWaybill(waybillId string, courierCode string) (*ResponseTrackingOrder, *Error)
- func (client *Client) UpdateOrder(orderId string, request interface{}) (*ResponseCreateOrder, *Error)
- type ClientOption
- type Coordinate
- type Courier
- type CourierProvider
- type CreateOrderRequestParam
- type Delivery
- type DeliveryType
- type Destination
- type DestinationRate
- type Error
- type HttpRequest
- type IHttpRequest
- type ItemCourierRate
- type Metadata
- type Origin
- type OriginRate
- type PricingRate
- type ProductItem
- type ReasonRequest
- type RequestCourierRates
- type ResponseCancelOrder
- type ResponseCourier
- type ResponseCreateOrder
- type ResponseListCourier
- type ResponseListRatesCouriers
- type ResponseRetrieveOrder
- type ResponseTrackingOrder
- type ResponseWithMap
- type RetrieveAreaResponse
- type Shipper
- type Status
Constants ¶
View Source
const ( ErrRatesPostalCodeInvalidOrNotAvailable = 40001001 ErrRatesPricingFailedDueToMissingParameters = 40001002 ErrRatesNoCourierAvailableForRequestedLocation = 40001010 ErrOrderBookingCourierAPIKeyNotFound = 40002001 ErrOrderKeyNotActivated = 40002002 ErrOrderAuthenticationKeyError = 40002003 ErrOrderMissingTypeField = 40002004 ErrOrderMissingDeliveryTypeValue = 40002005 ErrOrderInvalidDeliveryTypeValue = 40002006 ErrOrderCourierNotAvailableForScheduled = 40002007 ErrOrderIncorrectExtraFeatures = 40002008 ErrOrderCourierNotAvailableForCOD = 40002009 ErrOrderMissingPostalCodeOrCoordinateDestination = 40002010 ErrOrderMissingPostalCodeOrCoordinateOrigin = 40002011 ErrOrderDestinationAddressRequired = 40002012 ErrOrderTimeAlreadyPassed = 40002013 ErrOrderMissingOriginContactName = 40002014 ErrOrderMissingOriginContactPhone = 40002015 ErrOrderMissingOriginAddress = 40002016 ErrOrderMissingDestinationContactName = 40002017 ErrOrderMissingDestinationContactPhone = 40002018 ErrOrderMissingDestinationAddress = 40002019 ErrOrderInvalidOrMissingPostalCode = 40002020 ErrOrderFailedGettingCourierRates = 40002021 ErrOrderMissingOriginCoordinate = 40002022 ErrOrderMissingOriginCoordinateForCourier = 40002023 ErrOrderMissingDestinationCoordinate = 40002024 ErrOrderMissingDestinationCoordinateForCourier = 40002025 ErrOrderCourierNotExist = 40002026 ErrOrderCourierServiceTypeNotExist = 40002027 ErrOrderAccountNotAvailableForCOD = 40002028 ErrOrderInvalidCODType = 40002029 ErrOrderExceededCODValue = 40002030 ErrOrderCourierCannotProvideCOD = 40002031 ErrOrderMissingPODNote = 40002032 ErrOrderCourierCannotProvidePOD = 40002033 ErrOrderCourierCannotProvideInsurance = 40002034 ErrOrderMissingDeliveryDate = 40002035 ErrOrderMissingDeliveryTime = 40002036 ErrOrderSameDayDeliveryOrderTimeRestriction = 40002037 ErrOrderOrderItemIssue = 40002038 ErrOrderPaymentIssue = 40002039 ErrOrderOrderingPartnerIssue = 40002040 ErrOrderFailedToCreateOrder = 40002041 ErrOrderGetOrderDetailsIssue = 40002042 ErrOrderOrderNotFound = 40002057 ErrOrderUpdateOrderIssue = 40002043 ErrOrderCannotEditConfirmedOrder = 40002044 ErrOrderCannotUpdateDeliveredOrder = 40002045 ErrOrderCannotUpdateCancelledOrder = 40002046 ErrOrderCannotUpdateOrderInProgress = 40002047 ErrOrderDevelopmentModeError = 40002048 ErrOrderPaymentUpdateIssue = 40002049 ErrOrderOrderAlreadyInNewStatus = 40002050 ErrOrderFailedToConfirmDevModeOrder = 40002051 ErrOrderFailedToConfirmOrder = 40002052 ErrOrderCannotCancelOrderInCurrentStatus = 40002053 ErrOrderFailedToCancelDevOrder = 40002054 ErrOrderFailedToCancelCourier = 40002055 ErrOrderCancelOrderIssue = 40002056 ErrOrderTagsNotInArrayFormat = 40002058 ErrOrderDuplicateWaybillID = 40002059 ErrOrderDuplicateReferenceID = 40002060 ErrOrderLackOfTransactionData = 40009001 ErrOrderPaymentMethodNotFound = 40009002 ErrOrderPaymentProcessingFailed = 40009003 ErrOrderFailedToCreateTransaction = 40009004 ErrTrackingFailedToGetTrackingData = 40003001 ErrTrackingCourierTrackingNotAvailable = 40003002 ErrTrackingWaybillNotFound = 40003003 )
View Source
const (
DefaultUrl = "https://api.biteship.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiResponse ¶
type Area ¶ added in v1.2.0
type Area struct { ID string `json:"id"` PostalCode uint `json:"postal_code"` CountryName string `json:"country_name"` CountryCode string `json:"country_code"` AdministrativeDivisionLevel1Name string `json:"administrative_division_level_1_name"` AdministrativeDivisionLevel1Type string `json:"administrative_division_level_1_type"` AdministrativeDivisionLevel2Name string `json:"administrative_division_level_2_name"` AdministrativeDivisionLevel2Type string `json:"administrative_division_level_2_type"` AdministrativeDivisionLevel3Name string `json:"administrative_division_level_3_name"` AdministrativeDivisionLevel3Type string `json:"administrative_division_level_3_type"` AdministrativeDivisionLevel4Name string `json:"administrative_division_level_4_name"` AdministrativeDivisionLevel4Type string `json:"administrative_division_level_4_type"` }
type Biteship ¶
type Biteship interface { GetCouriers() (*ResponseListCourier, *Error) // GetCourierRates List of available courier GetCourierRates(request *RequestCourierRates) (*ResponseListRatesCouriers, *Error) // CreateOrder Order objects are created to handle sellers’ shipment. // You can create, retrieve, and update individual orders. Orders are identified by a unique, random ID CreateOrder(request *CreateOrderRequestParam) (*ResponseCreateOrder, *Error) // RetrieveOrder Check your order history or tracking by orderId. // You can get the Order ID from the Order API request RetrieveOrder(orderId string) (*ResponseRetrieveOrder, *Error) // UpdateOrder When the order status has not been updated to confirmed, sellers can edit their order based on their needs. // For Example Let’s pretend if you want to change your origin address. // You can just simply send a JSON body with only the origin_address field. It will automatically change your current order details. UpdateOrder(orderId string, request interface{}) (*ResponseCreateOrder, *Error) ConfirmOrder(orderId string) (*ResponseCreateOrder, *Error) CancelOrder(orderId string, reason string) (*ResponseCancelOrder, *Error) // TrackOrder This endpoint can only be used when you order via our order API. // Biteship will generate tracking_id separately if you create an Order through Biteship API. TrackOrder(orderId string) (*ResponseTrackingOrder, *Error) // TrackOrderByWaybill (Public Tracking) This endpoint can be used to track any other waybill from any other source. // It requires the courier code which you can find the in Courier API TrackOrderByWaybill(waybillId string, courierCode string) (*ResponseTrackingOrder, *Error) RetrieveArea(countries, input string) (*RetrieveAreaResponse, *Error) RetrieveAreaByID(id string) (*RetrieveAreaResponse, *Error) }
func New ¶
func New(configs ...ClientOption) Biteship
type Client ¶ added in v0.0.4
type Client struct { SecretKey string BiteshipUrl string HttpRequest IHttpRequest }
func (*Client) CancelOrder ¶ added in v0.0.4
func (client *Client) CancelOrder(orderId string, reason string) (*ResponseCancelOrder, *Error)
func (*Client) ConfirmOrder ¶ added in v0.0.4
func (client *Client) ConfirmOrder(orderId string) (*ResponseCreateOrder, *Error)
func (*Client) CreateOrder ¶ added in v0.0.4
func (client *Client) CreateOrder(request *CreateOrderRequestParam) (*ResponseCreateOrder, *Error)
func (*Client) GetCourierRates ¶ added in v0.0.4
func (client *Client) GetCourierRates(request *RequestCourierRates) (*ResponseListRatesCouriers, *Error)
func (*Client) GetCouriers ¶ added in v0.0.4
func (client *Client) GetCouriers() (*ResponseListCourier, *Error)
func (*Client) RetrieveArea ¶ added in v1.2.0
func (client *Client) RetrieveArea(countries, input string) (*RetrieveAreaResponse, *Error)
func (*Client) RetrieveAreaByID ¶ added in v1.2.0
func (client *Client) RetrieveAreaByID(id string) (*RetrieveAreaResponse, *Error)
func (*Client) RetrieveOrder ¶ added in v0.0.4
func (client *Client) RetrieveOrder(orderId string) (*ResponseRetrieveOrder, *Error)
func (*Client) TrackOrder ¶ added in v0.0.4
func (client *Client) TrackOrder(orderId string) (*ResponseTrackingOrder, *Error)
func (*Client) TrackOrderByWaybill ¶ added in v0.0.4
func (client *Client) TrackOrderByWaybill(waybillId string, courierCode string) (*ResponseTrackingOrder, *Error)
func (*Client) UpdateOrder ¶ added in v0.0.4
func (client *Client) UpdateOrder(orderId string, request interface{}) (*ResponseCreateOrder, *Error)
type ClientOption ¶ added in v1.0.0
type ClientOption interface {
Apply(client *Client)
}
func WithHttpRequest ¶ added in v1.0.0
func WithHttpRequest(httpRequest IHttpRequest) ClientOption
func WithSecret ¶ added in v1.0.0
func WithSecret(secret string) ClientOption
WithSecret example: biteship_test.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9....
func WithUrl ¶ added in v1.0.0
func WithUrl(url string) ClientOption
type Coordinate ¶
type Courier ¶
type Courier struct { TrackingId *string `json:"tracking_id"` WaybillId *string `json:"waybill_id"` Company string `json:"company"` Name *string `json:"name"` Phone *string `json:"phone"` Type string `json:"type"` Link *string `json:"link"` Status *string `json:"status,omitempty"` History []struct { ServiceType string `json:"service_type"` Status string `json:"status"` Note string `json:"note"` UpdatedAt string `json:"updated_at"` } `json:"history,omitempty"` }
type CourierProvider ¶
type CourierProvider string
const ( CourierProviderGrab CourierProvider = "grab" CourierProviderGojek CourierProvider = "gojek" CourierProviderJNE CourierProvider = "jne" CourierProviderTIKI CourierProvider = "tiki" CourierProviderJET CourierProvider = "jet" CourierProviderJNT CourierProvider = "jnt" CourierProviderSicepat CourierProvider = "sicepat" CourierProviderWahana CourierProvider = "wahana" CourierProviderPos CourierProvider = "pos" CourierProviderLion CourierProvider = "lion" CourierProviderNinja CourierProvider = "ninja" CourierProviderAnteraja CourierProvider = "anteraja" CourierProviderRPX CourierProvider = "rpx" CourierProviderPaxel CourierProvider = "paxel" CourierProviderMrSpeedy CourierProvider = "mrspeedy" CourierProviderLalamove CourierProvider = "lalamove" CourierProviderDeliveree CourierProvider = "deliveree" CourierProviderSAP CourierProvider = "sap" )
type CreateOrderRequestParam ¶
type CreateOrderRequestParam struct { ShipperContactName string `json:"shipper_contact_name"` ShipperContactPhone string `json:"shipper_contact_phone"` ShipperContactEmail string `json:"shipper_contact_email"` ShipperOrganization string `json:"shipper_organization"` OriginContactName string `json:"origin_contact_name"` OriginContactPhone string `json:"origin_contact_phone"` OriginAddress string `json:"origin_address"` OriginNote string `json:"origin_note"` OriginPostalCode uint32 `json:"origin_postal_code"` OriginCoordinate Coordinate `json:"origin_coordinate"` DestinationContactName string `json:"destination_contact_name"` DestinationContactPhone string `json:"destination_contact_phone"` DestinationContactEmail string `json:"destination_contact_email"` DestinationAddress string `json:"destination_address"` DestinationPostalCode uint32 `json:"destination_postal_code"` DestinationNote string `json:"destination_note"` DestinationCoordinate Coordinate `json:"destination_coordinate"` DestinationCashOnDelivery *uint `json:"destination_cash_on_delivery"` // Optional DestinationCashOnDeliveryType *string `json:"destination_cash_on_delivery_type"` CourierCompany CourierProvider `json:"courier_company" binding:"required"` CourierType string `json:"courier_type" binding:"required"` CourierInsurance uint `json:"courier_insurance"` DeliveryType DeliveryType `json:"delivery_type" binding:"required"` // "later" or "now" DeliveryDate string `json:"delivery_date"` // yyyy-mm-dd DeliveryTime string `json:"delivery_time"` // hh:mm PaymentType string `json:"payment_type" binding:"required"` // Set to be 'online' OrderNote string `json:"order_note"` Metadata Metadata `json:"metadata"` // Optional Items []ProductItem `json:"items"` }
type DeliveryType ¶ added in v0.0.4
type DeliveryType string
const ( DeliveryTypeNow DeliveryType = "now" DeliveryTypeScheduled DeliveryType = "scheduled" )
type Destination ¶
type Destination struct { Coordinate Coordinate `json:"coordinate"` PostalCode uint `json:"postal_code"` ContactName string `json:"contact_name"` ContactPhone string `json:"contact_phone"` ContactEmail string `json:"contact_email"` Address string `json:"address,omitempty"` Location string `json:"location,omitempty"` Note string `json:"note"` }
type DestinationRate ¶
type DestinationRate struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` PostalCode uint `json:"postal_code"` CountryName string `json:"country_name"` CountryCode string `json:"country_code"` AdministrativeDivisionLevel1Name string `json:"administrative_division_level_1_name"` AdministrativeDivisionLevel1Type string `json:"administrative_division_level_1_type"` AdministrativeDivisionLevel2Name string `json:"administrative_division_level_2_name"` AdministrativeDivisionLevel2Type string `json:"administrative_division_level_2_type"` AdministrativeDivisionLevel3Name string `json:"administrative_division_level_3_name"` AdministrativeDivisionLevel3Type string `json:"administrative_division_level_3_type"` AdministrativeDivisionLevel4Name string `json:"administrative_division_level_4_name"` AdministrativeDivisionLevel4Type string `json:"administrative_division_level_4_type"` }
type Error ¶
type Error struct { Status int `json:"status,omitempty"` ErrorCode string `json:"error_code,omitempty"` Message string `json:"message,omitempty"` RawError string `json:"error,omitempty"` Code int `json:"code,omitempty"` }
func ErrorRequestParam ¶
type HttpRequest ¶
type HttpRequest struct{}
type IHttpRequest ¶ added in v1.0.0
type IHttpRequest interface {
Call(method string, url string, secretKey string, body io.Reader, result interface{}) *Error
}
func NewHttp ¶ added in v1.0.0
func NewHttp() IHttpRequest
type ItemCourierRate ¶
type OriginRate ¶
type OriginRate struct { Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` PostalCode uint `json:"postal_code"` CountryName string `json:"country_name"` CountryCode string `json:"country_code"` AdministrativeDivisionLevel1Name string `json:"administrative_division_level_1_name"` AdministrativeDivisionLevel1Type string `json:"administrative_division_level_1_type"` AdministrativeDivisionLevel2Name string `json:"administrative_division_level_2_name"` AdministrativeDivisionLevel2Type string `json:"administrative_division_level_2_type"` AdministrativeDivisionLevel3Name string `json:"administrative_division_level_3_name"` AdministrativeDivisionLevel3Type string `json:"administrative_division_level_3_type"` AdministrativeDivisionLevel4Name string `json:"administrative_division_level_4_name"` AdministrativeDivisionLevel4Type string `json:"administrative_division_level_4_type"` }
type PricingRate ¶
type PricingRate struct { Company string `json:"company"` CourierName string `json:"courier_name"` CourierCode string `json:"courier_code"` CourierServiceName string `json:"courier_service_name"` CourierServiceCode string `json:"courier_service_code"` Type string `json:"type"` Description string `json:"description"` Duration string `json:"duration"` ShipmentDurationRange string `json:"shipment_duration_range"` ShipmentDurationUnit string `json:"shipment_duration_unit"` ServiceType string `json:"service_type"` ShippingType string `json:"shipping_type"` Price uint `json:"price"` }
PricingRate RATES COURIER
type ProductItem ¶
type ProductItem struct { Id string `json:"id"` Name string `json:"name"` Description string `json:"description"` Image string `json:"image"` Value uint `json:"value"` Quantity uint `json:"quantity" validate:"gte=1"` Height uint `json:"height" validate:"gte=1"` Width uint `json:"width" validate:"gte=1"` Length uint `json:"length" validate:"gte=1"` Weight uint `json:"weight"` }
type ReasonRequest ¶
type ReasonRequest struct {
CancellationReason string `json:"cancellation_reason"`
}
type RequestCourierRates ¶
type RequestCourierRates struct { OriginLatitude *float64 `json:"origin_latitude,omitempty"` OriginLongitude *float64 `json:"origin_longitude,omitempty"` DestinationLatitude *float64 `json:"destination_latitude,omitempty"` DestinationLongitude *float64 `json:"destination_longitude,omitempty"` OriginPostalCode uint `json:"origin_postal_code,omitempty"` DestinationPostalCode uint `json:"destination_postal_code,omitempty"` Couriers string `json:"couriers" validate:"required"` // "grab, gojek, jne, tiki, jet, jnt, sicepat, wahana, pos, lion, ninja, anteraja, rpx, paxel, mrspeedy, lalamove, deliveree, sap" Items []ItemCourierRate `json:"items"` }
type ResponseCancelOrder ¶
type ResponseCourier ¶
type ResponseCourier struct { AvailableForCashOnDelivery bool `json:"available_for_cash_on_delivery"` AvailableForProofOfDelivery bool `json:"available_for_proof_of_delivery"` AvailableForInstantWaybillId bool `json:"available_for_instant_waybill_id"` CourierName string `json:"courier_name"` CourierCode string `json:"courier_code"` CourierServiceName string `json:"courier_service_name"` CourierServiceCode string `json:"courier_service_code"` Tier string `json:"tier"` Description string `json:"description"` ServiceType string `json:"service_type"` ShippingType string `json:"shipping_type"` ShipmentDurationRange string `json:"shipment_duration_range"` ShipmentDurationUnit string `json:"shipment_duration_unit"` }
type ResponseCreateOrder ¶
type ResponseCreateOrder struct { Success bool `json:"success"` Message string `json:"message"` Object string `json:"object"` Id string `json:"id"` Shipper Shipper `json:"shipper"` Origin Origin `json:"origin"` Destination Destination `json:"destination"` Courier Courier `json:"courier"` Items []ProductItem `json:"items"` Price uint `json:"price"` Note string `json:"note"` Status string `json:"status"` }
type ResponseListCourier ¶
type ResponseListCourier struct { Success bool `json:"success"` Object string `json:"object"` Couriers []ResponseCourier `json:"couriers"` }
type ResponseListRatesCouriers ¶
type ResponseListRatesCouriers struct { Success bool `json:"success"` Message string `json:"message"` Origin OriginRate `json:"origin"` Destination DestinationRate `json:"destination"` Pricing []PricingRate `json:"pricing"` }
type ResponseRetrieveOrder ¶
type ResponseRetrieveOrder struct { Success bool `json:"success"` Message string `json:"message"` Object string `json:"object"` Id string `json:"id"` Shipper Shipper `json:"shipper"` Origin Origin `json:"origin"` Delivery Delivery `json:"delivery"` Destination Destination `json:"destination"` Courier Courier `json:"courier"` Items []ProductItem `json:"items"` Price uint `json:"price"` Note string `json:"note"` Status string `json:"status"` }
ResponseRetrieveOrder RESPONSE RETRIEVE ORDER
type ResponseTrackingOrder ¶
type ResponseTrackingOrder struct { Success bool `json:"success"` Message string `json:"message"` Object string `json:"object"` Id string `json:"id"` WaybillId string `json:"waybill_id"` Courier struct { Company string `json:"company"` Name *string `json:"name"` Phone *string `json:"phone"` } `json:"courier"` Origin struct { ContactName string `json:"contact_name"` Address string `json:"address"` } `json:"origin"` Destination struct { ContactName string `json:"contact_name"` Address string `json:"address"` } History []struct { Note string `json:"note"` Status string `json:"status"` UpdatedAt string `json:"updated_at"` } `json:"history"` Link string `json:"link"` OrderId *string `json:"order_id"` Status string `json:"status"` }
type ResponseWithMap ¶
type ResponseWithMap map[string]interface{}
type RetrieveAreaResponse ¶ added in v1.2.0
type Status ¶
type Status string
const ( StatusPlaced Status = "placed" StatusScheduled Status = "scheduled" StatusConfirmed Status = "confirmed" StatusAllocated Status = "allocated" StatusPickingUp Status = "picking_up" StatusPicked Status = "picked" StatusDroppingOff Status = "dropping_off" StatusDelivered Status = "delivered" StatusRejected Status = "rejected" StatusCancelled Status = "cancelled" StatusOnHold Status = "on_hold" StatusCourierNotFound Status = "courier_not_found" StatusReturned Status = "returned" StatusReturnInTransit Status = "return_in_transit" )
Click to show internal directories.
Click to hide internal directories.