规范notifyUrl字段属性写法

This commit is contained in:
Binary Wang 2018-01-18 20:11:09 +08:00
parent 48fb5e9e5a
commit 1a4ca8c0bd
4 changed files with 19 additions and 15 deletions

View File

@ -8,7 +8,7 @@ import java.nio.file.Files;
public class FileUtils { public class FileUtils {
/** /**
* 创建临时文件 * 创建临时文件.
* *
* @param inputStream 输入文件流 * @param inputStream 输入文件流
* @param name 文件名 * @param name 文件名
@ -24,7 +24,7 @@ public class FileUtils {
} }
/** /**
* 创建临时文件 * 创建临时文件.
* *
* @param inputStream 输入文件流 * @param inputStream 输入文件流
* @param name 文件名 * @param name 文件名

View File

@ -56,11 +56,14 @@ public class OkHttpMediaDownloadRequestExecutor extends BaseMediaDownloadRequest
return null; return null;
} }
File file = File.createTempFile(FilenameUtils.getBaseName(fileName), FilenameUtils.getExtension(fileName), File file = File.createTempFile(
super.tmpDirFile); FilenameUtils.getBaseName(fileName), "." + FilenameUtils.getExtension(fileName), super.tmpDirFile
);
try (BufferedSink sink = Okio.buffer(Okio.sink(file))) { try (BufferedSink sink = Okio.buffer(Okio.sink(file))) {
sink.writeAll(response.body().source()); sink.writeAll(response.body().source());
} }
file.deleteOnExit(); file.deleteOnExit();
return file; return file;
} }

View File

@ -214,7 +214,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
*/ */
@Required @Required
@XStreamAlias("notify_url") @XStreamAlias("notify_url")
private String notifyURL; private String notifyUrl;
/** /**
* <pre> * <pre>
@ -319,9 +319,11 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
/** /**
* 如果配置中已经设置可以不设置值. * 如果配置中已经设置可以不设置值.
*
* @param notifyUrl 支付回调通知地址
*/ */
public void setNotifyURL(String notifyURL) { public void setNotifyUrl(String notifyUrl) {
this.notifyURL = notifyURL; this.notifyUrl = notifyUrl;
} }
/** /**
@ -342,8 +344,8 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
@Override @Override
public void checkAndSign(WxPayConfig config) throws WxPayException { public void checkAndSign(WxPayConfig config) throws WxPayException {
if (StringUtils.isBlank(this.getNotifyURL())) { if (StringUtils.isBlank(this.getNotifyUrl())) {
this.setNotifyURL(config.getNotifyUrl()); this.setNotifyUrl(config.getNotifyUrl());
} }
if (StringUtils.isBlank(this.getTradeType())) { if (StringUtils.isBlank(this.getTradeType())) {

View File

@ -8,7 +8,6 @@ import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult; import com.github.binarywang.wxpay.bean.order.WxPayNativeOrderResult;
import com.github.binarywang.wxpay.bean.request.*; import com.github.binarywang.wxpay.bean.request.*;
import com.github.binarywang.wxpay.bean.result.*; import com.github.binarywang.wxpay.bean.result.*;
import com.github.binarywang.wxpay.constant.WxPayConstants;
import com.github.binarywang.wxpay.constant.WxPayConstants.BillType; import com.github.binarywang.wxpay.constant.WxPayConstants.BillType;
import com.github.binarywang.wxpay.constant.WxPayConstants.SignType; import com.github.binarywang.wxpay.constant.WxPayConstants.SignType;
import com.github.binarywang.wxpay.constant.WxPayConstants.TradeType; import com.github.binarywang.wxpay.constant.WxPayConstants.TradeType;
@ -26,7 +25,7 @@ import java.nio.file.Path;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import static com.github.binarywang.wxpay.constant.WxPayConstants.*; import static com.github.binarywang.wxpay.constant.WxPayConstants.TarType;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.testng.Assert.*; import static org.testng.Assert.*;
@ -53,7 +52,7 @@ public class BaseWxPayServiceImplTest {
.body("我去") .body("我去")
.totalFee(1) .totalFee(1)
.spbillCreateIp("11.1.11.1") .spbillCreateIp("11.1.11.1")
.notifyURL("111111") .notifyUrl("111111")
.tradeType(TradeType.JSAPI) .tradeType(TradeType.JSAPI)
.openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid()) .openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid())
.outTradeNo("1111112") .outTradeNo("1111112")
@ -76,7 +75,7 @@ public class BaseWxPayServiceImplTest {
.body("我去") .body("我去")
.totalFee(1) .totalFee(1)
.spbillCreateIp("11.1.11.1") .spbillCreateIp("11.1.11.1")
.notifyURL("111111") .notifyUrl("111111")
.tradeType(TradeType.JSAPI) .tradeType(TradeType.JSAPI)
.openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid()) .openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid())
.outTradeNo("1111112") .outTradeNo("1111112")
@ -92,7 +91,7 @@ public class BaseWxPayServiceImplTest {
.body("我去") .body("我去")
.totalFee(1) .totalFee(1)
.spbillCreateIp("11.1.11.1") .spbillCreateIp("11.1.11.1")
.notifyURL("111111") .notifyUrl("111111")
.tradeType(TradeType.APP) .tradeType(TradeType.APP)
.outTradeNo("1111112") .outTradeNo("1111112")
.build()); .build());
@ -108,7 +107,7 @@ public class BaseWxPayServiceImplTest {
.totalFee(1) .totalFee(1)
.productId("aaa") .productId("aaa")
.spbillCreateIp("11.1.11.1") .spbillCreateIp("11.1.11.1")
.notifyURL("111111") .notifyUrl("111111")
.tradeType(TradeType.NATIVE) .tradeType(TradeType.NATIVE)
.outTradeNo("111111290") .outTradeNo("111111290")
.build()); .build());