diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpConfigStorage.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpConfigStorage.java index 7dc29d4d..cff903bf 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpConfigStorage.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpConfigStorage.java @@ -89,7 +89,6 @@ public interface WxMpConfigStorage { /** * 微信支付异步回掉地址,通知url必须为直接可访问的url,不能携带参数。 * - * @return * @since 2.5.0 */ String getNotifyURL(); @@ -100,7 +99,6 @@ public interface WxMpConfigStorage { * JSAPI--公众号支付、NATIVE--原生扫码支付、APP--app支付 * * - * @return * @since 2.5.0 */ String getTradeType(); diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayBaseRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayBaseRequest.java index d6926d0e..3bfe556f 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayBaseRequest.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayBaseRequest.java @@ -1,10 +1,10 @@ package me.chanjar.weixin.mp.bean.pay.request; -import java.math.BigDecimal; - import com.thoughtworks.xstream.annotations.XStreamAlias; import me.chanjar.weixin.common.util.ToStringUtils; +import java.math.BigDecimal; + /** *
* Created by Binary Wang on 2016-10-24. @@ -75,7 +75,7 @@ public abstract class WxPayBaseRequest { /** * 如果配置中已经设置,可以不设置值 - * @param appid + * @param appid 微信公众号appid */ public void setAppid(String appid) { this.appid = appid; @@ -87,7 +87,7 @@ public abstract class WxPayBaseRequest { /** * 如果配置中已经设置,可以不设置值 - * @param mchId + * @param mchId 微信商户号 */ public void setMchId(String mchId) { this.mchId = mchId; @@ -99,7 +99,7 @@ public abstract class WxPayBaseRequest { /** * 默认采用时间戳为随机字符串,可以不设置 - * @param nonceStr + * @param nonceStr 随机字符串 */ public void setNonceStr(String nonceStr) { this.nonceStr = nonceStr; @@ -112,12 +112,11 @@ public abstract class WxPayBaseRequest { public void setSign(String sign) { this.sign = sign; } - + /** * 将单位为元转换为单位为分 * - * @param yuan - * @return + * @param yuan 将要转换的元的数值字符串 */ public static Integer yuanToFee(String yuan) { return new BigDecimal(yuan).setScale(2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)).intValue(); diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayBaseResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayBaseResult.java index b719e333..cafd8a56 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayBaseResult.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayBaseResult.java @@ -1,13 +1,12 @@ package me.chanjar.weixin.mp.bean.pay.result; -import java.math.BigDecimal; -import java.util.Map; - import com.thoughtworks.xstream.annotations.XStreamAlias; - import me.chanjar.weixin.common.util.BeanUtils; import me.chanjar.weixin.common.util.ToStringUtils; +import java.math.BigDecimal; +import java.util.Map; + /** ** 微信支付结果共用属性类 @@ -146,16 +145,15 @@ public abstract class WxPayBaseResult { public void setSign(String sign) { this.sign = sign; } - + /** * 将单位分转换成单位圆 - * @param fee - * @return + * @param fee 将要被转换为元的分的数值 */ public static String feeToYuan(Integer fee) { return new BigDecimal(Double.valueOf(fee) / 100).setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString(); } - + public MaptoMap(){ return BeanUtils.xmlBean2Map(this); } diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayOrderNotifyResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayOrderNotifyResult.java index 3c782477..a5770873 100644 --- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayOrderNotifyResult.java +++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayOrderNotifyResult.java @@ -1,403 +1,381 @@ -package me.chanjar.weixin.mp.bean.pay.result; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; - -import com.thoughtworks.xstream.annotations.XStreamAlias; - -import me.chanjar.weixin.common.util.BeanUtils; -import me.chanjar.weixin.mp.bean.pay.WxPayOrderNotifyCoupon; - -/** - * 支付结果通用通知 ,文档见:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7 - * @author aimilin6688 - * @since 2.5.0 - */ -@XStreamAlias("xml") -public class WxPayOrderNotifyResult extends WxPayBaseResult implements Serializable { - - /** - * @fields serialVersionUID - */ - private static final long serialVersionUID = 5389718115223345496L; - - - /** - * - * 设备号 - * device_info - * 否 - * String(32) - * 013467007045764 - * 微信支付分配的终端设备号, - *- * @fields deviceInfo - */ - @XStreamAlias("device_info") - private String deviceInfo; - - /** - *- * 用户标识 - * openid - * 是 - * String(128) - * wxd930ea5d5a258f4f - * 用户在商户appid下的唯一标识 - *- * @fields openid - */ - @XStreamAlias("openid") - private String openid; - - /** - *- * 是否关注公众账号 - * is_subscribe - * 否 - * String(1) - * Y - * 用户是否关注公众账号,Y-关注,N-未关注,仅在公众账号类型支付有效 - *- * @fields isSubscribe - */ - @XStreamAlias("is_subscribe") - private String isSubscribe; - - - /** - *- * 交易类型 - * trade_type - * 是 - * String(16) - * JSAPI JSAPI、NATIVE、APP - *- * @fields tradeType - */ - @XStreamAlias("trade_type") - private String tradeType; - - - /** - *- * 付款银行 - * bank_type - * 是 - * String(16) - * CMC - * 银行类型,采用字符串类型的银行标识,银行类型见银行列表 - *- * @fields bankType - */ - @XStreamAlias("bank_type") - private String bankType; - - - /** - *- * 订单金额 - * total_fee - * 是 - * Int - * 100 - * 订单总金额,单位为分 - *- * @fields totalFee - */ - @XStreamAlias("total_fee") - private Integer totalFee; - /** - *- * 应结订单金额 - * settlement_total_fee - * 否 - * Int - * 100 - * 应结订单金额=订单金额-非充值代金券金额,应结订单金额<=订单金额。 - *- * @fields settlementTotalFee - */ - @XStreamAlias("settlement_total_fee") - private Integer settlementTotalFee; - /** - *- * 货币种类 - * fee_type - * 否 - * String(8) - * CNY - * 货币类型,符合ISO4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 - *- * @fields feeType - */ - @XStreamAlias("fee_type") - private String feeType; - /** - *- * 现金支付金额 - * cash_fee - * 是 - * Int - * 100 - * 现金支付金额订单现金支付金额,详见支付金额 - *- * @fields cashFee - */ - @XStreamAlias("cash_fee") - private Integer cashFee; - /** - *- * 现金支付货币类型 - * cash_fee_type - * 否 - * String(16) - * CNY - * 货币类型,符合ISO4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 - *- * @fields cashFeeType - */ - @XStreamAlias("cash_fee_type") - private String cashFeeType; - /** - *- * 总代金券金额 - * coupon_fee - * 否 - * Int - * 10 - * 代金券金额<=订单金额,订单金额-代金券金额=现金支付金额,详见支付金额 - *- * @fields couponFee - */ - @XStreamAlias("coupon_fee") - private Integer couponFee; - - /** - *- * 代金券使用数量 - * coupon_count - * 否 - * Int - * 1 - * 代金券使用数量 - */ - @XStreamAlias("coupon_count") - private Integer couponCount; - - private ListcouponList; - - - - /** - * - * 微信支付订单号 - * transaction_id - * 是 - * String(32) - * 1217752501201407033233368018 - * 微信支付订单号 - *- * @fields transactionId - */ - @XStreamAlias("transaction_id") - private String transactionId; - - /** - *- * 商户订单号 - * out_trade_no - * 是 - * String(32) - * 1212321211201407033568112322 - * 商户系统的订单号,与请求一致。 - *- * @fields outTradeNo - */ - @XStreamAlias("out_trade_no") - private String outTradeNo; - /** - *- * 商家数据包 - * attach - * 否 - * String(128) - * 123456 - * 商家数据包,原样返回 - *- * @fields - */ - @XStreamAlias("attach") - private String attach; - /** - *- * 支付完成时间 - * time_end - * 是 - * String(14) - * 20141030133525 - * 支付完成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则 - *- * @fields timeEnd - */ - @XStreamAlias("time_end") - private String timeEnd; - - - public Integer getCouponCount() { - return couponCount; - } - - public void setCouponCount(Integer couponCount) { - this.couponCount = couponCount; - } - - public ListgetCouponList() { - return couponList; - } - - public void setCouponList(List couponList) { - this.couponList = couponList; - } - - 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 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 Integer getSettlementTotalFee() { - return settlementTotalFee; - } - - public void setSettlementTotalFee(Integer settlementTotalFee) { - this.settlementTotalFee = settlementTotalFee; - } - - 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 getCouponFee() { - return couponFee; - } - - public void setCouponFee(Integer couponFee) { - this.couponFee = couponFee; - } - - 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; - } - - @Override - public Map toMap(){ - Map resultMap = BeanUtils.xmlBean2Map(this); - if(this.getCouponCount() != null && this.getCouponCount() > 0){ - for (int i = 0; i < this.getCouponCount(); i++) { - WxPayOrderNotifyCoupon coupon = couponList.get(i); - resultMap.putAll(coupon.toMap(i)); - } - } - return resultMap; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE); - } -} +package me.chanjar.weixin.mp.bean.pay.result; + +import com.thoughtworks.xstream.annotations.XStreamAlias; +import me.chanjar.weixin.common.util.BeanUtils; +import me.chanjar.weixin.mp.bean.pay.WxPayOrderNotifyCoupon; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +/** + * 支付结果通用通知 ,文档见:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7 + * @author aimilin6688 + * @since 2.5.0 + */ +@XStreamAlias("xml") +public class WxPayOrderNotifyResult extends WxPayBaseResult implements Serializable { + + private static final long serialVersionUID = 5389718115223345496L; + + + /** + * + * 设备号 + * device_info + * 否 + * String(32) + * 013467007045764 + * 微信支付分配的终端设备号, + *+ */ + @XStreamAlias("device_info") + private String deviceInfo; + + /** + *+ * 用户标识 + * openid + * 是 + * String(128) + * wxd930ea5d5a258f4f + * 用户在商户appid下的唯一标识 + *+ */ + @XStreamAlias("openid") + private String openid; + + /** + *+ * 是否关注公众账号 + * is_subscribe + * 否 + * String(1) + * Y + * 用户是否关注公众账号,Y-关注,N-未关注,仅在公众账号类型支付有效 + *+ */ + @XStreamAlias("is_subscribe") + private String isSubscribe; + + + /** + *+ * 交易类型 + * trade_type + * 是 + * String(16) + * JSAPI JSAPI、NATIVE、APP + *+ */ + @XStreamAlias("trade_type") + private String tradeType; + + + /** + *+ * 付款银行 + * bank_type + * 是 + * String(16) + * CMC + * 银行类型,采用字符串类型的银行标识,银行类型见银行列表 + *+ */ + @XStreamAlias("bank_type") + private String bankType; + + + /** + *+ * 订单金额 + * total_fee + * 是 + * Int + * 100 + * 订单总金额,单位为分 + *+ */ + @XStreamAlias("total_fee") + private Integer totalFee; + /** + *+ * 应结订单金额 + * settlement_total_fee + * 否 + * Int + * 100 + * 应结订单金额=订单金额-非充值代金券金额,应结订单金额<=订单金额。 + *+ */ + @XStreamAlias("settlement_total_fee") + private Integer settlementTotalFee; + /** + *+ * 货币种类 + * fee_type + * 否 + * String(8) + * CNY + * 货币类型,符合ISO4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 + *+ */ + @XStreamAlias("fee_type") + private String feeType; + /** + *+ * 现金支付金额 + * cash_fee + * 是 + * Int + * 100 + * 现金支付金额订单现金支付金额,详见支付金额 + *+ */ + @XStreamAlias("cash_fee") + private Integer cashFee; + /** + *+ * 现金支付货币类型 + * cash_fee_type + * 否 + * String(16) + * CNY + * 货币类型,符合ISO4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型 + *+ */ + @XStreamAlias("cash_fee_type") + private String cashFeeType; + /** + *+ * 总代金券金额 + * coupon_fee + * 否 + * Int + * 10 + * 代金券金额<=订单金额,订单金额-代金券金额=现金支付金额,详见支付金额 + *+ */ + @XStreamAlias("coupon_fee") + private Integer couponFee; + + /** + *+ * 代金券使用数量 + * coupon_count + * 否 + * Int + * 1 + * 代金券使用数量 + *+ */ + @XStreamAlias("coupon_count") + private Integer couponCount; + + private ListcouponList; + + /** + * + * 微信支付订单号 + * transaction_id + * 是 + * String(32) + * 1217752501201407033233368018 + * 微信支付订单号 + *+ */ + @XStreamAlias("transaction_id") + private String transactionId; + + /** + *+ * 商户订单号 + * out_trade_no + * 是 + * String(32) + * 1212321211201407033568112322 + * 商户系统的订单号,与请求一致。 + *+ */ + @XStreamAlias("out_trade_no") + private String outTradeNo; + /** + *+ * 商家数据包 + * attach + * 否 + * String(128) + * 123456 + * 商家数据包,原样返回 + *+ */ + @XStreamAlias("attach") + private String attach; + /** + *+ * 支付完成时间 + * time_end + * 是 + * String(14) + * 20141030133525 + * 支付完成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则 + *+ */ + @XStreamAlias("time_end") + private String timeEnd; + + public Integer getCouponCount() { + return couponCount; + } + + public void setCouponCount(Integer couponCount) { + this.couponCount = couponCount; + } + + public ListgetCouponList() { + return couponList; + } + + public void setCouponList(List couponList) { + this.couponList = couponList; + } + + 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 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 Integer getSettlementTotalFee() { + return settlementTotalFee; + } + + public void setSettlementTotalFee(Integer settlementTotalFee) { + this.settlementTotalFee = settlementTotalFee; + } + + 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 getCouponFee() { + return couponFee; + } + + public void setCouponFee(Integer couponFee) { + this.couponFee = couponFee; + } + + 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; + } + + @Override + public Map toMap(){ + Map resultMap = BeanUtils.xmlBean2Map(this); + if(this.getCouponCount() != null && this.getCouponCount() > 0){ + for (int i = 0; i < this.getCouponCount(); i++) { + WxPayOrderNotifyCoupon coupon = couponList.get(i); + resultMap.putAll(coupon.toMap(i)); + } + } + return resultMap; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this,ToStringStyle.MULTI_LINE_STYLE); + } +}