- AgreeOrRefuseRefund

- ConfirmReceivedReturnGoods
This commit is contained in:
gazebo
2019-05-10 11:01:50 +08:00
parent 2a1fdba715
commit 5e2e4acfbd
10 changed files with 175 additions and 15 deletions

View File

@@ -4,6 +4,7 @@ import (
"git.rosy.net.cn/baseapi/platformapi/jdapi"
"git.rosy.net.cn/baseapi/utils"
"git.rosy.net.cn/jx-callback/business/jxutils"
"git.rosy.net.cn/jx-callback/business/jxutils/jxcontext"
"git.rosy.net.cn/jx-callback/business/model"
"git.rosy.net.cn/jx-callback/business/partner"
"git.rosy.net.cn/jx-callback/globals"
@@ -51,6 +52,11 @@ var (
jdapi.AfsDealTypeReturnGoodsRefund: model.AfsAppealTypeReturnAndRefund,
jdapi.AfsDealTypeDirectCompensate: model.AfsAppealTypeNewGoods,
}
afsApproveTypeMap = map[int]int{
partner.AfsApproveTypeRefund: jdapi.AfsApproveTypeRefund,
partner.AfsApproveTypeReturnGoods: jdapi.AfsApproveTypeReturnGoods,
partner.AfsApproveTypeRefused: jdapi.AfsApproveTypeRefused,
}
)
func (c *PurchaseHandler) OnAfsOrderMsg(msg *jdapi.CallbackOrderMsg) (retVal *jdapi.CallbackResponse) {
@@ -104,6 +110,7 @@ func (c *PurchaseHandler) convertAfsReasonType(vendorReasonType int) int8 {
}
return model.AfsReasonNotOthers
}
func (c *PurchaseHandler) convertAfsAppealType(vendorAppealType string) int8 {
if status, ok := afsAppealTypeMap[vendorAppealType]; ok {
return status
@@ -112,7 +119,7 @@ func (c *PurchaseHandler) convertAfsAppealType(vendorAppealType string) int8 {
return 0
}
func (p *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsOrder *model.AfsOrder) {
func (c *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsOrder *model.AfsOrder) {
afsOrder = &model.AfsOrder{
VendorID: model.VendorIDJD,
AfsOrderID: afsInfo.AfsServiceOrder,
@@ -127,11 +134,11 @@ func (p *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsO
SkuBoxMoney: afsInfo.MealBoxMoney,
VendorReasonType: utils.Int2Str(afsInfo.QuestionTypeCid),
ReasonType: p.convertAfsReasonType(afsInfo.QuestionTypeCid),
ReasonType: c.convertAfsReasonType(afsInfo.QuestionTypeCid),
ReasonDesc: utils.LimitUTF8StringLen(afsInfo.QuestionDesc, 1024),
ReasonImgList: utils.LimitUTF8StringLen(afsInfo.QuestionPic, 1024),
VendorAppealType: afsInfo.ApplyDeal,
AppealType: p.convertAfsAppealType(afsInfo.ApplyDeal),
AppealType: c.convertAfsAppealType(afsInfo.ApplyDeal),
}
for _, x := range afsInfo.AfsDetailList {
orderSku := &model.OrderSkuFinancial{
@@ -161,3 +168,19 @@ func (p *PurchaseHandler) buildAfsOrder(afsInfo *jdapi.AfsServiceResponse) (afsO
}
return afsOrder
}
// 审核售后单申请
func (c *PurchaseHandler) AgreeOrRefuseRefund(ctx *jxcontext.Context, order *model.AfsOrder, approveType int, reason string) (err error) {
if globals.EnableJdStoreWrite {
err = api.JdAPI.AfsOpenApprove(order.AfsOrderID, afsApproveTypeMap[approveType], reason, ctx.GetUserName())
}
return err
}
// 确认收到退货
func (c *PurchaseHandler) ConfirmReceivedReturnGoods(ctx *jxcontext.Context, order *model.AfsOrder) (err error) {
if globals.EnableJdStoreWrite {
err = api.JdAPI.ConfirmReceipt(order.AfsOrderID, ctx.GetUserName())
}
return err
}