修改各种发单是扣款,品牌扣款和门店扣款,品牌充值门店充值

This commit is contained in:
邹宗楠
2023-05-11 10:56:05 +08:00
parent 28f172133b
commit 381447307d
17 changed files with 108 additions and 48 deletions

View File

@@ -109,3 +109,13 @@ func Test(t *testing.T) {
a := int(zero) * 100
fmt.Printf("a====%d", a)
}
func TestGetOrderLiquidatedDamages(t *testing.T) {
deductFee, err := api.GetOrderLiquidatedDamages("23022310041019000003804258", "2304613965000093")
if err != nil {
t.Fatal(err)
} else {
t.Log(deductFee)
}
}

View File

@@ -96,3 +96,34 @@ func (a *API) CancelOrder(orderCode, reason string) error {
return fmt.Errorf("UU跑腿未返回取消运单详情")
}
}
// GetOrderLiquidatedDamages 获取订单的违约金
func (a *API) GetOrderLiquidatedDamages(wayBillOrderID, orderID string) (int64, error) {
preParam := a.MakeUURequestHead()
preParam["order_code"] = wayBillOrderID
preParam["origin_id"] = orderID
resp, err := a.AccessAPI(BaseURL, "gethomeservicefee.ashx", RequestPost, preParam)
if err != nil {
return 0, err
}
var deductFee *LiquidatedDamagesFee
if err := utils.Map2StructByJson(resp, &deductFee, false); err != nil {
return 0, err
}
if deductFee.ReturnCode != "ok" {
return 0, fmt.Errorf(deductFee.ReturnMsg)
}
return utils.Float64TwoInt64(utils.Str2Float64(deductFee.DeductFee) * 100), nil
}
type LiquidatedDamagesFee struct {
DeductFee string `json:"deduct_fee"` // 违约金
NonceStr string `json:"nonce_str"` // 随机字符串不长于32位
Sign string `json:"sign"` // 加密签名,详情见消息体签名算法
Appid string `json:"appid"` // 第三方用户唯一凭证
ReturnMsg string `json:"return_msg"` // 返回信息,如非空,为错误原因,如签名失败、参数格式校验错误
ReturnCode string `json:"return_code"` // 状态ok/fail表示成功
}