diff --git a/CHANGE.md b/CHANGE.md
index 29c7b8f2..b1fe8e8c 100644
--- a/CHANGE.md
+++ b/CHANGE.md
@@ -731,4 +731,8 @@
* 2016-07-21
- + 新增MessageConverter
\ No newline at end of file
+ + weixin4j-base:新增MessageConverter
+
+* 2016-07-22
+
+ + weixin4j-base:主要调整退款相关类与官网一致
\ No newline at end of file
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/api/PayApi.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/api/PayApi.java
index a842c201..a814d3d0 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/api/PayApi.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/api/PayApi.java
@@ -729,10 +729,10 @@ public class PayApi extends MchApi {
* @throws WeixinException
* @see
- * 接口测试上报API
+ * 交易保障
*/
@SuppressWarnings("unchecked")
- public XmlResult interfaceReport(String interfaceUrl, int executeTime,
+ public XmlResult reportInterface(String interfaceUrl, int executeTime,
String outTradeNo, String ip, Date time, XmlResult returnXml)
throws WeixinException {
Map map = createBaseRequestMap(null);
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/MimeType.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/MimeType.java
index 3e47e7f7..3648f855 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/MimeType.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/MimeType.java
@@ -97,7 +97,7 @@ public class MimeType implements Serializable {
}
/**
- * reference of apache Spring Web
+ * reference of Spring Web
*/
public boolean includes(MimeType other) {
if (other == null) {
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/message/MessageConverter.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/message/MessageConverter.java
index 4fdcfb7e..151d8f7c 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/message/MessageConverter.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/message/MessageConverter.java
@@ -12,8 +12,7 @@ import com.foxinmy.weixin4j.http.MimeType;
* @className MessageConverter
* @author jinyu
* @date Jul 20, 2016
- * @since JDK 1.8
- * @see
+ * @since JDK 1.6
*/
public interface MessageConverter {
/**
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/message/XmlResult.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/message/XmlResult.java
index 87a9775d..46f83b5c 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/message/XmlResult.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/message/XmlResult.java
@@ -1,5 +1,7 @@
package com.foxinmy.weixin4j.http.message;
+import java.io.Serializable;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
@@ -18,10 +20,22 @@ import com.alibaba.fastjson.annotation.JSONField;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
-public class XmlResult extends ApiResult {
+public class XmlResult implements Serializable {
private static final long serialVersionUID = -6185313616955051150L;
-
+ /**
+ * 调用接口返回码,通信标识
+ */
+ @XmlElement(name = "return_code")
+ @JSONField(name = "return_code")
+ private String returnCode;
+
+ /**
+ * 调用接口返回消息,如非 空,为错误原因 可能为空
+ */
+ @XmlElement(name = "return_msg")
+ @JSONField(name = "return_msg")
+ private String returnMsg;
/**
* 业务结果SUCCESS/FAIL 非空
*/
@@ -42,10 +56,12 @@ public class XmlResult extends ApiResult {
private String errCodeDes;
protected XmlResult() {
+ // jaxb required
}
public XmlResult(String returnCode, String returnMsg) {
- super(returnCode, returnMsg);
+ this.returnCode = returnCode;
+ this.returnMsg = returnMsg;
}
public String getResultCode() {
@@ -60,6 +76,14 @@ public class XmlResult extends ApiResult {
return errCodeDes;
}
+ public String getReturnCode() {
+ return returnCode;
+ }
+
+ public String getReturnMsg() {
+ return returnMsg;
+ }
+
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
@@ -74,6 +98,8 @@ public class XmlResult extends ApiResult {
@Override
public String toString() {
- return super.toString() + ", resultCode=" + resultCode + ", errCode=" + errCode + ", errCodeDes=" + errCodeDes;
+ return "returnCode=" + returnCode + ", returnMsg=" + returnMsg
+ + ", resultCode=" + resultCode + ", errCode=" + errCode
+ + ", errCodeDes=" + errCodeDes;
}
}
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/WeixinRequestExecutor.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/WeixinRequestExecutor.java
index fdb6ffdf..64000432 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/WeixinRequestExecutor.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/WeixinRequestExecutor.java
@@ -114,7 +114,7 @@ public class WeixinRequestExecutor {
if (XmlMessageConverter.GLOBAL.canConvert(XmlResult.class, response)) {
try {
XmlResult xmlResult = XmlMessageConverter.GLOBAL.convert(XmlResult.class, response);
- if (!SUCCESS_CODE.contains(xmlResult.getResultCode())) {
+ if (!SUCCESS_CODE.contains(String.format(",%s,", xmlResult.getResultCode().toLowerCase()))) {
throw new WeixinException(xmlResult.getErrCode(), xmlResult.getErrCodeDes());
}
} catch (IOException e) {
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/error.xml b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/error.xml
index 3fa190b1..7bb4d439 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/error.xml
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/http/weixin/error.xml
@@ -821,7 +821,7 @@
60008
- 部门名称已存在
+ 部门ID或者部门名称已存在
60009
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/WeixinPayProxy.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/WeixinPayProxy.java
index 80ef4a16..a31b8add 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/WeixinPayProxy.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/WeixinPayProxy.java
@@ -624,10 +624,10 @@ public class WeixinPayProxy {
* 接口测试上报API
* @throws WeixinException
*/
- public XmlResult interfaceReport(String interfaceUrl, int executeTime,
+ public XmlResult reportInterface(String interfaceUrl, int executeTime,
String outTradeNo, String ip, Date time, XmlResult returnXml)
throws WeixinException {
- return payApi.interfaceReport(interfaceUrl, executeTime, outTradeNo,
+ return payApi.reportInterface(interfaceUrl, executeTime, outTradeNo,
ip, time, returnXml);
}
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/OrderCouponInfo.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/OrderCouponInfo.java
new file mode 100644
index 00000000..03b97a67
--- /dev/null
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/OrderCouponInfo.java
@@ -0,0 +1,96 @@
+package com.foxinmy.weixin4j.payment.coupon;
+
+import java.io.Serializable;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.foxinmy.weixin4j.type.CouponType;
+
+/**
+ * 订单代金券信息
+ *
+ * @className OrderCouponInfo
+ * @author jinyu(foxinmy@gmail.com)
+ * @date 2015年3月24日
+ * @since JDK 1.6
+ * @see
+ */
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.FIELD)
+public class OrderCouponInfo implements Serializable {
+
+ private static final long serialVersionUID = -8744999305258786901L;
+
+ /**
+ * 代金券或立减优惠批次ID
+ */
+ @XmlElement(name = "coupon_batch_id")
+ @JSONField(name = "coupon_batch_id")
+ private String couponBatchId;
+ /**
+ * 代金券类型
+ *
+ * @see com.foxinmy.weixin4j.type.CouponType
+ */
+ @XmlElement(name = "coupon_type")
+ @JSONField(name = "coupon_type")
+ private String couponType;
+ /**
+ * 代金券或立减优惠ID
+ */
+ @XmlElement(name = "coupon_id")
+ @JSONField(name = "coupon_id")
+ private String couponId;
+ /**
+ * 单个代金券或立减优惠支付金额
+ */
+ @XmlElement(name = "coupon_fee")
+ @JSONField(name = "coupon_fee")
+ private Integer couponFee;
+
+ protected OrderCouponInfo() {
+ // jaxb requried
+ }
+
+ public String getCouponBatchId() {
+ return couponBatchId;
+ }
+
+ public String getCouponType() {
+ return couponType;
+ }
+
+ @JSONField(serialize = false)
+ public CouponType getFormatCouponType() {
+ return couponType != null ? CouponType
+ .valueOf(couponType.toUpperCase()) : null;
+ }
+
+ public String getCouponId() {
+ return couponId;
+ }
+
+ public Integer getCouponFee() {
+ return couponFee;
+ }
+
+ /**
+ * 调用接口获取单位为分,get方法转换为元方便使用
+ *
+ * @return 元单位
+ */
+ @JSONField(serialize = false)
+ public double getFormatCouponFee() {
+ return couponFee != null ? couponFee.doubleValue() / 100d : 0d;
+ }
+
+ @Override
+ public String toString() {
+ return "couponBatchId=" + couponBatchId + ", couponType=" + couponType
+ + ", couponId=" + couponId + ", couponFee=" + couponFee;
+ }
+}
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/CouponInfo.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/RefundCouponInfo.java
similarity index 74%
rename from weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/CouponInfo.java
rename to weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/RefundCouponInfo.java
index 3b9284b3..4392345a 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/CouponInfo.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/coupon/RefundCouponInfo.java
@@ -10,9 +10,9 @@ import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
/**
- * 代金券信息(订单,退款中体现)
+ * 退款代金券信息
*
- * @className CouponInfo
+ * @className RefundCouponInfo
* @author jinyu(foxinmy@gmail.com)
* @date 2015年3月24日
* @since JDK 1.6
@@ -20,31 +20,31 @@ import com.alibaba.fastjson.annotation.JSONField;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
-public class CouponInfo implements Serializable {
+public class RefundCouponInfo implements Serializable {
private static final long serialVersionUID = -8744999305258786901L;
/**
* 代金券或立减优惠批次ID
*/
- @XmlElement(name = "coupon_batch_id")
- @JSONField(name = "coupon_batch_id")
+ @XmlElement(name = "coupon_refund_batch_id")
+ @JSONField(name = "coupon_refund_batch_id")
private String couponBatchId;
/**
- * 代金券或立减优惠ID
+ * 退款代金券ID
*/
- @XmlElement(name = "coupon_id")
- @JSONField(name = "coupon_id")
+ @XmlElement(name = "coupon_refund_id")
+ @JSONField(name = "coupon_refund_id")
private String couponId;
/**
* 单个代金券或立减优惠支付金额
*/
- @XmlElement(name = "coupon_fee")
- @JSONField(name = "coupon_fee")
+ @XmlElement(name = "coupon_refund_fee")
+ @JSONField(name = "coupon_refund_fee")
private Integer couponFee;
- public CouponInfo() {
-
+ protected RefundCouponInfo() {
+ // jaxb requried
}
public String getCouponBatchId() {
@@ -69,10 +69,6 @@ public class CouponInfo implements Serializable {
return couponFee != null ? couponFee.doubleValue() / 100d : 0d;
}
- public void setCouponId(String couponId) {
- this.couponId = couponId;
- }
-
@Override
public String toString() {
return "couponBatchId=" + couponBatchId + ", couponId=" + couponId
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/MerchantTradeResult.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/MerchantTradeResult.java
new file mode 100644
index 00000000..c52274d3
--- /dev/null
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/MerchantTradeResult.java
@@ -0,0 +1,126 @@
+package com.foxinmy.weixin4j.payment.mch;
+
+import javax.xml.bind.annotation.XmlElement;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.foxinmy.weixin4j.type.CurrencyType;
+
+/**
+ * 商户平台交易结果
+ *
+ * @className MerchantTradeResult
+ * @author jinyu(foxinmy@gmail.com)
+ * @date 2016年7月21日
+ * @since JDK 1.7
+ * @see
+ */
+public class MerchantTradeResult extends MerchantResult {
+
+ private static final long serialVersionUID = 4205906286092873877L;
+ /**
+ * 微信支付订单号
+ */
+ @XmlElement(name = "transaction_id")
+ @JSONField(name = "transaction_id")
+ private String transactionId;
+ /**
+ * 商户订单号
+ */
+ @XmlElement(name = "out_trade_no")
+ @JSONField(name = "out_trade_no")
+ private String outTradeNo;
+ /**
+ * 订单总金额,单位为分
+ */
+ @XmlElement(name = "total_fee")
+ @JSONField(name = "total_fee")
+ private Integer totalFee;
+ /**
+ * 应结订单金额,单位为分:应结订单金额=订单金额-非充值代金券金额,应结订单金额<=订单金额。
+ */
+ @XmlElement(name = "settlement_total_fee")
+ @JSONField(name = "settlement_total_fee")
+ private Integer settlementTotalFee;
+ /**
+ * 货币类型,符合 ISO 4217 标准的三位字母代码,默认人民币:CNY
+ *
+ * @see com.foxinmy.weixin4j.mp.type.CurrencyType
+ */
+ @XmlElement(name = "fee_type")
+ @JSONField(name = "fee_type")
+ private String feeType;
+ /**
+ * 现金支付金额
+ */
+ @XmlElement(name = "cash_fee")
+ @JSONField(name = "cash_fee")
+ private Integer cashFee;
+
+ public Integer getCashFee() {
+ return cashFee;
+ }
+
+ /**
+ * 调用接口获取单位为分,get方法转换为元方便使用
+ *
+ * @return 元单位
+ */
+ @JSONField(serialize = false)
+ public double getFormatCashFee() {
+ return cashFee != null ? cashFee / 100d : 0d;
+ }
+
+ public Integer getTotalFee() {
+ return totalFee;
+ }
+
+ /**
+ * 调用接口获取单位为分,get方法转换为元方便使用
+ *
+ * @return 元单位
+ */
+ @JSONField(serialize = false)
+ public double getFormatTotalFee() {
+ return totalFee != null ? totalFee / 100d : 0d;
+ }
+
+ @JSONField(serialize = false)
+ public CurrencyType getFormatFeeType() {
+ return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
+ : null;
+ }
+
+ public String getFeeType() {
+ return feeType;
+ }
+
+ public String getTransactionId() {
+ return transactionId;
+ }
+
+ public String getOutTradeNo() {
+ return outTradeNo;
+ }
+
+ public Integer getSettlementTotalFee() {
+ return settlementTotalFee;
+ }
+
+ /**
+ * 调用接口获取单位为分,get方法转换为元方便使用
+ *
+ * @return 元单位
+ */
+ @JSONField(serialize = false)
+ public double getFormatSettlementTotalFee() {
+ return settlementTotalFee != null ? settlementTotalFee / 100d : 0d;
+ }
+
+ @Override
+ public String toString() {
+ return "transactionId=" + transactionId + ", outTradeNo=" + outTradeNo
+ + ", totalFee=" + totalFee + ", cashFee=" + cashFee
+ + ", feeType=" + feeType + ", settlementTotalFee="
+ + settlementTotalFee + ", " + super.toString();
+ }
+}
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/NativePayResponse.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/NativePayResponse.java
index 383ae2f9..afddb09d 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/NativePayResponse.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/NativePayResponse.java
@@ -45,8 +45,7 @@ public class NativePayResponse extends MerchantResult {
* @throws WeixinPayException
*/
public NativePayResponse(String returnMsg, String resultMsg) {
- super.setReturnMsg(returnMsg);
- super.setReturnCode(Consts.FAIL);
+ super(Consts.FAIL, returnMsg);
super.setErrCodeDes(resultMsg);
super.setResultCode(Consts.FAIL);
}
@@ -61,7 +60,7 @@ public class NativePayResponse extends MerchantResult {
* @throws WeixinPayException
*/
public NativePayResponse(WeixinPayAccount weixinAccount, String prepayId) {
- super.setReturnCode(Consts.SUCCESS);
+ super(Consts.SUCCESS, "OK");
this.setResultCode(Consts.SUCCESS);
this.setMchId(weixinAccount.getMchId());
this.setAppId(weixinAccount.getId());
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/Order.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/Order.java
index b14f8af4..f6662181 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/Order.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/Order.java
@@ -9,7 +9,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
-import com.foxinmy.weixin4j.payment.coupon.CouponInfo;
+import com.foxinmy.weixin4j.payment.coupon.OrderCouponInfo;
import com.foxinmy.weixin4j.type.BankType;
import com.foxinmy.weixin4j.type.CurrencyType;
import com.foxinmy.weixin4j.type.TradeState;
@@ -28,7 +28,7 @@ import com.foxinmy.weixin4j.xml.ListsuffixResult;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
-public class Order extends MerchantResult {
+public class Order extends MerchantTradeResult {
private static final long serialVersionUID = 5636828325595317079L;
/**
@@ -65,14 +65,17 @@ public class Order extends MerchantResult {
@XmlElement(name = "bank_type")
@JSONField(name = "bank_type")
private String bankType;
+
/**
- * 订单总金额,单位为分
+ * 现金支付货币类型,符合 ISO 4217 标准的三位字母代码,默认人民币:CNY
+ *
+ * @see com.foxinmy.weixin4j.mp.type.CurrencyType
*/
- @XmlElement(name = "total_fee")
- @JSONField(name = "total_fee")
- private Integer totalFee;
+ @XmlElement(name = "cash_fee_type")
+ @JSONField(name = "cash_fee_type")
+ private String cashFeeType;
/**
- * 现金券支付金额<=订单总金 额,订单总金额-现金券金额 为现金支付金额
+ * 代金券金额:“代金券”金额<=订单金额,订单金额-“代金券”金额=现金支付金额
*/
@XmlElement(name = "coupon_fee")
@JSONField(name = "coupon_fee")
@@ -87,33 +90,7 @@ public class Order extends MerchantResult {
* 代金券信息 验证签名有点麻烦
*/
@ListsuffixResult
- private List couponList;
- /**
- * 现金支付金额
- */
- @XmlElement(name = "cash_fee")
- @JSONField(name = "cash_fee")
- private Integer cashFee;
- /**
- * 货币类型,符合 ISO 4217 标准的三位字母代码,默认人民币:CNY
- *
- * @see com.foxinmy.weixin4j.mp.type.CurrencyType
- */
- @XmlElement(name = "fee_type")
- @JSONField(name = "fee_type")
- private String feeType;
- /**
- * 微信支付订单号
- */
- @XmlElement(name = "transaction_id")
- @JSONField(name = "transaction_id")
- private String transactionId;
- /**
- * 商户订单号
- */
- @XmlElement(name = "out_trade_no")
- @JSONField(name = "out_trade_no")
- private String outTradeNo;
+ private List couponList;
/**
* 商家数据包
*/
@@ -183,20 +160,6 @@ public class Order extends MerchantResult {
: null;
}
- public Integer getTotalFee() {
- return totalFee;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatTotalFee() {
- return totalFee != null ? totalFee / 100d : 0d;
- }
-
public Integer getCouponFee() {
return couponFee;
}
@@ -215,26 +178,6 @@ public class Order extends MerchantResult {
return couponCount;
}
- public Integer getCashFee() {
- return cashFee;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatCashFee() {
- return cashFee != null ? cashFee / 100d : 0d;
- }
-
- @JSONField(serialize = false)
- public CurrencyType getFormatFeeType() {
- return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
- : null;
- }
-
public String getTradeState() {
return tradeState;
}
@@ -243,18 +186,6 @@ public class Order extends MerchantResult {
return tradeType;
}
- public String getFeeType() {
- return feeType;
- }
-
- public String getTransactionId() {
- return transactionId;
- }
-
- public String getOutTradeNo() {
- return outTradeNo;
- }
-
public String getAttach() {
return attach;
}
@@ -272,11 +203,11 @@ public class Order extends MerchantResult {
return tradeStateDesc;
}
- public List getCouponList() {
+ public List getCouponList() {
return couponList;
}
- public void setCouponList(List couponList) {
+ public void setCouponList(List couponList) {
this.couponList = couponList;
}
@@ -293,19 +224,25 @@ public class Order extends MerchantResult {
return subIsSubscribe != null && subIsSubscribe.equalsIgnoreCase("y");
}
+ public String getCashFeeType() {
+ return cashFeeType;
+ }
+
+ @JSONField(serialize = false)
+ public CurrencyType getFormatCashFeeType() {
+ return cashFeeType != null ? CurrencyType.valueOf(cashFeeType
+ .toUpperCase()) : null;
+ }
+
@Override
public String toString() {
return "Order [tradeState=" + tradeState + ", openId=" + openId
+ ", isSubscribe=" + isSubscribe + ", tradeType=" + tradeType
- + ", bankType=" + bankType + ", feeType=" + feeType
- + ", transactionId=" + transactionId + ", outTradeNo="
- + outTradeNo + ", attach=" + attach + ", timeEnd=" + timeEnd
- + ", totalFee=" + getFormatTotalFee() + ", couponFee="
- + getFormatCouponFee() + ", couponCount=" + couponCount
- + ", couponList=" + couponList + ", cashFee="
- + getFormatCashFee() + ", timeEnd=" + getFormatTimeEnd()
- + ", tradeStateDesc=" + tradeStateDesc + ", subOpenId="
- + subOpenId + ", subIsSubscribe=" + subIsSubscribe
- + super.toString() + "]";
+ + ", bankType=" + bankType + ", cashFeeType=" + cashFeeType
+ + ", couponFee=" + couponFee + ", couponCount=" + couponCount
+ + ", couponList=" + couponList + ", attach=" + attach
+ + ", timeEnd=" + timeEnd + ", tradeStateDesc=" + tradeStateDesc
+ + ", subOpenId=" + subOpenId + ", subIsSubscribe="
+ + subIsSubscribe + ", " + super.toString() + "]";
}
}
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundDetail.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundDetail.java
index 8b4a9c3f..c13d67b4 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundDetail.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundDetail.java
@@ -1,5 +1,6 @@
package com.foxinmy.weixin4j.payment.mch;
+import java.io.Serializable;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@@ -8,26 +9,28 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
-import com.foxinmy.weixin4j.payment.coupon.CouponInfo;
-import com.foxinmy.weixin4j.type.CurrencyType;
+import com.foxinmy.weixin4j.payment.coupon.RefundCouponInfo;
+import com.foxinmy.weixin4j.type.CouponType;
import com.foxinmy.weixin4j.type.RefundChannel;
import com.foxinmy.weixin4j.type.RefundStatus;
import com.foxinmy.weixin4j.xml.ListsuffixResult;
/**
- * V3退款详细
+ * 退款详细
*
* @className RefundDetail
* @author jinyu(foxinmy@gmail.com)
- * @date 2014年11月6日
+ * @date 2016年7月21日
* @since JDK 1.6
- * @see
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
-public class RefundDetail extends MerchantResult {
+public class RefundDetail implements Serializable {
+ private static final long serialVersionUID = 1402738803019986864L;
- private static final long serialVersionUID = -3687863914168618620L;
+ protected RefundDetail() {
+ // jaxb required
+ }
/**
* 商户退款单号
@@ -53,56 +56,6 @@ public class RefundDetail extends MerchantResult {
@XmlElement(name = "refund_fee")
@JSONField(name = "refund_fee")
private int refundFee;
- /**
- * 退款货币种类
- *
- * @see com.foxinmy.weixin4j.mp.type.CurrencyType
- */
- @XmlElement(name = "refund_fee_type")
- @JSONField(name = "refund_fee_type")
- private String refundFeeType;
- /**
- * 订单总金额
- */
- @XmlElement(name = "total_fee")
- @JSONField(name = "total_fee")
- private int totalFee;
- /**
- * 订单金额货币种类
- *
- * @see com.foxinmy.weixin4j.mp.type.CurrencyType
- */
- @XmlElement(name = "fee_type")
- @JSONField(name = "fee_type")
- private String feeType;
- /**
- * 现金支付金额
- */
- @XmlElement(name = "cash_fee")
- @JSONField(name = "cash_fee")
- private int cashFee;
- /**
- * 现金支付货币种类
- *
- * @see com.foxinmy.weixin4j.mp.type.CurrencyType
- */
- @XmlElement(name = "cash_fee_type")
- @JSONField(name = "cash_fee_type")
- private String cashFeeType;
- /**
- * 现金退款金额
- */
- @XmlElement(name = "cash_refund_fee")
- @JSONField(name = "cash_refund_fee")
- private Integer cashRefundFee;
- /**
- * 现金退款货币类型
- *
- * @see com.foxinmy.weixin4j.mp.type.CurrencyType
- */
- @XmlElement(name = "cash_refund_fee_type")
- @JSONField(name = "cash_refund_fee_type")
- private String cashRefundFeeType;
/**
* 退款状态
*/
@@ -110,30 +63,44 @@ public class RefundDetail extends MerchantResult {
@JSONField(name = "refund_status")
private String refundStatus;
/**
- * 现金券退款金额<=退款金额,退款金额-现金券退款金额为现金
+ * 退款金额:退款金额=申请退款金额-非充值代金券退款金额,退款金额<=申请退款金额
+ */
+ @XmlElement(name = "settlement_refund_fee")
+ @JSONField(name = "settlement_refund_fee")
+ private Integer settlementRefundFee;
+ /**
+ * 代金券退款金额:代金券退款金额<=退款金额,退款金额-代金券或立减优惠退款金额为现金,
*/
@XmlElement(name = "coupon_refund_fee")
@JSONField(name = "coupon_refund_fee")
private Integer couponRefundFee;
/**
- * 代金券或立减优惠使用数量 微信支付文档上写的coupon_count,而实际测试拿到的是coupon_refund_count,做个记号。
- *
+ * 代金券或立减优惠使用数量
*/
@XmlElement(name = "coupon_refund_count")
@JSONField(name = "coupon_refund_count")
private Integer couponRefundCount;
/**
- * 代金券信息
+ * 代金券类型
*
- * @see com.foxinmy.weixin4j.payment.coupon.CouponInfo
+ * @see com.foxinmy.weixin4j.type.CouponType
+ */
+ @XmlElement(name = "coupon_type")
+ @JSONField(name = "coupon_type")
+ private String couponType;
+ /**
+ * 退款入账账户:取当前退款单的退款入账方 1)退回银行卡: {银行名称}{卡类型}{卡尾号} 2)退回支付用户零钱: 支付用户零钱
+ */
+ @XmlElement(name = "refund_recv_accout")
+ @JSONField(name = "refund_recv_accout")
+ private String refundRecvAccout;
+ /**
+ * 退款代金券信息
+ *
+ * @see com.foxinmy.weixin4j.payment.coupon.RefundCouponInfo
*/
@ListsuffixResult
- private List couponList;
-
- protected RefundDetail() {
- // jaxb required
- }
+ private List couponList;
public String getOutRefundNo() {
return outRefundNo;
@@ -157,26 +124,6 @@ public class RefundDetail extends MerchantResult {
return refundFee;
}
- public String getFeeType() {
- return feeType;
- }
-
- @JSONField(serialize = false)
- public CurrencyType getFormatFeeType() {
- return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
- : null;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatRefundFee() {
- return refundFee / 100d;
- }
-
public String getRefundStatus() {
return refundStatus;
}
@@ -187,6 +134,28 @@ public class RefundDetail extends MerchantResult {
.toUpperCase()) : null;
}
+ public List getCouponList() {
+ return couponList;
+ }
+
+ public void setCouponList(List couponList) {
+ this.couponList = couponList;
+ }
+
+ public Integer getSettlementRefundFee() {
+ return settlementRefundFee;
+ }
+
+ /**
+ * 调用接口获取单位为分,get方法转换为元方便使用
+ *
+ * @return 元单位
+ */
+ @JSONField(serialize = false)
+ public double getFormatSettlementRefundFee() {
+ return settlementRefundFee != null ? settlementRefundFee / 100d : 0d;
+ }
+
public Integer getCouponRefundFee() {
return couponRefundFee;
}
@@ -198,105 +167,36 @@ public class RefundDetail extends MerchantResult {
*/
@JSONField(serialize = false)
public double getFormatCouponRefundFee() {
- return couponRefundFee != null ? couponRefundFee.intValue() / 100d : 0d;
- }
-
- public String getRefundFeeType() {
- return refundFeeType;
- }
-
- @JSONField(serialize = false)
- public CurrencyType getFormatRefundFeeType() {
- return refundFeeType != null ? CurrencyType.valueOf(refundFeeType
- .toUpperCase()) : null;
- }
-
- public int getTotalFee() {
- return totalFee;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatTotalFee() {
- return totalFee / 100d;
- }
-
- public int getCashFee() {
- return cashFee;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatCashFee() {
- return cashFee / 100d;
- }
-
- public String getCashFeeType() {
- return cashFeeType;
- }
-
- @JSONField(serialize = false)
- public CurrencyType getFormatCashFeeType() {
- return cashFeeType != null ? CurrencyType.valueOf(cashFeeType
- .toUpperCase()) : null;
- }
-
- public Integer getCashRefundFee() {
- return cashRefundFee;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatCashRefundFee() {
- return cashRefundFee != null ? cashRefundFee.intValue() / 100d : 0d;
- }
-
- public String getCashRefundFeeType() {
- return cashRefundFeeType;
- }
-
- @JSONField(serialize = false)
- public CurrencyType getFormatCashRefundFeeType() {
- return cashRefundFeeType != null ? CurrencyType
- .valueOf(cashRefundFeeType.toUpperCase()) : null;
+ return couponRefundFee != null ? couponRefundFee / 100d : 0d;
}
public Integer getCouponRefundCount() {
return couponRefundCount;
}
- public List getCouponList() {
- return couponList;
+ public String getCouponType() {
+ return couponType;
}
- public void setCouponList(List couponList) {
- this.couponList = couponList;
+ @JSONField(serialize = false)
+ public CouponType getFormatCouponType() {
+ return couponType != null ? CouponType
+ .valueOf(couponType.toUpperCase()) : null;
+ }
+
+ public String getRefundRecvAccout() {
+ return refundRecvAccout;
}
@Override
public String toString() {
return "RefundDetail [outRefundNo=" + outRefundNo + ", refundId="
+ refundId + ", refundChannel=" + refundChannel
- + ", refundFee=" + getFormatRefundFee() + ", refundFeeType="
- + refundFeeType + ", totalFee=" + getFormatTotalFee()
- + ", feeType=" + feeType + ", cashFee=" + getFormatCashFee()
- + ", cashFeeType=" + cashFeeType + ", cashRefundFee="
- + getFormatCashRefundFee() + ", cashRefundFeeType="
- + cashRefundFeeType + ", refundStatus=" + refundStatus
- + ", couponRefundFee=" + getFormatCouponRefundFee()
- + ", couponRefundCount=" + couponRefundCount + ", couponList="
- + couponList + ", " + super.toString() + "]";
+ + ", refundFee=" + refundFee + ", refundStatus=" + refundStatus
+ + ", settlementRefundFee=" + settlementRefundFee
+ + ", couponRefundFee=" + couponRefundFee
+ + ", couponRefundCount=" + couponRefundCount + ", couponType="
+ + couponType + ", refundRecvAccout=" + refundRecvAccout
+ + ", couponList=" + couponList + "]";
}
}
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundRecord.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundRecord.java
index ab3c36bc..945b4e64 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundRecord.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundRecord.java
@@ -8,11 +8,10 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
-import com.foxinmy.weixin4j.type.CurrencyType;
import com.foxinmy.weixin4j.xml.ListsuffixResult;
/**
- * V3退款记录
+ * 退款记录
*
* @className RefundRecord
* @author jinyu(foxinmy@gmail.com)
@@ -21,162 +20,37 @@ import com.foxinmy.weixin4j.xml.ListsuffixResult;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
-public class RefundRecord extends MerchantResult {
+public class RefundRecord extends MerchantTradeResult {
private static final long serialVersionUID = -2971132874939642721L;
-
- /**
- * 微信订单号
- */
- @XmlElement(name = "transaction_id")
- @JSONField(name = "transaction_id")
- private String transactionId;
- /**
- * 商户订单号
- */
- @XmlElement(name = "out_trade_no")
- @JSONField(name = "out_trade_no")
- private String outTradeNo;
- /**
- * 订单总金额
- */
- @XmlElement(name = "total_fee")
- @JSONField(name = "total_fee")
- private int totalFee;
- /**
- * 订单金额货币种类
- *
- * @see com.foxinmy.weixin4j.mp.type.CurrencyType
- */
- @XmlElement(name = "fee_type")
- @JSONField(name = "fee_type")
- private String feeType;
- /**
- * 现金支付金额
- */
- @XmlElement(name = "cash_fee")
- @JSONField(name = "cash_fee")
- private int cashFee;
- /**
- * 现金支付金额货币种类
- *
- * @see com.foxinmy.weixin4j.mp.type.CurrencyType
- */
- @XmlElement(name = "cash_fee_type")
- @JSONField(name = "cash_fee_type")
- private String cashFeeType;
- /**
- * 退款总金额
- */
- @XmlElement(name = "refund_fee")
- @JSONField(name = "refund_fee")
- private int refundFee;
- /**
- * 代金券或立减优惠退款金额=订单金额-现金退款金额,注意:满立减金额不会退回
- */
- @XmlElement(name = "coupon_refund_fee")
- @JSONField(name = "coupon_refund_fee")
- private Integer couponRefundFee;
/**
* 退款笔数
*/
@XmlElement(name = "refund_count")
@JSONField(name = "refund_count")
private int refundCount;
+ /**
+ * 退款总金额,单位为分,可以做部分退款
+ */
+ @XmlElement(name = "refund_fee")
+ @JSONField(name = "refund_fee")
+ private int refundFee;
/**
* 退款详情
*
- * @see com.foxinmy.weixin4j.payment.mch.RefundDetail
+ * @see RefundDetail
*/
- @ListsuffixResult({ "^out_refund_no(_\\d)$", "^refund_.*(_\\d)$" })
+ @ListsuffixResult({ ".*(_\\d)$" })
private List refundList;
protected RefundRecord() {
// jaxb required
}
- public String getTransactionId() {
- return transactionId;
- }
-
- public String getOutTradeNo() {
- return outTradeNo;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatCashFee() {
- return cashFee / 100d;
- }
-
- public int getCashFee() {
- return cashFee;
- }
-
- public String getFeeType() {
- return feeType;
- }
-
- public String getCashFeeType() {
- return cashFeeType;
- }
-
- @JSONField(serialize = false)
- public CurrencyType getFormatFeeType() {
- return feeType != null ? CurrencyType.valueOf(feeType.toUpperCase())
- : null;
- }
-
- @JSONField(serialize = false)
- public CurrencyType getFormatCashFeeType() {
- return cashFeeType != null ? CurrencyType.valueOf(cashFeeType
- .toUpperCase()) : null;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatCouponRefundFee() {
- return couponRefundFee != null ? couponRefundFee.intValue() / 100d : 0d;
- }
-
- public Integer getCouponRefundFee() {
- return couponRefundFee;
- }
-
- /**
- * 调用接口获取单位为分,get方法转换为元方便使用
- *
- * @return 元单位
- */
- @JSONField(serialize = false)
- public double getFormatTotalFee() {
- return totalFee / 100d;
- }
-
- public int getTotalFee() {
- return totalFee;
- }
-
public int getRefundCount() {
return refundCount;
}
- public List getRefundList() {
- return refundList;
- }
-
- public void setRefundList(List refundList) {
- this.refundList = refundList;
- }
-
public int getRefundFee() {
return refundFee;
}
@@ -191,14 +65,18 @@ public class RefundRecord extends MerchantResult {
return refundFee / 100d;
}
+ public List getRefundList() {
+ return refundList;
+ }
+
+ public void setRefundList(List refundList) {
+ this.refundList = refundList;
+ }
+
@Override
public String toString() {
- return "RefundRecord [transactionId=" + transactionId + ", outTradeNo="
- + outTradeNo + ", totalFee=" + getFormatTotalFee()
- + ", feeType=" + feeType + ", cashFee=" + getFormatCashFee()
- + ", cashFeeType=" + cashFeeType + ", refundFee="
- + getFormatRefundFee() + ", couponRefundFee="
- + getFormatCouponRefundFee() + ", refundCount=" + refundCount
- + ", refundList=" + refundList + ", " + super.toString() + "]";
+ return "RefundRecord [refundCount=" + refundCount + ", refundFee="
+ + refundFee + ", refundList=" + refundList + ", "
+ + super.toString() + "]";
}
}
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundResult.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundResult.java
index 8391a7f5..e6eb88dc 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundResult.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/payment/mch/RefundResult.java
@@ -1,14 +1,18 @@
package com.foxinmy.weixin4j.payment.mch;
+import java.util.List;
+
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.alibaba.fastjson.annotation.JSONField;
+import com.foxinmy.weixin4j.type.RefundChannel;
+import com.foxinmy.weixin4j.xml.ListsuffixResult;
/**
- * V3退款申请结果
+ * 退款申请结果
*
* @className RefundResult
* @author jinyu(foxinmy@gmail.com)
@@ -18,38 +22,108 @@ import com.alibaba.fastjson.annotation.JSONField;
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
-public class RefundResult extends RefundDetail {
+public class RefundResult extends MerchantTradeResult {
private static final long serialVersionUID = -3687863914168618620L;
/**
- * 微信订单号
+ * 商户退款单号
*/
- @XmlElement(name = "transaction_id")
- @JSONField(name = "transaction_id")
- private String transactionId;
+ @XmlElement(name = "out_refund_no")
+ @JSONField(name = "out_refund_no")
+ private String outRefundNo;
/**
- * 商户系统内部的订单号
+ * 微信退款单号
*/
- @XmlElement(name = "out_trade_no")
- @JSONField(name = "out_trade_no")
- private String outTradeNo;
+ @XmlElement(name = "refund_id")
+ @JSONField(name = "refund_id")
+ private String refundId;
+ /**
+ * 退款渠道:ORIGINAL—原路退款,默认 BALANCE—退回到余额
+ */
+ @XmlElement(name = "refund_channel")
+ @JSONField(name = "refund_channel")
+ private String refundChannel;
+ /**
+ * 退款总金额,单位为分,可以做部分退款
+ */
+ @XmlElement(name = "refund_fee")
+ @JSONField(name = "refund_fee")
+ private int refundFee;
+ /**
+ * 现金退款金额
+ */
+ @XmlElement(name = "cash_refund_fee")
+ @JSONField(name = "cash_refund_fee")
+ private Integer cashRefundFee;
+ /**
+ * 退款详情
+ *
+ * @see RefundDetail
+ */
+ @ListsuffixResult({ ".*(_\\d)$" })
+ private List refundList;
protected RefundResult() {
// jaxb required
}
-
- public String getTransactionId() {
- return transactionId;
+
+ public String getOutRefundNo() {
+ return outRefundNo;
}
- public String getOutTradeNo() {
- return outTradeNo;
+ public String getRefundId() {
+ return refundId;
+ }
+
+ public String getRefundChannel() {
+ return refundChannel;
+ }
+
+ @JSONField(serialize = false)
+ public RefundChannel getFormatRefundChannel() {
+ return refundChannel != null ? RefundChannel.valueOf(refundChannel
+ .toUpperCase()) : null;
+ }
+
+ public int getRefundFee() {
+ return refundFee;
+ }
+
+ /**
+ * 调用接口获取单位为分,get方法转换为元方便使用
+ *
+ * @return 元单位
+ */
+ @JSONField(serialize = false)
+ public double getFormatRefundFee() {
+ return refundFee / 100d;
+ }
+
+ public Integer getCashRefundFee() {
+ return cashRefundFee;
+ }
+
+ /**
+ * 调用接口获取单位为分,get方法转换为元方便使用
+ *
+ * @return 元单位
+ */
+ @JSONField(serialize = false)
+ public double getFormatCashRefundFee() {
+ return cashRefundFee != null ? cashRefundFee.intValue() / 100d : 0d;
+ }
+
+ public List getRefundList() {
+ return refundList;
}
@Override
public String toString() {
- return "RefundResult [transactionId=" + transactionId + ", outTradeNo="
- + outTradeNo + ", " + super.toString() + "]";
+ return "RefundResult [" + super.toString() + ", outRefundNo="
+ + outRefundNo + ", refundId=" + refundId + ", refundChannel="
+ + refundChannel + ", refundFee=" + refundFee
+ + ", cashRefundFee=" + cashRefundFee + ", refundList="
+ + refundList + "]";
}
}
diff --git a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/type/CouponType.java b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/type/CouponType.java
index 358d7492..f7483acc 100644
--- a/weixin4j-base/src/main/java/com/foxinmy/weixin4j/type/CouponType.java
+++ b/weixin4j-base/src/main/java/com/foxinmy/weixin4j/type/CouponType.java
@@ -21,7 +21,16 @@ public enum CouponType {
/**
* 门槛叠加
*/
- THRESHOLD_PLUS(3);
+ THRESHOLD_PLUS(3),
+
+ /**
+ * 充值代金券
+ */
+ CASH(-1),
+ /**
+ * 非充值代金券
+ */
+ NO_CASH(-2);
private int val;
CouponType(int val) {
diff --git a/weixin4j-base/src/test/java/com/foxinmy/weixin4j/base/test/PayTest.java b/weixin4j-base/src/test/java/com/foxinmy/weixin4j/base/test/PayTest.java
index 997cf3ec..95194950 100644
--- a/weixin4j-base/src/test/java/com/foxinmy/weixin4j/base/test/PayTest.java
+++ b/weixin4j-base/src/test/java/com/foxinmy/weixin4j/base/test/PayTest.java
@@ -34,7 +34,7 @@ import com.foxinmy.weixin4j.type.TradeType;
* @className PayTest
* @author jinyu(foxinmy@gmail.com)
* @date 2016年1月30日
- * @since JDK 1.7
+ * @since JDK 1.6
* @see
*/
public class PayTest {
@@ -50,11 +50,11 @@ public class PayTest {
/**
* 商户证书文件
*/
- protected File caFile = new File("商户证书:*.p12");
+ protected File caFile = new File("*.p12");
@Test
public void queryOrder() throws WeixinException {
- Order order = PAY.queryOrder(new IdQuery("BY2016010800025",
+ Order order = PAY.queryOrder(new IdQuery("201601131632321",
IdType.TRADENO));
System.err.println(order);
String sign = order.getSign();
@@ -70,7 +70,6 @@ public class PayTest {
RefundRecord record = PAY.queryRefund(new IdQuery("TT_1427183696238",
IdType.TRADENO));
System.err.println(record);
- // 这里的验证签名需要把details循环拼接
String sign = record.getSign();
record.setSign(null);
String valiSign = SIGNATURE.sign(record);
@@ -139,7 +138,7 @@ public class PayTest {
}
@Test
- public void interfaceReport() throws WeixinException {
+ public void reportInterface() throws WeixinException {
String interfaceUrl = "https://api.mch.weixin.qq.com/pay/unifiedorder";
int executeTime = 2500;
String outTradeNo = null;
@@ -147,7 +146,7 @@ public class PayTest {
Date time = new Date();
XmlResult returnXml = new XmlResult("SUCCESS", "");
returnXml.setResultCode("SUCCESS");
- returnXml = PAY.interfaceReport(interfaceUrl, executeTime, outTradeNo,
+ returnXml = PAY.reportInterface(interfaceUrl, executeTime, outTradeNo,
ip, time, returnXml);
System.err.println(returnXml);
}
diff --git a/weixin4j-mp/README.md b/weixin4j-mp/README.md
index d5ba2a33..a6b82619 100644
--- a/weixin4j-mp/README.md
+++ b/weixin4j-mp/README.md
@@ -33,6 +33,8 @@ weixin4j-mp
* UserApi `用户管理API`
+ * TagApi `用户标签管理API`
+
* ComponentApi `第三方组件API`
[如何使用](https://github.com/foxinmy/weixin4j/wiki)
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/OauthApi.java b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/OauthApi.java
index ece1040e..e1095e65 100644
--- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/OauthApi.java
+++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/OauthApi.java
@@ -220,7 +220,7 @@ public class OauthApi extends MpApi {
}
/**
- * 请求CODE
+ * 微信开放平台oauth授权:请求CODE
*
* @param redirectUri
* 重定向地址 域名与审核时填写的授权域名一致
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/README.md b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/README.md
index 525c4767..9ad62d7b 100644
--- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/README.md
+++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/api/README.md
@@ -24,4 +24,6 @@
* UserApi `用户管理API`
-* TagApi `用户标签管理API`
\ No newline at end of file
+* TagApi `用户标签管理API`
+
+* ComponentApi `第三方组件API`
\ No newline at end of file
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinComponentPreCodeCreator.java b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinComponentPreCodeCreator.java
index 743ea182..8d474542 100644
--- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinComponentPreCodeCreator.java
+++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinComponentPreCodeCreator.java
@@ -9,7 +9,7 @@ import com.foxinmy.weixin4j.token.TokenCreator;
import com.foxinmy.weixin4j.token.TokenManager;
/**
- * 微信开发平台应用组件预授权码创建
+ * 微信开放平台应用组件预授权码创建
*
* @className WeixinComponentPreCodeCreator
* @author jinyu(foxinmy@gmail.com)
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinComponentTokenCreator.java b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinComponentTokenCreator.java
index 97aced14..ee4a138f 100644
--- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinComponentTokenCreator.java
+++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinComponentTokenCreator.java
@@ -9,7 +9,7 @@ import com.foxinmy.weixin4j.token.TicketManager;
import com.foxinmy.weixin4j.token.TokenCreator;
/**
- * 微信开发平台应用组件凭证创建
+ * 微信开放平台应用组件凭证创建
*
* @className WeixinComponentTokenCreator
* @author jinyu(foxinmy@gmail.com)
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinTokenComponentCreator.java b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinTokenComponentCreator.java
index 5417ad0b..1ba09a61 100644
--- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinTokenComponentCreator.java
+++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/component/WeixinTokenComponentCreator.java
@@ -37,7 +37,7 @@ public class WeixinTokenComponentCreator extends TokenCreator {
@Override
public String key0() {
- return String.format("mp_token_suite_%s_%s",
+ return String.format("mp_token_component_%s_%s",
perTicketManager.getThirdId(), perTicketManager.getAuthAppId());
}
diff --git a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/message/TemplateMessage.java b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/message/TemplateMessage.java
index 3c8fb853..ab3a1d15 100644
--- a/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/message/TemplateMessage.java
+++ b/weixin4j-mp/src/main/java/com/foxinmy/weixin4j/mp/message/TemplateMessage.java
@@ -56,7 +56,10 @@ public class TemplateMessage implements Serializable {
private final static String TAIL_KEY = "remark";
private final static String DEFAULT_COLOR = "#173177";
- public TemplateMessage(String toUser, String templateId, String url) {
+ @JSONCreator
+ public TemplateMessage(@JSONField(name = "toUser") String toUser,
+ @JSONField(name = "templateId") String templateId,
+ @JSONField(name = "url") String url) {
this.toUser = toUser;
this.templateId = templateId;
this.url = url;
diff --git a/weixin4j-qy/src/test/java/com/foxinmy/weixin4j/qy/test/NotifyTest.java b/weixin4j-qy/src/test/java/com/foxinmy/weixin4j/qy/test/NotifyTest.java
index cc2edfa1..2dc9dfc7 100644
--- a/weixin4j-qy/src/test/java/com/foxinmy/weixin4j/qy/test/NotifyTest.java
+++ b/weixin4j-qy/src/test/java/com/foxinmy/weixin4j/qy/test/NotifyTest.java
@@ -35,7 +35,7 @@ public class NotifyTest extends TokenTest {
@Test
public void text() throws WeixinException {
- NotifyMessage notify = new NotifyMessage(0, new Text("content"));
+ NotifyMessage notify = new NotifyMessage(40, new Text("content"));
System.out.println(notifyApi.sendNotifyMessage(notify));
}