add no-arg default constructor for xmlbeans

This commit is contained in:
jinyu 2015-06-04 17:45:35 +08:00
parent dce67fcc80
commit daafd450a0
34 changed files with 153 additions and 61 deletions

View File

@ -247,6 +247,7 @@ public final class XmlStream {
try { try {
JAXBContext jaxbContext = JAXBContext.newInstance(clazz); JAXBContext jaxbContext = JAXBContext.newInstance(clazz);
marshaller = jaxbContext.createMarshaller(); marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, Consts.UTF_8.name());
messageMarshaller.put(clazz, marshaller); messageMarshaller.put(clazz, marshaller);
} catch (JAXBException e) { } catch (JAXBException e) {
throw new IllegalArgumentException(e); throw new IllegalArgumentException(e);

View File

@ -33,6 +33,10 @@ public class JsPayNotify extends PayBaseInfo {
@XmlElement(name = "IsSubscribe") @XmlElement(name = "IsSubscribe")
private int issubscribe; private int issubscribe;
public JsPayNotify() {
}
public String getOpenid() { public String getOpenid() {
return openid; return openid;
} }

View File

@ -58,6 +58,10 @@ public class MicroPayPackage extends PayPackage {
@JSONField(name = "auth_code") @JSONField(name = "auth_code")
private String authCode; private String authCode;
protected MicroPayPackage(){
// jaxb required
}
public MicroPayPackage(WeixinMpAccount weixinAccount, String body, public MicroPayPackage(WeixinMpAccount weixinAccount, String body,
String attach, String outTradeNo, double totalFee, String attach, String outTradeNo, double totalFee,
String spbillCreateIp, String authCode) { String spbillCreateIp, String authCode) {

View File

@ -179,9 +179,10 @@ public class PayPackage implements Serializable {
this.notifyUrl = notifyUrl; this.notifyUrl = notifyUrl;
} }
public PayPackage() { protected PayPackage(){
// jaxb required
} }
/** /**
* 订单对象 * 订单对象
* *

View File

@ -173,6 +173,10 @@ public class CouponDetail extends ApiResult {
@JSONField(name = "is_partial_use") @JSONField(name = "is_partial_use")
private int isPartialUse; private int isPartialUse;
public CouponDetail(){
}
public String getCouponStockId() { public String getCouponStockId() {
return couponStockId; return couponStockId;
} }

View File

@ -43,6 +43,10 @@ public class CouponInfo implements Serializable {
@JSONField(name = "coupon_fee") @JSONField(name = "coupon_fee")
private Integer couponFee; private Integer couponFee;
public CouponInfo(){
}
public String getCouponBatchId() { public String getCouponBatchId() {
return couponBatchId; return couponBatchId;
} }

View File

@ -72,11 +72,14 @@ public class CouponResult extends ApiResult {
@JSONField(name = "ret_msg") @JSONField(name = "ret_msg")
private String retMsg; private String retMsg;
public CouponResult(){
}
public String getCouponStockId() { public String getCouponStockId() {
return couponStockId; return couponStockId;
} }
public int getResponseCount() { public int getResponseCount() {
return responseCount; return responseCount;
} }

View File

@ -119,6 +119,10 @@ public class CouponStock extends ApiResult {
@JSONField(name = "coupon_budget") @JSONField(name = "coupon_budget")
private Integer couponBudget; private Integer couponBudget;
public CouponStock(){
}
public String getCouponStockId() { public String getCouponStockId() {
return couponStockId; return couponStockId;
} }

View File

@ -64,6 +64,10 @@ public class ApiResult implements Serializable {
@XmlElement(name = "sign_type") @XmlElement(name = "sign_type")
private SignType signType; private SignType signType;
protected ApiResult(){
// jaxb required
}
public int getRetCode() { public int getRetCode() {
return retCode; return retCode;
} }

View File

@ -33,6 +33,10 @@ public class JsPayRequestV2 extends PayRequest {
private static final long serialVersionUID = -5972173459255255197L; private static final long serialVersionUID = -5972173459255255197L;
protected JsPayRequestV2(){
// jaxb required
}
public JsPayRequestV2(WeixinMpAccount weixinAccount, PayPackageV2 payPackage) { public JsPayRequestV2(WeixinMpAccount weixinAccount, PayPackageV2 payPackage) {
this.setAppId(weixinAccount.getId()); this.setAppId(weixinAccount.getId());
this.setPackageInfo(package2string(payPackage, this.setPackageInfo(package2string(payPackage,

View File

@ -28,14 +28,14 @@ public class NativePayNotifyV2 extends JsPayNotify {
@XmlElement(name = "ProductId") @XmlElement(name = "ProductId")
private String productId; private String productId;
private NativePayNotifyV2(){
// jaxb required
}
public String getProductId() { public String getProductId() {
return productId; return productId;
} }
public void setProductId(String productId) {
this.productId = productId;
}
@Override @Override
public String toString() { public String toString() {
return "NativePayNotifyV2 [productId=" + productId + ", " return "NativePayNotifyV2 [productId=" + productId + ", "

View File

@ -32,6 +32,10 @@ public class NativePayResponseV2 extends JsPayRequestV2 {
@XmlElement(name = "RetErrMsg") @XmlElement(name = "RetErrMsg")
private String retMsg; private String retMsg;
protected NativePayResponseV2(){
// jaxb required
}
public NativePayResponseV2(WeixinMpAccount weixinAccount, public NativePayResponseV2(WeixinMpAccount weixinAccount,
PayPackageV2 payPackage) { PayPackageV2 payPackage) {
super(weixinAccount, payPackage); super(weixinAccount, payPackage);

View File

@ -2,10 +2,6 @@ package com.foxinmy.weixin4j.mp.payment.v2;
import java.util.Date; import java.util.Date;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.foxinmy.weixin4j.mp.type.CurrencyType; import com.foxinmy.weixin4j.mp.type.CurrencyType;
import com.foxinmy.weixin4j.mp.type.TradeState; import com.foxinmy.weixin4j.mp.type.TradeState;
@ -20,8 +16,6 @@ import com.foxinmy.weixin4j.util.DateUtil;
* @since JDK 1.7 * @since JDK 1.7
* @see * @see
*/ */
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Order extends ApiResult { public class Order extends ApiResult {
private static final long serialVersionUID = 4543552984506609920L; private static final long serialVersionUID = 4543552984506609920L;

View File

@ -63,6 +63,10 @@ public class PayFeedback extends PayBaseInfo {
@XmlElement(name = "MsgType") @XmlElement(name = "MsgType")
private String status; private String status;
public PayFeedback() {
}
public String getFeedbackId() { public String getFeedbackId() {
return feedbackId; return feedbackId;
} }

View File

@ -61,6 +61,10 @@ public class PayPackageV2 extends PayPackage {
@JSONField(name = "input_charset") @JSONField(name = "input_charset")
private String inputCharset; private String inputCharset;
protected PayPackageV2() {
// jaxb required
}
public PayPackageV2(String outTradeNo, double totalFee, public PayPackageV2(String outTradeNo, double totalFee,
String spbillCreateIp) { String spbillCreateIp) {
this(null, null, null, outTradeNo, totalFee, null, spbillCreateIp, this(null, null, null, outTradeNo, totalFee, null, spbillCreateIp,

View File

@ -38,6 +38,10 @@ public class PayWarn extends PayBaseInfo {
@XmlElement(name = "AlarmContent") @XmlElement(name = "AlarmContent")
private String alarmcontent; private String alarmcontent;
public PayWarn() {
}
public String getErrortype() { public String getErrortype() {
return errortype; return errortype;
} }

View File

@ -68,6 +68,10 @@ public class RefundDetail extends ApiResult {
@JSONField(name = "reccv_user_name") @JSONField(name = "reccv_user_name")
private String reccvUserName; private String reccvUserName;
protected RefundDetail() {
// jaxb required
}
public String getOutRefundNo() { public String getOutRefundNo() {
return outRefundNo; return outRefundNo;
} }

View File

@ -50,6 +50,10 @@ public class RefundRecord extends ApiResult {
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false, deserialize = false)
private List<RefundDetail> refundList; private List<RefundDetail> refundList;
protected RefundRecord() {
// jaxb required
}
public String getTransactionId() { public String getTransactionId() {
return transactionId; return transactionId;
} }

View File

@ -35,6 +35,10 @@ public class RefundResult extends RefundDetail {
@JSONField(name = "out_trade_no") @JSONField(name = "out_trade_no")
private String outTradeNo; private String outTradeNo;
protected RefundResult() {
// jaxb required
}
public String getTransactionId() { public String getTransactionId() {
return transactionId; return transactionId;
} }

View File

@ -63,7 +63,7 @@ public class ApiResult extends XmlResult {
*/ */
private String recall; private String recall;
public ApiResult() { protected ApiResult() {
} }

View File

@ -64,6 +64,10 @@ public class MPPayment implements Serializable {
@JSONField(name = "spbill_create_ip") @JSONField(name = "spbill_create_ip")
private String clientIp; private String clientIp;
protected MPPayment() {
// jaxb required
}
/** /**
* 企业付款 * 企业付款
* @param outTradeNo 商户的订单号 * @param outTradeNo 商户的订单号

View File

@ -41,6 +41,10 @@ public class MPPaymentResult extends ApiResult {
@XmlElement(name = "payment_time") @XmlElement(name = "payment_time")
private String paymentTime; private String paymentTime;
protected MPPaymentResult() {
// jaxb required
}
public String getTransactionId() { public String getTransactionId() {
return transactionId; return transactionId;
} }

View File

@ -26,14 +26,14 @@ public class NativePayNotifyV3 extends ApiResult {
@XmlElement(name = "product_id") @XmlElement(name = "product_id")
private String productId; private String productId;
protected NativePayNotifyV3() {
// jaxb required
}
public String getProductId() { public String getProductId() {
return productId; return productId;
} }
public void setProductId(String productId) {
this.productId = productId;
}
@Override @Override
public String toString() { public String toString() {
return "NativePayNotifyV3 [productId=" + productId + ", " return "NativePayNotifyV3 [productId=" + productId + ", "

View File

@ -32,6 +32,10 @@ public class NativePayResponseV3 extends ApiResult {
private String prepay_id; private String prepay_id;
protected NativePayResponseV3() {
// jaxb required
}
/** /**
* 一般作为校验失败时返回 * 一般作为校验失败时返回
* *

View File

@ -132,6 +132,10 @@ public class Order extends ApiResult {
@JSONField(name = "trade_state_desc") @JSONField(name = "trade_state_desc")
private String tradeStateDesc; private String tradeStateDesc;
protected Order() {
// jaxb required
}
public TradeState getTradeState() { public TradeState getTradeState() {
return tradeState; return tradeState;
} }

View File

@ -71,6 +71,10 @@ public class PayPackageV3 extends PayPackage {
@JSONField(name = "product_id") @JSONField(name = "product_id")
private String productId; private String productId;
protected PayPackageV3() {
// jaxb required
}
public PayPackageV3(WeixinMpAccount weixinAccount, String openId, public PayPackageV3(WeixinMpAccount weixinAccount, String openId,
String body, String outTradeNo, double totalFee, String body, String outTradeNo, double totalFee,
String spbillCreateIp, TradeType tradeType) { String spbillCreateIp, TradeType tradeType) {

View File

@ -30,6 +30,10 @@ public class PayRequestV3 extends PayRequest {
private static final long serialVersionUID = -5972173459255255197L; private static final long serialVersionUID = -5972173459255255197L;
protected PayRequestV3() {
// jaxb required
}
public PayRequestV3(PrePay prePay) throws PayException { public PayRequestV3(PrePay prePay) throws PayException {
this.setAppId(prePay.getAppId()); this.setAppId(prePay.getAppId());
this.setPackageInfo("prepay_id=" + prePay.getPrepayId()); this.setPackageInfo("prepay_id=" + prePay.getPrepayId());

View File

@ -40,8 +40,8 @@ public class PrePay extends ApiResult {
@XmlElement(name = "code_url") @XmlElement(name = "code_url")
private String codeUrl; private String codeUrl;
public PrePay() { protected PrePay() {
// jaxb required
} }
public PrePay(String returnCode, String returnMsg) { public PrePay(String returnCode, String returnMsg) {

View File

@ -118,52 +118,53 @@ public class Redpacket implements Serializable {
@JSONField(name = "share_imgurl") @JSONField(name = "share_imgurl")
private String shareImageUrl; private String shareImageUrl;
public String getOutTradeNo() { protected Redpacket() {
return outTradeNo; // jaxb required
} }
public void setOutTradeNo(String outTradeNo) { /**
* 红包
*
* @param outTradeNo
* 商户侧一天内不可重复的订单号 接口根据商户订单号支持重入 如出现超时可再调用
* @param nickName
* 提供方名称
* @param sendName
* 红包发送者名称
* @param openid
* 接受收红包的用户的openid
* @param totalAmount
* 付款金额 <font color="red">单位为元,自动格式化为分</font>
*/
public Redpacket(String outTradeNo, String nickName, String sendName,
String openid, double totalAmount) {
this.outTradeNo = outTradeNo; this.outTradeNo = outTradeNo;
this.nickName = nickName;
this.sendName = sendName;
this.openid = openid;
this.totalAmount = DateUtil.formaFee2Fen(totalAmount);
}
public String getOutTradeNo() {
return outTradeNo;
} }
public String getNickName() { public String getNickName() {
return nickName; return nickName;
} }
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getSendName() { public String getSendName() {
return sendName; return sendName;
} }
public void setSendName(String sendName) {
this.sendName = sendName;
}
public String getOpenid() { public String getOpenid() {
return openid; return openid;
} }
public void setOpenid(String openid) {
this.openid = openid;
}
public String getTotalAmount() { public String getTotalAmount() {
return totalAmount; return totalAmount;
} }
/**
* <font color="red">单位为元,自动格式化为分</font>
*
* @param totalAmount
* 付款金额 单位为元
*/
public void setTotalAmount(double totalAmount) {
this.totalAmount = DateUtil.formaFee2Fen(totalAmount);
}
public String getMinValue() { public String getMinValue() {
return minValue; return minValue;
} }
@ -172,7 +173,7 @@ public class Redpacket implements Serializable {
* <font color="red">单位为元,自动格式化为分</font> * <font color="red">单位为元,自动格式化为分</font>
* *
* @param minValue * @param minValue
* 最小红包 单位为元 * 最小红包 单位为元
*/ */
public void setMinValue(double minValue) { public void setMinValue(double minValue) {
this.minValue = DateUtil.formaFee2Fen(minValue); this.minValue = DateUtil.formaFee2Fen(minValue);
@ -186,7 +187,7 @@ public class Redpacket implements Serializable {
* <font color="red">单位为元,自动格式化为分</font> * <font color="red">单位为元,自动格式化为分</font>
* *
* @param minValue * @param minValue
* 最大红包 单位为元 * 最大红包 单位为元
*/ */
public void setMaxValue(double maxValue) { public void setMaxValue(double maxValue) {
this.maxValue = DateUtil.formaFee2Fen(maxValue); this.maxValue = DateUtil.formaFee2Fen(maxValue);
@ -266,13 +267,13 @@ public class Redpacket implements Serializable {
@Override @Override
public String toString() { public String toString() {
return "Redpacket [ nickName=" + nickName return "Redpacket [ nickName=" + nickName + ", sendName=" + sendName
+ ", sendName=" + sendName + ", openid=" + openid + ", openid=" + openid + ", totalAmount=" + totalAmount
+ ", totalAmount=" + totalAmount + ", minValue=" + minValue + ", minValue=" + minValue + ", maxValue=" + maxValue
+ ", maxValue=" + maxValue + ", totalNum=" + totalNum + ", totalNum=" + totalNum + ", wishing=" + wishing
+ ", wishing=" + wishing + ", clientIp=" + clientIp + ", clientIp=" + clientIp + ", actName=" + actName
+ ", actName=" + actName + ", remark=" + remark + ", logoUrl=" + ", remark=" + remark + ", logoUrl=" + logoUrl
+ logoUrl + ", shareContent=" + shareContent + ", shareUrl=" + ", shareContent=" + shareContent + ", shareUrl=" + shareUrl
+ shareUrl + ", shareImageUrl=" + shareImageUrl + "]"; + ", shareImageUrl=" + shareImageUrl + "]";
} }
} }

View File

@ -53,6 +53,10 @@ public class RedpacketSendResult extends XmlResult {
@JSONField(name = "total_amount") @JSONField(name = "total_amount")
private int totalAmount; private int totalAmount;
protected RedpacketSendResult() {
// jaxb required
}
public String getAppid() { public String getAppid() {
return appid; return appid;
} }

View File

@ -133,6 +133,10 @@ public class RefundDetail extends ApiResult {
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false, deserialize = false)
private List<CouponInfo> couponList; private List<CouponInfo> couponList;
protected RefundDetail() {
// jaxb required
}
public String getOutRefundNo() { public String getOutRefundNo() {
return outRefundNo; return outRefundNo;
} }

View File

@ -92,6 +92,10 @@ public class RefundRecord extends ApiResult {
@JSONField(serialize = false, deserialize = false) @JSONField(serialize = false, deserialize = false)
private List<RefundDetail> refundList; private List<RefundDetail> refundList;
protected RefundRecord() {
// jaxb required
}
public String getTransactionId() { public String getTransactionId() {
return transactionId; return transactionId;
} }

View File

@ -35,6 +35,10 @@ public class RefundResult extends RefundDetail {
@JSONField(name = "out_trade_no") @JSONField(name = "out_trade_no")
private String outTradeNo; private String outTradeNo;
protected RefundResult() {
// jaxb required
}
public String getTransactionId() { public String getTransactionId() {
return transactionId; return transactionId;
} }

View File

@ -22,17 +22,13 @@ public class CashTest extends CouponTest {
@Test @Test
public void sendRedpacket() throws WeixinException { public void sendRedpacket() throws WeixinException {
Redpacket redpacket = new Redpacket(); Redpacket redpacket = new Redpacket("HB001", "无忧钱庄", "无忧钱庄",
"oyFLst1bqtuTcxK-ojF8hOGtLQao", 1d);
redpacket.setActName("红包测试"); redpacket.setActName("红包测试");
redpacket.setClientIp("127.0.0.1"); redpacket.setClientIp("127.0.0.1");
redpacket.setMaxValue(1d); redpacket.setMaxValue(1d);
redpacket.setMinValue(1d); redpacket.setMinValue(1d);
redpacket.setNickName("无忧钱庄");
redpacket.setOpenid("oyFLst1bqtuTcxK-ojF8hOGtLQao");
redpacket.setOutTradeNo("HB001");
redpacket.setRemark("快来领取红包吧!"); redpacket.setRemark("快来领取红包吧!");
redpacket.setSendName("无忧钱庄");
redpacket.setTotalAmount(1d);
redpacket.setTotalNum(1); redpacket.setTotalNum(1);
redpacket.setWishing("来就送钱"); redpacket.setWishing("来就送钱");
RedpacketSendResult result = WEIXINPAY.sendRedpack(caFile, redpacket); RedpacketSendResult result = WEIXINPAY.sendRedpack(caFile, redpacket);