Ver código fonte

规范notifyUrl字段属性写法

master
Binary Wang 7 anos atrás
pai
commit
1a4ca8c0bd
4 arquivos alterados com 19 adições e 15 exclusões
  1. +2
    -2
      weixin-java-common/src/main/java/me/chanjar/weixin/common/util/fs/FileUtils.java
  2. +5
    -2
      weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/okhttp/OkHttpMediaDownloadRequestExecutor.java
  3. +7
    -5
      weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java
  4. +5
    -6
      weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java

+ 2
- 2
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/fs/FileUtils.java Ver arquivo

@@ -8,7 +8,7 @@ import java.nio.file.Files;
public class FileUtils {

/**
* 创建临时文件
* 创建临时文件.
*
* @param inputStream 输入文件流
* @param name 文件名
@@ -24,7 +24,7 @@ public class FileUtils {
}

/**
* 创建临时文件
* 创建临时文件.
*
* @param inputStream 输入文件流
* @param name 文件名


+ 5
- 2
weixin-java-common/src/main/java/me/chanjar/weixin/common/util/http/okhttp/OkHttpMediaDownloadRequestExecutor.java Ver arquivo

@@ -56,11 +56,14 @@ public class OkHttpMediaDownloadRequestExecutor extends BaseMediaDownloadRequest
return null;
}

File file = File.createTempFile(FilenameUtils.getBaseName(fileName), FilenameUtils.getExtension(fileName),
super.tmpDirFile);
File file = File.createTempFile(
FilenameUtils.getBaseName(fileName), "." + FilenameUtils.getExtension(fileName), super.tmpDirFile
);

try (BufferedSink sink = Okio.buffer(Okio.sink(file))) {
sink.writeAll(response.body().source());
}

file.deleteOnExit();
return file;
}


+ 7
- 5
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java Ver arquivo

@@ -214,7 +214,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
*/
@Required
@XStreamAlias("notify_url")
private String notifyURL;
private String notifyUrl;

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

/**
* 如果配置中已经设置,可以不设置值.
*
* @param notifyUrl 支付回调通知地址
*/
public void setNotifyURL(String notifyURL) {
this.notifyURL = notifyURL;
public void setNotifyUrl(String notifyUrl) {
this.notifyUrl = notifyUrl;
}

/**
@@ -342,8 +344,8 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {

@Override
public void checkAndSign(WxPayConfig config) throws WxPayException {
if (StringUtils.isBlank(this.getNotifyURL())) {
this.setNotifyURL(config.getNotifyUrl());
if (StringUtils.isBlank(this.getNotifyUrl())) {
this.setNotifyUrl(config.getNotifyUrl());
}

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


+ 5
- 6
weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java Ver arquivo

@@ -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.request.*;
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.SignType;
import com.github.binarywang.wxpay.constant.WxPayConstants.TradeType;
@@ -26,7 +25,7 @@ import java.nio.file.Path;
import java.util.Calendar;
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.testng.Assert.*;

@@ -53,7 +52,7 @@ public class BaseWxPayServiceImplTest {
.body("我去")
.totalFee(1)
.spbillCreateIp("11.1.11.1")
.notifyURL("111111")
.notifyUrl("111111")
.tradeType(TradeType.JSAPI)
.openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid())
.outTradeNo("1111112")
@@ -76,7 +75,7 @@ public class BaseWxPayServiceImplTest {
.body("我去")
.totalFee(1)
.spbillCreateIp("11.1.11.1")
.notifyURL("111111")
.notifyUrl("111111")
.tradeType(TradeType.JSAPI)
.openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid())
.outTradeNo("1111112")
@@ -92,7 +91,7 @@ public class BaseWxPayServiceImplTest {
.body("我去")
.totalFee(1)
.spbillCreateIp("11.1.11.1")
.notifyURL("111111")
.notifyUrl("111111")
.tradeType(TradeType.APP)
.outTradeNo("1111112")
.build());
@@ -108,7 +107,7 @@ public class BaseWxPayServiceImplTest {
.totalFee(1)
.productId("aaa")
.spbillCreateIp("11.1.11.1")
.notifyURL("111111")
.notifyUrl("111111")
.tradeType(TradeType.NATIVE)
.outTradeNo("111111290")
.build());


Carregando…
Cancelar
Salvar