- 京东售后单填充所有信息
This commit is contained in:
@@ -33,6 +33,12 @@ const (
|
||||
PrinterStatusOnlineAbnormal = 3
|
||||
)
|
||||
|
||||
const (
|
||||
AfsApproveTypeRefund = 1 // 退款
|
||||
AfsApproveTypeReturnGoods = 2 // 退货
|
||||
AfsApproveTypeRefused = 3 // 驳回
|
||||
)
|
||||
|
||||
const (
|
||||
PrintResultSuccess = 0
|
||||
PrintResultNoPrinter = 1
|
||||
@@ -194,7 +200,7 @@ type IPurchasePlatformHandler interface {
|
||||
|
||||
// 售后
|
||||
// 同意用户退款申请
|
||||
// AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error)
|
||||
// AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.GoodsOrder, approveType int, reason string) (err error)
|
||||
// // 发起全款退款
|
||||
// RefundOrder(ctx *jxcontext.Context, order *model.GoodsOrder, reason string) (err error)
|
||||
// // 发起部分退款
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils"
|
||||
"git.rosy.net.cn/jx-callback/business/model"
|
||||
"git.rosy.net.cn/jx-callback/business/partner"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"git.rosy.net.cn/jx-callback/globals/api"
|
||||
)
|
||||
|
||||
@@ -31,6 +32,25 @@ var (
|
||||
jdapi.AfsServiceStateDirectCompensateFailed: model.AfsOrderStatusFailed,
|
||||
jdapi.AfsServiceStateReturnGoodsFailed: model.AfsOrderStatusFailed,
|
||||
}
|
||||
|
||||
afsReasonTypeMap = map[int]int8{
|
||||
jdapi.AfsReasonTypeGoodsQuality: model.AfsReasonTypeGoodsQuality,
|
||||
jdapi.AfsReasonTypeWrongGoods: model.AfsReasonTypeWrongGoods,
|
||||
jdapi.AfsReasonTypeMissingGoods: model.AfsReasonTypeMissingGoods,
|
||||
jdapi.AfsReasonTypeNoGoods: model.AfsReasonTypeNoGoods,
|
||||
jdapi.AfsReasonTypeDamagedGoods: model.AfsReasonTypeDamagedGoods,
|
||||
jdapi.AfsReasonTypeGoodsQuantity: model.AfsReasonTypeGoodsQuantity,
|
||||
jdapi.AfsReasonTypeAgreedByMerchant: model.AfsReasonTypeAgreedByMerchant,
|
||||
jdapi.AfsReasonTypeGoodsSizeNoSame: model.AfsReasonTypeGoodsNoSame,
|
||||
jdapi.AfsReasonTypeGoodsColorNoSame: model.AfsReasonTypeGoodsNoSame,
|
||||
jdapi.AfsReasonWrongPurchase: model.AfsReasonWrongPurchase,
|
||||
jdapi.AfsReasonNotReceivedIntime: model.AfsReasonNotReceivedIntime,
|
||||
}
|
||||
afsAppealTypeMap = map[string]int8{
|
||||
jdapi.AfsDealTypeRefund: model.AfsAppealTypeRefund,
|
||||
jdapi.AfsDealTypeReturnGoodsRefund: model.AfsAppealTypeReturnAndRefund,
|
||||
jdapi.AfsDealTypeDirectCompensate: model.AfsAppealTypeNewGoods,
|
||||
}
|
||||
)
|
||||
|
||||
func (c *PurchaseHandler) OnAfsOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
|
||||
@@ -78,6 +98,20 @@ func (c *PurchaseHandler) GetAfsStatusFromVendorStatus(vendorStatus string) int
|
||||
return model.OrderStatusUnknown
|
||||
}
|
||||
|
||||
func (c *PurchaseHandler) convertAfsReasonType(vendorReasonType int) int8 {
|
||||
if status, ok := afsReasonTypeMap[vendorReasonType]; ok {
|
||||
return status
|
||||
}
|
||||
return model.AfsReasonNotOthers
|
||||
}
|
||||
func (c *PurchaseHandler) convertAfsAppealType(vendorAppealType string) int8 {
|
||||
if status, ok := afsAppealTypeMap[vendorAppealType]; ok {
|
||||
return status
|
||||
}
|
||||
globals.SugarLogger.Warnf("jd convertAfsAppealType unknown vendorAppealType:%d", vendorAppealType)
|
||||
return 0
|
||||
}
|
||||
|
||||
func (p *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsOrder *model.AfsOrder) {
|
||||
afsOrder = &model.AfsOrder{
|
||||
VendorID: model.VendorIDJD,
|
||||
@@ -91,6 +125,13 @@ func (p *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsO
|
||||
BoxMoney: afsInfo.PackagingMoney,
|
||||
TongchengFreightMoney: afsInfo.TongchengFreightMoney,
|
||||
SkuBoxMoney: afsInfo.MealBoxMoney,
|
||||
|
||||
VendorReasonType: utils.Int2Str(afsInfo.QuestionTypeCid),
|
||||
ReasonType: p.convertAfsReasonType(afsInfo.QuestionTypeCid),
|
||||
ReasonDesc: utils.LimitUTF8StringLen(afsInfo.QuestionDesc, 1024),
|
||||
ReasonImgList: utils.LimitUTF8StringLen(afsInfo.QuestionPic, 1024),
|
||||
VendorAppealType: afsInfo.ApplyDeal,
|
||||
AppealType: p.convertAfsAppealType(afsInfo.ApplyDeal),
|
||||
}
|
||||
for _, x := range afsInfo.AfsDetailList {
|
||||
orderSku := &model.OrderSkuFinancial{
|
||||
|
||||
Reference in New Issue
Block a user