Skip to content

Commit acc0833

Browse files
committed
🎨 规范化部分代码格式和命名
1 parent 913aec6 commit acc0833

File tree

4 files changed

+49
-53
lines changed

4 files changed

+49
-53
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/profitsharing/ProfitSharingRequest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ public class ProfitSharingRequest extends BaseWxPayRequest {
7878

7979
@Override
8080
protected void checkConstraints() throws WxPayException {
81-
/**
82-
* 目前仅支持HMAC-SHA256
83-
*/
81+
// 目前仅支持HMAC-SHA256.
8482
this.setSignType(WxPayConstants.SignType.HMAC_SHA256);
8583
}
8684
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/ProfitSharingService.java

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
import com.github.binarywang.wxpay.bean.profitsharing.*;
44
import com.github.binarywang.wxpay.exception.WxPayException;
55

6-
import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingResult;
7-
import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingRequest;
8-
96
/**
107
* 注意:微信最高分账比例为30%
118
* 可多次分账到同一个人,但是依然不能超过30%
@@ -22,11 +19,11 @@ public interface ProfitSharingService {
2219
* 接口链接:https://api.mch.weixin.qq.com/secapi/pay/profitsharing
2320
* </pre>
2421
*
25-
* @param profitsharingRequest
26-
* @return
22+
* @param request .
23+
* @return .
2724
* @throws WxPayException the wx pay exception
2825
*/
29-
ProfitSharingResult profitsharing(ProfitSharingRequest profitsharingRequest) throws WxPayException;
26+
ProfitSharingResult profitSharing(ProfitSharingRequest request) throws WxPayException;
3027

3128
/**
3229
* <pre>
@@ -38,11 +35,11 @@ public interface ProfitSharingService {
3835
* 文档详见: https://pay.weixin.qq.com/wiki/doc/api/allocation_sl.php?chapter=25_6&index=2
3936
* 接口链接:https://api.mch.weixin.qq.com/secapi/pay/multiprofitsharing
4037
*
41-
* @param profitsharingRequest
42-
* @return
38+
* @param request .
39+
* @return .
4340
* @throws WxPayException the wx pay exception
4441
*/
45-
ProfitSharingResult multiprofitsharing(ProfitSharingRequest profitsharingRequest) throws WxPayException;
42+
ProfitSharingResult multiProfitSharing(ProfitSharingRequest request) throws WxPayException;
4643

4744
/**
4845
* <pre>
@@ -54,11 +51,11 @@ public interface ProfitSharingService {
5451
* 接口链接:https://api.mch.weixin.qq.com/secapi/pay/profitsharingfinish
5552
* </pre>
5653
*
57-
* @param profitSharingFinishRequest
58-
* @return
54+
* @param request .
55+
* @return .
5956
* @throws WxPayException the wx pay exception
6057
*/
61-
ProfitSharingResult profitsharingfinish(ProfitSharingFinishRequest profitSharingFinishRequest) throws WxPayException;
58+
ProfitSharingResult profitSharingFinish(ProfitSharingFinishRequest request) throws WxPayException;
6259

6360
/**
6461
* <pre>
@@ -67,11 +64,11 @@ public interface ProfitSharingService {
6764
* 接口链接:https://api.mch.weixin.qq.com/pay/profitsharingaddreceiver
6865
* </pre>
6966
*
70-
* @param profitSharingReceiverRequest
71-
* @return
72-
* @throws WxPayException
67+
* @param request .
68+
* @return .
69+
* @throws WxPayException .
7370
*/
74-
ProfitSharingReceiverResult addReceiver(ProfitSharingReceiverRequest profitSharingReceiverRequest) throws WxPayException;
71+
ProfitSharingReceiverResult addReceiver(ProfitSharingReceiverRequest request) throws WxPayException;
7572

7673
/**
7774
* <pre>
@@ -80,11 +77,11 @@ public interface ProfitSharingService {
8077
* 接口链接:https://api.mch.weixin.qq.com/pay/profitsharingremovereceiver
8178
* </pre>
8279
*
83-
* @param profitSharingReceiverRequest
84-
* @return
85-
* @throws WxPayException
80+
* @param request .
81+
* @return .
82+
* @throws WxPayException .
8683
*/
87-
ProfitSharingReceiverResult removeReceiver(ProfitSharingReceiverRequest profitSharingReceiverRequest) throws WxPayException;
84+
ProfitSharingReceiverResult removeReceiver(ProfitSharingReceiverRequest request) throws WxPayException;
8885

8986
/**
9087
* TODO:微信返回签名失败
@@ -93,11 +90,11 @@ public interface ProfitSharingService {
9390
* 接口频率:80QPS
9491
* </pre>
9592
*
96-
* @param profitSharingReceiverRequest
97-
* @return
98-
* @throws WxPayException
93+
* @param request .
94+
* @return .
95+
* @throws WxPayException .
9996
*/
100-
ProfitSharingQueryResult profitsharingQuery(ProfitSharingQueryRequest profitSharingReceiverRequest) throws WxPayException;
97+
ProfitSharingQueryResult profitSharingQuery(ProfitSharingQueryRequest request) throws WxPayException;
10198

10299
/**
103100
* TODO:这个接口用真实的数据返回【参数不正确】,我对比官方文档除了缺少sub_mch_id,和sub_appid之外其他相同,当我随便填了一个商户id的时候,提示【回退方没有开通分账回退功能】
@@ -111,11 +108,11 @@ public interface ProfitSharingService {
111108
* 接口链接:https://api.mch.weixin.qq.com/secapi/pay/profitsharingreturn
112109
* </pre>
113110
*
114-
* @param profitSharingReturnRequest
115-
* @return
116-
* @throws WxPayException
111+
* @param returnRequest .
112+
* @return .
113+
* @throws WxPayException .
117114
*/
118-
ProfitSharingReturnResult profitsharingReturn(ProfitSharingReturnRequest profitSharingReturnRequest) throws WxPayException;
115+
ProfitSharingReturnResult profitSharingReturn(ProfitSharingReturnRequest returnRequest) throws WxPayException;
119116

120117
/**
121118
* TODO:因profitsharingReturn接口无法使用,没有办法对这里进行真实的测试,模拟数据这里返回【记录不存在】
@@ -127,10 +124,11 @@ public interface ProfitSharingService {
127124
* 接口链接:https://api.mch.weixin.qq.com/pay/profitsharingreturnquery
128125
* </pre>
129126
*
130-
* @param profitSharingReturnQueryRequest
131-
* @return
132-
* @throws WxPayException
127+
* @param queryRequest .
128+
* @return .
129+
* @throws WxPayException .
133130
*/
134-
ProfitSharingReturnResult profitsharingReturnQuery(ProfitSharingReturnQueryRequest profitSharingReturnQueryRequest) throws WxPayException;
131+
ProfitSharingReturnResult profitSharingReturnQuery(ProfitSharingReturnQueryRequest queryRequest)
132+
throws WxPayException;
135133

136134
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/service/impl/ProfitSharingServiceImpl.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public ProfitSharingServiceImpl(WxPayService payService) {
2020
}
2121

2222
@Override
23-
public ProfitSharingResult profitsharing(ProfitSharingRequest request) throws WxPayException {
23+
public ProfitSharingResult profitSharing(ProfitSharingRequest request) throws WxPayException {
2424
request.checkAndSign(this.payService.getConfig());
2525
String url = this.payService.getPayBaseUrl() + "/secapi/pay/profitsharing";
2626

@@ -31,7 +31,7 @@ public ProfitSharingResult profitsharing(ProfitSharingRequest request) throws Wx
3131
}
3232

3333
@Override
34-
public ProfitSharingResult multiprofitsharing(ProfitSharingRequest request) throws WxPayException {
34+
public ProfitSharingResult multiProfitSharing(ProfitSharingRequest request) throws WxPayException {
3535
request.checkAndSign(this.payService.getConfig());
3636
String url = this.payService.getPayBaseUrl() + "/secapi/pay/multiprofitsharing";
3737

@@ -42,7 +42,7 @@ public ProfitSharingResult multiprofitsharing(ProfitSharingRequest request) thro
4242
}
4343

4444
@Override
45-
public ProfitSharingResult profitsharingfinish(ProfitSharingFinishRequest request) throws WxPayException {
45+
public ProfitSharingResult profitSharingFinish(ProfitSharingFinishRequest request) throws WxPayException {
4646
request.checkAndSign(this.payService.getConfig());
4747
String url = this.payService.getPayBaseUrl() + "/secapi/pay/profitsharingfinish";
4848

@@ -75,7 +75,7 @@ public ProfitSharingReceiverResult removeReceiver(ProfitSharingReceiverRequest r
7575
}
7676

7777
@Override
78-
public ProfitSharingQueryResult profitsharingQuery(ProfitSharingQueryRequest request) throws WxPayException {
78+
public ProfitSharingQueryResult profitSharingQuery(ProfitSharingQueryRequest request) throws WxPayException {
7979
if (true) throw new WxPayException("暂不支持,微信一直返回签名失败");
8080
request.checkAndSign(this.payService.getConfig());
8181
String url = this.payService.getPayBaseUrl() + "/pay/profitsharingquery";
@@ -87,24 +87,24 @@ public ProfitSharingQueryResult profitsharingQuery(ProfitSharingQueryRequest req
8787
}
8888

8989
@Override
90-
public ProfitSharingReturnResult profitsharingReturn(ProfitSharingReturnRequest request) throws WxPayException {
91-
request.checkAndSign(this.payService.getConfig());
90+
public ProfitSharingReturnResult profitSharingReturn(ProfitSharingReturnRequest returnRequest) throws WxPayException {
91+
returnRequest.checkAndSign(this.payService.getConfig());
9292
String url = this.payService.getPayBaseUrl() + "/secapi/pay/profitsharingreturn";
9393

94-
String responseContent = this.payService.post(url, request.toXML(), true);
94+
String responseContent = this.payService.post(url, returnRequest.toXML(), true);
9595
ProfitSharingReturnResult result = BaseWxPayResult.fromXML(responseContent, ProfitSharingReturnResult.class);
96-
result.checkResult(this.payService, request.getSignType(), true);
96+
result.checkResult(this.payService, returnRequest.getSignType(), true);
9797
return result;
9898
}
9999

100100
@Override
101-
public ProfitSharingReturnResult profitsharingReturnQuery(ProfitSharingReturnQueryRequest request) throws WxPayException {
102-
request.checkAndSign(this.payService.getConfig());
101+
public ProfitSharingReturnResult profitSharingReturnQuery(ProfitSharingReturnQueryRequest queryRequest) throws WxPayException {
102+
queryRequest.checkAndSign(this.payService.getConfig());
103103
String url = this.payService.getPayBaseUrl() + "/pay/profitsharingreturnquery";
104104

105-
String responseContent = this.payService.post(url, request.toXML(), true);
105+
String responseContent = this.payService.post(url, queryRequest.toXML(), true);
106106
ProfitSharingReturnResult result = BaseWxPayResult.fromXML(responseContent, ProfitSharingReturnResult.class);
107-
result.checkResult(this.payService, request.getSignType(), true);
107+
result.checkResult(this.payService, queryRequest.getSignType(), true);
108108
return result;
109109
}
110110
}

weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/ProfitSharingServiceImplTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void testProfitsharing() throws WxPayException {
3636
.transactionId("4200000431201910234736634272")
3737
.receivers(instance.toJSONString())
3838
.build();
39-
this.logger.info(this.payService.getProfitSharingService().profitsharing(request).toString());
39+
this.logger.info(this.payService.getProfitSharingService().profitSharing(request).toString());
4040
}
4141

4242
@Test
@@ -52,7 +52,7 @@ public void testMultiprofitsharing() throws WxPayException {
5252
.transactionId("4200000448201910238249687345")//order_id=30000102922019102310821824010
5353
.receivers(instance.toJSONString())
5454
.build();
55-
this.logger.info(this.payService.getProfitSharingService().multiprofitsharing(request).toString());
55+
this.logger.info(this.payService.getProfitSharingService().multiProfitSharing(request).toString());
5656
}
5757

5858
@Test
@@ -63,7 +63,7 @@ public void testProfitsharingFinish() throws WxPayException {
6363
.transactionId("4200000441201910238267278073")
6464
.description("分账完成")
6565
.build();
66-
this.logger.info(this.payService.getProfitSharingService().profitsharingfinish(request).toString());
66+
this.logger.info(this.payService.getProfitSharingService().profitSharingFinish(request).toString());
6767
}
6868

6969
@Test
@@ -98,7 +98,7 @@ public void testProfitsharingQuery() throws WxPayException {
9898
.outOrderNo("20191023112023031060677")
9999
.transactionId("4200000431201910234736634272")
100100
.build();
101-
ProfitSharingQueryResult result = this.payService.getProfitSharingService().profitsharingQuery(request);
101+
ProfitSharingQueryResult result = this.payService.getProfitSharingService().profitSharingQuery(request);
102102
this.logger.info(result.formatReceivers().toString());
103103
this.logger.info(result.toString());
104104
}
@@ -114,7 +114,7 @@ public void testProfitsharingReturn() throws WxPayException {
114114
.returnAmount(2)
115115
.description("用户退款")
116116
.build();
117-
this.logger.info(this.payService.getProfitSharingService().profitsharingReturn(request).toString());
117+
this.logger.info(this.payService.getProfitSharingService().profitSharingReturn(request).toString());
118118
}
119119

120120
@Test
@@ -124,7 +124,7 @@ public void testProfitsharingReturnQuery() throws WxPayException {
124124
.outOrderNo("20191023154723316420060")
125125
.outReturnNo("R2019102315")
126126
.build();
127-
this.logger.info(this.payService.getProfitSharingService().profitsharingReturnQuery(request).toString());
127+
this.logger.info(this.payService.getProfitSharingService().profitSharingReturnQuery(request).toString());
128128
}
129129

130130

0 commit comments

Comments
 (0)