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
package dwd
import (
"context"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
//售后
type refundDwd struct {
}
var Refund = refundDwd{}
type RefundApplyReq struct {
OrderID int64 `json:"order_id"`
Money int64 `json:"refund_money"`
Pics string `json:"pics,omitempty"`
ReasonID int `json:"reason_id"`
ReasonDesc string `json:"refund_reason_detail"`
}
type RefundApplyRes struct {
Errno int `json:"errno"`
Errmsg string `json:"errmsg"`
Data *RefundApplyData `json:"data"`
RequestId string `json:"request_id"`
Timestamp int `json:"timestamp"`
Signature string `json:"signature"`
}
type RefundApplyData struct {
BatchNo string `json:"batch_no"`
OrderId int64 `json:"order_id"`
RefundOrderId int64 `json:"refund_order_id"`
}
//Apply 申请退款
func (*refundDwd) Apply(ctx context.Context, req RefundApplyReq) (res *RefundApplyRes, err error) {
var method = "refund.apply"
result, err := post(ctx, method, req)
if err != nil {
return
}
res = &RefundApplyRes{
Errno: result.Errno,
Errmsg: result.Errmsg,
RequestId: result.RequestId,
Timestamp: result.Timestamp,
Signature: result.Signature,
}
_ = gjson.New(result.Data).Scan(&res.Data)
return
}
type RefundArbitrateReq struct {
OrderId string `json:"order_id"`
RefundOrderId int64 `json:"refund_order_id"`
}
type RefundArbitrateRes struct {
Errno int `json:"errno"`
Errmsg string `json:"errmsg"`
Data *RefundArbitrateData `json:"data"`
RequestId string `json:"request_id"`
Timestamp int `json:"timestamp"`
Signature string `json:"signature"`
}
type RefundArbitrateData struct {
BatchNo string `json:"batch_no"`
OrderId int `json:"order_id"`
RefundOrderId int `json:"refund_order_id"`
}
//Arbitrate 申述
func (*refundDwd) Arbitrate(ctx context.Context, req RefundArbitrateReq) (res *RefundArbitrateRes, err error) {
var method = "refund.arbitrate"
result, err := post(ctx, method, req)
if err != nil {
return
}
res = &RefundArbitrateRes{
Errno: result.Errno,
Errmsg: result.Errmsg,
RequestId: result.RequestId,
Timestamp: result.Timestamp,
Signature: result.Signature,
}
_ = gjson.New(result.Data).Scan(&res.Data)
return
}
type RefundDetailRes struct {
Errno int `json:"errno"`
Errmsg string `json:"errmsg"`
Data *RefundDetailData `json:"data"`
RequestId string `json:"request_id"`
Timestamp int `json:"timestamp"`
Signature string `json:"signature"`
}
type RefundDetailData struct {
BatchNo string `json:"batch_no"`
OrderId int64 `json:"order_id"`
RefundOrderId int `json:"refund_order_id"`
RefundStatus int `json:"refund_status"`
Type int `json:"type"`
Address string `json:"address"`
Remarks string `json:"remarks"`
RefundMoney int `json:"refund_money"`
AuditStatus int `json:"audit_status"`
AuditTime int `json:"audit_time"`
}
//Detail 详情
func (*refundDwd) Detail(ctx context.Context, OrderID interface{}) (res *RefundDetailRes, err error) {
var method = "refund.info"
result, err := post(ctx, method, g.Map{
"order_id": gconv.Int64(OrderID),
})
if err != nil {
return
}
res = &RefundDetailRes{
Errno: result.Errno,
Errmsg: result.Errmsg,
RequestId: result.RequestId,
Timestamp: result.Timestamp,
Signature: result.Signature,
}
_ = gjson.New(result.Data).Scan(&res.Data)
return
}