src/main/java/net/arccode/wechat/pay/api/common/exception/WXPayApiException.java
public class WXPayApiException extends Exception {
    private static final long serialVersionUID = -7457798164814346771L;

    /**
     * 错误码
     */
    private String errCode;

    /**
     * 错误消息
     */
    private String errMsg;

    public WXPayApiException() {
        super();
    }

    public WXPayApiException(String message) {
        super(message);
    }

    public WXPayApiException(Throwable cause) {
        super(cause);
    }

    public WXPayApiException(String message, Throwable cause) {
        super(message, cause);
    }

    public WXPayApiException(String errCode, String errMsg) {
        super(errCode + ":" + errMsg);
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public String getErrCode() {
        return errCode;
    }

    public String getErrMsg() {
        return errMsg;
    }
}
src/main/java/net/arccode/wechat/pay/api/protocol/query_order/QueryOrderRequest.java
public class QueryOrderRequest implements WXPayRequest<QueryOrderResponse> {

    /**==================== 协议应用参数 ====================**/

    /**
     * 微信订单号
     * 必选: 否, 但需要与商户订单号二选一
     * String(32)	1009660380201506130728806387	微信的订单号，优先使用
     */
    private String transactionId;
    /**
     * 商户订单号
     * 必选: 否, 但需要与微信订单号二选一
     * String(32)	20150806125346	商户系统内部的订单号，当没提供transaction_id时需要传这个。
     */
    private String outTradeNo;

    /**
     * 随机字符串	必填: 是
     * <p/>
     * 5K8264ILTKCH16CQ2502SI8ZNMTM67VS	String(32)	随机字符串，不长于32位
     */
    private String nonceStr;

    public QueryOrderRequest() {
    }

    public QueryOrderRequest(String transactionId, String outTradeNo, String nonceStr) {
        this.transactionId = transactionId;
        this.outTradeNo = outTradeNo;
        this.nonceStr = nonceStr;
    }

    @Override
    public String getHttpVerb() {
        return WXPayConstants.HTTP_POST;
    }

    @Override
    public String getApiURL() {
        return WXPayConstants.QUERY_ORDER;
    }

    @Override
    public Map<String, String> getApplicationParams() {
        ACHashMap txtParams = new ACHashMap();
        txtParams.put("transaction_id", this.transactionId);
        txtParams.put("out_trade_no", this.outTradeNo);
        txtParams.put("nonce_str", this.nonceStr);
        return txtParams;
    }

    @Override
    public Class<QueryOrderResponse> getResponseClass() {
        return QueryOrderResponse.class;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }
}
src/main/java/net/arccode/wechat/pay/api/protocol/refund/RefundResponse.java
public class RefundResponse extends WXPayResponse {
    private static final long serialVersionUID = 6252751420895289657L;

    /**==================== 以下字段在return_code为SUCCESS的时候有返回 ====================**/

    /**
     * 业务结果
     * 必填: 是	String(16)	SUCCESS
     * SUCCESS/FAIL
     * SUCCESS退款申请接收成功，结果通过退款查询接口查询
     * FAIL 提交业务失败
     */
    @ApiField("result_code")
    private String resultCode;
    /**
     * 错误代码
     * 必填: 否	String(32)	SYSTEMERROR	列表详见第6节
     */
    @ApiField("err_code")
    private String errCode;
    /**
     * 错误代码描述
     * 必填: 否	String(128)	系统超时	结果信息描述
     */
    @ApiField("err_code_des")
    private String errCodeDes;
    /**
     * 公众账号ID
     * 必填: 是	String(32)	wx8888888888888888	微信分配的公众账号ID
     */
    @ApiField("appid")
    private String appId;
    /**
     * 商户号
     * 必填: 是	String(32)	1900000109	微信支付分配的商户号
     */
    @ApiField("mch_id")
    private String mchId;
    /**
     * 设备号
     * 必填: 否	String(32)	013467007045764	微信支付分配的终端设备号，与下单一致
     */
    @ApiField("device_info")
    private String deviceInfo;
    /**
     * 随机字符串
     * 必填: 是	String(32)	5K8264ILTKCH16CQ2502SI8ZNMTM67VS	随机字符串，不长于32位
     */
    @ApiField("nonce_str")
    private String nonceStr;
    /**
     * 签名
     * 必填: 是	String(32)	5K8264ILTKCH16CQ2502SI8ZNMTM67VS	签名，详见签名算法
     */
    @ApiField("sign")
    private String sign;
    /**
     * 微信订单号
     * 必填: 是	String(28)	1217752501201407033233368018	微信订单号
     */
    @ApiField("transaction_id")
    private String transactionId;
    /**
     * 商户订单号
     * 必填: 是	String(32)	1217752501201407033233368018	商户系统内部的订单号
     */
    @ApiField("out_trade_no")
    private String outTradeNo;
    /**
     * 商户退款单号
     * 必填: 是	String(32)	1217752501201407033233368018	商户退款单号
     */
    @ApiField("out_refund_no")
    private String outRefundNo;
    /**
     * 微信退款单号
     * 必填: 是	String(28)	1217752501201407033233368018	微信退款单号
     */
    @ApiField("refund_id")
    private String refundId;
    /**
     * 退款渠道
     * 必填: 否	String(16)	ORIGINAL—原路退款, BALANCE—退回到余额
     */
    @ApiField("refund_channel")
    private String refundChannel;

