Skip to content

Commit 1a4ca8c

Browse files
committed
规范notifyUrl字段属性写法
1 parent 48fb5e9 commit 1a4ca8c

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/fs/FileUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
public class FileUtils {
99

1010
/**
11-
* 创建临时文件
11+
* 创建临时文件.
1212
*
1313
* @param inputStream 输入文件流
1414
* @param name 文件名
@@ -24,7 +24,7 @@ public static File createTmpFile(InputStream inputStream, String name, String ex
2424
}
2525

2626
/**
27-
* 创建临时文件
27+
* 创建临时文件.
2828
*
2929
* @param inputStream 输入文件流
3030
* @param name 文件名

weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/okhttp/OkHttpMediaDownloadRequestExecutor.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ public File execute(String uri, String queryParam) throws WxErrorException, IOEx
5656
return null;
5757
}
5858

59-
File file = File.createTempFile(FilenameUtils.getBaseName(fileName), FilenameUtils.getExtension(fileName),
60-
super.tmpDirFile);
59+
File file = File.createTempFile(
60+
FilenameUtils.getBaseName(fileName), "." + FilenameUtils.getExtension(fileName), super.tmpDirFile
61+
);
62+
6163
try (BufferedSink sink = Okio.buffer(Okio.sink(file))) {
6264
sink.writeAll(response.body().source());
6365
}
66+
6467
file.deleteOnExit();
6568
return file;
6669
}

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
214214
*/
215215
@Required
216216
@XStreamAlias("notify_url")
217-
private String notifyURL;
217+
private String notifyUrl;
218218

219219
/**
220220
* <pre>
@@ -319,9 +319,11 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
319319

320320
/**
321321
* 如果配置中已经设置,可以不设置值.
322+
*
323+
* @param notifyUrl 支付回调通知地址
322324
*/
323-
public void setNotifyURL(String notifyURL) {
324-
this.notifyURL = notifyURL;
325+
public void setNotifyUrl(String notifyUrl) {
326+
this.notifyUrl = notifyUrl;
325327
}
326328

327329
/**
@@ -342,8 +344,8 @@ protected void checkConstraints() throws WxPayException {
342344

343345
@Override
344346
public void checkAndSign(WxPayConfig config) throws WxPayException {
345-
if (StringUtils.isBlank(this.getNotifyURL())) {
346-
this.setNotifyURL(config.getNotifyUrl());
347+
if (StringUtils.isBlank(this.getNotifyUrl())) {
348+
this.setNotifyUrl(config.getNotifyUrl());
347349
}
348350

349351
if (StringUtils.isBlank(this.getTradeType())) {

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult;
99
import com.github.binarywang.wxpay.bean.request.*;
1010
import com.github.binarywang.wxpay.bean.result.*;
11-
import com.github.binarywang.wxpay.constant.WxPayConstants;
1211
import com.github.binarywang.wxpay.constant.WxPayConstants.BillType;
1312
import com.github.binarywang.wxpay.constant.WxPayConstants.SignType;
1413
import com.github.binarywang.wxpay.constant.WxPayConstants.TradeType;
@@ -26,7 +25,7 @@
2625
import java.util.Calendar;
2726
import java.util.Date;
2827

29-
import static com.github.binarywang.wxpay.constant.WxPayConstants.*;
28+
import static com.github.binarywang.wxpay.constant.WxPayConstants.TarType;
3029
import static org.assertj.core.api.Assertions.assertThat;
3130
import static org.testng.Assert.*;
3231

@@ -53,7 +52,7 @@ public void testUnifiedOrder() throws WxPayException {
5352
.body("我去")
5453
.totalFee(1)
5554
.spbillCreateIp("11.1.11.1")
56-
.notifyURL("111111")
55+
.notifyUrl("111111")
5756
.tradeType(TradeType.JSAPI)
5857
.openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid())
5958
.outTradeNo("1111112")
@@ -76,7 +75,7 @@ public void testCreateOrder_jsapi() throws Exception {
7675
.body("我去")
7776
.totalFee(1)
7877
.spbillCreateIp("11.1.11.1")
79-
.notifyURL("111111")
78+
.notifyUrl("111111")
8079
.tradeType(TradeType.JSAPI)
8180
.openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid())
8281
.outTradeNo("1111112")
@@ -92,7 +91,7 @@ public void testCreateOrder_app() throws Exception {
9291
.body("我去")
9392
.totalFee(1)
9493
.spbillCreateIp("11.1.11.1")
95-
.notifyURL("111111")
94+
.notifyUrl("111111")
9695
.tradeType(TradeType.APP)
9796
.outTradeNo("1111112")
9897
.build());
@@ -108,7 +107,7 @@ public void testCreateOrder_native() throws Exception {
108107
.totalFee(1)
109108
.productId("aaa")
110109
.spbillCreateIp("11.1.11.1")
111-
.notifyURL("111111")
110+
.notifyUrl("111111")
112111
.tradeType(TradeType.NATIVE)
113112
.outTradeNo("111111290")
114113
.build());

0 commit comments

Comments
 (0)