Documentation ¶
Overview ¶
@description 顺丰接口的sdk封装 @link https://github.com/chenghuama/sf @license https://github.com/chenghuama/sf/blob/master/LICENSE @authors chenghuama(chenghuama@vip.qq.com) @team yl10/忆零
@description 顺丰接口的sdk封装 @link https://github.com/chenghuama/sf @license https://github.com/chenghuama/sf/blob/master/LICENSE @authors chenghuama(chenghuama@vip.qq.com) @team yl10/忆零
@description 顺丰接口的sdk封装 @link https://github.com/chenghuama/sf @license https://github.com/chenghuama/sf/blob/master/LICENSE @authors chenghuama(chenghuama@vip.qq.com) @team yl10/忆零
@description 顺丰接口的sdk封装 @link https://github.com/chenghuama/sf @license https://github.com/chenghuama/sf/blob/master/LICENSE @authors chenghuama(chenghuama@vip.qq.com) @team yl10/忆零
@description 顺丰接口的sdk封装 @link https://github.com/chenghuama/sf @license https://github.com/chenghuama/sf/blob/master/LICENSE @authors chenghuama(chenghuama@vip.qq.com) @team yl10/忆零
@description 顺丰接口的sdk封装 @link https://github.com/chenghuama/sf @license https://github.com/chenghuama/sf/blob/master/LICENSE @authors chenghuama(chenghuama@vip.qq.com) @team yl10/忆零
Index ¶
- Constants
- func CallRoutePush(WaybillRoute *WaybillRoute) interface{}
- func RouteError(msg string) []byte
- type AddedService
- type BackAddedService
- type BackCargo
- type Cargo
- type Order
- type Order1
- type Order1Cargo
- type Order2
- type Order2Cargo
- type OrderBack
- type OrderChange
- type OrderConfirm
- type OrderConfirmOption
- type OrderConfirmResponse
- type OrderExchangeResponse
- type OrderFilter
- type OrderFilterOption
- type OrderFilterResponse
- type OrderResponse
- type OrderReverseResponse
- type OrderSearch
- type OrderSearchResponse
- type Request
- type Response
- type Route
- type RouteRequest
- type RouteResponse
- type SFrequest
- type Sf
- type SoaResponse
- type WaybillRoute
- type WaybillRouteRequest
- type WaybillRouteResponse
Constants ¶
const ( //路由查询方式 ConstTracking_type_Orderno = 1 //按照订单号 ConstTracking_type_mailno = 2 //按照运单号 )
const ( ConstService_OrderService = "OrderService" //下订单 ConstService_OrderConfirmService = "OrderConfirmService" //订单发货确认 ConstService_OrderReverseService = "OrderReverseService" //下退货订单(含筛选) ConstService_OrderExchangeService = "OrderExchangeService" //下换货订单(含筛选) ConstService_OrderSearchService = "OrderSearchService" //订单结果查询 ConstService_OrderFilterService = "OrderFilterService" //订单筛选 ConstService_RouteService = "RouteService" //路由查询 )
Variables ¶
This section is empty.
Functions ¶
func CallRoutePush ¶
func CallRoutePush(WaybillRoute *WaybillRoute) interface{}
func RouteError ¶
Types ¶
type AddedService ¶
type AddedService struct { Name string `xml:"name,attr"` //增值服务名 Value string `xml:"value,attr"` //增值服务值 1 Value1 string `xml:"value1,attr"` //增值服务值 2 Value2 string `xml:"value2,attr"` //增值服务值 3 Value3 string `xml:"value3,attr"` //增值服务值 4 Value4 string `xml:"value4,attr"` //增值服务值 5 }
增值服务
type BackAddedService ¶
type BackAddedService struct { Name string `xml:"name,attr"` //货物名称 // contains filtered or unexported fields }
退单增值
type BackCargo ¶
type BackCargo struct { Name string `xml:"name,attr"` //货物名称 Serl string `xml:"serl,attr"` //商品编号 Count string `xml:"count,attr"` //货物数量 Unit string `xml:"unit,attr"` //货物单位如:个,台,本 Weight string `xml:"weight,attr"` //货物单位重量 Amount string `xml:"amount,attr"` //货物单价 VisualInspection string `xml:"visual_inspection,attr"` //外观,如果商品需要收派员验货则要填写这一项。 CheckRemark string `xml:"check_remark,attr"` //收货备注,如果商品需要收派员验货则要填写这一项。 }
货物信息
type Cargo ¶
type Cargo struct { Name string `xml:"name,attr"` //货物名称 Count string `xml:"count,attr"` //货物数量 Unit string `xml:"unit,attr"` //货物单位 }
货物信息
type Order ¶
type Order struct { XMLName xml.Name `xml:"Order"` Orderid string `xml:"orderid,attr"` ExpressType string `xml:"express_type,attr"` //快件产品类别 JCompany string `xml:"j_company,attr"` //寄件方公司名称 JContact string `xml:"j_contact,attr"` //寄件方联系人 JTel string `xml:"j_tel,attr"` //寄件方联系电话 JMobile string `xml:"j_mobile,attr"` //寄件方手机 JProvince string `xml:"j_province,attr"` //寄件方所在省份字段 JCity string `xml:"j_city,attr"` //寄件方所属城市名称 JAddress string `xml:"j_address,attr"` //寄件方详细地址 DCompany string `xml:"d_company,attr"` //到件方公司名称 DContact string `xml:"d_contact,attr"` //到件方联系人 DTel string `xml:"d_tel,attr"` //到件方联系电话 DMobile string `xml:"d_mobile,attr"` //到件方手机 DAddress string `xml:"d_address,attr"` //到件方详细地址 DProvince string `xml:"d_province,attr"` //到件方所在省份 DCity string `xml:"d_city,attr"` //到件方所属城市 ParcelQuantity string `xml:"parcel_quantity,attr"` //包裹数 PayMethod string `xml:"pay_method,attr"` //付款方式 Custid string `xml:"custid,attr"` //月结卡号 //Template string `xml:"template,attr"` //模板选择 //DCountry string `xml:"d_country,attr"` //到方国家 DCounty string `xml:"d_county,attr"` //到件人所在县/区 //DDeliverycode string `xml:"d_deliverycode,attr"` //到件方代码 //CargoTotalWeight string `xml:"cargo_total_weight,attr"` //订单货物总重量 Sendstarttime string `xml:"sendstarttime,attr"` //要求上门取件开始时间 //Mailno string `xml:"mailno,attr"` //运单号 //ReturnTracking string `xml:"return_tracking,attr"` //签回单单号 Remark string `xml:"remark,attr"` //备注 //NeedReturnTrackingNo string `xml:"need_return_tracking_no,attr"` //是否需要签回单号,1:需要 //IsDocall string `xml:"is_docall,attr"` //是否下 call 1-下 call //IsGenBillNo string `xml:"is_gen_bill_no,attr"` //是否申请运单号 1- 申请运单号 //IsGenEletricPic string `xml:"is_gen_eletric_pic,attr"` //是否生成电子运单图片1- 生成 //WaybillSize string `xml:"waybill_size,attr"` //图片格式:如果需要顺丰系统推送图片,则要传这个值。1:A4 2:A5 //CargoLength string `xml:"cargo_length,attr"` //长 //CargoWidth string `xml:"cargo_width,attr"` //宽 //CargoHeight string `xml:"cargo_height,attr"` //高 Cargo []*Cargo `xml:"Cargo"` //货物信息 AddedService []*AddedService `xml:"AddedService"` //增值服务 }
订单
func (*Order) CallSF ¶
func (order *Order) CallSF() ([]OrderResponse, error)
type Order1 ¶
type Order1 struct { ExpressType string `xml:"express_type,attr"` //快件产品类别1 标准快递2 顺丰特惠 JCompany string `xml:"j_company,attr"` //寄新货方公司名称 JContact string `xml:"j_contact,attr"` //寄新货方联系人 JTel string `xml:"j_tel,attr"` //寄新货方联系电话 JMobile string `xml:"j_mobile,attr"` //手机 JAddress string `xml:"j_address,attr"` //寄新货方详细地址 JPostalCode string `xml:"j_postal_code,attr"` //寄新货方邮编 DCompany string `xml:"d_company,attr"` //换货方公司名称 DContact string `xml:"d_contact,attr"` //换货方联系人 DTel string `xml:"d_tel,attr"` //换货方联系电话 DMobile string `xml:"d_mobile,attr"` //手机 DAddress string `xml:"d_address,attr"` //换货方详细地址 DPostalCode string `xml:"d_postal_code,attr"` //换货方邮编 PayMethod string `xml:"pay_method,attr"` //付款方式:1:寄方付 2:收方付默认为 1 Custid string `xml:"custid,attr"` //寄新货方月结卡号如果此字段不为空,则表示寄新货的运单为月结。 JProvince string `xml:"j_province,attr"` //寄新货方所在省份 JCity string `xml:"j_city,attr"` //寄新货方所属城市名称 JCounty string `xml:"j_county,attr"` //寄新货方所在县/区 JShippercode string `xml:"j_shippercode,attr"` //寄新货方城市区号 DProvince string `xml:"d_province,attr"` //换货方所在省份 DCity string `xml:"d_city,attr"` //换货方所属城市 DCounty string `xml:"d_county,attr"` //换货方所在县/区 DDeliverycode string `xml:"d_deliverycode,attr"` //换货方城市区号 Mailno string `xml:"mailno,attr"` //运单号 Remark string `xml:"remark,attr"` //运单备注 Sendstarttime string `xml:"sendstarttime,attr"` //要求上门取件开始时间 Order1Cargo []*Order1Cargo `xml:"Cargo"` //货物信息 BackAddedService []*BackAddedService `xml:"AddedService"` //增值服务 }
换货订单1
type Order1Cargo ¶
type Order1Cargo struct { Name string `xml:"name,attr"` //货物名称 Count string `xml:"count,attr"` //货物数量 Unit string `xml:"unit,attr"` //货物单位如:个,台,本 Weight string `xml:"weight,attr"` //货物单位重量 Amount string `xml:"amount,attr"` //货物单价 Remark string `xml:"remark,attr"` //收货备注,如果商品需要收派员验货则要填写这一项。 }
货物信息
type Order2 ¶
type Order2 struct { ExpressType string `xml:"express_type,attr"` //快件产品类别,1 标准快递2 顺丰特惠 DCompany string `xml:"d_company,attr"` //收旧货方公司名称 DContact string `xml:"d_contact,attr"` //收旧货方联系人 DTel string `xml:"d_tel,attr"` //收旧货方联系电话 DMobile string `xml:"d_mobile,attr"` //手机 DAddress string `xml:"d_address,attr"` //收旧货方详细地址 DPostalCode string `xml:"d_postal_code,attr"` //收旧货方邮编 PayMethod string `xml:"pay_method,attr"` //付款方式:1:寄方付 2:收方付 Custid string `xml:"custid,attr"` //月结卡号 DProvince string `xml:"d_province,attr"` //收旧货方所在省份 DCity string `xml:"d_city,attr"` //收旧货方所属城市名称 DCounty string `xml:"d_county,attr"` //收旧货方所在县/区 DDeliverycode string `xml:"d_deliverycode,attr"` //收旧货方城市区号 Mailno string `xml:"mailno,attr"` //运单号,如果客户不指定运单号,则由顺丰平台系统生成一个运单号 Remark string `xml:"remark,attr"` //运单备注 Order2Cargo []*Order2Cargo `xml:"Cargo"` //货物信息 BackAddedService []*BackAddedService `xml:"AddedService"` //增值服务 }
换货订单2
type Order2Cargo ¶
type Order2Cargo struct { Name string `xml:"name,attr"` //货物名称 Serl string `xml:"serl,attr"` //商品编号 Count string `xml:"count,attr"` //货物数量 Unit string `xml:"unit,attr"` //货物单位如:个,台,本 Weight string `xml:"weight,attr"` //货物单位重量 Amount string `xml:"amount,attr"` //货物单价 Remark string `xml:"remark,attr"` //收货备注,如果商品需要收派员验货则要填写这一项。 }
货物信息
type OrderBack ¶
type OrderBack struct { Orderid string `xml:"orderid,attr"` //订单号 OrigOrderid string `xml:"orig_orderid,attr"` //原订单号 OrigMailno string `xml:"orig_mailno,attr"` //原运单号 ExpressType string `xml:"express_type,attr"` //快件产品类别(可根据需要定制扩展)1 标准快递2 顺丰特惠 JCompany string `xml:"j_company,attr"` //退货方公司名称 JContact string `xml:"j_contact,attr"` //退货方联系人 JTel string `xml:"j_tel,attr"` //退货方联系电话 JMobile string `xml:"j_mobile,attr"` //手机 JAddress string `xml:"j_address,attr"` //退货方详细地址 JPostalCode string `xml:"j_postal_code,attr"` //退货方邮编 DCompany string `xml:"d_company,attr"` //商家(收货方)公司名称 DContact string `xml:"d_contact,attr"` //商家(收货方)联系人 DTel string `xml:"d_tel,attr"` //商家(收货方)联系电话 DMobile string `xml:"d_mobile,attr"` //手机 DAddress string `xml:"d_address,attr"` //商家(收货方)详细地址 DPostalCode string `xml:"d_postal_code,attr"` //商家(收货方)邮编 ShopName string `xml:"shop_name,attr"` //商家店铺名称 PayMethod string `xml:"pay_method,attr"` //付款方式:1:寄方付 2:收方付 Custid string `xml:"custid,attr"` //月结卡号 JProvince string `xml:"j_province,attr"` //退货方所在省份 JCity string `xml:"j_city,attr"` //退货方所属城市名称 JCounty string `xml:"j_county,attr"` //退货方所在县/区 JShippercode string `xml:"j_shippercode,attr"` //退货方城市区号 DProvince string `xml:"d_province,attr"` //商家(收货方)所在省份 DCity string `xml:"d_city,attr"` //商家(收货方)所属城市名称 DCounty string `xml:"d_county,attr"` //商家(收货方)所在县/区 DDeliverycode string `xml:"d_deliverycode,attr"` //商家(收货方)城市区号 Mailno string `xml:"mailno,attr"` //运单号,如果客户不指定运单号,则由顺丰平台系统生成一个运单号 Remark string `xml:"remark,attr"` //运单备注 Template string `xml:"template,attr"` //模板选择 Sendstarttime string `xml:"sendstarttime,attr"` //要求上门取件开始时间 BackCargo []*BackCargo `xml:"Cargo"` //货物信息 }
退货订单
func (*OrderBack) CallSF ¶
func (OrderBack *OrderBack) CallSF() ([]OrderReverseResponse, error)
type OrderChange ¶
type OrderChange struct { Orderid string `xml:"orderid,attr"` //订单号 OrigOrderid string `xml:"orig_orderid,attr"` //原订单号 OrigMailno string `xml:"orig_mailno,attr"` //原运单号 Template string `xml:"template,attr"` //模板选择 Order1 *Order1 `xml:"Order1"` //订单信息 Order2 *Order2 `xml:"Order2"` //订单信息 }
换货定单
func (*OrderChange) CallSF ¶
func (OrderChange *OrderChange) CallSF() ([]OrderExchangeResponse, error)
type OrderConfirm ¶
type OrderConfirm struct { XMLName xml.Name `xml:"OrderConfirm"` Orderid string `xml:"orderid,attr"` //订单号 Mailno string `xml:"mailno,attr"` //运单号(如果 dealtype=2,可选) Dealtype string `xml:"dealtype,attr"` //订单操作标识:1-订单确认 2-消单 OrderConfirmOption *OrderConfirmOption `xml:"OrderConfirmOption"` //快件信息 }
订单
func (*OrderConfirm) CallSF ¶
func (OrderConfirm *OrderConfirm) CallSF() ([]OrderConfirmResponse, error)
type OrderConfirmOption ¶
type OrderConfirmOption struct {
Weight string `xml:"weight,attr"` //订单重量,单位 KG
}
快件信息
type OrderConfirmResponse ¶
type OrderConfirmResponse struct { XMLName xml.Name `xml:"OrderConfirmResponse"` Orderid string `xml:"orderid,attr"` //订单号 Mailno string `xml:"mailno,attr"` //运单号,可多个单号,如子母件,以逗号分隔 ResStatus string `xml:"res_status,attr"` //备注1 订单号与运单不匹配2 成功 }
返回值
type OrderExchangeResponse ¶
type OrderExchangeResponse struct { Orderid string `xml:"orderid,attr"` //订单号 Mailno1 string `xml:"mailno1,attr"` //发新货的运单号 Mailno2 string `xml:"mailno2,attr"` //发旧货的运单号 Origincode string `xml:"origincode,attr"` //发新货的原寄地代码 Destcode string `xml:"destcode,attr"` //新货的目的地代码 Destcode2 string `xml:"destcode2,attr"` //旧货的目的地代码 FilterResult string `xml:"filter_result,attr"` //筛单结果:1-人工确认,2-可收派 3-不可以收派 Remark string `xml:"remark,attr"` // 1-换货方超范围,2-商家超范围,3-其他原因 }
返回值
type OrderFilter ¶
type OrderFilter struct { XMLName xml.Name `xml:"OrderFilter"` FilterType string `xml:"filter_type,attr"` //筛单类别:1-自动筛单(系统根据地址库进行判断,并返回结果),2-可人工筛单(系统首先根据地址库判断,如果无法自动判断是否收派,系统将生成需要人工判断的任务,后续由人工处理,处理结束后,顺丰可主动推送给客户系统 Orderid string `xml:"orderid,attr"` //客户订单号。如果filter_type=2,则必须提供 DAddress string `xml:"d_address,attr"` //到件方详细地址 OrderFilterOption []*OrderFilterOption `xml:"OrderFilterOption"` //订单筛选选项 }
订单筛选
func (*OrderFilter) CallSF ¶
func (OrderFilter *OrderFilter) CallSF() ([]OrderFilterResponse, error)
type OrderFilterOption ¶
type OrderFilterOption struct { JTel string `xml:"j_tel,attr"` //寄件方电话 Country string `xml:"country,attr"` //寄件人所在国家 Province string `xml:"province,attr"` //寄件人所在省份 City string `xml:"city,attr"` //寄件方所属城市名称 County string `xml:"county,attr"` //寄件人所在县/区 DCountry string `xml:"d_country,attr"` //到件方国家 DProvince string `xml:"d_province,attr"` //到件方所在省份 DCity string `xml:"d_city,attr"` //到件方所属城市名称 DCounty string `xml:"d_county,attr"` //到件方所在县/区 JAddress string `xml:"j_address,attr"` //寄件方详细地址 DTel string `xml:"d_tel,attr"` //到件方电话 JCustid string `xml:"j_custid,attr"` //寄方客户编码 }
订单筛选选项
type OrderFilterResponse ¶
type OrderFilterResponse struct { XMLName xml.Name `xml:"OrderFilterResponse"` Orderid string `xml:"orderid,attr"` //订单号 FilterResult string `xml:"filter_result,attr"` //筛单结果:1- 人工确认,2- 可收派3-不可以收派 Origincode string `xml:"origincode,attr"` //原寄地代码 Destcode string `xml:"destcode,attr"` //目的地代码,如果可收派,此项不能为空 Remark string `xml:"remark,attr"` //1-收方超范围,2-派方超范围,3-其他原因 }
返回值
type OrderResponse ¶
type OrderResponse struct { XMLName xml.Name `xml:"OrderResponse"` Orderid string `xml:"orderid,attr"` //订单号 Mailno string `xml:"mailno,attr"` //运单号,可多个单号,如子母件,以逗号分隔 ReturnTrackingNo string `xml:"return_tracking_no,attr"` //签单返还运单号 AgentMailno string `xml:"agent_mailno,attr"` //代理运单号,可多个单号,如子母件,以逗号分隔 Origincode string `xml:"origincode,attr"` //原寄地代码 Destcode string `xml:"destcode,attr"` //目的地代码 FilterResult string `xml:"filter_result,attr"` //单结果:1-人工确认,2-可收派 3-不可以收派 Remark string `xml:"remark,attr"` //1-收方超范围,2-派方超范围,3-其他原因 }
返回值
type OrderReverseResponse ¶
type OrderReverseResponse struct { Orderid string `xml:"orderid,attr"` //订单号 Mailno string `xml:"mailno,attr"` //运单号,可多个单号,如子母件,以逗号分隔 FilterResult string `xml:"filter_result,attr"` //筛单结果:1-人工确认,2-可收派 3-不可以收派 Remark string `xml:"remark,attr"` //1-退货方超范围,2-商家超范围,3-其他原因 }
返回值
type OrderSearch ¶
type OrderSearch struct { XMLName xml.Name `xml:"OrderSearch"` Orderid string `xml:"orderid,attr"` //客户订单号。 }
功能描述 此接口用于查询下订单(含筛选)接口的订单情况——注:因 Internet 环境下,网络不是 绝对可靠,用户系统下订单到顺丰后,不一定可以收到顺丰返回的数据,此接口用于在未收到返 回数据时,查询订单当前的情况。 订单结果查询
func (*OrderSearch) CallSF ¶
func (OrderSearch *OrderSearch) CallSF() ([]OrderSearchResponse, error)
type OrderSearchResponse ¶
type OrderSearchResponse struct { XMLName xml.Name `xml:"OrderResponse"` Orderid string `xml:"orderid,attr"` //订单号 Mailno string `xml:"mailno"` FilterResult string `xml:"filter_result,attr"` //筛单结果:1- 人工确认,2- 可收派3-不可以收派 Origincode string `xml:"origincode,attr"` //原寄地代码 Destcode string `xml:"destcode,attr"` //目的地代码,如果可收派,此项不能为空 Remark string `xml:"remark,attr"` //1-收方超范围,2-派方超范围,3-其他原因 }
返回值
type Request ¶
type Response ¶
type Response struct { XMLName xml.Name `xml:"Response"` Service string `xml:"service,attr"` Head string `xml:"Head"` Body struct { XMLName xml.Name `xml:Body` Bodydata interface{} `xml:"Body"` } ERROR struct { Code string `xml:"code,attr"` } `xml:"ERROR"` }
正常返回类型
type Route ¶
type Route struct { AcceptTime string `xml:"accept_time,attr"` //路由发生的时间 AcceptAddress string `xml:"accept_address,attr"` //路由发生的地点 Remark string `xml:"remark,attr"` //具体描述 Opcode string `xml:"opcode,attr"` //操作码 }
返回值
type RouteRequest ¶
type RouteRequest struct { XMLName xml.Name `xml:"RouteRequest"` TrackingType int64 `xml:"tracking_type,attr"` //查询类别, tracking_type 字段说明:1-根据运单号查询,order节点中 track_number 将被当作运单号处理,2-根据订单号查询,order 节点中 track_number 将被当作订单号处理-自动筛单(系统根据地址库进行判断,并返回结果),2-可人工筛单(系统首先根据地址库判断,如果无法自动判断是否收派,系统将生成需要人工判断的任务,后续由人工处理,处理结束后,顺丰可主动推送给客户系统 TrackingNumber string `xml:"tracking_number,attr"` //查询号, 如果tracking_type=1,则此值为运单号。如果 tracking_type=2,则此值为订单号如果有多个单号,以逗号分隔 MethodType string `xml:"method_type,attr"` //查询方法选择1-标准查询2-定制查询 }
路由查询
func (*RouteRequest) CallSF ¶
func (RouteRequest *RouteRequest) CallSF() ([]RouteResponse, error)
type RouteResponse ¶
type RouteResponse struct { XMLName xml.Name `xml:"RouteResponse"` Orderid string `xml:"orderid,attr"` //订单号 Mailno string `xml:"mailno,attr"` //运单号 Route []*Route `xml:"Route"` //路由 }
返回值
type SoaResponse ¶
type WaybillRoute ¶
type WaybillRoute struct { Id string `xml:"id,attr"` //路由编号,每一个 id 代表一条不同的路由 Mailno string `xml:"mailno,attr"` //运单号 Orderid string `xml:"orderid,attr"` //订单号 AcceptTime string `xml:"acceptTime,attr"` //路由产生时间 AcceptAddress string `xml:"acceptAddress,attr"` //路由发生城市 Remark string `xml:"remark,attr"` //路由说明 OpCode string `xml:"opCode,attr"` //操作码 }
路由推送
type WaybillRouteRequest ¶
type WaybillRouteRequest struct { Service string `xml:"service,attr"` Lang string `xml:"lang,attr"` Routes []WaybillRoute `xml:"Body>WaybillRoute"` }
type WaybillRouteResponse ¶
type WaybillRouteResponse struct { Id string `xml:"id,attr"` //成功接收的路由编号,如果有多个路由编 号 , 以 逗 号 分 隔 IdError string `xml:"id_error,attr"` //未成功接收的路由编号,如果有多个路由 编 号 , 以 逗 号 分 隔 }
返回值