UpdateOrderWaybillTip

This commit is contained in:
gazebo
2019-12-26 14:18:16 +08:00
parent 9559fc6420
commit deadc8f563
10 changed files with 151 additions and 1 deletions

View File

@@ -660,3 +660,23 @@ func (c *PurchaseHandler) ListOrders(ctx *jxcontext.Context, vendorOrgCode strin
}
return vendorOrderIDs, err
}
func (c *PurchaseHandler) GetWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorOrderID, vendorWaybillID, vendorWaybillID2 string) (tipFee int64, err error) {
orderInfo, err := api.EbaiAPI.GetStoreOrderInfo(vendorOrderID)
if err == nil {
if orderBasic, _ := orderInfo["order_basic"].(map[string]interface{}); orderBasic != nil {
tipFee = jxutils.StandardPrice2Int(utils.Interface2Float64WithDefault(orderBasic["delivery_tip_amount"], 0))
}
}
return tipFee, err
}
func (c *PurchaseHandler) AddWaybillTip(ctx *jxcontext.Context, vendorOrgCode, vendorOrderID, vendorWaybillID, vendorWaybillID2, cityCode string, tipFee2Add int64) (err error) {
tipFee, err := c.GetWaybillTip(ctx, vendorOrgCode, vendorOrderID, vendorWaybillID, vendorWaybillID2)
if err == nil {
if globals.EnableEbaiStoreWrite {
err = api.EbaiAPI.ModifyTip4OrderWaybill(vendorOrderID, "", jxutils.IntPrice2Standard(tipFee), 0)
}
}
return err
}