1+ package com .github .binarywang .wxpay .bean .request ;
2+
3+ import com .github .binarywang .wxpay .exception .WxPayException ;
4+ import com .thoughtworks .xstream .annotations .XStreamAlias ;
5+ import lombok .*;
6+ import me .chanjar .weixin .common .annotation .Required ;
7+
8+ import java .util .Map ;
9+
10+ /**
11+ * <pre>
12+ * 押金退款请求
13+ * 详见:<a href="https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_7&index=6">https://pay.weixin.qq.com/wiki/doc/api/deposit_sl.php?chapter=27_7&index=6</a>
14+ * </pre>
15+ *
16+ * @author Binary Wang
17+ * created on 2024-09-24
18+ */
19+ @ Data
20+ @ EqualsAndHashCode (callSuper = true )
21+ @ Builder (builderMethodName = "newBuilder" )
22+ @ NoArgsConstructor
23+ @ AllArgsConstructor
24+ @ XStreamAlias ("xml" )
25+ public class WxDepositRefundRequest extends BaseWxPayRequest {
26+
27+ /**
28+ * <pre>
29+ * 微信押金订单号
30+ * transaction_id
31+ * 否
32+ * String(32)
33+ * 1009660380201506130728806387
34+ * 微信押金订单号,与out_trade_no二选一
35+ * </pre>
36+ */
37+ @ XStreamAlias ("transaction_id" )
38+ private String transactionId ;
39+
40+ /**
41+ * <pre>
42+ * 商户押金订单号
43+ * out_trade_no
44+ * 否
45+ * String(32)
46+ * 20150806125346
47+ * 商户系统内部的押金订单号,与transaction_id二选一
48+ * </pre>
49+ */
50+ @ XStreamAlias ("out_trade_no" )
51+ private String outTradeNo ;
52+
53+ /**
54+ * <pre>
55+ * 商户退款单号
56+ * out_refund_no
57+ * 是
58+ * String(32)
59+ * 1217752501201407033233368018
60+ * 商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔
61+ * </pre>
62+ */
63+ @ Required
64+ @ XStreamAlias ("out_refund_no" )
65+ private String outRefundNo ;
66+
67+ /**
68+ * <pre>
69+ * 退款金额
70+ * refund_fee
71+ * 是
72+ * Int
73+ * 100
74+ * 退款总金额,订单总金额,单位为分,只能为整数
75+ * </pre>
76+ */
77+ @ Required
78+ @ XStreamAlias ("refund_fee" )
79+ private Integer refundFee ;
80+
81+ /**
82+ * <pre>
83+ * 退款原因
84+ * refund_desc
85+ * 否
86+ * String(80)
87+ * 商品已售完
88+ * 若商户传入,会在下发给用户的退款消息中体现退款原因
89+ * </pre>
90+ */
91+ @ XStreamAlias ("refund_desc" )
92+ private String refundDesc ;
93+
94+ @ Override
95+ protected void checkConstraints () throws WxPayException {
96+ if (transactionId == null && outTradeNo == null ) {
97+ throw new WxPayException ("transaction_id 和 out_trade_no 不能同时为空" );
98+ }
99+ }
100+
101+ @ Override
102+ protected void storeMap (Map <String , String > map ) {
103+ if (transactionId != null ) {
104+ map .put ("transaction_id" , transactionId );
105+ }
106+ if (outTradeNo != null ) {
107+ map .put ("out_trade_no" , outTradeNo );
108+ }
109+ map .put ("out_refund_no" , outRefundNo );
110+ map .put ("refund_fee" , refundFee .toString ());
111+ if (refundDesc != null ) {
112+ map .put ("refund_desc" , refundDesc );
113+ }
114+ }
115+ }
0 commit comments