From f58ba62acc24990861a86280cf1453b743fcf16c Mon Sep 17 00:00:00 2001 From: Binary Wang Date: Sun, 8 Mar 2020 20:15:36 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20#1428=20=E5=BE=AE=E4=BF=A1=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E7=BB=9F=E4=B8=80=E4=B8=8B=E5=8D=95=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=B8=AD=E7=9A=84attach=E5=92=8Cdetail=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=9C=A8=E7=94=9F=E6=88=90xml=E6=97=B6=E5=8A=A0=E5=85=A5CDATA?= =?UTF-8?q?=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wxpay/bean/request/WxPayUnifiedOrderRequest.java | 4 ++++ .../wxpay/service/impl/BaseWxPayServiceImplTest.java | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java index fc5949df..3a80c827 100644 --- a/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java +++ b/weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java @@ -4,9 +4,11 @@ import com.github.binarywang.wxpay.config.WxPayConfig; import com.github.binarywang.wxpay.constant.WxPayConstants.TradeType; import com.github.binarywang.wxpay.exception.WxPayException; import com.thoughtworks.xstream.annotations.XStreamAlias; +import com.thoughtworks.xstream.annotations.XStreamConverter; import lombok.*; import lombok.experimental.Accessors; import me.chanjar.weixin.common.annotation.Required; +import me.chanjar.weixin.common.util.xml.XStreamCDataConverter; import org.apache.commons.lang3.StringUtils; import java.util.Map; @@ -111,6 +113,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest { * */ @XStreamAlias("detail") + @XStreamConverter(value = XStreamCDataConverter.class) private String detail; /** @@ -124,6 +127,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest { * */ @XStreamAlias("attach") + @XStreamConverter(value = XStreamCDataConverter.class) private String attach; /** diff --git a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java index ab850d0b..de7b1e58 100644 --- a/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java +++ b/weixin-java-pay/src/test/java/com/github/binarywang/wxpay/service/impl/BaseWxPayServiceImplTest.java @@ -63,12 +63,13 @@ public class BaseWxPayServiceImplTest { .notifyUrl("111111") .tradeType(TradeType.JSAPI) .openid(((XmlWxPayConfig) this.payService.getConfig()).getOpenid()) - .outTradeNo("1111112") + .outTradeNo("111111826") + .attach("#*#{\"pn\":\"粤B87965\",\"aid\":\"wx123\"}#*#") .build(); request.setSignType(SignType.HMAC_SHA256); WxPayUnifiedOrderResult result = this.payService.unifiedOrder(request); log.info(result.toString()); - log.warn(this.payService.getWxApiData().toString()); +// log.warn(this.payService.getWxApiData().toString()); } /**