<NME> PayOrder.java
<BEF> package com.egzosn.pay.common.bean;

import java.math.BigDecimal;
import java.util.Date;

import com.egzosn.pay.common.util.str.StringUtils;
 * 支付订单信息
 *
 * @author egan
 *  <pre>
 *      email egzosn@gmail.com
 *      date 2016/10/19 22:34
 *  </pre>
 *      date 2016/10/19 22:34
 *  </pre>
 */
public class PayOrder extends AssistOrder {
    /**
     * 商品名称
     */
    private String subject;
    /**
     * 商品描述
     */
    private String body;
    /**
     * 附加信息
     */
    private String addition;
    /**
     * 价格
     */
    private BigDecimal price;

    /**
     * 银行卡类型
     */
    private String bankType;
    /**
     * 设备信息
     */
    @Deprecated
    private String deviceInfo;
    /**
     * 支付创建ip
     */
    @Deprecated
    private String spbillCreateIp;
    /**
     * 付款条码串,人脸凭证，有关支付代码相关的，
     */
    private String authCode;
    /**
     * 微信专用，，，，
     * WAP支付链接
     */
    @Deprecated
    private String wapUrl;
    /**
     * 微信专用，，，，
     * WAP支付网页名称
     */
    @Deprecated
    private String wapName;
    /**
    private String wapName;
    /**
     * 用户唯一标识
     *  微信含 sub_openid 字段
     */
    private String openid;
    /**
     * 支付币种
     */
    private CurType curType;
    /**
     * 订单过期时间
     */
    private Date expirationTime;


    public PayOrder() {
    private Date expirationTime;




    public CurType getCurType() {
        this.curType = curType;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public String getAddition() {
        return addition;
    }

    public void setAddition(String addition) {
        this.addition = addition;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }


    public String getBankType() {
        return bankType;

    /**
     * 支付平台订单号,交易号
     * @return 支付平台订单号,交易号
     */
    public String getTradeNo() {
        return tradeNo;
    }
    /**
     * 支付平台订单号,交易号
     * @param tradeNo 支付平台订单号,交易号
     */
    public void setTradeNo(String tradeNo) {
    }
    }

    /**
     *  获取商户订单号
     * @return 商户订单号
     */
    public String getOutTradeNo() {

    public void setDeviceInfo(String deviceInfo) {

    /**
     * 设置商户订单号
     * @param outTradeNo  商户订单号
     */
    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
        this.wapUrl = wapUrl;
    }

    public String getWapName() {
        return wapName;
    }

    public void setWapName(String wapName) {
        this.wapName = wapName;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public Date getExpirationTime() {
        return expirationTime;
    }

    public void setExpirationTime(Date expirationTime) {
        this.expirationTime = expirationTime;
    }

}
        this.deviceInfo = deviceInfo;
    }

    public PayOrder() {
    }


    public PayOrder(String subject, String body, BigDecimal price, String outTradeNo, TransactionType transactionType) {
        this.subject = subject;
        this.body = body;
        this.price = price;
        this.outTradeNo = outTradeNo;
        this.transactionType = transactionType;
    }
    public PayOrder(String subject, String body, BigDecimal price, String outTradeNo) {
        this.subject = subject;
        this.body = body;
        this.price = price;
        this.outTradeNo = outTradeNo;
    }

    public String getWapUrl() {
        return wapUrl;
    }
        this.expirationTime = expirationTime;
    }

    @Override
    public String toString() {
        return "PayOrder{" +

<MSG> Merge remote-tracking branch 'origin/master'

<DFF> @@ -7,7 +7,7 @@ import java.util.Date;
  * 支付订单信息
  *
  * @author egan
- *  <pre>
+ * <pre>
  *      email egzosn@gmail.com
  *      date 2016/10/19 22:34
  *  </pre>
@@ -66,7 +66,7 @@ public class PayOrder {
     private String wapName;
     /**
      * 用户唯一标识
-     *  微信含 sub_openid 字段
+     * 微信含 sub_openid 字段
      */
     private String openid;
     /**
@@ -83,6 +83,21 @@ public class PayOrder {
     private Date expirationTime;
 
 
+    public PayOrder() {
+    }
+
+
+    public PayOrder(String subject, String body, BigDecimal price, String outTradeNo) {
+        this(subject, body, price, outTradeNo, null);
+    }
+
+    public PayOrder(String subject, String body, BigDecimal price, String outTradeNo, TransactionType transactionType) {
+        this.subject = tryTrim(subject);
+        this.body = tryTrim(body);
+        this.price = price;
+        this.outTradeNo = tryTrim(outTradeNo);
+        this.transactionType = transactionType;
+    }
 
 
     public CurType getCurType() {
@@ -127,13 +142,16 @@ public class PayOrder {
 
     /**
      * 支付平台订单号,交易号
-     * @return 支付平台订单号,交易号
+     *
+     * @return 支付平台订单号, 交易号
      */
     public String getTradeNo() {
         return tradeNo;
     }
+
     /**
      * 支付平台订单号,交易号
+     *
      * @param tradeNo 支付平台订单号,交易号
      */
     public void setTradeNo(String tradeNo) {
@@ -141,7 +159,8 @@ public class PayOrder {
     }
 
     /**
-     *  获取商户订单号
+     * 获取商户订单号
+     *
      * @return 商户订单号
      */
     public String getOutTradeNo() {
@@ -150,7 +169,8 @@ public class PayOrder {
 
     /**
      * 设置商户订单号
-     * @param outTradeNo  商户订单号
+     *
+     * @param outTradeNo 商户订单号
      */
     public void setOutTradeNo(String outTradeNo) {
         this.outTradeNo = outTradeNo;
@@ -196,24 +216,6 @@ public class PayOrder {
         this.deviceInfo = deviceInfo;
     }
 
-    public PayOrder() {
-    }
-
-
-    public PayOrder(String subject, String body, BigDecimal price, String outTradeNo, TransactionType transactionType) {
-        this.subject = subject;
-        this.body = body;
-        this.price = price;
-        this.outTradeNo = outTradeNo;
-        this.transactionType = transactionType;
-    }
-    public PayOrder(String subject, String body, BigDecimal price, String outTradeNo) {
-        this.subject = subject;
-        this.body = body;
-        this.price = price;
-        this.outTradeNo = outTradeNo;
-    }
-
     public String getWapUrl() {
         return wapUrl;
     }
@@ -246,6 +248,16 @@ public class PayOrder {
         this.expirationTime = expirationTime;
     }
 
+    /**
+     * 对 subject body 进行 trim 运算，
+     * 以防止在签名是可能造成的签名错误问题
+     * @param str
+     * @return
+     */
+    private static String tryTrim(String str) {
+        return str == null ? null : str.trim();
+    }
+
     @Override
     public String toString() {
         return "PayOrder{" +

Merge remote-tracking branch 'origin/master'