1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
package tm
import (
"context"
"encoding/json"
"github.com/gogf/gf/util/gconv"
)
type refundTm struct {
}
var Refund = refundTm{}
type RefundSubmitReq struct {
UserId string
SubLmOrderId string //子订单号
DisputeId string //售后ID
CpCode string //物流编码
LogisticsNo string //物流单号
}
//Submit 提交退货物流信息接口
func (s *refundTm) Submit(ctx context.Context, req RefundSubmitReq) (res *CommonRes, err error) {
method := "submitReturnGoodLogistics"
request := map[string]string{
"BizUid": server.BizUid,
"SubLmOrderId": req.SubLmOrderId,
"DisputeId": req.DisputeId,
"CpCode": req.CpCode,
"LogisticsNo": req.LogisticsNo,
"ThirdPartyUserId": req.UserId,
"AccountType": typeAnony,
}
result, err := post(ctx, method, request)
_ = json.Unmarshal([]byte(result), &res)
return
}
//Cancel 取消退款申请接口
func (s *refundTm) Cancel(ctx context.Context, UserId, subLmOrderId, disputeId string) (res *CommonRes, err error) {
method := "cancelRefund"
request := map[string]string{
"BizUid": server.BizUid,
"SubLmOrderId": subLmOrderId,
"DisputeId": disputeId,
"ThirdPartyUserId": UserId,
"AccountType": typeAnony,
}
result, err := post(ctx, method, request)
_ = json.Unmarshal([]byte(result), &res)
return
}
type RefundBeforeReq struct {
UserId string
ChannelOrder string
SubLmOrderId string
BizClaimType string
GoodsStatus string
}
type RefundBeforeRes struct {
Code string `json:"Code"`
Message string `json:"Message"`
RequestId string `json:"RequestId"`
InitApplyRefundData struct {
RefundReasonList struct {
RefundReasonList []struct {
ReasonTextId int64 `json:"ReasonTextId"`
ReasonTips string `json:"ReasonTips"`
RefundDescRequired bool `json:"RefundDescRequired"` //是否要求留言
ProofRequired bool `json:"ProofRequired"` //是否要求上传凭证
} `json:"RefundReasonList"`
} `json:"RefundReasonList"`
MaxRefundFeeData struct {
MaxRefundFee int64 `json:"MaxRefundFee"` //本单最大可退款金额
MinRefundFee int64 `json:"MinRefundFee"` //本单最小可退款金额
} `json:"MaxRefundFeeData"`
BizClaimType int `json:"BizClaimType"` // 支持的订单退货方式,1, 标识仅退款,3,标识退货退款
} `json:"InitApplyRefundData"`
}
// Before 前置
func (s *refundTm) Before(ctx context.Context, req RefundBeforeReq) (res *RefundBeforeRes, err error) {
method := "initApplyRefund"
request := map[string]string{
"BizUid": server.BizUid,
"SubLmOrderId": req.SubLmOrderId,
"GoodsStatus": req.GoodsStatus,
"BizClaimType": req.BizClaimType,
"ThirdPartyUserId": req.UserId,
"AccountType": typeAnony,
}
result, err := post(ctx, method, request)
_ = json.Unmarshal([]byte(result), &res)
return
}
type RefundApplyReq struct {
UserId string
SubLmOrderId string //子订单号
BizClaimType string //退款类型
ApplyRefundFee string //申请退款金额
ApplyRefundCount string //退货数量
ApplyReasonTextId string //退款原因ID
LeaveMessage string //留言
LeavePictureList []*RefundApplyPicture //凭证,某些原因要求必须有凭证。
GoodsStatus string //当退款类型:仅退款时,货物状态:为4未 发货。所有状态:4: 未发货, 6: 已发货, 1: 未收到货, 2: 已收到货, 3:已寄回, 5: 卖家确 认收货
}
type RefundApplyPicture struct {
Picture string `json:"Picture"` //图片地址
Desc string `json:"Desc"` //图片描述
}
type RefundApplyRes struct {
Code string `json:"Code"`
Message string `json:"Message"`
RequestId string `json:"RequestId"`
RefundApplicationData struct {
SubLmOrderId string `json:"SubLmOrderId"` //当前发起逆向的子订单号
DisputeStatus int `json:"DisputeStatus"` //逆向的状态
DisputeType int `json:"DisputeType"` //任意退款类型
DisputeId int64 `json:"DisputeId"` //shou
} `json:"RefundApplicationData"`
}
//Apply 申请
func (s *refundTm) Apply(ctx context.Context, req *RefundApplyReq) (res *RefundApplyRes, err error) {
method := "applyRefund"
request := convert("LeavePictureList", gconv.Maps(req.LeavePictureList))
request["SubLmOrderId"] = req.SubLmOrderId
request["BizClaimType"] = req.BizClaimType
request["ApplyRefundFee"] = req.ApplyRefundFee
request["ApplyRefundCount"] = req.ApplyRefundCount
request["ApplyReasonTextId"] = req.ApplyReasonTextId
request["LeaveMessage"] = req.LeaveMessage
request["GoodsStatus"] = req.GoodsStatus
request["BizUid"] = server.BizUid
request["AccountType"] = typeAnony
request["ThirdPartyUserId"] = req.UserId
result, err := post(ctx, method, request)
_ = json.Unmarshal([]byte(result), &res)
return
}
type RefundInfoRes struct {
Code string `json:"Code"`
Message string `json:"Message"`
RequestId string `json:"RequestId"`
RefundApplicationDetail struct {
SubLmOrderId string `json:"SubLmOrderId"` //当前发起逆向的子订单号
RealRefundFee int64 `json:"RealRefundFee"` // 实际买家收到的金额
DisputeCreateTime string `json:"DisputeCreateTime"` //"逆向发起时间"
DisputeDesc string `json:"DisputeDesc"` //申请逆向描述
BizClaimType int `json:"BizClaimType"` // 支持的订单退货方式,1, 标识仅退款,3,标识退货退款
ApplyDisputeDesc string `json:"ApplyDisputeDesc"` //当前买家申请退款说明
DisputeType int `json:"DisputeType"` //逆向发生的类型 0: "任意退款类型" 1: "售中退款"2: "售后退款"
SellerAgreeMsg string `json:"SellerAgreeMsg"` //卖家同意退货说明,真实的退货地址会在这个字段进行返 回。
ApplyReasonText struct { //买家申请的逆向原因
ReasonTextId int64 `json:"ReasonTextId"`
ReasonTips string `json:"ReasonTips"`
} `json:"ApplyReasonText"`
RefundFee int64 `json:"RefundFee"` // 退款金额(含退平台补贴的金额)
SellerRefuseReason string `json:"SellerRefuseReason"` // 卖家拒绝的留言说明
RefunderTel string `json:"RefunderTel"` //退货联系方式,卖家同意退货后才显示
LmOrderId string `json:"LmOrderId"` //对应的主订单号
DisputeEndTime string `json:"DisputeEndTime"` //逆向发起时间
RefunderName string `json:"RefunderName"` //退货收货人,卖家同意退货后才显示
RefunderZipCode string `json:"RefunderZipCode"` //退货地址邮编,卖家同意退货后才显示
RefunderAddress string `json:"RefunderAddress"` //商家退货地址,卖家同意退货后才显示
DisputeStatus int `json:"DisputeStatus"` // 逆向的状态
//1: "买家已经申请退款,等待卖家同意"
//2: "卖家已经同意退款,等待买家退货"
//3: "买家已经退货,等待卖家确认收货"
//4: "退款关闭"
//5: "退款成功"
//6: "卖家拒绝退款"
//7: "等待买家确认重新邮寄的货物"
//8: "等待卖家确认退货地址"
//9: "没有申请退款"
//10: "有活动的退款"
//11: "退款结束"
//12: "卖家确认收货,等待卖家发货"
//14: "换货关闭,转退货退款"
//13: "卖家已发货,等待卖家和买家确认收货"
//15: "邮费单已创建,待激活"
ReturnGoodLogisticsStatus int `json:"ReturnGoodLogisticsStatus"` // 退货物流状态
//0: "未退货"
//1: "等待揽收"
//2: "快件已揽收"
//3: "物流⾛件中"
//4: "派送中"
//5: "已签收"
//6: "签收失败"
SelleAgreementMessage string `json:"SelleAgreementMessage"`
SellerRefuseAgreementMessage string `json:"SellerRefuseAgreementMessage"` //// 卖家拒绝的留言说明
ReturnGoodCount int `json:"ReturnGoodCount"` //退货数量
DisputeId int64 `json:"DisputeId"` //纠纷ID
} `json:"RefundApplicationDetail"`
}
//Info 详情
func (s *refundTm) Info(ctx context.Context, UserId, subLmOrderId string) (res *RefundInfoRes, err error) {
method := "queryRefundApplicationDetail"
request := map[string]string{
"BizUid": server.BizUid,
"SubLmOrderId": subLmOrderId,
"ThirdPartyUserId": UserId,
"AccountType": typeAnony,
}
result, err := post(ctx, method, request)
_ = json.Unmarshal([]byte(result), &res)
return
}