File tree Expand file tree Collapse file tree 4 files changed +59
-2
lines changed
weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp Expand file tree Collapse file tree 4 files changed +59
-2
lines changed Original file line number Diff line number Diff line change 1
1
package cn .binarywang .wx .miniapp .api ;
2
2
3
3
import cn .binarywang .wx .miniapp .bean .shop .request .WxMaShopPayCreateOrderRequest ;
4
+ import cn .binarywang .wx .miniapp .bean .shop .request .WxMaShopPayOrderRefundRequest ;
5
+ import cn .binarywang .wx .miniapp .bean .shop .response .WxMaShopBaseResponse ;
4
6
import cn .binarywang .wx .miniapp .bean .shop .response .WxMaShopPayCreateOrderResponse ;
5
7
import cn .binarywang .wx .miniapp .bean .shop .response .WxMaShopPayGetOrderResponse ;
6
8
import me .chanjar .weixin .common .error .WxErrorException ;
@@ -31,4 +33,14 @@ public interface WxMaShopPayService {
31
33
* @throws WxErrorException
32
34
*/
33
35
WxMaShopPayGetOrderResponse getOrder (String trade_no ) throws WxErrorException ;
36
+
37
+ /**
38
+ * 订单退款
39
+ * 文档地址:<a href="https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/business-capabilities/ministore/wxafunds/API/order/refunds_order.html">文档地址</a>
40
+ *
41
+ * @param request
42
+ * @return
43
+ * @throws WxErrorException
44
+ */
45
+ WxMaShopBaseResponse refundOrder (WxMaShopPayOrderRefundRequest request ) throws WxErrorException ;
34
46
}
Original file line number Diff line number Diff line change 3
3
import cn .binarywang .wx .miniapp .api .WxMaService ;
4
4
import cn .binarywang .wx .miniapp .api .WxMaShopPayService ;
5
5
import cn .binarywang .wx .miniapp .bean .shop .request .WxMaShopPayCreateOrderRequest ;
6
+ import cn .binarywang .wx .miniapp .bean .shop .request .WxMaShopPayOrderRefundRequest ;
7
+ import cn .binarywang .wx .miniapp .bean .shop .response .WxMaShopBaseResponse ;
6
8
import cn .binarywang .wx .miniapp .bean .shop .response .WxMaShopPayCreateOrderResponse ;
7
9
import cn .binarywang .wx .miniapp .bean .shop .response .WxMaShopPayGetOrderResponse ;
8
10
import lombok .RequiredArgsConstructor ;
9
11
import lombok .extern .slf4j .Slf4j ;
10
12
import me .chanjar .weixin .common .error .WxErrorException ;
11
13
import me .chanjar .weixin .common .util .json .WxGsonBuilder ;
12
14
13
- import static cn .binarywang .wx .miniapp .constant .WxMaApiUrlConstants .Shop .Pay .CREATE_ORDER ;
14
- import static cn .binarywang .wx .miniapp .constant .WxMaApiUrlConstants .Shop .Pay .GET_ORDER ;
15
+ import static cn .binarywang .wx .miniapp .constant .WxMaApiUrlConstants .Shop .Pay .*;
15
16
16
17
/**
17
18
* 小程序支付管理订单相关接口
@@ -34,4 +35,10 @@ public WxMaShopPayGetOrderResponse getOrder(String tradeNo) throws WxErrorExcept
34
35
String response = this .wxMaService .post (GET_ORDER , tradeNo );
35
36
return WxGsonBuilder .create ().fromJson (response , WxMaShopPayGetOrderResponse .class );
36
37
}
38
+
39
+ @ Override
40
+ public WxMaShopBaseResponse refundOrder (WxMaShopPayOrderRefundRequest request ) throws WxErrorException {
41
+ String response = this .wxMaService .post (REFUND_ORDER , request );
42
+ return WxGsonBuilder .create ().fromJson (response , WxMaShopBaseResponse .class );
43
+ }
37
44
}
Original file line number Diff line number Diff line change
1
+ package cn .binarywang .wx .miniapp .bean .shop .request ;
2
+
3
+ import com .google .gson .annotations .SerializedName ;
4
+ import lombok .AllArgsConstructor ;
5
+ import lombok .Builder ;
6
+ import lombok .Data ;
7
+ import lombok .NoArgsConstructor ;
8
+
9
+ import java .io .Serializable ;
10
+
11
+ /**
12
+ * @author liming1019
13
+ * created on 2022/8/31
14
+ */
15
+ @ Data
16
+ @ Builder
17
+ @ NoArgsConstructor
18
+ @ AllArgsConstructor
19
+ public class WxMaShopPayOrderRefundRequest implements Serializable {
20
+ private static final long serialVersionUID = -5850024411710741165L ;
21
+
22
+ @ SerializedName ("openid" )
23
+ private String openid ;
24
+ @ SerializedName ("mchid" )
25
+ private String mchid ;
26
+ @ SerializedName ("trade_no" )
27
+ private String tradeNo ;
28
+ @ SerializedName ("transaction_id" )
29
+ private String transactionId ;
30
+ @ SerializedName ("refund_no" )
31
+ private String refundNo ;
32
+ @ SerializedName ("total_amount" )
33
+ private int totalAmount ;
34
+ @ SerializedName ("refund_amount" )
35
+ private int refundAmount ;
36
+ }
37
+
Original file line number Diff line number Diff line change @@ -542,6 +542,7 @@ interface Coupon {
542
542
interface Pay {
543
543
String CREATE_ORDER = "https://api.weixin.qq.com/shop/pay/createorder" ;
544
544
String GET_ORDER = "https://api.weixin.qq.com/shop/pay/getorder" ;
545
+ String REFUND_ORDER = "https://api.weixin.qq.com/shop/pay/refundorder" ;
545
546
}
546
547
}
547
548
You can’t perform that action at this time.
0 commit comments