Documentation
¶
Index ¶
- Constants
- Variables
- func GetFeeTypeDesc(feeType string) string
- type CardType
- type Client
- type CompanyCode
- type Data
- type Express
- func (exp *Express) BCancelExpress(params *express.CancelExpressParams) (*express.CancelExpressResponse, error)
- func (exp *Express) BExpressPushVerify(sign, params string) (*express.SubscribeCallbackPush, error)
- func (exp *Express) BSendExpress(params *express.SendExpressParams) (*express.SendExpressResponse, error)
- func (exp *Express) BSendExpressVerify(sign, params string) (*express.BSendExpressCallbackPush, error)
- func (exp *Express) CCancelExpress(params *express.CancelExpressParams) (*express.CancelExpressResponse, error)
- func (exp *Express) CExpressPushVerify(sign, params string) (*express.SubscribeCallbackPush, error)
- func (exp *Express) CSendExpress(params *express.SendExpressParams) (*express.SendExpressResponse, error)
- func (exp *Express) CSendExpressVerify(sign, params string) (*express.CSendExpressCallbackPush, error)
- func (exp *Express) Query(params *express.QueryParams) (*express.QueryResponse, error)
- func (exp *Express) QueryBSendExpress(taskId string) (*express.QueryBSendExpressResponse, error)
- func (exp *Express) QueryMapTrack(params *express.QueryParams) (*express.QueryMapResponse, error)
- func (exp *Express) QueryPostage(params *express.QueryPostageParams) (*express.QueryPostageResponse, error)
- func (exp *Express) Sign(params string) string
- func (exp *Express) Subscribe(params *express.SubscribeParams) error
- func (exp *Express) SubscribeMapTrack(params *express.SubscribeParams) error
- func (exp *Express) Verify(sign, params string) bool
- func (exp *Express) VerifyCallbackMapPush(data, sign string) (*express.SubscribeCallbackMapPush, error)
- func (exp *Express) VerifyCallbackPush(data, sign string) (*express.SubscribeCallbackPush, error)
- type ExpressType
- type FeeType
- type MonitorStatus
- type Option
- type Options
- type PayStatus
- type PayType
- type PushResp
- type QueryExpressResp
- type QueryParams
- type QueryReqConfig
- type QueryRequest
- type Result
- type Sort
- type State
- type SubscribeParam
- type SubscribeParameters
- type SubscribePush
- type SubscribeReq
- type SubscribeReqConfig
- type SubscribeResp
- type TrackStatus
Constants ¶
View Source
const ( SubscribeStatusPolling = "polling" // 监控中 SubscribeStatusShutdown = "shutdown" // 结束 SubscribeStatusAbort = "abort" // 中止 当message为“3天查询无记录”或“60天无变化时”status= abort SubscribeStatusUpdateAll = "updateall" // 重新推送 )
View Source
const ( StatusAwaitPickup = "1" // 揽收 StatusOrderPlaced = "101" // 已下单 StatusAwaitingPickup = "102" // 待揽收 StatusPickedUp = "103" // 已揽收 StatusInTransit = "0" // 在途 StatusArrivedCity = "1001" // 到达派件城市 StatusMainline = "1002" // 运输干线 StatusTransfer = "1003" // 转递 StatusDelivering = "5" // 派件 StatusDeliveredStation = "501" // 投柜或驿站 快递已投柜或已送达驿站 StatusSignedDelivery = "3" // 签收 StatusSelfSigned = "301" // 本人签收 StatusAbnormalSigned = "302" // 派件异常后签收 StatusOtherSigned = "303" // 代签 StatusStationSigned = "304" // 站点代签或者投柜代签 StatusReturned = "6" // 退回 StatusReturnSigned = "4" // 退签 StatusSalesOrder = "401" // 快递单已撤销 StatusRefusal = "14" // 拒签 StatusTransferAnother = "7" // 转寄 StatusDifficult = "2" // 疑难件 StatusSignExpired = "201" // 签收超时 StatusUpdateExpired = "202" // 更新超时 StatusRefuseReceive = "203" // 拒收(退件) StatusDeliveryException = "204" // 派件异常 StatusStationException = "205" // 站点或快递柜超时未取件 StatusNotContacted = "206" // 未联系上收件人 StatusOutDeliveryArea = "207" // 超出配送区域 StatusUndelivered = "208" // 滞留 – 暂无法进行派件 StatusDamaged = "209" // 破损 StatusCancelOrder = "210" // 用户取消订单 StatusCustomsClearance = "8" // 清关 StatusWaitCustomsClearance = "10" // 等待清关 StatusCustomsCleaning = "11" // 清关中 StatusCustomsClearanceCompleted = "12" // 清关完成 StatusCustomsClearanceFail = "13" // 清关异常 )
View Source
const ( StateInTransit = 0 // 在途 StatePickUp = 1 // 揽件 StateDifficult = 2 // 疑难件 StateSign = 3 // 签收 StateReject = 4 // 退签 StateDispatch = 5 // 派件 StateClearance = 8 // 清关 StateRefuse = 14 // 拒签 )
View Source
const ( SortDesc = "desc" // 降序 SortAsc = "asc" // 升序 )
View Source
const ( PayTypeSender = iota + 1 // 寄付 PayTypeRecipient // 到付 PayTypeMonthly // 月结 )
View Source
const ( ExpressTypeDomesiticExpress = iota + 1 // 国内快递 ExpressTypeInternationalExpress // 国际快递 ExpressTypeDomesiticLogistics // 国内物流 ExpressTypeInternationalLogistics // 国际物流 )
View Source
const ( PayFail = -1 // 支付失败 PayUnpaid = 0 // 未支付 PayPaid = 1 // 已支付 PayNoPayment = 2 // 无需支付 PayRefund = 3 // 已退款 )
Variables ¶
View Source
var FeeTypeDescMap = map[FeeType]string{ FeeTypeInsuranceFee: "保价费", FeeTypePackagingFee: "包装费", FeeTypeCollectionFee: "代收货款", FeeTypeSignAndReturn: "签单返还", FeeTypeHandlingCharges: "装卸服务", FeeTypePickUpServiceFee: "提货服务", FeeTypeDeliveryServiceFee: "配送服务", FeeTypeResourceConditioningCharges: "资源调节费", FeeTypeAnimalQuarantineCertificate: "动检证", FeeTypeSpecialWarehousingFee: "特殊入仓", FeeTypeSurcharge: "附加费", FeeTypeExpressCompensation: "快递赔付费", FeeTypeReceiveDeliveryFeeClaims: "收派服务费-理赔", FeeTypeExpressAddrChangeFee: "快递改址费", FeeTypeExceededAreaFee: "超区服务费", FeeTypeOverLengthOverWeightFee: "超长超重附加费", FeeTypeReturnFee: "逆向费用", FeeTypeFreshFee: "保鲜服务费", FeeTypeFullInsuranceFee: "顺丰足额保", FeeTypeOtherFee: "其他费用", }
View Source
var FeeTypeMap = map[FeeType]string{ FeeTypeInsuranceFee: "INSURANCEFEE", FeeTypePackagingFee: "PACKAGINGFEE", FeeTypeCollectionFee: "COLLECTIONFEE", FeeTypeSignAndReturn: "SIGNANDRETURN", FeeTypeHandlingCharges: "HANDLINGCHARGES", FeeTypePickUpServiceFee: "PICKUPSERVICEFEE", FeeTypeDeliveryServiceFee: "DELIVERYSERVICEFEE", FeeTypeResourceConditioningCharges: "RESOURCECONDITIONINGCHARGES", FeeTypeAnimalQuarantineCertificate: "ANIMALQUARANTINECERTIFICATE", FeeTypeSpecialWarehousingFee: "SPECIALWAREHOUSINGFEE", FeeTypeSurcharge: "SURCHARGE", FeeTypeExpressCompensation: "EXPRESSCOMPENSATION", FeeTypeReceiveDeliveryFeeClaims: "RECEIVEDELIVERYFEECLAIMS", FeeTypeExpressAddrChangeFee: "EXPRESSADDRCHANGEFEE", FeeTypeExceededAreaFee: "EXCEEDEDAREAFEE", FeeTypeOverLengthOverWeightFee: "OVERLENGTHOVERWEIGHTFEE", FeeTypeReturnFee: "RETURNFEE", FeeTypeFreshFee: "FRESHFEE", FeeTypeFullInsuranceFee: "FULLINSURANCEFEE", FeeTypeOtherFee: "OTHERFEE", }
View Source
var FeeTypeReverseDescMap = map[string]string{
"INSURANCEFEE": "保价费",
"PACKAGINGFEE": "包装费",
"COLLECTIONFEE": "代收货款",
"SIGNANDRETURN": "签单返还",
"HANDLINGCHARGES": "装卸服务",
"PICKUPSERVICEFEE": "提货服务",
"DELIVERYSERVICEFEE": "配送服务",
"RESOURCECONDITIONINGCHARGES": "资源调节费",
"ANIMALQUARANTINECERTIFICATE": "动检证",
"SPECIALWAREHOUSINGFEE": "特殊入仓",
"SURCHARGE": "附加费",
"EXPRESSCOMPENSATION": "快递赔付费",
"RECEIVEDELIVERYFEECLAIMS": "收派服务费-理赔",
"EXPRESSADDRCHANGEFEE": "快递改址费",
"EXCEEDEDAREAFEE": "超区服务费",
"OVERLENGTHOVERWEIGHTFEE": "超长超重附加费",
"RETURNFEE": "逆向费用",
"FRESHFEE": "保鲜服务费",
"FULLINSURANCEFEE": "顺丰足额保",
"OTHERFEE": "其他费用",
}
View Source
var FeeTypeReverseMap = map[string]FeeType{ "INSURANCEFEE": FeeTypeInsuranceFee, "PACKAGINGFEE": FeeTypePackagingFee, "COLLECTIONFEE": FeeTypeCollectionFee, "SIGNANDRETURN": FeeTypeSignAndReturn, "HANDLINGCHARGES": FeeTypeHandlingCharges, "PICKUPSERVICEFEE": FeeTypePickUpServiceFee, "DELIVERYSERVICEFEE": FeeTypeDeliveryServiceFee, "RESOURCECONDITIONINGCHARGES": FeeTypeResourceConditioningCharges, "ANIMALQUARANTINECERTIFICATE": FeeTypeAnimalQuarantineCertificate, "SPECIALWAREHOUSINGFEE": FeeTypeSpecialWarehousingFee, "SURCHARGE": FeeTypeSurcharge, "EXPRESSCOMPENSATION": FeeTypeExpressCompensation, "RECEIVEDELIVERYFEECLAIMS": FeeTypeReceiveDeliveryFeeClaims, "EXPRESSADDRCHANGEFEE": FeeTypeExpressAddrChangeFee, "EXCEEDEDAREAFEE": FeeTypeExceededAreaFee, "OVERLENGTHOVERWEIGHTFEE": FeeTypeOverLengthOverWeightFee, "RETURNFEE": FeeTypeReturnFee, "FRESHFEE": FeeTypeFreshFee, "FULLINSURANCEFEE": FeeTypeFullInsuranceFee, "OTHERFEE": FeeTypeOtherFee, }
View Source
var MonitorStatusMap = map[MonitorStatus]string{ Polling: "polling", Shutdown: "shutdown", Abort: "abort", UpdateAll: "updateall", }
View Source
var MonitorStatusReverseMap = map[string]MonitorStatus{ "polling": Polling, "shutdown": Shutdown, "abort": Abort, "updateall": UpdateAll, }
Functions ¶
func GetFeeTypeDesc ¶
Types ¶
type Data ¶
type Data struct {
Time string `json:"time"` // 物流事件发生的时间
Context string `json:"context"` // 物流事件的描述
Ftime string `json:"ftime"` // 物流事件发生的时间
AreaCode string `json:"areaCode"` // 物流事件发生的区域编码
AreaName string `json:"areaName"` // 物流事件发生的区域名称
Status string `json:"status"` // 物流事件的状态
Location string `json:"location"` // 物流事件的城市
AreaCenter string `json:"areaCenter"` // 物流事件的城市
AreaPinYin string `json:"areaPinYin"` // 物流事件的城市
StatusCode string `json:"statusCode"` // 物流事件的状态编码
}
type Express ¶
type Express struct {
// contains filtered or unexported fields
}
func (*Express) BCancelExpress ¶ added in v0.1.0
func (exp *Express) BCancelExpress(params *express.CancelExpressParams) (*express.CancelExpressResponse, error)
func (*Express) BExpressPushVerify ¶ added in v0.1.0
func (exp *Express) BExpressPushVerify(sign, params string) (*express.SubscribeCallbackPush, error)
func (*Express) BSendExpress ¶ added in v0.1.0
func (exp *Express) BSendExpress(params *express.SendExpressParams) (*express.SendExpressResponse, error)
func (*Express) BSendExpressVerify ¶ added in v0.1.0
func (exp *Express) BSendExpressVerify(sign, params string) (*express.BSendExpressCallbackPush, error)
func (*Express) CCancelExpress ¶ added in v0.1.0
func (exp *Express) CCancelExpress(params *express.CancelExpressParams) (*express.CancelExpressResponse, error)
func (*Express) CExpressPushVerify ¶ added in v0.1.0
func (exp *Express) CExpressPushVerify(sign, params string) (*express.SubscribeCallbackPush, error)
func (*Express) CSendExpress ¶ added in v0.1.0
func (exp *Express) CSendExpress(params *express.SendExpressParams) (*express.SendExpressResponse, error)
func (*Express) CSendExpressVerify ¶ added in v0.1.0
func (exp *Express) CSendExpressVerify(sign, params string) (*express.CSendExpressCallbackPush, error)
func (*Express) Query ¶
func (exp *Express) Query(params *express.QueryParams) (*express.QueryResponse, error)
func (*Express) QueryBSendExpress ¶ added in v0.1.0
func (exp *Express) QueryBSendExpress(taskId string) (*express.QueryBSendExpressResponse, error)
func (*Express) QueryMapTrack ¶
func (exp *Express) QueryMapTrack(params *express.QueryParams) (*express.QueryMapResponse, error)
func (*Express) QueryPostage ¶
func (exp *Express) QueryPostage(params *express.QueryPostageParams) (*express.QueryPostageResponse, error)
func (*Express) SubscribeMapTrack ¶
func (exp *Express) SubscribeMapTrack(params *express.SubscribeParams) error
func (*Express) VerifyCallbackMapPush ¶
func (exp *Express) VerifyCallbackMapPush(data, sign string) (*express.SubscribeCallbackMapPush, error)
func (*Express) VerifyCallbackPush ¶
func (exp *Express) VerifyCallbackPush(data, sign string) (*express.SubscribeCallbackPush, error)
type FeeType ¶
type FeeType uint8
const ( FeeTypeInsuranceFee FeeType = iota + 1 // 保价费 FeeTypePackagingFee // 包装费 FeeTypeCollectionFee // 代收货款 FeeTypeSignAndReturn // 签单返还 FeeTypeHandlingCharges // 装卸服务 FeeTypePickUpServiceFee // 提货服务 FeeTypeDeliveryServiceFee // 配送服务 FeeTypeResourceConditioningCharges // 资源调节费 FeeTypeAnimalQuarantineCertificate // 动检证 FeeTypeSpecialWarehousingFee // 特殊入仓 FeeTypeSurcharge // 附加费 FeeTypeExpressCompensation // 快递赔付费 FeeTypeReceiveDeliveryFeeClaims // 收派服务费-理赔 FeeTypeExpressAddrChangeFee // 快递改址费 FeeTypeExceededAreaFee // 超区服务费 FeeTypeOverLengthOverWeightFee // 超长超重附加费 FeeTypeReturnFee // 逆向费用 FeeTypeFreshFee // 保鲜服务费 FeeTypeFullInsuranceFee // 顺丰足额保 FeeTypeOtherFee // 其他费用 )
func ParseFeeType ¶
func (FeeType) GetFeeTypeDesc ¶
type MonitorStatus ¶
type MonitorStatus uint8
MonitorStatus 监控状态
const ( Polling MonitorStatus = iota // 监控中 Shutdown // 结束 Abort // 中止 UpdateAll // 重新推送 )
func ReverseString ¶
func ReverseString(monitor string) MonitorStatus
func (MonitorStatus) String ¶
func (s MonitorStatus) String() string
type Option ¶
type Option func(options *Options)
func WithBaseUrl ¶
func WithCustomer ¶
func WithNotifyUrl ¶
func WithSecret ¶
type PushResp ¶
type PushResp struct {
Result bool `json:"result"` // 推送处理结果
ReturnCode string `json:"returnCode"` // 推送处理结果编码
Message string `json:"message"` // 推送处理结果描述
}
PushResp 推送响应
type QueryExpressResp ¶
type QueryExpressResp struct {
Message string `json:"message"` // 消息体, 可以忽略
State string `json:"state"` // 快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值
Status string `json:"status"` // 通讯状态, 可以忽略
Condition string `json:"condition"` // 快递单明细状态标记,暂未实现,可以忽略
Nu string `json:"nu"` // 快递单号
Ischeck string `json:"ischeck"` // 是否签收标记 0:未签收 1:已签收
Com string `json:"com"` // 快递公司编码
Data []struct {
Context string `json:"context"` // 物流事件的描述
Time string `json:"time"` // 物流事件发生的时间, 原始格式
Ftime string `json:"ftime"` // 物流事件发生的时间, 格式化后的
AreaCode string `json:"areaCode"` // 物流事件发生的区域编码
AreaName string `json:"areaName"` // 物流事件发生的区域名称
Status string `json:"status"` // 物流事件的状态
Location string `json:"location"` // 物流事件的城市
AreaCenter string `json:"areaCenter"` // 物流事件的城市
AreaPinYin string `json:"areaPinYin"` // 物流事件的城市
StatusCode string `json:"statusCode"` // 物流事件的状态编码
} `json:"data"`
RouteInfo struct {
From struct {
Number string `json:"number"` // 出发地编码
Name string `json:"name"` // 出发地名称
} `json:"from"`
Cur struct {
Number string `json:"number"` // 当前所在地编码
Name string `json:"name"` // 当前所在地名称
} `json:"cur"`
To interface{} `json:"to"` // 目的地
} `json:"routeInfo"`
IsLoop bool `json:"isLoop"` // 是否循环推送
// 错误处理
Result bool `json:"result"` // 查询结果
ReturnCode string `json:"returnCode"` // 查询结果编码
}
QueryExpressResp 查询响应
type QueryParams ¶
type QueryParams struct {
Com string `json:"com"` // 快递公司编码
Num string `json:"num"` // 快递单号
Phone string `json:"phone"` // 手机号
From string `json:"from"` // 出发地城市
To string `json:"to"` // 目的地城市
Resultv2 string `json:"resultv2"` // 开通行政区域解析功能:0-关闭(默认),1-开通
Show string `json:"show"` // 返回数据格式:0-json(默认),1-xml,2-html,3-text
Order string `json:"order"` // 排序:desc-降序(默认),asc-升序
}
QueryParams 查询请求参数
type QueryReqConfig ¶
type QueryReqConfig struct {
Com string // 快递公司编码
Num string // 快递单号
Phone string // 手机号
From string // 出发地城市
To string // 目的地城市
Resultv2 string // 开通行政区域解析功能:0-关闭(默认),1-开通
Show string // 返回数据格式:0-json(默认),1-xml,2-html,3-text
Order string // 排序:desc-降序(默认),asc-升序
}
QueryReqConfig 查询请求配置
type QueryRequest ¶
type QueryRequest struct {
Customer string `json:"customer"`
Sign string `json:"sign"`
Param *QueryParams `json:"param"`
}
QueryRequest 查询请求
type Result ¶
type Result struct {
Message string `json:"message"` // 监控状态相关消息,如:3天查询无记录,60天无变化
Nu string `json:"nu"` // 快递单号
Ischeck string `json:"ischeck"` // 是否签收标记 0:未签收 1:已签收
Com express.CompanyCode `json:"com"` // 快递公司编码
Status string `json:"status"` // 快递单当前的状态 :0:在途,即货物处于运输过程中;1:揽件,货物已由快递公司揽收并且产生了第一条跟踪信息;
Data []*Data `json:"data"` // 快递单明细状态标记,多行
State string `json:"state"` // 快递单当前状态,默认为0在途,1揽收,2疑难,3签收,4退签,5派件,8清关,14拒签等10个基础物流状态,如需要返回高级物流状态,请参考 resultv2 传值
Condition string `json:"condition"` // 快递单明细状态标记,多行
RouteInfo struct {
From struct {
Number string `json:"number"`
Name string `json:"name"`
} `json:"from"`
Cur struct {
Number string `json:"number"`
Name string `json:"name"`
} `json:"cur"`
To interface{} `json:"to"` // 目的地
} `json:"routeInfo"`
IsLoop bool `json:"isLoop"` // 是否循环推送
}
type SubscribeParam ¶
type SubscribeParam struct {
Company string `json:"company"` // 快递公司编码
Number string `json:"number"` // 快递单号
From string `json:"from,omitempty"` // 出发地城市
To string `json:"to,omitempty"` // 目的地城市
Key string `json:"key"` // 授权key
Parameters *SubscribeParameters `json:"parameters"` // 可选参数
}
SubscribeParam 请求参数
type SubscribeParameters ¶
type SubscribeParameters struct {
CallbackUrl string `json:"callbackurl"` // 回调地址
Salt string `json:"salt,omitempty"` // MD5加密串
Resultv2 string `json:"resultv2"` // 开通行政区域解析功能:0-关闭(默认),1-开通
AutoCom string `json:"autoCom"` // 开通智能单号识别功能:0-关闭(默认),1-开通
InterCom string `json:"interCom"` // 开通国际版功能:0-关闭(默认),1-开通
DepartureCountry string `json:"departureCountry"` // 出发国
DepartureCom string `json:"departureCom"` // 出发国快递公司编码
DestinationCountry string `json:"destinationCountry"` // 目的国
DestinationCom string `json:"destinationCom"` // 目的国快递公司编码
Phone string `json:"phone"` // 手机号 顺丰速运、顺丰快运和丰网速运必填
}
SubscribeParameters 可选参数
type SubscribePush ¶
type SubscribePush struct {
Status string `json:"status"` // 监控状态:polling:监控中,shutdown:结束,abort:中止,updateall:重新推送
Billstatus string `json:"billstatus"` // 包括got、sending、check三个状态,由于意义不大,已弃用,请忽略
Message string `json:"message"` // 监控状态相关消息,如:3天查询无记录,60天无变化
AutoCheck string `json:"autoCheck"` // 是否开启智能判断功能,当快递单号识别出多个快递公司时,是否开启智能判断功能,默认值0,0:关闭智能判断,1:开启智能判断
ComOld string `json:"comOld"` // 识别出的快递公司编码
ComNew string `json:"comNew"` // 智能判断出的快递公司编码
LastResult *Result `json:"lastResult"` // 最新查询结果,包括:comNew、nuNew、ischeck、condition、status、state、data、message、autoCheck、comOld、nuOld
}
type SubscribeReq ¶
type SubscribeReq struct {
Schema string `json:"schema"` // 返回的数据格式, json(默认),xml
Param *SubscribeParam `json:"param"` // 请求参数
}
SubscribeReq 订阅请求
type SubscribeReqConfig ¶
type SubscribeReqConfig struct {
Schema string // 返回的数据格式, json(默认),xml
Company string // 快递公司编码
Number string // 快递单号
From string // 出发地城市
To string // 目的地城市
CallbackUrl string // 回调地址
Salt string // MD5加密串
Resultv2 string // 开通行政区域解析功能:0-关闭(默认),1-开通
AutoCom string // 开通智能单号识别功能:0-关闭(默认),1-开通
InterCom string // 开通国际版功能:0-关闭(默认),1-开通
DepartureCountry string // 出发国
DepartureCom string // 出发国快递公司编码
DestinationCountry string // 目的国
DestinationCom string // 目的国快递公司编码
Phone string // 手机号 顺丰速运、顺丰快运和丰网速运必填
}
type SubscribeResp ¶
type TrackStatus ¶
type TrackStatus string
Click to show internal directories.
Click to hide internal directories.