Files
jx-callback/business/q_bida/q_bida_server_utils.go
2022-06-27 15:36:47 +08:00

62 lines
2.0 KiB
Go

package q_bida
import (
"errors"
"fmt"
bida "git.rosy.net.cn/baseapi/platformapi/q_bida"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/globals/api"
)
// 检查快递费是否正确
func checkWayFeeIsTrue(param *model.MakeOrderParamReq) error {
// 检查运费提交是否准确
orderWayFee, err := QueryExpressPrice(&bida.GetExpressPriceReq{
PromiseTimeType: param.PromiseTimeType,
DeliveryType: param.DeliveryType,
GoodsValue: param.GuaranteeValueAmount,
ReceiveAddress: param.ReceiveAddress,
SendAddress: param.SenderAddress,
Type: param.Type,
Weight: param.Weight,
Length: param.Length,
Height: param.Height,
Width: param.Width,
SendPhone: param.SenderPhone,
})
if err != nil {
return err
}
if fee, ok := orderWayFee[fmt.Sprintf("%d", param.Type)]; !ok || fee.Code != 0 || fee.Data.ChannelFee != param.ChannelFee {
return errors.New("价格核算错误,价格不匹配")
}
return nil
}
// 创建QBiDa订单
func createOtherOrder(param *model.MakeOrderParamReq) (string, error) {
// 创建三方订单
return api.QBiDaAPI.CreateOrder(&bida.MakeOrderReq{
PromiseTimeType: param.PromiseTimeType,
DeliveryType: param.DeliveryType,
Goods: param.Goods,
GuaranteeValueAmount: param.GuaranteeValueAmount,
Weight: param.Weight,
Length: param.Length,
Height: param.Height,
Width: param.Width,
OrderSendTime: param.OrderSendTime,
PackageNum: param.PackageNum,
ReceiveAddress: param.ReceiveAddress,
ReceiveName: param.ReceiveName,
ReceivePhone: param.ReceivePhone,
Remark: param.Remark,
SenderAddress: param.SenderAddress,
SenderName: param.SenderName,
SenderPhone: param.SenderPhone,
ThirdPlatform: param.ThirdPlatform,
Type: param.Type,
Img: param.Img,
})
}