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 {
JAXBContext jaxbContext = JAXBContext.newInstance(clazz);
marshaller = jaxbContext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_ENCODING, Consts.UTF_8.name());
messageMarshaller.put(clazz, marshaller);
} catch (JAXBException e) {
throw new IllegalArgumentException(e);

View File

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

View File

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

View File

@ -179,9 +179,10 @@ public class PayPackage implements Serializable {
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")
private int isPartialUse;
public CouponDetail(){
}
public String getCouponStockId() {
return couponStockId;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,10 +2,6 @@ package com.foxinmy.weixin4j.mp.payment.v2;
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.foxinmy.weixin4j.mp.type.CurrencyType;
import com.foxinmy.weixin4j.mp.type.TradeState;
@ -20,8 +16,6 @@ import com.foxinmy.weixin4j.util.DateUtil;
* @since JDK 1.7
* @see
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Order extends ApiResult {
private static final long serialVersionUID = 4543552984506609920L;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -118,52 +118,53 @@ public class Redpacket implements Serializable {
@JSONField(name = "share_imgurl")
private String shareImageUrl;
public String getOutTradeNo() {
return outTradeNo;
protected Redpacket() {
// 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.nickName = nickName;
this.sendName = sendName;
this.openid = openid;
this.totalAmount = DateUtil.formaFee2Fen(totalAmount);
}
public String getOutTradeNo() {
return outTradeNo;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getSendName() {
return sendName;
}
public void setSendName(String sendName) {
this.sendName = sendName;
}
public String getOpenid() {
return openid;
}
public void setOpenid(String openid) {
this.openid = openid;
}
public String getTotalAmount() {
return totalAmount;
}
/**
* <font color="red">单位为元,自动格式化为分</font>
*
* @param totalAmount
* 付款金额 单位为元
*/
public void setTotalAmount(double totalAmount) {
this.totalAmount = DateUtil.formaFee2Fen(totalAmount);
}
public String getMinValue() {
return minValue;
}
@ -172,7 +173,7 @@ public class Redpacket implements Serializable {
* <font color="red">单位为元,自动格式化为分</font>
*
* @param minValue
* 最小红包 单位为元
* 最小红包 单位为元
*/
public void setMinValue(double minValue) {
this.minValue = DateUtil.formaFee2Fen(minValue);
@ -186,7 +187,7 @@ public class Redpacket implements Serializable {
* <font color="red">单位为元,自动格式化为分</font>
*
* @param minValue
* 最大红包 单位为元
* 最大红包 单位为元
*/
public void setMaxValue(double maxValue) {
this.maxValue = DateUtil.formaFee2Fen(maxValue);
@ -266,13 +267,13 @@ public class Redpacket implements Serializable {
@Override
public String toString() {
return "Redpacket [ nickName=" + nickName
+ ", sendName=" + sendName + ", openid=" + openid
+ ", totalAmount=" + totalAmount + ", minValue=" + minValue
+ ", maxValue=" + maxValue + ", totalNum=" + totalNum
+ ", wishing=" + wishing + ", clientIp=" + clientIp
+ ", actName=" + actName + ", remark=" + remark + ", logoUrl="
+ logoUrl + ", shareContent=" + shareContent + ", shareUrl="
+ shareUrl + ", shareImageUrl=" + shareImageUrl + "]";
return "Redpacket [ nickName=" + nickName + ", sendName=" + sendName
+ ", openid=" + openid + ", totalAmount=" + totalAmount
+ ", minValue=" + minValue + ", maxValue=" + maxValue
+ ", totalNum=" + totalNum + ", wishing=" + wishing
+ ", clientIp=" + clientIp + ", actName=" + actName
+ ", remark=" + remark + ", logoUrl=" + logoUrl
+ ", shareContent=" + shareContent + ", shareUrl=" + shareUrl
+ ", shareImageUrl=" + shareImageUrl + "]";
}
}

View File

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

View File

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

View File

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

View File

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

View File

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