    /**
     * 退款金额
     * 必填: 是	Int	100	退款总金额,单位为分,可以做部分退款
     */
    @ApiField("refund_fee")
    private String refundFee;
    /**
     * 订单总金额
     * 必填: 是	Int	100	订单总金额，单位为分，只能为整数，详见支付金额
     */
    @ApiField("total_fee")
    private String totalFee;
    /**
     * 订单金额货币种类
     * 必填: 否	String(8)	CNY	订单金额货币类型，符合ISO 4217标准的三位字母代码，默认人民币：CNY，其他值列表详见货币类型
     */
    @ApiField("fee_type")
    private String feeType;
    /**
     * 现金支付金额
     * 必填: 是	Int	100	现金支付金额，单位为分，只能为整数，详见支付金额
     */
    @ApiField("cash_fee")
    private String cashFee;
    /**
     * 现金退款金额
     * 必填: 否	Int	100	现金退款金额，单位为分，只能为整数，详见支付金额
     */
    @ApiField("cash_refund_fee")
    private String cashRefundFee;
    /**
     * 代金券或立减优惠退款金额
     * 必填: 否	Int	100	代金券或立减优惠退款金额=订单金额-现金退款金额，注意：立减优惠金额不会退回
     */
    @ApiField("coupon_refund_fee")
    private String couponRefundFee;
    /**
     * 代金券或立减优惠使用数量
     * 必填: 否	Int	1	代金券或立减优惠使用数量
     */
    @ApiField("coupon_refund_count")
    private String couponRefundCount;
    /**
     * 代金券或立减优惠ID
     * 否	String(20)	10000 	代金券或立减优惠ID
     */
    @ApiField("coupon_refund_id")
    private String couponRefundId;

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getErrCodeDes() {
        return errCodeDes;
    }

    public void setErrCodeDes(String errCodeDes) {
        this.errCodeDes = errCodeDes;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getOutRefundNo() {
        return outRefundNo;
    }

    public void setOutRefundNo(String outRefundNo) {
        this.outRefundNo = outRefundNo;
    }

    public String getRefundId() {
        return refundId;
    }

    public void setRefundId(String refundId) {
        this.refundId = refundId;
    }

    public String getRefundChannel() {
        return refundChannel;
    }

    public void setRefundChannel(String refundChannel) {
        this.refundChannel = refundChannel;
    }

    public String getRefundFee() {
        return refundFee;
    }

    public void setRefundFee(String refundFee) {
        this.refundFee = refundFee;
    }

    public String getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(String totalFee) {
        this.totalFee = totalFee;
    }

    public String getFeeType() {
        return feeType;
    }

    public void setFeeType(String feeType) {
        this.feeType = feeType;
    }

    public String getCashFee() {
        return cashFee;
    }

    public void setCashFee(String cashFee) {
        this.cashFee = cashFee;
    }

    public String getCashRefundFee() {
        return cashRefundFee;
    }

    public void setCashRefundFee(String cashRefundFee) {
        this.cashRefundFee = cashRefundFee;
    }

    public String getCouponRefundFee() {
        return couponRefundFee;
    }

    public void setCouponRefundFee(String couponRefundFee) {
        this.couponRefundFee = couponRefundFee;
    }

    public String getCouponRefundCount() {
        return couponRefundCount;
    }

    public void setCouponRefundCount(String couponRefundCount) {
        this.couponRefundCount = couponRefundCount;
    }

    public String getCouponRefundId() {
        return couponRefundId;
    }

    public void setCouponRefundId(String couponRefundId) {
        this.couponRefundId = couponRefundId;
    }
}
src/main/java/net/arccode/wechat/pay/api/protocol/mch_pay/MchPayResponse.java
public class MchPayResponse extends WXPayResponse {
    private static final long serialVersionUID = -2681586546776415340L;

    /**==================== 以下字段在return_code为SUCCESS的时候有返回 ====================**/

    /**商户appid	 mch_appid
     * 必选: 是
     *
     * wx8888888888888888	String	微信分配的公众账号ID（企业号corpid即为此appId）
     */
    @ApiField("mch_appid")
    private String mchAppId;

    /**
     * 商户号	mchid
     * 必选: 是
     *
     * 1900000109	String(32)	微信支付分配的商户号
     */
    @ApiField("mchid")
    private String mchId;

    /**
     * 设备号	device_info
     * 必选: 否
     *
     * 013467007045764	String(32)	微信支付分配的终端设备号，
     */
    @ApiField("device_info")
    private String deviceInfo;

    /**
     * 随机字符串	nonce_str
     * 必选: 是
     *
     * 5K8264ILTKCH16CQ2502SI8ZNMTM67VS	String(32)	随机字符串，不长于32位
     */
    @ApiField("nonce_str")
    private String nonceStr;

    /**
     * 业务结果	result_code
     * 必选: 是
     *
     * SUCCESS	String(16)	SUCCESS/FAIL
     */
    @ApiField("result_code")
    private String resultCode;

    /**
     * 错误代码	err_code
     * 必选: 否
     *
     * SYSTEMERROR	String(32)	错误码信息
     */
    @ApiField("err_code")
    private String errCode;

    /**
     * 错误代码描述	err_code_des
     * 必选: 否
     *
     * 系统错误	String(128)	结果信息描述
     */
    @ApiField("err_code_des")
    private String errCodeDes;


    /**==================== 以下字段在return_code 和result_code都为SUCCESS的时候有返回 ====================**/

    /**
     * 商户订单号	partner_trade_no
     * 必选: 是
     *
     * 1217752501201407033233368018	String(32)	商户订单号，需保持唯一性
     */
    @ApiField("partner_trade_no")
    private String partnerTradeNo;

    /**
     * 微信订单号	payment_no
     * 必选: 是
     *
     * 1007752501201407033233368018	String	企业付款成功，返回的微信订单号
     */
    @ApiField("payment_no")
    private String paymentNo;

