Skip to content

Commit

Permalink
🎨 #1428 微信支付统一下单接口中的attach和detail参数在生成xml时加入CDATA标签
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Mar 8, 2020
1 parent 06aaacc commit f58ba62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
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;
Expand Down Expand Up @@ -111,6 +113,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
* </pre>
*/
@XStreamAlias("detail")
@XStreamConverter(value = XStreamCDataConverter.class)
private String detail;

/**
Expand All @@ -124,6 +127,7 @@ public class WxPayUnifiedOrderRequest extends BaseWxPayRequest {
* </pre>
*/
@XStreamAlias("attach")
@XStreamConverter(value = XStreamCDataConverter.class)
private String attach;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ public void testUnifiedOrder() throws WxPayException {
.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());
}

/**
Expand Down

0 comments on commit f58ba62

Please sign in to comment.