    /**
     * 微信支付成功时间	payment_time
     * 必选: 是
     *
     * 2015-05-19 15：26：59	String	企业付款成功时间
     */
    @ApiField("payment_time")
    private String paymentTime;

    public String getMchAppId() {
        return mchAppId;
    }

    public void setMchAppId(String mchAppId) {
        this.mchAppId = mchAppId;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getErrCodeDes() {
        return errCodeDes;
    }

    public void setErrCodeDes(String errCodeDes) {
        this.errCodeDes = errCodeDes;
    }

    public String getPartnerTradeNo() {
        return partnerTradeNo;
    }

    public void setPartnerTradeNo(String partnerTradeNo) {
        this.partnerTradeNo = partnerTradeNo;
    }

    public String getPaymentNo() {
        return paymentNo;
    }

    public void setPaymentNo(String paymentNo) {
        this.paymentNo = paymentNo;
    }

    public String getPaymentTime() {
        return paymentTime;
    }

    public void setPaymentTime(String paymentTime) {
        this.paymentTime = paymentTime;
    }
}
src/main/java/net/arccode/wechat/pay/api/protocol/query_order/QueryOrderResponse.java
public class QueryOrderResponse extends WXPayResponse {

    private static final long serialVersionUID = 8009307874140691769L;


    /**==================== 以下字段在return_code为SUCCESS的时候有返回 ====================**/


    /**
     * 应用APPID
     * 必填: 是	String(32)	wxd678efh567hg6787	微信开放平台审核通过的应用APPID
     */
    @ApiField("appid")
    private String appId;
    /**
     * 商户号
     * 必填: 是	String(32)	1230000109	微信支付分配的商户号
     */
    @ApiField("mch_id")
    private String mchId;
    /**
     * 随机字符串
     * 必填: 是	String(32)	5K8264ILTKCH16CQ2502SI8ZNMTM67VS	随机字符串，不长于32位。推荐随机数生成算法
     */
    @ApiField("nonce_str")
    private String nonceStr;
    /**
     * 签名
     * 必填: 是	String(32)	C380BEC2BFD727A4B6845133519F3AD6	签名，详见签名生成算法
     */
    @ApiField("sign")
    private String sign;
    /**
     * 业务结果
     * 必填: 是	String(16)	SUCCESS	SUCCESS/FAIL
     */
    @ApiField("result_code")
    private String resultCode;
    /**
     * 错误代码
     * 必填: 否	String(32)	SYSTEMERROR	错误码
     */
    @ApiField("err_code")
    private String errCode;
    /**
     * 错误代码描述
     * 必填: 否	String(128)	系统错误	结果信息描述
     */
    @ApiField("err_code_des")
    private String errCodeDes;


    /**==================== 以下字段在return_code 和result_code都为SUCCESS的时候有返回 ====================**/

    /**
     * 设备号
     * 否	String(32)	013467007045764	微信支付分配的终端设备号，
     */
    @ApiField("device_info")
    private String deviceInfo;
    /**
     * 用户标识
     * 是	String(128)	oUpF8uMuAJO_M2pxb1Q9zNjWeS6o	用户在商户appid下的唯一标识
     */
    @ApiField("openid")
    private String openId;
    /**
     * 是否关注公众账号
     * 否	String(1)	Y	用户是否关注公众账号，Y-关注，N-未关注，仅在公众账号类型支付有效
     */
    @ApiField("is_subscribe")
    private String isSubscribe;
    /**
     * 交易类型
     * 是	String(16)	APP	调用接口提交的交易类型
     */
    @ApiField("trade_type")
    private String tradeType;
    /**
     * 交易状态
     * 是	String(32)	SUCCESS
     * SUCCESS—支付成功
     * REFUND—转入退款
     * NOTPAY—未支付
     * CLOSED—已关闭
     * REVOKED—已撤销（刷卡支付）
     * USERPAYING--用户支付中
     * PAYERROR--支付失败(其他原因，如银行返回失败)
     */
    @ApiField("trade_state")
    private String tradeState;

    /**
     * 付款银行
     * 是	String(16)	CMC	银行类型，采用字符串类型的银行标识
     */
    @ApiField("bank_type")
    private String bankType;
    /**
     * 总金额
     * 是	Int	100	订单总金额，单位为分
     */
    @ApiField("total_fee")
    private Integer totalFee;
    /**
     * 货币种类
     * 否	String(8)	CNY	货币类型，符合ISO 4217标准的三位字母代码，默认人民币：CNY，其他值列表详见货币类型
     */
    @ApiField("fee_type")
    private String feeType;
    /**
     * 现金支付金额
     * 是	Int	100	现金支付金额订单现金支付金额，详见支付金额
     */
    @ApiField("cash_fee")
    private Integer cashFee;
    /**
     * 现金支付货币类型
     * 否	String(16)	CNY	货币类型，符合ISO 4217标准的三位字母代码，默认人民币：CNY，其他值列表详见货币类型
     */
    @ApiField("cash_fee_type")
    private String cashFeeType;
    /**
     * 应结订单金额
     * 否	Int	100	当订单使用了免充值型优惠券后返回该参数，应结订单金额=订单金额-免充值优惠券金额。
     */
    @ApiField("settlement_total_fee")
    private Integer settlementTotalFee;
    /**
     * 代金券金额
     * 否	Int	100	“代金券或立减优惠”金额<=订单总金额，订单总金额-“代金券或立减优惠”金额=现金支付金额，详见支付金额
     */
    @ApiField("coupon_fee")
    private Integer couponFee;
    /**
     * 代金券使用数量
     * 否	Int	1	代金券或立减优惠使用数量
     */
    @ApiField("coupon_count")
    private Integer couponCount;
    /**
     * 代金券ID
     * 否	String(20)	10000 	代金券或立减优惠ID, $n为下标，从0开始编号
     */
    @ApiField("coupon_id_$n")
    private String couponIdN;
    /**
     * 代金券类型
     * 否	String	CASH
     * CASH--充值代金券
     * NO_CASH---非充值优惠券
     * 开通免充值券功能，并且订单使用了优惠券后有返回（取值：CASH、NO_CASH）。$n为下标,从0开始编号，举例：coupon_type_$0
     */
    @ApiField("coupon_type_$n")
    private String couponTypeN;
    /**
     * 单个代金券支付金额
     * 否	Int	100	单个代金券或立减优惠支付金额, $n为下标，从0开始编号
     */
    @ApiField("coupon_fee_$n")
    private Integer couponFeeN;
    /**
     * 微信支付订单号
     * 是	String(32)	1009660380201506130728806387	微信支付订单号
     */
    @ApiField("transaction_id")
    private String transactionId;
    /**
     * 商户订单号
     * 是	String(32)	20150806125346	商户系统内部订单号，要求32个字符内，只能是数字、大小写字母_-|*@ ，且在同一个商户号下唯一。
     */
    @ApiField("out_trade_no")
    private String outTradeNo;
    /**
     * 附加数据
     * 否	String(128)	深圳分店	附加数据，原样返回
     */
    @ApiField("attach")
    private String attach;
    /**
     * 支付完成时间
     * 是	String(14)	20141030133525
     * 订单支付时间，格式为yyyyMMddHHmmss，如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则
     */
    @ApiField("time_end")
    private String timeEnd;
    /**
     * 交易状态描述
     * 是	String(256)	支付失败，请重新下单支付	对当前查询订单状态的描述和下一步操作的指引
     */
    @ApiField("trade_state_desc")
    private String tradeStateDesc;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getErrCodeDes() {
        return errCodeDes;
    }

    public void setErrCodeDes(String errCodeDes) {
        this.errCodeDes = errCodeDes;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getIsSubscribe() {
        return isSubscribe;
    }

    public void setIsSubscribe(String isSubscribe) {
        this.isSubscribe = isSubscribe;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public String getTradeState() {
        return tradeState;
    }

    public void setTradeState(String tradeState) {
        this.tradeState = tradeState;
    }

    public String getBankType() {
        return bankType;
    }

    public void setBankType(String bankType) {
        this.bankType = bankType;
    }

    public Integer getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(Integer totalFee) {
        this.totalFee = totalFee;
    }

    public String getFeeType() {
        return feeType;
    }

    public void setFeeType(String feeType) {
        this.feeType = feeType;
    }

    public Integer getCashFee() {
        return cashFee;
    }

    public void setCashFee(Integer cashFee) {
        this.cashFee = cashFee;
    }

    public String getCashFeeType() {
        return cashFeeType;
    }

    public void setCashFeeType(String cashFeeType) {
        this.cashFeeType = cashFeeType;
    }

    public Integer getSettlementTotalFee() {
        return settlementTotalFee;
    }

    public void setSettlementTotalFee(Integer settlementTotalFee) {
        this.settlementTotalFee = settlementTotalFee;
    }

    public Integer getCouponFee() {
        return couponFee;
    }

    public void setCouponFee(Integer couponFee) {
        this.couponFee = couponFee;
    }

    public Integer getCouponCount() {
        return couponCount;
    }

    public void setCouponCount(Integer couponCount) {
        this.couponCount = couponCount;
    }

    public String getCouponIdN() {
        return couponIdN;
    }

    public void setCouponIdN(String couponIdN) {
        this.couponIdN = couponIdN;
    }

    public String getCouponTypeN() {
        return couponTypeN;
    }

    public void setCouponTypeN(String couponTypeN) {
        this.couponTypeN = couponTypeN;
    }

    public Integer getCouponFeeN() {
        return couponFeeN;
    }

    public void setCouponFeeN(Integer couponFeeN) {
        this.couponFeeN = couponFeeN;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getAttach() {
        return attach;
    }

    public void setAttach(String attach) {
        this.attach = attach;
    }

    public String getTimeEnd() {
        return timeEnd;
    }

    public void setTimeEnd(String timeEnd) {
        this.timeEnd = timeEnd;
    }

    public String getTradeStateDesc() {
        return tradeStateDesc;
    }

    public void setTradeStateDesc(String tradeStateDesc) {
        this.tradeStateDesc = tradeStateDesc;
    }
}
src/main/java/net/arccode/wechat/pay/api/common/util/SDKUtils.java
public class SDKUtils {

    /**
     * 构造订单号
     * @return
     */
    public static String genOrderNo() {

        return "O" + DateUtils.convertDate2String("yyMMddHHmmssSSS") + RandomUtils.randomNInt(8);
    }

    /**
     * 构造结算号
     * @return
     */
    public static String genSettleNo() {

        return "S" + DateUtils.convertDate2String("yyMMddHHmmssSSS") + RandomUtils.randomNInt(8);
    }

    /**
     * 构造付款流水号
     * @return
     */
    public static String genOutTradeNo() {

        return "T" + DateUtils.convertDate2String("yyMMddHHmmssSSS") + RandomUtils.randomNInt(8);
    }

    /**
     * 构造退款流水号
     * @return
     */
    public static String genOutRefundNo() {

        return "R" + DateUtils.convertDate2String("yyMMddHHmmssSSS") + RandomUtils.randomNInt(8);
    }

    /**
     * 获取一定长度的随机字符串
     * @param length 指定字符串长度
     * @return 一定长度的字符串
     */
    public static String genRandomStringByLength(int length) {
        String base = "abcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < length; i++) {
            int number = random.nextInt(base.length());
            sb.append(base.charAt(number));
        }
        return sb.toString();
    }
}
src/main/java/net/arccode/wechat/pay/api/protocol/unified_order/UnifiedOrderRequest.java
public class UnifiedOrderRequest implements WXPayRequest<UnifiedOrderResponse> {

    /**==================== 协议可选参数 ====================**/

    /**
     * 货币类型, 可空, 默认为CNY
     */
    private String feeType;

    /**
     * 指定支付方式, 可空
     */
    private String limitPay;


    /**==================== 协议应用参数 ====================**/

    /**
     * 通知地址, 不可空
     */
    private String notifyUrl;

    /**
     * 交易类型, 不可空
     */
    private String tradeType;

    /**
     * 设备号, 可空
     */
    private String deviceInfo;

    /**
     * 商品描述, 不可空
     */
    private String body;

    /**
     * 商品详情, 可空
     */
    private String detail;

    /**
     * 附加数据, 可空
     */
    private String attach;

    /**
     * 商户订单号, 不可空
     */
    private String outTradeNo;

    /**
     * 总金额(分), 不可空
     */
    private Integer totalFee;

    /**
     * 终端IP, 不可空
     */
    private String spBillCreateIp;

    /**
     * 交易起始时间, 可空
     */
    private String timeStart;

    /**
     * 交易结束时间, 可空
     */
    private String timeExpire;

    /**
     * 商品标记, 可空
     */
    private String goodsTag;

    /**
     * 商品ID, 可空
     */
    private String productId;

    /**
     * 用户标识, 不可空
     */
    private String openId;

    /**
     * 随机字符串, 不可空
     */
    private String nonceStr;


    public UnifiedOrderRequest() {
    }

    public UnifiedOrderRequest(String body, String outTradeNo, Integer totalFee, String
            spBillCreateIp,
                               String notifyUrl, String tradeType, String nonceStr) {
        this.body = body;
        this.outTradeNo = outTradeNo;
        this.totalFee = totalFee;
        this.spBillCreateIp = spBillCreateIp;
        this.notifyUrl = notifyUrl;
        this.tradeType = tradeType;
        this.nonceStr = nonceStr;
    }

    @Override
    public String getHttpVerb() {
        return WXPayConstants.HTTP_POST;
    }

    @Override
    public String getApiURL() {
        return WXPayConstants.UNIFIED_ORDER_API;
    }

    @Override
    public Map<String, String> getApplicationParams() {
        ACHashMap txtParams = new ACHashMap();
        txtParams.put("device_info", this.deviceInfo);
        txtParams.put("body", this.body);
        txtParams.put("detail", this.detail);
        txtParams.put("attach", this.attach);
        txtParams.put("out_trade_no", this.outTradeNo);
        txtParams.put("total_fee", this.totalFee);
        txtParams.put("spbill_create_ip", this.spBillCreateIp);
        txtParams.put("time_start", this.timeStart);
        txtParams.put("time_expire", this.timeExpire);
        txtParams.put("goods_tag", this.goodsTag);
        txtParams.put("product_id", this.productId);
        txtParams.put("openid", this.openId);
        txtParams.put("notify_url", this.notifyUrl);
        txtParams.put("trade_type", this.tradeType);
        txtParams.put("nonce_str", this.nonceStr);

        return txtParams;
    }

    @Override
    public Class<UnifiedOrderResponse> getResponseClass() {
        return UnifiedOrderResponse.class;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getFeeType() {
        return feeType;
    }

    public void setFeeType(String feeType) {
        this.feeType = feeType;
    }

    public String getLimitPay() {
        return limitPay;
    }

    public void setLimitPay(String limitPay) {
        this.limitPay = limitPay;
    }

    public String getNotifyUrl() {
        return notifyUrl;
    }

    public void setNotifyUrl(String notifyUrl) {
        this.notifyUrl = notifyUrl;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getBody() {
        return body;
    }

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

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public String getAttach() {
        return attach;
    }

    public void setAttach(String attach) {
        this.attach = attach;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public Integer getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(Integer totalFee) {
        this.totalFee = totalFee;
    }

    public String getSpBillCreateIp() {
        return spBillCreateIp;
    }

    public void setSpBillCreateIp(String spBillCreateIp) {
        this.spBillCreateIp = spBillCreateIp;
    }

    public String getTimeStart() {
        return timeStart;
    }

    public void setTimeStart(String timeStart) {
        this.timeStart = timeStart;
    }

    public String getTimeExpire() {
        return timeExpire;
    }

    public void setTimeExpire(String timeExpire) {
        this.timeExpire = timeExpire;
    }

    public String getGoodsTag() {
        return goodsTag;
    }

    public void setGoodsTag(String goodsTag) {
        this.goodsTag = goodsTag;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }
}
src/main/java/net/arccode/wechat/pay/api/protocol/mch_pay/MchPayRequest.java
public class MchPayRequest implements WXPayRequest<MchPayResponse> {

    /**==================== 协议可选参数 ====================**/


    /**==================== 协议应用参数 ====================**/

    /**
     * 设备号	必填: 否
     * <p/>
     * 013467007045764	String(32)	微信支付分配的终端设备号
     */
    private String deviceInfo;

    /**
     * 商户订单号	必填: 是
     * <p/>
     * 10000098201411111234567890	String	商户订单号，需保持唯一性
     */
    private String partnerTradeNo;

    /**
     * 用户openid	必填: 是
     * <p/>
     * oxTWIuGaIt6gTKsQRLau2M0yL16E	String	商户appid下，某用户的openid
     */
    private String openId;

    /**
     * 校验用户姓名选项	必填: 是
     * <p/>
     * String
     * <p/>
     * NO_CHECK：不校验真实姓名
     * FORCE_CHECK：强校验真实姓名（未实名认证的用户会校验失败，无法转账）
     * OPTION_CHECK：针对已实名认证的用户才校验真实姓名(未实名认证用户不校验，可以转账成功)
     */
    private String checkName;

    /**
     * 收款用户姓名 必填: 否
     * <p/>
     * 马花花	String	收款用户真实姓名。
     */
    private String reUserName;

    /**
     * 企业付款金额
     * 必填: 是
     * 企业付款金额，单位为分
     */
    private Integer amount;

    /**
     * 企业付款描述信息	必填: 是
     * <p/>
     * 理赔	String	企业付款操作说明信息.
     */
    private String desc;

    /**
     * Ip地址	必填: 是
     * <p/>
     * 192.168.0.1	String(32)	调用接口的机器Ip地址
     */
    private String spBillCreateIp;

    /**
     * 随机字符串	必填: 是
     * <p/>
     * 5K8264ILTKCH16CQ2502SI8ZNMTM67VS	String(32)	随机字符串，不长于32位
     */
    private String nonceStr;

    public MchPayRequest() {
    }

    public MchPayRequest(String partnerTradeNo, String openId, String checkName, Integer amount,
                         String desc, String spBillCreateIp, String nonceStr) {
        this.partnerTradeNo = partnerTradeNo;
        this.openId = openId;
        this.checkName = checkName;
        this.amount = amount;
        this.desc = desc;
        this.spBillCreateIp = spBillCreateIp;
        this.nonceStr = nonceStr;
    }

    @Override
    public String getHttpVerb() {
        return WXPayConstants.HTTPS_POST_CA_MCH_PAY;
    }

    @Override
    public String getApiURL() {
        return WXPayConstants.MCH_PAY_API;
    }

    @Override
    public Map<String, String> getApplicationParams() {
        ACHashMap txtParams = new ACHashMap();
        txtParams.put("device_info", this.deviceInfo);
        txtParams.put("partner_trade_no", this.partnerTradeNo);
        txtParams.put("openid", this.openId);
        txtParams.put("check_name", this.checkName);
        txtParams.put("re_user_name", this.reUserName);
        txtParams.put("amount", this.amount);
        txtParams.put("desc", this.desc);
        txtParams.put("spbill_create_ip", this.spBillCreateIp);
        txtParams.put("nonce_str", this.nonceStr);

        return txtParams;
    }

    @Override
    public Class<MchPayResponse> getResponseClass() {
        return MchPayResponse.class;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getPartnerTradeNo() {
        return partnerTradeNo;
    }

    public void setPartnerTradeNo(String partnerTradeNo) {
        this.partnerTradeNo = partnerTradeNo;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getCheckName() {
        return checkName;
    }

    public void setCheckName(String checkName) {
        this.checkName = checkName;
    }

    public String getReUserName() {
        return reUserName;
    }

    public void setReUserName(String reUserName) {
        this.reUserName = reUserName;
    }

    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getSpBillCreateIp() {
        return spBillCreateIp;
    }

    public void setSpBillCreateIp(String spBillCreateIp) {
        this.spBillCreateIp = spBillCreateIp;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }
}
src/main/java/net/arccode/wechat/pay/api/protocol/unified_order/UnifiedOrderResponse.java
public class UnifiedOrderResponse extends WXPayResponse {
    private static final long serialVersionUID = -116106125361949648L;

    /**==================== 以下字段在return_code为SUCCESS的时候有返回 ====================**/

    /**
     * 公众号ID
     */
    @ApiField("appid")
    private String appId;

    /**
     * 商户号
     */
    @ApiField("mch_id")
    private String mchId;

    /**
     * 设备号
     */
    @ApiField("device_info")
    private String deviceInfo;

    /**
     * 随机字符串
     */
    @ApiField("nonce_str")
    private String nonceStr;

    /**
     * 签名
     */
    @ApiField("sign")
    private String sign;

    /**
     * 业务结果
     */
    @ApiField("result_code")
    private String resultCode;

    /**
     * 错误代码
     */
    @ApiField("err_code")
    private String errCode;

    /**
     * 错误代码描述
     */
    @ApiField("err_code_des")
    private String errCodeDes;

    /**==================== 以下字段在return_code 和result_code都为SUCCESS的时候有返回 ====================**/

    /**
     * 交易类型
     */
    @ApiField("trade_type")
    private String tradeType;

    /**
     * 预支付交易会话标识
     */
    @ApiField("prepay_id")
    private String prepayId;

    /**
     * 二维码链接
     */
    @ApiField("code_url")
    private String codeUrl;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getErrCodeDes() {
        return errCodeDes;
    }

    public void setErrCodeDes(String errCodeDes) {
        this.errCodeDes = errCodeDes;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public String getPrepayId() {
        return prepayId;
    }

    public void setPrepayId(String prepayId) {
        this.prepayId = prepayId;
    }

    public String getCodeUrl() {
        return codeUrl;
    }

    public void setCodeUrl(String codeUrl) {
        this.codeUrl = codeUrl;
    }
}
src/main/java/net/arccode/wechat/pay/api/protocol/pay_notify/PayNotifyResponse.java
public class PayNotifyResponse extends WXPayResponse {
    private static final long serialVersionUID = 5980237292242838244L;

    /**==================== 以下字段在return_code为SUCCESS的时候有返回 ====================**/

    /**
     * 公众账号ID 不可空*
     */
    @ApiField("appid")
    private String appId;

    /**
     * 商户号 不可空*
     */
    @ApiField("mch_id")
    private String mchId;

    /**
     * 设备号 可空*
     */
    @ApiField("device_info")
    private String deviceInfo;

    /**
     * 随机字符串 不可空*
     */
    @ApiField("nonce_str")
    private String nonceStr;

    /**
     * 签名 不可空*
     */
    @ApiField("sign")
    private String sign;

    /**
     * 业务结果 不可空*
     */
    @ApiField("result_code")
    private String resultCode;

    /**
     * 错误代码 可空*
     */
    @ApiField("err_code")
    private String errCode;

    /**
     * 错误代码描述 可空*
     */
    @ApiField("err_code_des")
    private String errCodeDes;

    /**
     * 用户标识 不可空*
     */
    @ApiField("openid")
    private String openId;

    /**
     * 是否关注公众账号 可空*
     */
    @ApiField("is_subscrib")
    private String isSubscrib;
    /**
     * 交易类型 不可空*
     */
    @ApiField("trade_type")
    private String tradeType;

    /**
     * 付款银行 不可空*
     */
    @ApiField("bank_type")
    private String bankType;

    /**
     * 总金额 不可空*
     */
    @ApiField("total_fee")
    private Integer totalFee;
    /**
     * 货币种类 可空*
     */
    @ApiField("fee_type")
    private String feeType;

    /**
     * 现金支付金额 不可空*
     */
    @ApiField("cash_fee")
    private String cashFee;

    /**
     * 现金支付货币类型 可空*
     */
    @ApiField("cash_fee_type")
    private Integer cashFeeType;
    /**
     * 代金券或立减优惠金额 可空*
     */
    @ApiField("coupon_fee")
    private Integer couponFee;
    /**
     * 代金券或立减优惠使用数量 可空*
     */
    @ApiField("coupon_count")
    private Integer couponCount;

    /**
     * 代金券或立减优惠ID 可空*
     */
    @ApiField("coupon_id_$n")
    private String couponIdN;

    /**
     * 单个代金券或立减优惠支付金额 可空*
     */
    @ApiField("coupon_fee_$n")
    private Integer couponFeeN;

    /**
     * 微信支付订单号 不可空*
     */
    @ApiField("transaction_id")
    private String transactionId;

    /**
     * 商户订单号 不可空*
     */
    @ApiField("out_trade_no")
    private String outTradeNo;

    /**
     * 商家数据包 可空*
     */
    @ApiField("attach")
    private String attach;

    /**
     * 支付完成时间 不可空*
     */
    @ApiField("time_end")
    private String timeEnd;

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getMchId() {
        return mchId;
    }

    public void setMchId(String mchId) {
        this.mchId = mchId;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getResultCode() {
        return resultCode;
    }

    public void setResultCode(String resultCode) {
        this.resultCode = resultCode;
    }

    public String getErrCode() {
        return errCode;
    }

    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public String getErrCodeDes() {
        return errCodeDes;
    }

    public void setErrCodeDes(String errCodeDes) {
        this.errCodeDes = errCodeDes;
    }

    public String getOpenId() {
        return openId;
    }

    public void setOpenId(String openId) {
        this.openId = openId;
    }

    public String getIsSubscrib() {
        return isSubscrib;
    }

    public void setIsSubscrib(String isSubscrib) {
        this.isSubscrib = isSubscrib;
    }

    public String getTradeType() {
        return tradeType;
    }

    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    }

    public String getBankType() {
        return bankType;
    }

    public void setBankType(String bankType) {
        this.bankType = bankType;
    }

    public Integer getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(Integer totalFee) {
        this.totalFee = totalFee;
    }

    public String getFeeType() {
        return feeType;
    }

    public void setFeeType(String feeType) {
        this.feeType = feeType;
    }

    public String getCashFee() {
        return cashFee;
    }

    public void setCashFee(String cashFee) {
        this.cashFee = cashFee;
    }

    public Integer getCashFeeType() {
        return cashFeeType;
    }

    public void setCashFeeType(Integer cashFeeType) {
        this.cashFeeType = cashFeeType;
    }

    public Integer getCouponFee() {
        return couponFee;
    }

    public void setCouponFee(Integer couponFee) {
        this.couponFee = couponFee;
    }

    public Integer getCouponCount() {
        return couponCount;
    }

    public void setCouponCount(Integer couponCount) {
        this.couponCount = couponCount;
    }

    public String getCouponIdN() {
        return couponIdN;
    }

    public void setCouponIdN(String couponIdN) {
        this.couponIdN = couponIdN;
    }

    public Integer getCouponFeeN() {
        return couponFeeN;
    }

    public void setCouponFeeN(Integer couponFeeN) {
        this.couponFeeN = couponFeeN;
    }

    public String getTransactionId() {
        return transactionId;
    }

    public void setTransactionId(String transactionId) {
        this.transactionId = transactionId;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getAttach() {
        return attach;
    }

    public void setAttach(String attach) {
        this.attach = attach;
    }

    public String getTimeEnd() {
        return timeEnd;
    }

    public void setTimeEnd(String timeEnd) {
        this.timeEnd = timeEnd;
    }

    public boolean isBizSuccess() {
        return "SUCCESS".equalsIgnoreCase(this.resultCode);
    }


}
src/main/java/net/arccode/wechat/pay/api/protocol/refund/RefundRequest.java
public class RefundRequest implements WXPayRequest<RefundResponse> {

    /**==================== 协议可选参数 ====================**/

    /**
     * 货币种类, 可空, 符合ISO 4217标准的三位字母代码，默认人民币：CNY，其他值列表详见货币类型
     */
    private String refundFeeType;

    /**==================== 协议应用参数 ====================**/

    /**
     * 设备号, 可空
     */
    private String deviceInfo;

    /**
     * 商户订单号, 不可空
     */
    private String outTradeNo;

    /**
     * 商户退款单号, 不可空
     */
    private String outRefundNo;

    /**
     * 总金额(分), 不可空
     */
    private Integer totalFee;

    /**
     * 退款金额(分), 不可空
     */
    private Integer refundFee;

    /**
     * 操作员, 不可空, 操作员帐号, 默认为商户号
     */
    private String opUserId;

    /**
     * 随机字符串, 不可空
     */
    private String nonceStr;

    public RefundRequest() {
    }

    public RefundRequest(String outTradeNo, String outRefundNo, Integer totalFee, Integer refundFee,
                         String opUserId, String nonceStr) {
        this.outTradeNo = outTradeNo;
        this.outRefundNo = outRefundNo;
        this.totalFee = totalFee;
        this.refundFee = refundFee;
        this.opUserId = opUserId;
        this.nonceStr = nonceStr;
    }

    @Override
    public String getHttpVerb() {
        return WXPayConstants.HTTPS_POST_CA_REFUND;
    }

    @Override
    public String getApiURL() {
        return WXPayConstants.REFUND_API;
    }

    @Override
    public Map<String, String> getApplicationParams() {
        ACHashMap txtParams = new ACHashMap();
        txtParams.put("device_info", this.deviceInfo);
        txtParams.put("out_trade_no", this.outTradeNo);
        txtParams.put("out_refund_no", this.outRefundNo);
        txtParams.put("total_fee", this.totalFee);
        txtParams.put("refund_fee", this.refundFee);
        txtParams.put("op_user_id", this.opUserId);
        txtParams.put("nonce_str", this.nonceStr);

        return txtParams;
    }

    @Override
    public Class<RefundResponse> getResponseClass() {
        return RefundResponse.class;
    }

    public String getRefundFeeType() {
        return refundFeeType;
    }

    public void setRefundFeeType(String refundFeeType) {
        this.refundFeeType = refundFeeType;
    }

    public String getDeviceInfo() {
        return deviceInfo;
    }

    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }

    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    public String getOutRefundNo() {
        return outRefundNo;
    }

    public void setOutRefundNo(String outRefundNo) {
        this.outRefundNo = outRefundNo;
    }

    public Integer getTotalFee() {
        return totalFee;
    }

    public void setTotalFee(Integer totalFee) {
        this.totalFee = totalFee;
    }

    public Integer getRefundFee() {
        return refundFee;
    }

    public void setRefundFee(Integer refundFee) {
        this.refundFee = refundFee;
    }

    public String getOpUserId() {
        return opUserId;
    }

    public void setOpUserId(String opUserId) {
        this.opUserId = opUserId;
    }

    public String getNonceStr() {
        return nonceStr;
    }

    public void setNonceStr(String nonceStr) {
        this.nonceStr = nonceStr;
    }
}


Question: package net.arccode.wechat.pay.api.service;
import com.alibaba.fastjson.JSON;
import net.arccode.wechat.pay.api.common.exception.WXPayApiException;
import net.arccode.wechat.pay.api.protocol.mch_pay.MchPayResponse;
import net.arccode.wechat.pay.api.protocol.pay_notify.PayNotifyResponse;
import net.arccode.wechat.pay.api.common.util.SDKUtils;
import net.arccode.wechat.pay.api.protocol.mch_pay.MchPayRequest;
import net.arccode.wechat.pay.api.protocol.query_order.QueryOrderRequest;
import net.arccode.wechat.pay.api.protocol.query_order.QueryOrderResponse;
import net.arccode.wechat.pay.api.protocol.refund.RefundRequest;
import net.arccode.wechat.pay.api.protocol.refund.RefundResponse;
import net.arccode.wechat.pay.api.protocol.unified_order.UnifiedOrderRequest;
import net.arccode.wechat.pay.api.protocol.unified_order.UnifiedOrderResponse;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * 微信客户端测试类
 *
 * @author http://arccode.net
 * @since 2015-11-05
 */
public class WXPayClientTest {

    private static final Logger LOG = LoggerFactory.getLogger(WXPayClientTest.class);

    private WXPayClient wxPayClient;

    private WXPayClient wxPayVIPClient;

    private String asyncNotifyUrl = "http://domain:port/path";

    @Before
    public void before() {

        // 以下配置参数根据公司申请的微信支付帐号填写
        String appId = "";
        String mchId = "";
        String key = "";
        String certPwd = "";
        // 绝对路径, 用于退款和商户支付
        String certPath = "";

        wxPayClient = new WXPayClient(appId, mchId, key);
        wxPayVIPClient = new WXPayClient(appId, mchId, key, certPwd, certPath);
    }

    /**
     * 扫码支付下单
     */
    @Test
    public void scanPay() throws WXPayApiException {

        String nonceStr = SDKUtils.genRandomStringByLength(32);
        UnifiedOrderRequest request = new UnifiedOrderRequest("commodity-899", SDKUtils
                .genOutTradeNo(),
                1, "192.168.1.1", asyncNotifyUrl, "NATIVE", nonceStr);

Answer:         UnifiedOrderResponse response = wxPayClient.execute(request);