{
+ private String mediaId;
+
+ public MpNewsBuilder() {
+ this.msgType = WxConsts.CUSTOM_MSG_MPNEWS;
+ }
+
+ public MpNewsBuilder mediaId(String mediaId) {
+ this.mediaId = mediaId;
+ return this;
+ }
+
+ @Override
+ public WxMpKefuMessage build() {
+ WxMpKefuMessage m = super.build();
+ m.setMpNewsMediaId(this.mediaId);
+ return m;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/MusicBuilder.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/MusicBuilder.java
index 7a9994ad..3555f7a9 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/MusicBuilder.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/MusicBuilder.java
@@ -1,12 +1,12 @@
package me.chanjar.weixin.mp.bean.custombuilder;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
/**
* 音乐消息builder
*
- * 用法: WxMpCustomMessage m = WxMpCustomMessage.MUSIC()
+ * 用法: WxMpKefuMessage m = WxMpKefuMessage.MUSIC()
* .musicUrl(...)
* .hqMusicUrl(...)
* .title(...)
@@ -53,8 +53,8 @@ public final class MusicBuilder extends BaseBuilder {
}
@Override
- public WxMpCustomMessage build() {
- WxMpCustomMessage m = super.build();
+ public WxMpKefuMessage build() {
+ WxMpKefuMessage m = super.build();
m.setMusicUrl(this.musicUrl);
m.setHqMusicUrl(this.hqMusicUrl);
m.setTitle(this.title);
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/NewsBuilder.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/NewsBuilder.java
index ad0efb23..d909eb7d 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/NewsBuilder.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/NewsBuilder.java
@@ -1,7 +1,7 @@
package me.chanjar.weixin.mp.bean.custombuilder;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import java.util.ArrayList;
import java.util.List;
@@ -10,27 +10,27 @@ import java.util.List;
* 图文消息builder
*
* 用法:
- * WxMpCustomMessage m = WxMpCustomMessage.NEWS().addArticle(article).toUser(...).build();
+ * WxMpKefuMessage m = WxMpKefuMessage.NEWS().addArticle(article).toUser(...).build();
*
* @author chanjarster
*
*/
public final class NewsBuilder extends BaseBuilder {
- private List articles = new ArrayList<>();
-
+ private List articles = new ArrayList<>();
+
public NewsBuilder() {
this.msgType = WxConsts.CUSTOM_MSG_NEWS;
}
- public NewsBuilder addArticle(WxMpCustomMessage.WxArticle article) {
+ public NewsBuilder addArticle(WxMpKefuMessage.WxArticle article) {
this.articles.add(article);
return this;
}
@Override
- public WxMpCustomMessage build() {
- WxMpCustomMessage m = super.build();
+ public WxMpKefuMessage build() {
+ WxMpKefuMessage m = super.build();
m.setArticles(this.articles);
return m;
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/TextBuilder.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/TextBuilder.java
index 7f458457..770675f5 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/TextBuilder.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/TextBuilder.java
@@ -1,12 +1,12 @@
package me.chanjar.weixin.mp.bean.custombuilder;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
/**
* 文本消息builder
*
- * 用法: WxMpCustomMessage m = WxMpCustomMessage.TEXT().content(...).toUser(...).build();
+ * 用法: WxMpKefuMessage m = WxMpKefuMessage.TEXT().content(...).toUser(...).build();
*
* @author chanjarster
*
@@ -24,8 +24,8 @@ public final class TextBuilder extends BaseBuilder {
}
@Override
- public WxMpCustomMessage build() {
- WxMpCustomMessage m = super.build();
+ public WxMpKefuMessage build() {
+ WxMpKefuMessage m = super.build();
m.setContent(this.content);
return m;
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VideoBuilder.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VideoBuilder.java
index bda6ef7c..f9740e2f 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VideoBuilder.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VideoBuilder.java
@@ -1,12 +1,12 @@
package me.chanjar.weixin.mp.bean.custombuilder;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
/**
* 视频消息builder
*
- * 用法: WxMpCustomMessage m = WxMpCustomMessage.VOICE()
+ * 用法: WxMpKefuMessage m = WxMpKefuMessage.VOICE()
* .mediaId(...)
* .title(...)
* .thumbMediaId(..)
@@ -48,8 +48,8 @@ public final class VideoBuilder extends BaseBuilder {
}
@Override
- public WxMpCustomMessage build() {
- WxMpCustomMessage m = super.build();
+ public WxMpKefuMessage build() {
+ WxMpKefuMessage m = super.build();
m.setMediaId(this.mediaId);
m.setTitle(this.title);
m.setDescription(this.description);
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VoiceBuilder.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VoiceBuilder.java
index 867c8aff..7686a56d 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VoiceBuilder.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/VoiceBuilder.java
@@ -1,12 +1,12 @@
package me.chanjar.weixin.mp.bean.custombuilder;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
/**
* 语音消息builder
*
- * 用法: WxMpCustomMessage m = WxMpCustomMessage.VOICE().mediaId(...).toUser(...).build();
+ * 用法: WxMpKefuMessage m = WxMpKefuMessage.VOICE().mediaId(...).toUser(...).build();
*
* @author chanjarster
*
@@ -24,8 +24,8 @@ public final class VoiceBuilder extends BaseBuilder {
}
@Override
- public WxMpCustomMessage build() {
- WxMpCustomMessage m = super.build();
+ public WxMpKefuMessage build() {
+ WxMpKefuMessage m = super.build();
m.setMediaId(this.mediaId);
return m;
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/WxCardBuilder.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/WxCardBuilder.java
index 8620cd84..fb5e81c2 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/WxCardBuilder.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/custombuilder/WxCardBuilder.java
@@ -1,12 +1,12 @@
package me.chanjar.weixin.mp.bean.custombuilder;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
/**
* 卡券消息builder
*
- * 用法: WxMpCustomMessage m = WxMpCustomMessage.WXCARD().cardId(...).toUser(...).build();
+ * 用法: WxMpKefuMessage m = WxMpKefuMessage.WXCARD().cardId(...).toUser(...).build();
*
* @author mgcnrx11
*
@@ -24,8 +24,8 @@ public final class WxCardBuilder extends BaseBuilder {
}
@Override
- public WxMpCustomMessage build() {
- WxMpCustomMessage m = super.build();
+ public WxMpKefuMessage build() {
+ WxMpKefuMessage m = super.build();
m.setCardId(this.cardId);
return m;
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleResult.java
index 3dd28459..d763543e 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleResult.java
@@ -10,7 +10,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 图文分析数据接口返回结果对象
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016/8/24.
*/
public class WxDataCubeArticleResult extends WxDataCubeBaseResult {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleTotal.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleTotal.java
index 37401cf8..d3236be3 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleTotal.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleTotal.java
@@ -10,7 +10,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 图文分析数据接口返回结果对象
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016/8/24.
*/
public class WxDataCubeArticleTotal extends WxDataCubeBaseResult {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleTotalDetail.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleTotalDetail.java
index cbbf148f..e228a3cc 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleTotalDetail.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeArticleTotalDetail.java
@@ -4,7 +4,7 @@ import com.google.gson.annotations.SerializedName;
/**
* 获取图文群发总数据接口(getarticletotal)中的详细字段
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016/8/24.
*/
public class WxDataCubeArticleTotalDetail {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeBaseResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeBaseResult.java
index f819ab42..f3999fa2 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeBaseResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeBaseResult.java
@@ -6,13 +6,13 @@ import org.apache.commons.lang3.builder.ToStringStyle;
/**
* 统计接口的共用属性类
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016/8/25.
*/
public class WxDataCubeBaseResult {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
/**
@@ -29,5 +29,5 @@ public class WxDataCubeBaseResult {
public void setRefDate(String refDate) {
this.refDate = refDate;
}
-
+
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeInterfaceResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeInterfaceResult.java
index 82a45dcf..2088453c 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeInterfaceResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeInterfaceResult.java
@@ -10,7 +10,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 接口分析数据接口返回结果对象
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016/8/30.
*/
public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult {
@@ -98,5 +98,5 @@ public class WxDataCubeInterfaceResult extends WxDataCubeBaseResult {
new TypeToken>() {
}.getType());
}
-
+
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeMsgResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeMsgResult.java
index 908dfca8..01e40e80 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeMsgResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeMsgResult.java
@@ -10,7 +10,7 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 消息分析数据接口返回结果对象
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016/8/29.
*/
public class WxDataCubeMsgResult extends WxDataCubeBaseResult {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeUserCumulate.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeUserCumulate.java
index 039bd189..e764f244 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeUserCumulate.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeUserCumulate.java
@@ -46,7 +46,7 @@ public class WxDataCubeUserCumulate implements Serializable {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public static List fromJson(String json) {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeUserSummary.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeUserSummary.java
index 4802027e..54eb0d4a 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeUserSummary.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/datacube/WxDataCubeUserSummary.java
@@ -65,7 +65,7 @@ public class WxDataCubeUserSummary implements Serializable {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public static List fromJson(String json) {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpCustomMessage.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/WxMpKefuMessage.java
similarity index 87%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpCustomMessage.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/WxMpKefuMessage.java
index a7f1670f..36c2525c 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpCustomMessage.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/WxMpKefuMessage.java
@@ -1,10 +1,11 @@
-package me.chanjar.weixin.mp.bean;
+package me.chanjar.weixin.mp.bean.kefu;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import me.chanjar.weixin.mp.bean.custombuilder.ImageBuilder;
+import me.chanjar.weixin.mp.bean.custombuilder.MpNewsBuilder;
import me.chanjar.weixin.mp.bean.custombuilder.MusicBuilder;
import me.chanjar.weixin.mp.bean.custombuilder.NewsBuilder;
import me.chanjar.weixin.mp.bean.custombuilder.TextBuilder;
@@ -15,10 +16,10 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 客服消息
- * @author chanjarster
*
+ * @author chanjarster
*/
-public class WxMpCustomMessage implements Serializable {
+public class WxMpKefuMessage implements Serializable {
private static final long serialVersionUID = -9196732086954365246L;
private String toUser;
@@ -32,18 +33,85 @@ public class WxMpCustomMessage implements Serializable {
private String hqMusicUrl;
private String kfAccount;
private String cardId;
+ private String mpNewsMediaId;
private List articles = new ArrayList<>();
+ /**
+ * 获得文本消息builder
+ */
+ public static TextBuilder TEXT() {
+ return new TextBuilder();
+ }
+
+ /**
+ * 获得图片消息builder
+ */
+ public static ImageBuilder IMAGE() {
+ return new ImageBuilder();
+ }
+
+ /**
+ * 获得语音消息builder
+ */
+ public static VoiceBuilder VOICE() {
+ return new VoiceBuilder();
+ }
+
+ /**
+ * 获得视频消息builder
+ */
+ public static VideoBuilder VIDEO() {
+ return new VideoBuilder();
+ }
+
+ /**
+ * 获得音乐消息builder
+ */
+ public static MusicBuilder MUSIC() {
+ return new MusicBuilder();
+ }
+
+ /**
+ * 获得图文消息(点击跳转到外链)builder
+ */
+ public static NewsBuilder NEWS() {
+ return new NewsBuilder();
+ }
+
+ /**
+ * 获得图文消息(点击跳转到图文消息页面)builder
+ */
+ public static MpNewsBuilder MPNEWS() {
+ return new MpNewsBuilder();
+ }
+
+ /**
+ * 获得卡券消息builder
+ */
+ public static WxCardBuilder WXCARD() {
+ return new WxCardBuilder();
+ }
+
public String getToUser() {
return this.toUser;
}
+
public void setToUser(String toUser) {
this.toUser = toUser;
}
+
public String getMsgType() {
return this.msgType;
}
+ public String getMpNewsMediaId() {
+ return this.mpNewsMediaId;
+ }
+
+ public void setMpNewsMediaId(String mpNewsMediaId) {
+ this.mpNewsMediaId = mpNewsMediaId;
+ }
+
/**
*
* 请使用
@@ -53,52 +121,68 @@ public class WxMpCustomMessage implements Serializable {
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_MUSIC}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_VIDEO}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_NEWS}
+ * {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_MPNEWS}
* {@link me.chanjar.weixin.common.api.WxConsts#CUSTOM_MSG_WXCARD}
*
+ *
* @param msgType
*/
public void setMsgType(String msgType) {
this.msgType = msgType;
}
+
public String getContent() {
return this.content;
}
+
public void setContent(String content) {
this.content = content;
}
+
public String getMediaId() {
return this.mediaId;
}
+
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
+
public String getThumbMediaId() {
return this.thumbMediaId;
}
+
public void setThumbMediaId(String thumbMediaId) {
this.thumbMediaId = thumbMediaId;
}
+
public String getTitle() {
return this.title;
}
+
public void setTitle(String title) {
this.title = title;
}
+
public String getDescription() {
return this.description;
}
+
public void setDescription(String description) {
this.description = description;
}
+
public String getMusicUrl() {
return this.musicUrl;
}
+
public void setMusicUrl(String musicUrl) {
this.musicUrl = musicUrl;
}
+
public String getHqMusicUrl() {
return this.hqMusicUrl;
}
+
public void setHqMusicUrl(String hqMusicUrl) {
this.hqMusicUrl = hqMusicUrl;
}
@@ -114,6 +198,7 @@ public class WxMpCustomMessage implements Serializable {
public List getArticles() {
return this.articles;
}
+
public void setArticles(List articles) {
this.articles = articles;
}
@@ -122,8 +207,15 @@ public class WxMpCustomMessage implements Serializable {
return WxMpGsonBuilder.INSTANCE.create().toJson(this);
}
- public static class WxArticle {
+ public String getKfAccount() {
+ return this.kfAccount;
+ }
+ public void setKfAccount(String kfAccount) {
+ this.kfAccount = kfAccount;
+ }
+
+ public static class WxArticle {
private String title;
private String description;
private String url;
@@ -132,85 +224,34 @@ public class WxMpCustomMessage implements Serializable {
public String getTitle() {
return this.title;
}
+
public void setTitle(String title) {
this.title = title;
}
+
public String getDescription() {
return this.description;
}
+
public void setDescription(String description) {
this.description = description;
}
+
public String getUrl() {
return this.url;
}
+
public void setUrl(String url) {
this.url = url;
}
+
public String getPicUrl() {
return this.picUrl;
}
+
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
}
-
- /**
- * 获得文本消息builder
- */
- public static TextBuilder TEXT() {
- return new TextBuilder();
- }
-
- /**
- * 获得图片消息builder
- */
- public static ImageBuilder IMAGE() {
- return new ImageBuilder();
- }
-
- /**
- * 获得语音消息builder
- */
- public static VoiceBuilder VOICE() {
- return new VoiceBuilder();
- }
-
- /**
- * 获得视频消息builder
- */
- public static VideoBuilder VIDEO() {
- return new VideoBuilder();
- }
-
- /**
- * 获得音乐消息builder
- */
- public static MusicBuilder MUSIC() {
- return new MusicBuilder();
- }
-
- /**
- * 获得图文消息builder
- */
- public static NewsBuilder NEWS() {
- return new NewsBuilder();
- }
-
-
- /**
- * 获得卡券消息builder
- */
- public static WxCardBuilder WXCARD() {
- return new WxCardBuilder();
- }
-
- public String getKfAccount() {
- return this.kfAccount;
- }
-
- public void setKfAccount(String kfAccount) {
- this.kfAccount = kfAccount;
- }
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/request/WxMpKfSessionRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/request/WxMpKfSessionRequest.java
index e821916e..420c0d62 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/request/WxMpKfSessionRequest.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/request/WxMpKfSessionRequest.java
@@ -31,7 +31,7 @@ public class WxMpKfSessionRequest implements Serializable {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public String toJson() {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfInfo.java
index 37154aa4..bcb811bc 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfInfo.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfInfo.java
@@ -127,7 +127,7 @@ public class WxMpKfInfo implements Serializable {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public String getWxAccount() {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfList.java
index 062ff9ac..3465073a 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfList.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfList.java
@@ -19,7 +19,7 @@ public class WxMpKfList {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public List getKfList() {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfMsgList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfMsgList.java
index 570f2def..cfcbba92 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfMsgList.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfMsgList.java
@@ -46,7 +46,7 @@ public class WxMpKfMsgList {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public static WxMpKfMsgList fromJson(String responseContent) {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfMsgRecord.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfMsgRecord.java
index 7f326ac1..14b26567 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfMsgRecord.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfMsgRecord.java
@@ -41,7 +41,7 @@ public class WxMpKfMsgRecord {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public String getWorker() {
return this.worker;
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfOnlineList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfOnlineList.java
index b4a418f6..1cc674c9 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfOnlineList.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfOnlineList.java
@@ -19,7 +19,7 @@ public class WxMpKfOnlineList {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public List getKfOnlineList() {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSession.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSession.java
index e29f45b8..8a9ef842 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSession.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSession.java
@@ -39,7 +39,7 @@ public class WxMpKfSession {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public String getKfAccount() {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionGetResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionGetResult.java
index 22a6cf24..eb78f3b6 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionGetResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionGetResult.java
@@ -27,7 +27,7 @@ public class WxMpKfSessionGetResult {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public static WxMpKfSessionGetResult fromJson(String json) {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionList.java
index dea7e243..8bcac0e4 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionList.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionList.java
@@ -23,7 +23,7 @@ public class WxMpKfSessionList {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public static WxMpKfSessionList fromJson(String json) {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionWaitCaseList.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionWaitCaseList.java
index dc2ab06b..7e876901 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionWaitCaseList.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/kefu/result/WxMpKfSessionWaitCaseList.java
@@ -29,7 +29,7 @@ public class WxMpKfSessionWaitCaseList {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public static WxMpKfSessionWaitCaseList fromJson(String json) {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/outxmlbuilder/TransferCustomerServiceBuilder.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/outxmlbuilder/TransferCustomerServiceBuilder.java
index 87ec3a04..b89e31b4 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/outxmlbuilder/TransferCustomerServiceBuilder.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/outxmlbuilder/TransferCustomerServiceBuilder.java
@@ -1,17 +1,17 @@
package me.chanjar.weixin.mp.bean.outxmlbuilder;
import me.chanjar.weixin.common.util.StringUtils;
-import me.chanjar.weixin.mp.bean.WxMpXmlOutTransferCustomerServiceMessage;
+import me.chanjar.weixin.mp.bean.WxMpXmlOutTransferKefuMessage;
/**
* 客服消息builder
*
- * 用法: WxMpCustomMessage m = WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE().content(...).toUser(...).build();
+ * 用法: WxMpKefuMessage m = WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE().content(...).toUser(...).build();
*
*
* @author chanjarster
*/
-public final class TransferCustomerServiceBuilder extends BaseBuilder {
+public final class TransferCustomerServiceBuilder extends BaseBuilder {
private String kfAccount;
public TransferCustomerServiceBuilder kfAccount(String kf) {
@@ -20,11 +20,11 @@ public final class TransferCustomerServiceBuilder extends BaseBuilder 订单支付状态回调
- *
- * 支付结果通知(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7)
- *
- * /pre>
- *
- * @author ukid
- */
-public class WxMpPayCallback implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -4143804055690843641L;
- private String return_code;
- private String return_msg;
-
- private String appid;
- private String mch_id;
- private String device_info;
- private String nonce_str;
- private String sign;
- private String result_code;
- private String err_code;
- private String err_code_des;
- private String openid;
- private String is_subscribe;
- private String trade_type;
- private String bank_type;
- private String total_fee;
- private String fee_type;
- private String cash_fee;
- private String cash_fee_type;
- private String coupon_fee;
- private String coupon_count;
- private String coupon_batch_id_$n;
- private String coupon_id_$n;
- private String coupon_fee_$n;
- private String transaction_id;
- private String out_trade_no;
- private String attach;
- private String time_end;
-
- public String getReturn_code() {
- return this.return_code;
- }
-
- public String getReturn_msg() {
- return this.return_msg;
- }
-
- public String getAppid() {
- return this.appid;
- }
-
- public String getMch_id() {
- return this.mch_id;
- }
-
- public String getDevice_info() {
- return this.device_info;
- }
-
- public String getNonce_str() {
- return this.nonce_str;
- }
-
- public String getSign() {
- return this.sign;
- }
-
- public String getResult_code() {
- return this.result_code;
- }
-
- public String getErr_code() {
- return this.err_code;
- }
-
- public String getErr_code_des() {
- return this.err_code_des;
- }
-
- public String getOpenid() {
- return this.openid;
- }
-
- public String getIs_subscribe() {
- return this.is_subscribe;
- }
-
- public String getTrade_type() {
- return this.trade_type;
- }
-
- public String getBank_type() {
- return this.bank_type;
- }
-
- public String getTotal_fee() {
- return this.total_fee;
- }
-
- public String getFee_type() {
- return this.fee_type;
- }
-
- public String getCash_fee() {
- return this.cash_fee;
- }
-
- public String getCash_fee_type() {
- return this.cash_fee_type;
- }
-
- public String getCoupon_fee() {
- return this.coupon_fee;
- }
-
- public String getCoupon_count() {
- return this.coupon_count;
- }
-
- public String getCoupon_batch_id_$n() {
- return this.coupon_batch_id_$n;
- }
-
- public String getCoupon_id_$n() {
- return this.coupon_id_$n;
- }
-
- public String getCoupon_fee_$n() {
- return this.coupon_fee_$n;
- }
-
- public String getTransaction_id() {
- return this.transaction_id;
- }
-
- public String getOut_trade_no() {
- return this.out_trade_no;
- }
-
- public String getAttach() {
- return this.attach;
- }
-
- public String getTime_end() {
- return this.time_end;
- }
-
- public void setReturn_code(String return_code) {
- this.return_code = return_code;
- }
-
- public void setReturn_msg(String return_msg) {
- this.return_msg = return_msg;
- }
-
- public void setAppid(String appid) {
- this.appid = appid;
- }
-
- public void setMch_id(String mch_id) {
- this.mch_id = mch_id;
- }
-
- public void setDevice_info(String device_info) {
- this.device_info = device_info;
- }
-
- public void setNonce_str(String nonce_str) {
- this.nonce_str = nonce_str;
- }
-
- public void setSign(String sign) {
- this.sign = sign;
- }
-
- public void setResult_code(String result_code) {
- this.result_code = result_code;
- }
-
- public void setErr_code(String err_code) {
- this.err_code = err_code;
- }
-
- public void setErr_code_des(String err_code_des) {
- this.err_code_des = err_code_des;
- }
-
- public void setOpenid(String openid) {
- this.openid = openid;
- }
-
- public void setIs_subscribe(String is_subscribe) {
- this.is_subscribe = is_subscribe;
- }
-
- public void setTrade_type(String trade_type) {
- this.trade_type = trade_type;
- }
-
- public void setBank_type(String bank_type) {
- this.bank_type = bank_type;
- }
-
- public void setTotal_fee(String total_fee) {
- this.total_fee = total_fee;
- }
-
- public void setFee_type(String fee_type) {
- this.fee_type = fee_type;
- }
-
- public void setCash_fee(String cash_fee) {
- this.cash_fee = cash_fee;
- }
-
- public void setCash_fee_type(String cash_fee_type) {
- this.cash_fee_type = cash_fee_type;
- }
-
- public void setCoupon_fee(String coupon_fee) {
- this.coupon_fee = coupon_fee;
- }
-
- public void setCoupon_count(String coupon_count) {
- this.coupon_count = coupon_count;
- }
-
- public void setCoupon_batch_id_$n(String coupon_batch_id_$n) {
- this.coupon_batch_id_$n = coupon_batch_id_$n;
- }
-
- public void setCoupon_id_$n(String coupon_id_$n) {
- this.coupon_id_$n = coupon_id_$n;
- }
-
- public void setCoupon_fee_$n(String coupon_fee_$n) {
- this.coupon_fee_$n = coupon_fee_$n;
- }
-
- public void setTransaction_id(String transaction_id) {
- this.transaction_id = transaction_id;
- }
-
- public void setOut_trade_no(String out_trade_no) {
- this.out_trade_no = out_trade_no;
- }
-
- public void setAttach(String attach) {
- this.attach = attach;
- }
-
- public void setTime_end(String time_end) {
- this.time_end = time_end;
- }
-
- @Override
- public String toString() {
- return "WxMpPayCallback [return_code=" + this.return_code + ", return_msg="
- + this.return_msg + ", appid=" + this.appid + ", mch_id=" + this.mch_id
- + ", device_info=" + this.device_info + ", nonce_str=" + this.nonce_str
- + ", sign=" + this.sign + ", result_code=" + this.result_code
- + ", err_code=" + this.err_code + ", err_code_des=" + this.err_code_des
- + ", openid=" + this.openid + ", is_subscribe=" + this.is_subscribe
- + ", trade_type=" + this.trade_type + ", bank_type=" + this.bank_type
- + ", total_fee=" + this.total_fee + ", fee_type=" + this.fee_type
- + ", cash_fee=" + this.cash_fee + ", cash_fee_type=" + this.cash_fee_type
- + ", coupon_fee=" + this.coupon_fee + ", coupon_count="
- + this.coupon_count + ", coupon_batch_id_$n=" + this.coupon_batch_id_$n
- + ", coupon_id_$n=" + this.coupon_id_$n + ", coupon_fee_$n="
- + this.coupon_fee_$n + ", transaction_id=" + this.transaction_id
- + ", out_trade_no=" + this.out_trade_no + ", attach=" + this.attach
- + ", time_end=" + this.time_end + "]";
- }
-
-}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPrepayIdResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPrepayIdResult.java
deleted file mode 100644
index cff9d787..00000000
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPrepayIdResult.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package me.chanjar.weixin.mp.bean.pay;
-
-import java.io.Serializable;
-
-/**
- *
- * 在发起微信支付前,需要调用统一下单接口,获取"预支付交易会话标识"返回的结果
- * 统一下单(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1)
- *
- *
- * @author chanjarster
- */
-@Deprecated
-public class WxMpPrepayIdResult implements Serializable {
- private static final long serialVersionUID = -8970574397788396143L;
- private String return_code;
- private String return_msg;
- private String appid;
- private String mch_id;
- private String nonce_str;
- private String sign;
- private String result_code;
- private String prepay_id;
- private String trade_type;
- private String err_code;
- private String err_code_des;
- private String code_url;
-
- public String getReturn_code() {
- return this.return_code;
- }
-
- public void setReturn_code(String return_code) {
- this.return_code = return_code;
- }
-
- public String getReturn_msg() {
- return this.return_msg;
- }
-
- public void setReturn_msg(String return_msg) {
- this.return_msg = return_msg;
- }
-
- public String getAppid() {
- return this.appid;
- }
-
- public void setAppid(String appid) {
- this.appid = appid;
- }
-
- public String getMch_id() {
- return this.mch_id;
- }
-
- public void setMch_id(String mch_id) {
- this.mch_id = mch_id;
- }
-
- public String getNonce_str() {
- return this.nonce_str;
- }
-
- public void setNonce_str(String nonce_str) {
- this.nonce_str = nonce_str;
- }
-
- public String getSign() {
- return this.sign;
- }
-
- public void setSign(String sign) {
- this.sign = sign;
- }
-
- public String getResult_code() {
- return this.result_code;
- }
-
- public void setResult_code(String result_code) {
- this.result_code = result_code;
- }
-
- public String getPrepay_id() {
- return this.prepay_id;
- }
-
- public void setPrepay_id(String prepay_id) {
- this.prepay_id = prepay_id;
- }
-
- public String getTrade_type() {
- return this.trade_type;
- }
-
- public void setTrade_type(String trade_type) {
- this.trade_type = trade_type;
- }
-
- public String getErr_code() {
- return this.err_code;
- }
-
- public void setErr_code(String err_code) {
- this.err_code = err_code;
- }
-
- public String getErr_code_des() {
- return this.err_code_des;
- }
-
- public void setErr_code_des(String err_code_des) {
- this.err_code_des = err_code_des;
- }
-
- public String getCode_url() {
- return this.code_url;
- }
-
- public void setCode_url(String code_url) {
- this.code_url = code_url;
- }
-}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPayResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxPayJsSDKCallback.java
similarity index 66%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPayResult.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxPayJsSDKCallback.java
index 2978ba17..742f5e18 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPayResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxPayJsSDKCallback.java
@@ -2,258 +2,278 @@ package me.chanjar.weixin.mp.bean.pay;
import java.io.Serializable;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
/**
*
- * 查询订单支付状态返回的结果
- *
- * 查询订单(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_2)
- *
- *
+ * 订单支付状态回调
+ * 支付结果通知(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7)
+ * /pre>
*
* @author ukid
*/
-public class WxMpPayResult implements Serializable {
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
- }
-
- private static final long serialVersionUID = -570934170727777190L;
-
+public class WxPayJsSDKCallback implements Serializable {
+ private static final long serialVersionUID = -4143804055690843641L;
private String return_code;
private String return_msg;
+
private String appid;
private String mch_id;
+ private String device_info;
private String nonce_str;
private String sign;
private String result_code;
private String err_code;
private String err_code_des;
- private String trade_state;
- private String trade_state_desc;
- private String device_info;
private String openid;
private String is_subscribe;
private String trade_type;
private String bank_type;
private String total_fee;
- private String coupon_fee;
private String fee_type;
+ private String cash_fee;
+ private String cash_fee_type;
+ private String coupon_fee;
+ private String coupon_count;
+ private String coupon_batch_id_$n;
+ private String coupon_id_$n;
+ private String coupon_fee_$n;
private String transaction_id;
private String out_trade_no;
private String attach;
private String time_end;
- /**
- * 现金支付金额 cash_fee 是 Int 100 现金支付金额订单现金支付金额,详见支付金额
- */
- private String cash_fee;
-
- /**
- * 现金支付货币类型 cash_fee_type 否
- *
- */
- private String cash_fee_type;
public String getReturn_code() {
return this.return_code;
}
+ public void setReturn_code(String return_code) {
+ this.return_code = return_code;
+ }
+
public String getReturn_msg() {
return this.return_msg;
}
+ public void setReturn_msg(String return_msg) {
+ this.return_msg = return_msg;
+ }
+
public String getAppid() {
return this.appid;
}
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
public String getMch_id() {
return this.mch_id;
}
+ public void setMch_id(String mch_id) {
+ this.mch_id = mch_id;
+ }
+
+ public String getDevice_info() {
+ return this.device_info;
+ }
+
+ public void setDevice_info(String device_info) {
+ this.device_info = device_info;
+ }
+
public String getNonce_str() {
return this.nonce_str;
}
+ public void setNonce_str(String nonce_str) {
+ this.nonce_str = nonce_str;
+ }
+
public String getSign() {
return this.sign;
}
+ public void setSign(String sign) {
+ this.sign = sign;
+ }
+
public String getResult_code() {
return this.result_code;
}
+ public void setResult_code(String result_code) {
+ this.result_code = result_code;
+ }
+
public String getErr_code() {
return this.err_code;
}
- public String getErr_code_des() {
- return this.err_code_des;
+ public void setErr_code(String err_code) {
+ this.err_code = err_code;
}
- public String getTrade_state() {
- return this.trade_state;
+ public String getErr_code_des() {
+ return this.err_code_des;
}
- public String getDevice_info() {
- return this.device_info;
+ public void setErr_code_des(String err_code_des) {
+ this.err_code_des = err_code_des;
}
public String getOpenid() {
return this.openid;
}
+ public void setOpenid(String openid) {
+ this.openid = openid;
+ }
+
public String getIs_subscribe() {
return this.is_subscribe;
}
+ public void setIs_subscribe(String is_subscribe) {
+ this.is_subscribe = is_subscribe;
+ }
+
public String getTrade_type() {
return this.trade_type;
}
+ public void setTrade_type(String trade_type) {
+ this.trade_type = trade_type;
+ }
+
public String getBank_type() {
return this.bank_type;
}
+ public void setBank_type(String bank_type) {
+ this.bank_type = bank_type;
+ }
+
public String getTotal_fee() {
return this.total_fee;
}
- public String getCoupon_fee() {
- return this.coupon_fee;
+ public void setTotal_fee(String total_fee) {
+ this.total_fee = total_fee;
}
public String getFee_type() {
return this.fee_type;
}
- public String getTransaction_id() {
- return this.transaction_id;
- }
-
- public String getOut_trade_no() {
- return this.out_trade_no;
- }
-
- public String getAttach() {
- return this.attach;
- }
-
- public String getTime_end() {
- return this.time_end;
+ public void setFee_type(String fee_type) {
+ this.fee_type = fee_type;
}
- public void setReturn_code(String return_code) {
- this.return_code = return_code;
+ public String getCash_fee() {
+ return this.cash_fee;
}
- public void setReturn_msg(String return_msg) {
- this.return_msg = return_msg;
+ public void setCash_fee(String cash_fee) {
+ this.cash_fee = cash_fee;
}
- public void setAppid(String appid) {
- this.appid = appid;
+ public String getCash_fee_type() {
+ return this.cash_fee_type;
}
- public void setMch_id(String mch_id) {
- this.mch_id = mch_id;
+ public void setCash_fee_type(String cash_fee_type) {
+ this.cash_fee_type = cash_fee_type;
}
- public void setNonce_str(String nonce_str) {
- this.nonce_str = nonce_str;
+ public String getCoupon_fee() {
+ return this.coupon_fee;
}
- public void setSign(String sign) {
- this.sign = sign;
+ public void setCoupon_fee(String coupon_fee) {
+ this.coupon_fee = coupon_fee;
}
- public void setResult_code(String result_code) {
- this.result_code = result_code;
+ public String getCoupon_count() {
+ return this.coupon_count;
}
- public void setErr_code(String err_code) {
- this.err_code = err_code;
+ public void setCoupon_count(String coupon_count) {
+ this.coupon_count = coupon_count;
}
- public void setErr_code_des(String err_code_des) {
- this.err_code_des = err_code_des;
+ public String getCoupon_batch_id_$n() {
+ return this.coupon_batch_id_$n;
}
- public void setTrade_state(String trade_state) {
- this.trade_state = trade_state;
+ public void setCoupon_batch_id_$n(String coupon_batch_id_$n) {
+ this.coupon_batch_id_$n = coupon_batch_id_$n;
}
- public void setDevice_info(String device_info) {
- this.device_info = device_info;
+ public String getCoupon_id_$n() {
+ return this.coupon_id_$n;
}
- public void setOpenid(String openid) {
- this.openid = openid;
+ public void setCoupon_id_$n(String coupon_id_$n) {
+ this.coupon_id_$n = coupon_id_$n;
}
- public void setIs_subscribe(String is_subscribe) {
- this.is_subscribe = is_subscribe;
+ public String getCoupon_fee_$n() {
+ return this.coupon_fee_$n;
}
- public void setTrade_type(String trade_type) {
- this.trade_type = trade_type;
+ public void setCoupon_fee_$n(String coupon_fee_$n) {
+ this.coupon_fee_$n = coupon_fee_$n;
}
- public void setBank_type(String bank_type) {
- this.bank_type = bank_type;
- }
-
- public void setTotal_fee(String total_fee) {
- this.total_fee = total_fee;
- }
-
- public void setCoupon_fee(String coupon_fee) {
- this.coupon_fee = coupon_fee;
- }
-
- public void setFee_type(String fee_type) {
- this.fee_type = fee_type;
+ public String getTransaction_id() {
+ return this.transaction_id;
}
public void setTransaction_id(String transaction_id) {
this.transaction_id = transaction_id;
}
- public void setOut_trade_no(String out_trade_no) {
- this.out_trade_no = out_trade_no;
- }
-
- public void setAttach(String attach) {
- this.attach = attach;
+ public String getOut_trade_no() {
+ return this.out_trade_no;
}
- public void setTime_end(String time_end) {
- this.time_end = time_end;
+ public void setOut_trade_no(String out_trade_no) {
+ this.out_trade_no = out_trade_no;
}
- public String getTrade_state_desc() {
- return this.trade_state_desc;
+ public String getAttach() {
+ return this.attach;
}
- public void setTrade_state_desc(String trade_state_desc) {
- this.trade_state_desc = trade_state_desc;
+ public void setAttach(String attach) {
+ this.attach = attach;
}
- public String getCash_fee() {
- return this.cash_fee;
+ public String getTime_end() {
+ return this.time_end;
}
- public void setCash_fee(String cash_fee) {
- this.cash_fee = cash_fee;
+ public void setTime_end(String time_end) {
+ this.time_end = time_end;
}
- public String getCash_fee_type() {
- return this.cash_fee_type;
+ @Override
+ public String toString() {
+ return "WxPayJsSDKCallback [return_code=" + this.return_code + ", return_msg="
+ + this.return_msg + ", appid=" + this.appid + ", mch_id=" + this.mch_id
+ + ", device_info=" + this.device_info + ", nonce_str=" + this.nonce_str
+ + ", sign=" + this.sign + ", result_code=" + this.result_code
+ + ", err_code=" + this.err_code + ", err_code_des=" + this.err_code_des
+ + ", openid=" + this.openid + ", is_subscribe=" + this.is_subscribe
+ + ", trade_type=" + this.trade_type + ", bank_type=" + this.bank_type
+ + ", total_fee=" + this.total_fee + ", fee_type=" + this.fee_type
+ + ", cash_fee=" + this.cash_fee + ", cash_fee_type=" + this.cash_fee_type
+ + ", coupon_fee=" + this.coupon_fee + ", coupon_count="
+ + this.coupon_count + ", coupon_batch_id_$n=" + this.coupon_batch_id_$n
+ + ", coupon_id_$n=" + this.coupon_id_$n + ", coupon_fee_$n="
+ + this.coupon_fee_$n + ", transaction_id=" + this.transaction_id
+ + ", out_trade_no=" + this.out_trade_no + ", attach=" + this.attach
+ + ", time_end=" + this.time_end + "]";
}
- public void setCash_fee_type(String cash_fee_type) {
- this.cash_fee_type = cash_fee_type;
- }
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxRedpackResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxRedpackResult.java
deleted file mode 100644
index 297e07d7..00000000
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxRedpackResult.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package me.chanjar.weixin.mp.bean.pay;
-
-import java.io.Serializable;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-/**
- * 向微信用户个人发现金红包返回结果
- * https://pay.weixin.qq.com/wiki/doc/api/cash_coupon.php?chapter=13_5
- * @author kane
- *
- */
-@XStreamAlias("xml")
-public class WxRedpackResult implements Serializable {
-
- private static final long serialVersionUID = -4837415036337132073L;
-
- @XStreamAlias("return_code")
- private String returnCode;
- @XStreamAlias("return_msg")
- private String returnMsg;
- @XStreamAlias("sign")
- private String sign;
- @XStreamAlias("result_code")
- private String resultCode;
-
- @XStreamAlias("err_code")
- private String errCode;
- @XStreamAlias("err_code_des")
- private String errCodeDes;
- @XStreamAlias("mch_billno")
- private String mchBillno;
- @XStreamAlias("mch_id")
- private String mchId;
- @XStreamAlias("wxappid")
- private String wxappid;
- @XStreamAlias("re_openid")
- private String reOpenid;
- @XStreamAlias("total_amount")
- private int totalAmount;
- @XStreamAlias("send_time")
- private String sendTime;
- @XStreamAlias("send_listid")
- private String sendListid;
-
- public String getErrCode() {
- return this.errCode;
- }
-
- public String getErrCodeDes() {
- return this.errCodeDes;
- }
-
- public String getReturnCode() {
- return this.returnCode;
- }
-
- public String getReturnMsg() {
- return this.returnMsg;
- }
-
- public String getSign() {
- return this.sign;
- }
-
- public String getResultCode() {
- return this.resultCode;
- }
-
- public String getMchBillno() {
- return this.mchBillno;
- }
-
- public String getMchId() {
- return this.mchId;
- }
-
- public String getWxappid() {
- return this.wxappid;
- }
-
- public String getReOpenid() {
- return this.reOpenid;
- }
-
- public int getTotalAmount() {
- return this.totalAmount;
- }
-
- public String getSendTime() {
- return this.sendTime;
- }
-
- public String getSendListid() {
- return this.sendListid;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
- }
-}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxEntPayQueryRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxEntPayQueryRequest.java
new file mode 100644
index 00000000..499e111d
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxEntPayQueryRequest.java
@@ -0,0 +1,77 @@
+package me.chanjar.weixin.mp.bean.pay.request;
+
+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.annotation.Required;
+
+/**
+ *
+ * 企业付款请求对象
+ * 注释中各行每个字段描述对应如下:
+ *
字段名
+ * 变量名
+ * 是否必填
+ * 类型
+ * 示例值
+ * 描述
+ *
+ * Created by Binary Wang on 2016/10/19.
+ * @author binarywang (https://github.com/binarywang)
+ */
+@XStreamAlias("xml")
+public class WxEntPayQueryRequest extends WxPayBaseRequest {
+ /**
+ *
+ * 商户号
+ * mch_id
+ * 是
+ * 10000098
+ * String(32)
+ * 微信支付分配的商户号
+ *
+ */
+ @SuppressWarnings("hiding")
+ @XStreamAlias("mchid")
+ private String mchId;
+
+ /**
+ *
+ * 商户订单号
+ * partner_trade_no
+ * 是
+ * 10000098201411111234567890
+ * String
+ * 商户订单号
+ *
+ */
+ @Required
+ @XStreamAlias("partner_trade_no")
+ private String partnerTradeNo;
+
+ @Override
+ public String getMchId() {
+ return this.mchId;
+ }
+
+ @Override
+ public void setMchId(String mchId) {
+ this.mchId = mchId;
+ }
+
+ public String getPartnerTradeNo() {
+ return this.partnerTradeNo;
+ }
+
+ public void setPartnerTradeNo(String partnerTradeNo) {
+ this.partnerTradeNo = partnerTradeNo;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxEntPayRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxEntPayRequest.java
new file mode 100644
index 00000000..196ef95f
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxEntPayRequest.java
@@ -0,0 +1,284 @@
+package me.chanjar.weixin.mp.bean.pay.request;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ *
+ * 企业付款请求对象
+ * 注释中各行每个字段描述对应如下:
+ *
字段名
+ * 变量名
+ * 是否必填
+ * 类型
+ * 示例值
+ * 描述
+ *
+ * Created by Binary Wang on 2016/10/02.
+ * @author binarywang (https://github.com/binarywang)
+ */
+@XStreamAlias("xml")
+public class WxEntPayRequest {
+ /**
+ *
+ * 公众账号appid
+ * mch_appid
+ * 是
+ * wx8888888888888888
+ * String
+ * 微信分配的公众账号ID(企业号corpid即为此appId)
+ *
+ */
+ @XStreamAlias("mch_appid")
+ private String mchAppid;
+
+ /**
+ *
+ * 商户号
+ * mchid
+ * 是
+ * 1900000109
+ * String(32)
+ * 微信支付分配的商户号
+ *
+ */
+ @XStreamAlias("mchid")
+ private String mchId;
+
+ /**
+ *
+ * 设备号
+ * device_info
+ * 否
+ * 13467007045764
+ * String(32)
+ *微信支付分配的终端设备号
+ *
+ */
+ @XStreamAlias("device_info")
+ private String deviceInfo;
+
+ /**
+ *
+ * 随机字符串
+ * nonce_str
+ *是
+ *5K8264ILTKCH16CQ2502SI8ZNMTM67VS
+ *String(32)
+ *随机字符串,不长于32位
+ *
+ */
+ @XStreamAlias("nonce_str")
+ private String nonceStr;
+
+ /**
+ *
+ * 签名
+ * sign
+ * 是
+ * C380BEC2BFD727A4B6845133519F3AD6
+ * String(32)
+ *签名,详见签名算法
+ *
+ */
+ @XStreamAlias("sign")
+ private String sign;
+
+ /**
+ *
+ * 商户订单号
+ * partner_trade_no
+ * 是
+ * 10000098201411111234567890
+ * String
+ * 商户订单号
+ *
+ */
+ @XStreamAlias("partner_trade_no")
+ private String partnerTradeNo;
+
+ /**
+ *
+ * 需保持唯一性 用户openid
+ * openid
+ * 是
+ * oxTWIuGaIt6gTKsQRLau2M0yL16E
+ * String
+ * 商户appid下,某用户的openid
+ *
+ */
+ @XStreamAlias("openid")
+ private String openid;
+
+ /**
+ *
+ * 校验用户姓名选项
+ * check_name
+ * 是
+ * OPTION_CHECK
+ * String
+ * NO_CHECK:不校验真实姓名
+ * FORCE_CHECK:强校验真实姓名(未实名认证的用户会校验失败,无法转账)
+ * OPTION_CHECK:针对已实名认证的用户才校验真实姓名(未实名认证用户不校验,可以转账成功)
+ *
+ */
+ @XStreamAlias("check_name")
+ private String checkName;
+
+ /**
+ *
+ * 收款用户姓名
+ * re_user_name
+ * 可选
+ * 马花花
+ * String
+ * 收款用户真实姓名。
+ * 如果check_name设置为FORCE_CHECK或OPTION_CHECK, 则必填用户真实姓名
+ *
+ */
+ @XStreamAlias("re_user_name")
+ private String reUserName;
+
+ /**
+ *
+ * 金额
+ * amount
+ * 是
+ * 10099
+ * int
+ * 企业付款金额, 单位为分
+ *
+ */
+ @XStreamAlias("amount")
+ private Integer amount;
+
+ /**
+ *
+ * 企业付款描述信息
+ * desc
+ * 是
+ * 理赔
+ * String
+ * 企业付款操作说明信息。必填。
+ *
+ */
+ @XStreamAlias("desc")
+ private String description;
+
+ /**
+ *
+ * Ip地址
+ * spbill_create_ip
+ * 是
+ * 192.168.0.1
+ * String(32)
+ * 调用接口的机器Ip地址
+ *
+ */
+ @XStreamAlias("spbill_create_ip")
+ private String spbillCreateIp;
+
+ public String getMchAppid() {
+ return this.mchAppid;
+ }
+
+ public void setMchAppid(String mchAppid) {
+ this.mchAppid = mchAppid;
+ }
+
+ public String getMchId() {
+ return this.mchId;
+ }
+
+ public void setMchId(String mchId) {
+ this.mchId = mchId;
+ }
+
+ public String getDeviceInfo() {
+ return this.deviceInfo;
+ }
+
+ public void setDeviceInfo(String deviceInfo) {
+ this.deviceInfo = deviceInfo;
+ }
+
+ public String getNonceStr() {
+ return this.nonceStr;
+ }
+
+ public void setNonceStr(String nonceStr) {
+ this.nonceStr = nonceStr;
+ }
+
+ public String getSign() {
+ return this.sign;
+ }
+
+ public void setSign(String sign) {
+ this.sign = sign;
+ }
+
+ public String getPartnerTradeNo() {
+ return this.partnerTradeNo;
+ }
+
+ public void setPartnerTradeNo(String partnerTradeNo) {
+ this.partnerTradeNo = partnerTradeNo;
+ }
+
+ public String getOpenid() {
+ return this.openid;
+ }
+
+ public void setOpenid(String openid) {
+ this.openid = openid;
+ }
+
+ public String getCheckName() {
+ return this.checkName;
+ }
+
+ public void setCheckName(String checkName) {
+ this.checkName = checkName;
+ }
+
+ public String getReUserName() {
+ return this.reUserName;
+ }
+
+ public void setReUserName(String reUserName) {
+ this.reUserName = reUserName;
+ }
+
+ public Integer getAmount() {
+ return this.amount;
+ }
+
+ public void setAmount(Integer amount) {
+ this.amount = amount;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getSpbillCreateIp() {
+ return this.spbillCreateIp;
+ }
+
+ public void setSpbillCreateIp(String spbillCreateIp) {
+ this.spbillCreateIp = spbillCreateIp;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+}
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
new file mode 100644
index 00000000..aabbdfd1
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayBaseRequest.java
@@ -0,0 +1,108 @@
+package me.chanjar.weixin.mp.bean.pay.request;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ *
+ * Created by Binary Wang on 2016-10-24.
+ * 微信支付请求对象共用的参数存放类
+ * 注释中各行每个字段描述对应如下:
+ *
字段名
+ * 变量名
+ * 是否必填
+ * 类型
+ * 示例值
+ * 描述
+ *
+ * @author binarywang(Binary Wang)
+ */
+public abstract class WxPayBaseRequest {
+ /**
+ *
+ * 公众账号ID
+ * appid
+ * 是
+ * String(32)
+ * wxd678efh567hg6787
+ * 微信分配的公众账号ID(企业号corpid即为此appId)
+ *
+ */
+ @XStreamAlias("appid")
+ protected String appid;
+ /**
+ *
+ * 商户号
+ * mch_id
+ * 是
+ * String(32)
+ * 1230000109
+ * 微信支付分配的商户号
+ *
+ */
+ @XStreamAlias("mch_id")
+ protected String mchId;
+ /**
+ *
+ * 随机字符串
+ * nonce_str
+ * 是
+ * String(32)
+ * 5K8264ILTKCH16CQ2502SI8ZNMTM67VS
+ * 随机字符串,不长于32位。推荐随机数生成算法
+ *
+ */
+ @XStreamAlias("nonce_str")
+ protected String nonceStr;
+ /**
+ *
+ * 签名
+ * sign
+ * 是
+ * String(32)
+ * C380BEC2BFD727A4B6845133519F3AD6
+ * 签名,详见签名生成算法
+ *
+ */
+ @XStreamAlias("sign")
+ protected String sign;
+
+ public String getAppid() {
+ return this.appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ public String getMchId() {
+ return this.mchId;
+ }
+
+ public void setMchId(String mchId) {
+ this.mchId = mchId;
+ }
+
+ public String getNonceStr() {
+ return this.nonceStr;
+ }
+
+ public void setNonceStr(String nonceStr) {
+ this.nonceStr = nonceStr;
+ }
+
+ public String getSign() {
+ return this.sign;
+ }
+
+ public void setSign(String sign) {
+ this.sign = sign;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayOrderQueryRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayOrderQueryRequest.java
new file mode 100644
index 00000000..3cc7dd2b
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayOrderQueryRequest.java
@@ -0,0 +1,63 @@
+package me.chanjar.weixin.mp.bean.pay.request;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ *
+ * 订单查询请求对象
+ * Created by Binary Wang on 2016-10-24.
+ * 注释中各行每个字段描述对应如下:
+ *
字段名
+ * 变量名
+ * 是否必填
+ * 类型
+ * 示例值
+ * 描述
+ *
+ * @author binarywang(Binary Wang)
+ */
+@XStreamAlias("xml")
+public class WxPayOrderQueryRequest extends WxPayBaseRequest {
+
+ /**
+ *
+ * 微信订单号
+ * transaction_id
+ * 二选一
+ * String(32)
+ * 1009660380201506130728806387
+ * 微信的订单号,优先使用
+ *
+ */
+ @XStreamAlias("transaction_id")
+ private String transactionId;
+
+ /**
+ *
+ * 商户订单号
+ * out_trade_no
+ * 二选一
+ * String(32)
+ * 20150806125346
+ * 商户系统内部的订单号,当没提供transaction_id时需要传这个。
+ *
+ */
+ @XStreamAlias("out_trade_no")
+ private String outTradeNo;
+
+ public String getTransactionId() {
+ return this.transactionId;
+ }
+
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public String getOutTradeNo() {
+ return this.outTradeNo;
+ }
+
+ public void setOutTradeNo(String outTradeNo) {
+ this.outTradeNo = outTradeNo;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayRefundRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayRefundRequest.java
new file mode 100644
index 00000000..9a0c0178
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayRefundRequest.java
@@ -0,0 +1,302 @@
+package me.chanjar.weixin.mp.bean.pay.request;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+import me.chanjar.weixin.common.annotation.Required;
+
+/**
+ *
+ * 微信支付-申请退款请求参数
+ * 注释中各行每个字段描述对应如下:
+ *
字段名
+ * 变量名
+ * 是否必填
+ * 类型
+ * 示例值
+ * 描述
+ *
+ *
+ * @author binarywang(Binary Wang)
+ * Created by Binary Wang on 2016-10-08.
+ */
+@XStreamAlias("xml")
+public class WxPayRefundRequest {
+ /**
+ *
+ * 公众账号ID
+ * appid
+ * 是
+ * String(32)
+ * wx8888888888888888
+ * 微信分配的公众账号ID(企业号corpid即为此appId)
+ *
+ */
+ @XStreamAlias("appid")
+ private String appid;
+
+ /**
+ *
+ * 商户号
+ * mch_id
+ * 是
+ * String(32)
+ * 1900000109
+ * 微信支付分配的商户号
+ *
+ */
+ @XStreamAlias("mch_id")
+ private String mchId;
+
+ /**
+ *
+ * 设备号
+ * device_info
+ * 否
+ * String(32)
+ * 13467007045764
+ * 终端设备号
+ *
+ */
+ @XStreamAlias("device_info")
+ private String deviceInfo;
+
+ /**
+ *
+ * 随机字符串
+ * nonce_str
+ * 是
+ * String(32)
+ * 5K8264ILTKCH16CQ2502SI8ZNMTM67VS
+ * 随机字符串,不长于32位。推荐随机数生成算法
+ *
+ */
+ @XStreamAlias("nonce_str")
+ private String nonceStr;
+
+ /**
+ *
+ * 签名
+ * sign
+ * 是
+ * String(32)
+ * C380BEC2BFD727A4B6845133519F3AD6
+ * 签名,详见签名生成算法
+ *
+ */
+ @XStreamAlias("sign")
+ private String sign;
+
+ /**
+ *
+ * 微信订单号
+ * transaction_id
+ * 跟out_trade_no二选一
+ * String(28)
+ * 1217752501201400000000000000
+ * 微信生成的订单号,在支付通知中有返回
+ *
+ */
+ @XStreamAlias("transaction_id")
+ private String transactionId;
+
+ /**
+ *
+ * 商户订单号
+ * out_trade_no
+ * 跟transaction_id二选一
+ * String(32)
+ * 1217752501201400000000000000
+ * 商户侧传给微信的订单号
+ *
+ */
+ @XStreamAlias("out_trade_no")
+ private String outTradeNo;
+
+ /**
+ *
+ * 商户退款单号
+ * out_refund_no
+ * 是
+ * String(32)
+ * 1217752501201400000000000000
+ * 商户系统内部的退款单号,商户系统内部唯一,同一退款单号多次请求只退一笔
+ *
+ */
+ @Required
+ @XStreamAlias("out_refund_no")
+ private String outRefundNo;
+
+ /**
+ *
+ * 订单金额
+ * total_fee
+ * 是
+ * Int
+ * 100
+ * 订单总金额,单位为分,只能为整数,详见支付金额
+ *
+ */
+ @Required
+ @XStreamAlias("total_fee")
+ private Integer totalFee;
+
+ /**
+ *
+ * 退款金额
+ * refund_fee
+ * 是
+ * Int
+ * 100
+ * 退款总金额,订单总金额,单位为分,只能为整数,详见支付金额
+ *
+ */
+ @Required
+ @XStreamAlias("refund_fee")
+ private Integer refundFee;
+
+ /**
+ *
+ * 货币种类
+ * refund_fee_type
+ * 否
+ * String(8)
+ * CNY
+ * 货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
+ *
+ */
+ @XStreamAlias("refund_fee_type")
+ private String refundFeeType;
+
+ /**
+ *
+ * 操作员
+ * op_user_id
+ * 是
+ * String(32)
+ * 1900000109
+ * 操作员帐号, 默认为商户号
+ *
+ */
+ //@Required
+ @XStreamAlias("op_user_id")
+ private String opUserId;
+
+ /**
+ *
+ * 退款资金来源
+ * refund_account
+ * 否
+ * String(30)
+ * REFUND_SOURCE_RECHARGE_FUNDS
+ * 仅针对老资金流商户使用,
+ *
REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款),
+ * REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款
+ *
+ */
+ @XStreamAlias("refund_account")
+ private String refundAccount;
+
+ public String getAppid() {
+ return this.appid;
+ }
+
+ public void setAppid(String appid) {
+ this.appid = appid;
+ }
+
+ public String getMchId() {
+ return this.mchId;
+ }
+
+ public void setMchId(String mchId) {
+ this.mchId = mchId;
+ }
+
+ public String getDeviceInfo() {
+ return this.deviceInfo;
+ }
+
+ public void setDeviceInfo(String deviceInfo) {
+ this.deviceInfo = deviceInfo;
+ }
+
+ public String getNonceStr() {
+ return this.nonceStr;
+ }
+
+ public void setNonceStr(String nonceStr) {
+ this.nonceStr = nonceStr;
+ }
+
+ public String getSign() {
+ return this.sign;
+ }
+
+ public void setSign(String sign) {
+ this.sign = sign;
+ }
+
+ public String getTransactionId() {
+ return this.transactionId;
+ }
+
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public String getOutTradeNo() {
+ return this.outTradeNo;
+ }
+
+ public void setOutTradeNo(String outTradeNo) {
+ this.outTradeNo = outTradeNo;
+ }
+
+ public String getOutRefundNo() {
+ return this.outRefundNo;
+ }
+
+ public void setOutRefundNo(String outRefundNo) {
+ this.outRefundNo = outRefundNo;
+ }
+
+ public Integer getTotalFee() {
+ return this.totalFee;
+ }
+
+ public void setTotalFee(Integer totalFee) {
+ this.totalFee = totalFee;
+ }
+
+ public Integer getRefundFee() {
+ return this.refundFee;
+ }
+
+ public void setRefundFee(Integer refundFee) {
+ this.refundFee = refundFee;
+ }
+
+ public String getRefundFeeType() {
+ return this.refundFeeType;
+ }
+
+ public void setRefundFeeType(String refundFeeType) {
+ this.refundFeeType = refundFeeType;
+ }
+
+ public String getOpUserId() {
+ return this.opUserId;
+ }
+
+ public void setOpUserId(String opUserId) {
+ this.opUserId = opUserId;
+ }
+
+ public String getRefundAccount() {
+ return this.refundAccount;
+ }
+
+ public void setRefundAccount(String refundAccount) {
+ this.refundAccount = refundAccount;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxSendRedpackRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPaySendRedpackRequest.java
similarity index 96%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxSendRedpackRequest.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPaySendRedpackRequest.java
index abe0d68f..cad2cc52 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxSendRedpackRequest.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPaySendRedpackRequest.java
@@ -1,4 +1,4 @@
-package me.chanjar.weixin.mp.bean.pay;
+package me.chanjar.weixin.mp.bean.pay.request;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@@ -8,7 +8,7 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
* @author binarywang (https://github.com/binarywang)
*/
@XStreamAlias("xml")
-public class WxSendRedpackRequest {
+public class WxPaySendRedpackRequest {
/**
* mch_billno
* 商户订单号(每个订单号必须唯一) 组成:mch_id+yyyymmdd+10位一天内不能重复的数字。 接口根据商户订单号支持重入,如出现超时可再调用。
@@ -18,7 +18,7 @@ public class WxSendRedpackRequest {
/**
* send_name
- * 商户名称
+ * 商户名称
* 红包发送者名称
*/
@XStreamAlias("send_name")
@@ -117,7 +117,7 @@ public class WxSendRedpackRequest {
* 场景id
* PRODUCT_1:商品促销
* PRODUCT_2:抽奖
- * PRODUCT_3:虚拟物品兑奖
+ * PRODUCT_3:虚拟物品兑奖
* PRODUCT_4:企业内部福利
* PRODUCT_5:渠道分润
* PRODUCT_6:保险回馈
@@ -135,7 +135,7 @@ public class WxSendRedpackRequest {
* 活动信息
* posttime:用户操作的时间戳
* mobile:业务系统账号的手机号,国家代码-手机号。不需要+号
- * deviceid :mac 地址或者设备唯一标识
+ * deviceid :mac 地址或者设备唯一标识
* clientversion :用户操作的客户端版本
* 把值为非空的信息用key=value进行拼接,再进行urlencode
* urlencode(posttime=xx&mobile=xx&deviceid=xx)
@@ -150,7 +150,7 @@ public class WxSendRedpackRequest {
* consume_mch_id
* 资金授权商户号
* 资金授权商户号
- * 服务商替特约商户发放时使用
+ * 服务商替特约商户发放时使用
* 非必填字段
*
*/
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxUnifiedOrderRequest.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayUnifiedOrderRequest.java
similarity index 87%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxUnifiedOrderRequest.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayUnifiedOrderRequest.java
index ccdfff90..195e13b0 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxUnifiedOrderRequest.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/request/WxPayUnifiedOrderRequest.java
@@ -1,7 +1,4 @@
-package me.chanjar.weixin.mp.bean.pay;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
+package me.chanjar.weixin.mp.bean.pay.request;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@@ -11,7 +8,7 @@ import me.chanjar.weixin.common.annotation.Required;
*
* 统一下单请求参数对象
* 参考文档:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1
- * 每个字段描述对应如下:
+ * 注释中各行每个字段描述对应如下:
*
字段名
* 变量名
* 是否必填
@@ -23,33 +20,7 @@ import me.chanjar.weixin.common.annotation.Required;
* @author binarywang (https://github.com/binarywang)
*/
@XStreamAlias("xml")
-public class WxUnifiedOrderRequest {
-
- /**
- *
- * 公众账号ID
- * appid
- * 是
- * String(32)
- * wxd678efh567hg6787
- * 微信分配的公众账号ID(企业号corpid即为此appId)
- *
- */
- @XStreamAlias("appid")
- private String appid;
-
- /**
- *
- * 商户号
- * mch_id
- * 是
- * String(32)
- * 1230000109
- * 微信支付分配的商户号
- *
- */
- @XStreamAlias("mch_id")
- private String mchId;
+public class WxPayUnifiedOrderRequest extends WxPayBaseRequest {
/**
*
@@ -64,32 +35,6 @@ public class WxUnifiedOrderRequest {
@XStreamAlias("device_info")
private String deviceInfo;
- /**
- *
- * 随机字符串
- * nonce_str
- * 是
- * String(32)
- * 5K8264ILTKCH16CQ2502SI8ZNMTM67VS
- * 随机字符串,不长于32位。推荐随机数生成算法
- *
- */
- @XStreamAlias("nonce_str")
- private String nonceStr;
-
- /**
- *
- * 签名
- * sign
- * 是
- * String(32)
- * C380BEC2BFD727A4B6845133519F3AD6
- * 签名,详见签名生成算法
- *
- */
- @XStreamAlias("sign")
- private String sign;
-
/**
*
* 商品描述
@@ -322,21 +267,6 @@ public class WxUnifiedOrderRequest {
@XStreamAlias("openid")
private String openid;
- public String getAppid() {
- return this.appid;
- }
-
- public void setAppid(String appid) {
- this.appid = appid;
- }
-
- public String getMchId() {
- return this.mchId;
- }
-
- public void setMchId(String mchId) {
- this.mchId = mchId;
- }
public String getDeviceInfo() {
return this.deviceInfo;
@@ -346,22 +276,6 @@ public class WxUnifiedOrderRequest {
this.deviceInfo = deviceInfo;
}
- public String getNonceStr() {
- return this.nonceStr;
- }
-
- public void setNonceStr(String nonceStr) {
- this.nonceStr = nonceStr;
- }
-
- public String getSign() {
- return this.sign;
- }
-
- public void setSign(String sign) {
- this.sign = sign;
- }
-
public String getBody() {
return this.body;
}
@@ -482,11 +396,6 @@ public class WxUnifiedOrderRequest {
this.openid = openid;
}
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
- }
-
public static WxUnifiedOrderRequestBuilder builder() {
return new WxUnifiedOrderRequestBuilder();
}
@@ -613,7 +522,7 @@ public class WxUnifiedOrderRequest {
return this;
}
- public WxUnifiedOrderRequestBuilder from(WxUnifiedOrderRequest origin) {
+ public WxUnifiedOrderRequestBuilder from(WxPayUnifiedOrderRequest origin) {
this.appid(origin.appid);
this.mchId(origin.mchId);
this.deviceInfo(origin.deviceInfo);
@@ -637,8 +546,8 @@ public class WxUnifiedOrderRequest {
return this;
}
- public WxUnifiedOrderRequest build() {
- WxUnifiedOrderRequest m = new WxUnifiedOrderRequest();
+ public WxPayUnifiedOrderRequest build() {
+ WxPayUnifiedOrderRequest m = new WxPayUnifiedOrderRequest();
m.appid = this.appid;
m.mchId = this.mchId;
m.deviceInfo = this.deviceInfo;
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxEntPayQueryResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxEntPayQueryResult.java
new file mode 100644
index 00000000..8ffbeff2
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxEntPayQueryResult.java
@@ -0,0 +1,138 @@
+package me.chanjar.weixin.mp.bean.pay.result;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 企业付款查询返回结果
+ * Created by Binary Wang on 2016/10/19.
+ * @author binarywang (https://github.com/binarywang)
+ */
+@XStreamAlias("xml")
+public class WxEntPayQueryResult extends WxPayBaseResult {
+
+ /**
+ * 商户订单号
+ */
+ @XStreamAlias("partner_trade_no")
+ private String partnerTradeNo;
+
+ /**
+ * 付款单号
+ */
+ @XStreamAlias("detail_id")
+ private String detailId;
+
+ /**
+ * 转账状态
+ */
+ @XStreamAlias("status")
+ private String status;
+
+ /**
+ * 失败原因
+ */
+ @XStreamAlias("reason")
+ private String reason;
+
+ /**
+ * 收款用户openid
+ */
+ @XStreamAlias("openid")
+ private String openid;
+
+ /**
+ * 收款用户姓名
+ */
+ @XStreamAlias("transfer_name")
+ private String transferName;
+
+ /**
+ * 付款金额
+ */
+ @XStreamAlias("payment_amount")
+ private Integer paymentAmount;
+
+ /**
+ * 转账时间
+ */
+ @XStreamAlias("transfer_time")
+ private String transferTime;
+
+ /**
+ * 付款描述
+ */
+ @XStreamAlias("desc")
+ private String desc;
+
+ public String getPartnerTradeNo() {
+ return this.partnerTradeNo;
+ }
+
+ public void setPartnerTradeNo(String partnerTradeNo) {
+ this.partnerTradeNo = partnerTradeNo;
+ }
+
+ public String getDetailId() {
+ return this.detailId;
+ }
+
+ public void setDetailId(String detailId) {
+ this.detailId = detailId;
+ }
+
+ public String getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(String status) {
+ this.status = status;
+ }
+
+ public String getReason() {
+ return this.reason;
+ }
+
+ public void setReason(String reason) {
+ this.reason = reason;
+ }
+
+ public String getOpenid() {
+ return this.openid;
+ }
+
+ public void setOpenid(String openid) {
+ this.openid = openid;
+ }
+
+ public String getTransferName() {
+ return this.transferName;
+ }
+
+ public void setTransferName(String transferName) {
+ this.transferName = transferName;
+ }
+
+ public Integer getPaymentAmount() {
+ return this.paymentAmount;
+ }
+
+ public void setPaymentAmount(Integer paymentAmount) {
+ this.paymentAmount = paymentAmount;
+ }
+
+ public String getTransferTime() {
+ return this.transferTime;
+ }
+
+ public void setTransferTime(String transferTime) {
+ this.transferTime = transferTime;
+ }
+
+ public String getDesc() {
+ return this.desc;
+ }
+
+ public void setDesc(String desc) {
+ this.desc = desc;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxEntPayResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxEntPayResult.java
new file mode 100644
index 00000000..5a8c4b75
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxEntPayResult.java
@@ -0,0 +1,83 @@
+package me.chanjar.weixin.mp.bean.pay.result;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 企业付款返回结果
+ * Created by Binary Wang on 2016/10/02.
+ * @author binarywang (https://github.com/binarywang)
+ */
+@XStreamAlias("xml")
+public class WxEntPayResult extends WxPayBaseResult {
+
+ /**
+ * 商户appid
+ */
+ @XStreamAlias("mch_appid")
+ private String mchAppid;
+
+ /**
+ * 设备号
+ */
+ @XStreamAlias("device_info")
+ private String deviceInfo;
+
+ //############以下字段在return_code 和result_code都为SUCCESS的时候有返回##############
+ /**
+ * 商户订单号
+ */
+ @XStreamAlias("partner_trade_no")
+ private String partnerTradeNo;
+
+ /**
+ * 微信订单号
+ */
+ @XStreamAlias("payment_no")
+ private String paymentNo;
+
+ /**
+ * 微信支付成功时间
+ */
+ @XStreamAlias("payment_time")
+ private String paymentTime;
+
+ public String getMchAppid() {
+ return this.mchAppid;
+ }
+
+ public void setMchAppid(String mchAppid) {
+ this.mchAppid = mchAppid;
+ }
+
+ public String getDeviceInfo() {
+ return this.deviceInfo;
+ }
+
+ public void setDeviceInfo(String deviceInfo) {
+ this.deviceInfo = deviceInfo;
+ }
+
+ public String getPartnerTradeNo() {
+ return this.partnerTradeNo;
+ }
+
+ public void setPartnerTradeNo(String partnerTradeNo) {
+ this.partnerTradeNo = partnerTradeNo;
+ }
+
+ public String getPaymentNo() {
+ return this.paymentNo;
+ }
+
+ public void setPaymentNo(String paymentNo) {
+ this.paymentNo = paymentNo;
+ }
+
+ public String getPaymentTime() {
+ return this.paymentTime;
+ }
+
+ public void setPaymentTime(String paymentTime) {
+ this.paymentTime = paymentTime;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxUnifiedOrderResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayBaseResult.java
similarity index 67%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxUnifiedOrderResult.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayBaseResult.java
index 18817461..79f8dbb5 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxUnifiedOrderResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayBaseResult.java
@@ -1,4 +1,4 @@
-package me.chanjar.weixin.mp.bean.pay;
+package me.chanjar.weixin.mp.bean.pay.result;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -7,51 +7,71 @@ import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
*
- * 在发起微信支付前,需要调用统一下单接口,获取"预支付交易会话标识"返回的结果
- * 统一下单(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1)
+ * 微信支付结果共用属性类
+ * Created by Binary Wang on 2016-10-24.
+ * @author binarywang(Binary Wang)
*
- *
- * @author chanjarster
*/
-@XStreamAlias("xml")
-public class WxUnifiedOrderResult {
+public abstract class WxPayBaseResult {
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+ /**
+ * 返回状态码
+ */
@XStreamAlias("return_code")
- private String returnCode;
+ protected String returnCode;
+ /**
+ * 返回信息
+ */
@XStreamAlias("return_msg")
- private String returnMsg;
+ protected String returnMsg;
+
+ /**
+ * 业务结果
+ */
+ @XStreamAlias("result_code")
+ private String resultCode;
+
+ /**
+ * 错误代码
+ */
+ @XStreamAlias("err_code")
+ private String errCode;
+
+ /**
+ * 错误代码描述
+ */
+ @XStreamAlias("err_code_des")
+ private String errCodeDes;
+ /**
+ * 公众账号ID
+ */
@XStreamAlias("appid")
private String appid;
+ /**
+ * 商户号
+ */
@XStreamAlias("mch_id")
private String mchId;
+ /**
+ * 随机字符串
+ */
@XStreamAlias("nonce_str")
private String nonceStr;
+ /**
+ * 签名
+ */
@XStreamAlias("sign")
private String sign;
- @XStreamAlias("result_code")
- private String resultCode;
-
- @XStreamAlias("prepay_id")
- private String prepayId;
-
- @XStreamAlias("trade_type")
- private String tradeType;
-
- @XStreamAlias("err_code")
- private String errCode;
-
- @XStreamAlias("err_code_des")
- private String errCodeDes;
-
- @XStreamAlias("code_url")
- private String codeURL;
-
public String getReturnCode() {
return this.returnCode;
}
@@ -68,6 +88,30 @@ public class WxUnifiedOrderResult {
this.returnMsg = returnMsg;
}
+ public String getResultCode() {
+ return this.resultCode;
+ }
+
+ public void setResultCode(String resultCode) {
+ this.resultCode = resultCode;
+ }
+
+ public String getErrCode() {
+ return this.errCode;
+ }
+
+ public void setErrCode(String errCode) {
+ this.errCode = errCode;
+ }
+
+ public String getErrCodeDes() {
+ return this.errCodeDes;
+ }
+
+ public void setErrCodeDes(String errCodeDes) {
+ this.errCodeDes = errCodeDes;
+ }
+
public String getAppid() {
return this.appid;
}
@@ -99,57 +143,4 @@ public class WxUnifiedOrderResult {
public void setSign(String sign) {
this.sign = sign;
}
-
- public String getResultCode() {
- return this.resultCode;
- }
-
- public void setResultCode(String resultCode) {
- this.resultCode = resultCode;
- }
-
- public String getPrepayId() {
- return this.prepayId;
- }
-
- public void setPrepayId(String prepayId) {
- this.prepayId = prepayId;
- }
-
- public String getTradeType() {
- return this.tradeType;
- }
-
- public void setTradeType(String tradeType) {
- this.tradeType = tradeType;
- }
-
- public String getErrCode() {
- return this.errCode;
- }
-
- public void setErrCode(String errCode) {
- this.errCode = errCode;
- }
-
- public String getErrCodeDes() {
- return this.errCodeDes;
- }
-
- public void setErrCodeDes(String errCodeDes) {
- this.errCodeDes = errCodeDes;
- }
-
- public String getCodeURL() {
- return this.codeURL;
- }
-
- public void setCodeURL(String codeURL) {
- this.codeURL = codeURL;
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
- }
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayOrderQueryResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayOrderQueryResult.java
new file mode 100644
index 00000000..17b3a412
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayOrderQueryResult.java
@@ -0,0 +1,469 @@
+package me.chanjar.weixin.mp.bean.pay.result;
+
+import java.util.List;
+
+import com.google.common.collect.Lists;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ *
+ * 查询订单 返回结果对象
+ * Created by Binary Wang on 2016-10-24.
+ * 注释中各行每个字段描述对应如下:
+ *
字段名
+ * 变量名
+ * 是否必填
+ * 类型
+ * 示例值
+ * 描述
+ *
+ * @author binarywang(Binary Wang)
+ */
+@XStreamAlias("xml")
+public class WxPayOrderQueryResult extends WxPayBaseResult {
+
+ /**
+ * 设备号
+ * device_info
+ * 否
+ * String(32)
+ * 013467007045764
+ * 微信支付分配的终端设备号,
+ *
+ */
+ @XStreamAlias("device_info")
+ private String deviceInfo;
+
+ /**
+ * 用户标识
+ * openid
+ * 是
+ * String(128)
+ * oUpF8uMuAJO_M2pxb1Q9zNjWeS6o
+ * 用户在商户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,MICROPAY,详细说明见参数规定
+ *
+ */
+ @XStreamAlias("trade_type")
+ private String tradeType;
+
+ /**
+ * 交易状态
+ * trade_state
+ * 是
+ * String(32)
+ * SUCCESS
+ * SUCCESS—支付成功,REFUND—转入退款,NOTPAY—未支付,CLOSED—已关闭,REVOKED—已撤销(刷卡支付),USERPAYING--用户支付中,PAYERROR--支付失败(其他原因,如银行返回失败)
+ *
+ */
+ @XStreamAlias("trade_state")
+ private String tradeState;
+
+ /**
+ * 付款银行
+ * 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
+ * 货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
+ *
+ */
+ @XStreamAlias("fee_type")
+ private String feeType;
+
+ /**
+ * 现金支付金额
+ * cash_fee
+ * 是
+ * Int
+ * 100
+ * 现金支付金额订单现金支付金额,详见支付金额
+ *
+ */
+ @XStreamAlias("cash_fee")
+ private Integer cashFee;
+
+ /**
+ * 现金支付货币类型
+ * cash_fee_type
+ * 否
+ * String(16)
+ * CNY
+ * 货币类型,符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表详见货币类型
+ *
+ */
+ @XStreamAlias("cash_fee_type")
+ private String cashFeeType;
+
+ /**
+ * 代金券金额
+ * coupon_fee
+ * 否
+ * Int
+ * 100
+ * “代金券”金额<=订单金额,订单金额-“代金券”金额=现金支付金额,详见支付金额
+ *
+ */
+ @XStreamAlias("coupon_fee")
+ private Integer couponFee;
+
+ /**
+ * 代金券使用数量
+ * coupon_count
+ * 否
+ * Int
+ * 1
+ * 代金券使用数量
+ *
+ */
+ @XStreamAlias("coupon_count")
+ private Integer couponCount;
+
+ private List coupons;
+
+ public static class Coupon {
+ /**
+ * 代金券类型
+ * coupon_type_$n
+ * 否
+ * String
+ * CASH
+ *
CASH--充值代金券
+ * NO_CASH---非充值代金券
+ * 订单使用代金券时有返回(取值:CASH、NO_CASH)。$n为下标,从0开始编号,举例:coupon_type_$0
+ *
+ */
+ private String couponType;
+
+ /**
+ * 代金券ID
+ * coupon_id_$n
+ * 否
+ * String(20)
+ * 10000
+ * 代金券ID, $n为下标,从0开始编号
+ *
+ */
+ private String couponId;
+
+ /**
+ * 单个代金券支付金额
+ * coupon_fee_$n
+ * 否
+ * Int
+ * 100
+ * 单个代金券支付金额, $n为下标,从0开始编号
+ *
+ */
+ private Integer couponFee;
+
+ public Coupon(String couponType, String couponId, Integer couponFee) {
+ this.couponType = couponType;
+ this.couponId = couponId;
+ this.couponFee = couponFee;
+ }
+
+ public String getCouponType() {
+ return this.couponType;
+ }
+
+ public void setCouponType(String couponType) {
+ this.couponType = couponType;
+ }
+
+ public String getCouponId() {
+ return this.couponId;
+ }
+
+ public void setCouponId(String couponId) {
+ this.couponId = couponId;
+ }
+
+ public Integer getCouponFee() {
+ return this.couponFee;
+ }
+
+ public void setCouponFee(Integer couponFee) {
+ this.couponFee = couponFee;
+ }
+
+ }
+
+ /**
+ * 微信支付订单号
+ * transaction_id
+ * 是
+ * String(32)
+ * 1009660380201506130728806387
+ * 微信支付订单号
+ *
+ */
+ @XStreamAlias("transaction_id")
+ private String transactionId;
+
+ /**
+ * 商户订单号
+ * out_trade_no
+ * 是
+ * String(32)
+ * 20150806125346
+ * 商户系统的订单号,与请求一致。
+ *
+ */
+ @XStreamAlias("out_trade_no")
+ private String outTradeNo;
+
+ /**
+ * 附加数据
+ * attach
+ * 否
+ * String(128)
+ * 深圳分店
+ * 附加数据,原样返回
+ *
+ */
+ @XStreamAlias("attach")
+ private String attach;
+
+ /**
+ * 支付完成时间
+ * time_end
+ * 是
+ * String(14)
+ * 20141030133525
+ * 订单支付时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010。其他详见时间规则
+ *
+ */
+ @XStreamAlias("time_end")
+ private String timeEnd;
+
+ /**
+ * 交易状态描述
+ * trade_state_desc
+ * 是
+ * String(256)
+ * 支付失败,请重新下单支付
+ * 对当前查询订单状态的描述和下一步操作的指引
+ *
+ */
+ @XStreamAlias("trade_state_desc")
+ private String tradeStateDesc;
+
+ public String getDeviceInfo() {
+ return this.deviceInfo;
+ }
+
+ public void setDeviceInfo(String deviceInfo) {
+ this.deviceInfo = deviceInfo;
+ }
+
+ public String getOpenid() {
+ return this.openid;
+ }
+
+ public void setOpenid(String openid) {
+ this.openid = openid;
+ }
+
+ public String getIsSubscribe() {
+ return this.isSubscribe;
+ }
+
+ public void setIsSubscribe(String isSubscribe) {
+ this.isSubscribe = isSubscribe;
+ }
+
+ public String getTradeType() {
+ return this.tradeType;
+ }
+
+ public void setTradeType(String tradeType) {
+ this.tradeType = tradeType;
+ }
+
+ public String getTradeState() {
+ return this.tradeState;
+ }
+
+ public void setTradeState(String tradeState) {
+ this.tradeState = tradeState;
+ }
+
+ public String getBankType() {
+ return this.bankType;
+ }
+
+ public void setBankType(String bankType) {
+ this.bankType = bankType;
+ }
+
+ public Integer getTotalFee() {
+ return this.totalFee;
+ }
+
+ public void setTotalFee(Integer totalFee) {
+ this.totalFee = totalFee;
+ }
+
+ public Integer getSettlementTotalFee() {
+ return this.settlementTotalFee;
+ }
+
+ public void setSettlementTotalFee(Integer settlementTotalFee) {
+ this.settlementTotalFee = settlementTotalFee;
+ }
+
+ public String getFeeType() {
+ return this.feeType;
+ }
+
+ public void setFeeType(String feeType) {
+ this.feeType = feeType;
+ }
+
+ public Integer getCashFee() {
+ return this.cashFee;
+ }
+
+ public void setCashFee(Integer cashFee) {
+ this.cashFee = cashFee;
+ }
+
+ public String getCashFeeType() {
+ return this.cashFeeType;
+ }
+
+ public void setCashFeeType(String cashFeeType) {
+ this.cashFeeType = cashFeeType;
+ }
+
+ public Integer getCouponFee() {
+ return this.couponFee;
+ }
+
+ public void setCouponFee(Integer couponFee) {
+ this.couponFee = couponFee;
+ }
+
+ public Integer getCouponCount() {
+ return this.couponCount;
+ }
+
+ public void setCouponCount(Integer couponCount) {
+ this.couponCount = couponCount;
+ }
+
+ public List getCoupons() {
+ return this.coupons;
+ }
+
+ public void setCoupons(List coupons) {
+ this.coupons = coupons;
+ }
+
+ public String getTransactionId() {
+ return this.transactionId;
+ }
+
+ public void setTransactionId(String transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public String getOutTradeNo() {
+ return this.outTradeNo;
+ }
+
+ public void setOutTradeNo(String outTradeNo) {
+ this.outTradeNo = outTradeNo;
+ }
+
+ public String getAttach() {
+ return this.attach;
+ }
+
+ public void setAttach(String attach) {
+ this.attach = attach;
+ }
+
+ public String getTimeEnd() {
+ return this.timeEnd;
+ }
+
+ public void setTimeEnd(String timeEnd) {
+ this.timeEnd = timeEnd;
+ }
+
+ public String getTradeStateDesc() {
+ return this.tradeStateDesc;
+ }
+
+ public void setTradeStateDesc(String tradeStateDesc) {
+ this.tradeStateDesc = tradeStateDesc;
+ }
+
+ public void composeCoupons(String xmlString){
+ if(this.couponCount != null && this.couponCount > 0 ){
+ this.coupons = Lists.newArrayList();
+ //TODO 暂时待实现
+ }
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPayRefundResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayRefundResult.java
similarity index 57%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPayRefundResult.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayRefundResult.java
index 3f917fe0..d00e2db5 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/WxMpPayRefundResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayRefundResult.java
@@ -1,278 +1,173 @@
-package me.chanjar.weixin.mp.bean.pay;
+package me.chanjar.weixin.mp.bean.pay.result;
import java.io.Serializable;
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
+ *
* 微信支付-申请退款返回结果
* https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_4
+ *
* @author liukaitj
*
*/
@XStreamAlias("xml")
-public class WxMpPayRefundResult implements Serializable {
-
+public class WxPayRefundResult extends WxPayBaseResult implements Serializable{
private static final long serialVersionUID = 1L;
- @XStreamAlias("return_code")
- private String returnCode;
-
- @XStreamAlias("return_msg")
- private String returnMsg;
-
- @XStreamAlias("result_code")
- private String resultCode;
-
- @XStreamAlias("err_code")
- private String errCode;
-
- @XStreamAlias("err_code_des")
- private String errCodeDes;
-
- @XStreamAlias("appid")
- private String appid;
-
- @XStreamAlias("mch_id")
- private String mchId;
-
@XStreamAlias("device_info")
private String deviceInfo;
-
- @XStreamAlias("nonce_str")
- private String nonceStr;
-
- @XStreamAlias("sign")
- private String sign;
-
+
@XStreamAlias("transaction_id")
private String transactionId;
-
+
@XStreamAlias("out_trade_no")
private String outTradeNo;
-
+
@XStreamAlias("out_refund_no")
private String outRefundNo;
-
+
@XStreamAlias("refund_id")
private String refundId;
-
+
@XStreamAlias("refund_channel")
private String refundChannel;
-
+
@XStreamAlias("refund_fee")
private String refundFee;
-
+
@XStreamAlias("total_fee")
private String totalFee;
-
+
@XStreamAlias("fee_type")
private String feeType;
-
+
@XStreamAlias("cash_fee")
private String cashFee;
-
+
@XStreamAlias("cash_refund_fee")
- private String cashRefundfee;
-
+ private String cashRefundFee;
+
@XStreamAlias("coupon_refund_fee")
private String couponRefundFee;
-
+
@XStreamAlias("coupon_refund_count")
private String couponRefundCount;
-
+
@XStreamAlias("coupon_refund_id")
private String couponRefundId;
- public String getReturnCode() {
- return this.returnCode;
- }
-
- public void setReturnCode(String returnCode) {
- this.returnCode = returnCode;
- }
-
- public String getReturnMsg() {
- return this.returnMsg;
- }
-
- public void setReturnMsg(String returnMsg) {
- this.returnMsg = returnMsg;
- }
-
- public String getResultCode() {
- return this.resultCode;
- }
-
- public void setResultCode(String resultCode) {
- this.resultCode = resultCode;
- }
-
- public String getErrCode() {
- return this.errCode;
- }
-
- public void setErrCode(String errCode) {
- this.errCode = errCode;
- }
-
- public String getErrCodeDes() {
- return this.errCodeDes;
- }
-
- public void setErrCodeDes(String errCodeDes) {
- this.errCodeDes = errCodeDes;
- }
-
- public String getAppid() {
- return this.appid;
- }
-
- public void setAppid(String appid) {
- this.appid = appid;
- }
-
- public String getMchId() {
- return this.mchId;
- }
-
- public void setMchId(String mchId) {
- this.mchId = mchId;
- }
-
public String getDeviceInfo() {
return this.deviceInfo;
}
-
+
public void setDeviceInfo(String deviceInfo) {
this.deviceInfo = deviceInfo;
}
-
- public String getNonceStr() {
- return this.nonceStr;
- }
-
- public void setNonceStr(String nonceStr) {
- this.nonceStr = nonceStr;
- }
-
- public String getSign() {
- return this.sign;
- }
-
- public void setSign(String sign) {
- this.sign = sign;
- }
-
+
public String getTransactionId() {
return this.transactionId;
}
-
+
public void setTransactionId(String transactionId) {
this.transactionId = transactionId;
}
-
+
public String getOutTradeNo() {
return this.outTradeNo;
}
-
+
public void setOutTradeNo(String outTradeNo) {
this.outTradeNo = outTradeNo;
}
-
+
public String getOutRefundNo() {
return this.outRefundNo;
}
-
+
public void setOutRefundNo(String outRefundNo) {
this.outRefundNo = outRefundNo;
}
-
+
public String getRefundId() {
return this.refundId;
}
-
+
public void setRefundId(String refundId) {
this.refundId = refundId;
}
-
+
public String getRefundChannel() {
return this.refundChannel;
}
-
+
public void setRefundChannel(String refundChannel) {
this.refundChannel = refundChannel;
}
-
+
public String getRefundFee() {
return this.refundFee;
}
-
+
public void setRefundFee(String refundFee) {
this.refundFee = refundFee;
}
-
+
public String getTotalFee() {
return this.totalFee;
}
-
+
public void setTotalFee(String totalFee) {
this.totalFee = totalFee;
}
-
+
public String getFeeType() {
return this.feeType;
}
-
+
public void setFeeType(String feeType) {
this.feeType = feeType;
}
-
+
public String getCashFee() {
return this.cashFee;
}
-
+
public void setCashFee(String cashFee) {
this.cashFee = cashFee;
}
-
- public String getCashRefundfee() {
- return this.cashRefundfee;
+
+ public String getCashRefundFee() {
+ return this.cashRefundFee;
}
-
- public void setCashRefundfee(String cashRefundfee) {
- this.cashRefundfee = cashRefundfee;
+
+ public void setCashRefundFee(String cashRefundFee) {
+ this.cashRefundFee = cashRefundFee;
}
-
+
public String getCouponRefundFee() {
return this.couponRefundFee;
}
-
+
public void setCouponRefundFee(String couponRefundFee) {
this.couponRefundFee = couponRefundFee;
}
-
+
public String getCouponRefundCount() {
return this.couponRefundCount;
}
-
+
public void setCouponRefundCount(String couponRefundCount) {
this.couponRefundCount = couponRefundCount;
}
-
+
public String getCouponRefundId() {
return this.couponRefundId;
}
-
+
public void setCouponRefundId(String couponRefundId) {
this.couponRefundId = couponRefundId;
}
-
- @Override
- public String toString() {
- return "[" +
- "return_code:" + this.returnCode + ";" +
- "return_msg" + this.returnMsg + ";";
- }
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPaySendRedpackResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPaySendRedpackResult.java
new file mode 100644
index 00000000..8fe009bc
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPaySendRedpackResult.java
@@ -0,0 +1,82 @@
+package me.chanjar.weixin.mp.bean.pay.result;
+
+import java.io.Serializable;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ * 向微信用户个人发现金红包返回结果
+ * https://pay.weixin.qq.com/wiki/doc/api/cash_coupon.php?chapter=13_5
+ * @author kane
+ *
+ */
+@XStreamAlias("xml")
+public class WxPaySendRedpackResult extends WxPayBaseResult implements Serializable {
+ private static final long serialVersionUID = -4837415036337132073L;
+
+ @XStreamAlias("mch_billno")
+ private String mchBillno;
+
+ @XStreamAlias("wxappid")
+ private String wxappid;
+
+ @XStreamAlias("re_openid")
+ private String reOpenid;
+
+ @XStreamAlias("total_amount")
+ private int totalAmount;
+
+ @XStreamAlias("send_time")
+ private String sendTime;
+
+ @XStreamAlias("send_listid")
+ private String sendListid;
+
+ public String getMchBillno() {
+ return this.mchBillno;
+ }
+
+ public void setMchBillno(String mchBillno) {
+ this.mchBillno = mchBillno;
+ }
+
+ public String getWxappid() {
+ return this.wxappid;
+ }
+
+ public void setWxappid(String wxappid) {
+ this.wxappid = wxappid;
+ }
+
+ public String getReOpenid() {
+ return this.reOpenid;
+ }
+
+ public void setReOpenid(String reOpenid) {
+ this.reOpenid = reOpenid;
+ }
+
+ public int getTotalAmount() {
+ return this.totalAmount;
+ }
+
+ public void setTotalAmount(int totalAmount) {
+ this.totalAmount = totalAmount;
+ }
+
+ public String getSendTime() {
+ return this.sendTime;
+ }
+
+ public void setSendTime(String sendTime) {
+ this.sendTime = sendTime;
+ }
+
+ public String getSendListid() {
+ return this.sendListid;
+ }
+
+ public void setSendListid(String sendListid) {
+ this.sendListid = sendListid;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayUnifiedOrderResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayUnifiedOrderResult.java
new file mode 100644
index 00000000..70c13519
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/pay/result/WxPayUnifiedOrderResult.java
@@ -0,0 +1,48 @@
+package me.chanjar.weixin.mp.bean.pay.result;
+
+import com.thoughtworks.xstream.annotations.XStreamAlias;
+
+/**
+ *
+ * 在发起微信支付前,需要调用统一下单接口,获取"预支付交易会话标识"返回的结果
+ * 统一下单(详见http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1)
+ *
+ *
+ * @author chanjarster
+ */
+@XStreamAlias("xml")
+public class WxPayUnifiedOrderResult extends WxPayBaseResult {
+
+ @XStreamAlias("prepay_id")
+ private String prepayId;
+
+ @XStreamAlias("trade_type")
+ private String tradeType;
+
+ @XStreamAlias("code_url")
+ private String codeURL;
+
+ public String getPrepayId() {
+ return this.prepayId;
+ }
+
+ public void setPrepayId(String prepayId) {
+ this.prepayId = prepayId;
+ }
+
+ public String getTradeType() {
+ return this.tradeType;
+ }
+
+ public void setTradeType(String tradeType) {
+ this.tradeType = tradeType;
+ }
+
+ public String getCodeURL() {
+ return this.codeURL;
+ }
+
+ public void setCodeURL(String codeURL) {
+ this.codeURL = codeURL;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpCardResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpCardResult.java
index 8ce5ca47..7a711ba1 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpCardResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpCardResult.java
@@ -65,7 +65,7 @@ public class WxMpCardResult implements Serializable {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public String getUserCardStatus() {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpUser.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpUser.java
index 76670f02..e3e894cb 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpUser.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/result/WxMpUser.java
@@ -4,6 +4,9 @@ import java.io.Serializable;
import java.lang.reflect.Type;
import java.util.List;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
@@ -17,91 +20,110 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
*/
public class WxMpUser implements Serializable {
- /**
- * @fields serialVersionUID
- */
private static final long serialVersionUID = 5788154322646488738L;
- protected Boolean subscribe;
- protected String openId;
- protected String nickname;
- protected String sex;
- protected String language;
- protected String city;
- protected String province;
- protected String country;
- protected String headImgUrl;
- protected Long subscribeTime;
- protected String unionId;
- protected Integer sexId;
- protected String remark;
- protected Integer groupId;
+ private Boolean subscribe;
+ private String openId;
+ private String nickname;
+ private String sex;
+ private String language;
+ private String city;
+ private String province;
+ private String country;
+ private String headImgUrl;
+ private Long subscribeTime;
+ private String unionId;
+ private Integer sexId;
+ private String remark;
+ private Integer groupId;
+ private Integer[] tagIds;
public Boolean getSubscribe() {
return this.subscribe;
}
- public Boolean isSubscribe() {
- return this.subscribe;
- }
+
public void setSubscribe(Boolean subscribe) {
this.subscribe = subscribe;
}
+
public String getOpenId() {
return this.openId;
}
+
public void setOpenId(String openId) {
this.openId = openId;
}
+
public String getNickname() {
return this.nickname;
}
+
public void setNickname(String nickname) {
this.nickname = nickname;
}
+
public String getSex() {
return this.sex;
}
+
public void setSex(String sex) {
this.sex = sex;
}
+
public String getLanguage() {
return this.language;
}
+
public void setLanguage(String language) {
this.language = language;
}
+
public String getCity() {
return this.city;
}
+
public void setCity(String city) {
this.city = city;
}
+
public String getProvince() {
return this.province;
}
+
public void setProvince(String province) {
this.province = province;
}
+
public String getCountry() {
return this.country;
}
+
public void setCountry(String country) {
this.country = country;
}
+
public String getHeadImgUrl() {
return this.headImgUrl;
}
+
public void setHeadImgUrl(String headImgUrl) {
this.headImgUrl = headImgUrl;
}
+
public Long getSubscribeTime() {
return this.subscribeTime;
}
+
public void setSubscribeTime(Long subscribeTime) {
this.subscribeTime = subscribeTime;
}
+
+ /**
+ *只有在将公众号绑定到微信开放平台帐号后,才会出现该字段。
+ */
public String getUnionId() {
return this.unionId;
}
+
public void setUnionId(String unionId) {
this.unionId = unionId;
}
@@ -118,22 +140,34 @@ public class WxMpUser implements Serializable {
public String getRemark() {
return this.remark;
}
+
public void setRemark(String remark) {
this.remark = remark;
}
+
public Integer getGroupId() {
return this.groupId;
}
+
public void setGroupId(Integer groupId) {
this.groupId = groupId;
}
+ public Integer[] getTagIds() {
+ return this.tagIds;
+ }
+
+ public void setTagIds(Integer[] tagIds) {
+ this.tagIds = tagIds;
+ }
+
public static WxMpUser fromJson(String json) {
return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpUser.class);
}
public static List fromJsonList(String json) {
- Type collectionType = new TypeToken>() {}.getType();
+ Type collectionType = new TypeToken>() {
+ }.getType();
Gson gson = WxMpGsonBuilder.INSTANCE.create();
JsonObject jsonObject = gson.fromJson(json, JsonObject.class);
return gson.fromJson(jsonObject.get("user_info_list"), collectionType);
@@ -141,20 +175,7 @@ public class WxMpUser implements Serializable {
@Override
public String toString() {
- return "WxMpUser{" +
- "subscribe=" + this.subscribe +
- ", openId='" + this.openId + '\'' +
- ", nickname='" + this.nickname + '\'' +
- ", sex='" + this.sex + '\'' +
- ", language='" + this.language + '\'' +
- ", city='" + this.city + '\'' +
- ", province='" + this.province + '\'' +
- ", country='" + this.country + '\'' +
- ", headImgUrl='" + this.headImgUrl + '\'' +
- ", subscribeTime=" + this.subscribeTime +
- ", unionId='" + this.unionId + '\'' +
- ", remark='" + this.remark + '\'' +
- ", groupId='" + this.groupId + '\'' +
- '}';
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
+
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreBaseInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreBaseInfo.java
index 06a5b178..409e41c3 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreBaseInfo.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreBaseInfo.java
@@ -1,27 +1,29 @@
package me.chanjar.weixin.mp.bean.store;
-import java.math.BigDecimal;
-import java.util.List;
-
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
-
import me.chanjar.weixin.common.annotation.Required;
import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.math.BigDecimal;
+import java.util.List;
/**
* 门店基础信息
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016-09-23.
*/
public class WxMpStoreBaseInfo {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+ public static WxMpStoreBaseInfo fromJson(String json) {
+ return WxMpGsonBuilder.create().fromJson(json, WxMpStoreBaseInfo.class);
}
public String toJson() {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java
index eae6dc6e..9d07eb03 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java
@@ -1,7 +1,3 @@
-/**
- * Copyright(c) 2011-2016 by UCredit Inc.
- * All Rights Reserved
- */
package me.chanjar.weixin.mp.bean.store;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -12,7 +8,7 @@ import com.google.gson.annotations.SerializedName;
public class WxMpStoreInfo {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
@SerializedName("base_info")
@@ -26,4 +22,4 @@ public class WxMpStoreInfo {
this.baseInfo = baseInfo;
}
-}
\ No newline at end of file
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreListResult.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreListResult.java
index 2bc514ed..f16c1534 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreListResult.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreListResult.java
@@ -11,14 +11,14 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 门店列表结果类
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016-09-27.
*
*/
public class WxMpStoreListResult {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
public static WxMpStoreListResult fromJson(String json) {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/tag/WxTagListUser.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/tag/WxTagListUser.java
index 0ba48edc..47ed067a 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/tag/WxTagListUser.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/tag/WxTagListUser.java
@@ -1,15 +1,17 @@
package me.chanjar.weixin.mp.bean.tag;
-import com.google.gson.annotations.SerializedName;
-import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
+import java.util.List;
+
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
-import java.util.List;
+import com.google.gson.annotations.SerializedName;
+
+import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 获取标签下粉丝列表的结果对象
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016-09-19.
*/
public class WxTagListUser {
@@ -24,7 +26,7 @@ public class WxTagListUser {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
/**
@@ -46,7 +48,7 @@ public class WxTagListUser {
private String nextOpenid;
public Integer getCount() {
- return count;
+ return this.count;
}
public void setCount(Integer count) {
@@ -54,7 +56,7 @@ public class WxTagListUser {
}
public WxTagListUserData getData() {
- return data;
+ return this.data;
}
public void setData(WxTagListUserData data) {
@@ -62,7 +64,7 @@ public class WxTagListUser {
}
public String getNextOpenid() {
- return nextOpenid;
+ return this.nextOpenid;
}
public void setNextOpenid(String nextOpenid) {
@@ -72,7 +74,7 @@ public class WxTagListUser {
public static class WxTagListUserData {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
/**
@@ -82,7 +84,7 @@ public class WxTagListUser {
private List openidList;
public List getOpenidList() {
- return openidList;
+ return this.openidList;
}
public void setOpenidList(List openidList) {
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/tag/WxUserTag.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/tag/WxUserTag.java
index d9e07d04..67b443a4 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/tag/WxUserTag.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/tag/WxUserTag.java
@@ -12,14 +12,14 @@ import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
/**
* 用户标签对象
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016/9/2.
*/
public class WxUserTag {
/**
* id 标签id,由微信分配
*/
- private Integer id;
+ private Long id;
/**
* name 标签名,UTF8编码
@@ -47,11 +47,11 @@ public class WxUserTag {
this.count = count;
}
- public Integer getId() {
+ public Long getId() {
return this.id;
}
- public void setId(Integer id) {
+ public void setId(Long id) {
this.id = id;
}
@@ -73,6 +73,6 @@ public class WxUserTag {
@Override
public String toString() {
- return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
}
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplate.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplate.java
new file mode 100644
index 00000000..0b3a1e61
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplate.java
@@ -0,0 +1,126 @@
+package me.chanjar.weixin.mp.bean.template;
+
+import java.util.List;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import com.google.gson.JsonParser;
+import com.google.gson.annotations.SerializedName;
+import com.google.gson.reflect.TypeToken;
+
+import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
+
+/**
+ *
+ * 模板列表信息
+ * Created by Binary Wang on 2016-10-17.
+ * @author binarywang(Binary Wang)
+ *
+ */
+public class WxMpTemplate {
+
+ private static final JsonParser JSON_PARSER = new JsonParser();
+
+ public static List fromJson(String json) {
+ return WxMpGsonBuilder.create().fromJson(JSON_PARSER.parse(json).getAsJsonObject().get("template_list"),
+ new TypeToken>() {
+ }.getType());
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+ /**
+ * template_id
+ * 模板ID
+ */
+ @SerializedName("template_id")
+ private String templateId;
+
+ /**
+ * title
+ * 模板标题
+ */
+ @SerializedName("title")
+ private String title;
+
+ /**
+ * primary_industry
+ * 模板所属行业的一级行业
+ */
+ @SerializedName("primary_industry")
+ private String primaryIndustry;
+
+ /**
+ * deputy_industry
+ * 模板所属行业的二级行业
+ */
+ @SerializedName("deputy_industry")
+ private String deputyIndustry;
+
+ /**
+ * content
+ * 模板内容
+ */
+ @SerializedName("content")
+ private String content;
+
+ /**
+ * example
+ * 模板示例
+ */
+ @SerializedName("example")
+ private String example;
+
+ public String getTemplateId() {
+ return this.templateId;
+ }
+
+ public void setTemplateId(String templateId) {
+ this.templateId = templateId;
+ }
+
+ public String getTitle() {
+ return this.title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getPrimaryIndustry() {
+ return this.primaryIndustry;
+ }
+
+ public void setPrimaryIndustry(String primaryIndustry) {
+ this.primaryIndustry = primaryIndustry;
+ }
+
+ public String getDeputyIndustry() {
+ return this.deputyIndustry;
+ }
+
+ public void setDeputyIndustry(String deputyIndustry) {
+ this.deputyIndustry = deputyIndustry;
+ }
+
+ public String getContent() {
+ return this.content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getExample() {
+ return this.example;
+ }
+
+ public void setExample(String example) {
+ this.example = example;
+ }
+
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpTemplateData.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateData.java
similarity index 95%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpTemplateData.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateData.java
index d46ae24b..0eb0eaa5 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpTemplateData.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateData.java
@@ -1,4 +1,4 @@
-package me.chanjar.weixin.mp.bean;
+package me.chanjar.weixin.mp.bean.template;
import java.io.Serializable;
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateIndustry.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateIndustry.java
new file mode 100644
index 00000000..b0f689a4
--- /dev/null
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateIndustry.java
@@ -0,0 +1,107 @@
+package me.chanjar.weixin.mp.bean.template;
+
+
+import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.io.Serializable;
+
+/**
+ * @author miller
+ */
+public class WxMpTemplateIndustry implements Serializable {
+ private static final long serialVersionUID = -7700398224795914722L;
+ private Industry primaryIndustry;
+ private Industry secondIndustry;
+
+ public WxMpTemplateIndustry() {
+ }
+
+ public WxMpTemplateIndustry(Industry primaryIndustry, Industry secondIndustry) {
+ this.primaryIndustry = primaryIndustry;
+ this.secondIndustry = secondIndustry;
+ }
+
+ /**
+ * @author miller
+ * 官方文档中,创建和获取的数据结构不一样。所以采用冗余字段的方式,实现相应的接口
+ */
+ public static class Industry implements Serializable {
+ private static final long serialVersionUID = -1707184885588012142L;
+ private String id;
+ private String firstClass;
+ private String secondClass;
+
+ public Industry() {
+ }
+
+ public Industry(String id) {
+ this.id = id;
+ }
+
+ public Industry(String id, String firstClass, String secondClass) {
+ this.id = id;
+ this.firstClass = firstClass;
+ this.secondClass = secondClass;
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getFirstClass() {
+ return this.firstClass;
+ }
+
+ public void setFirstClass(String firstClass) {
+ this.firstClass = firstClass;
+ }
+
+ public String getSecondClass() {
+ return this.secondClass;
+ }
+
+ public void setSecondClass(String secondClass) {
+ this.secondClass = secondClass;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
+ }
+
+ public static WxMpTemplateIndustry fromJson(String json) {
+ return WxMpGsonBuilder.create().fromJson(json, WxMpTemplateIndustry.class);
+ }
+
+ public String toJson() {
+ return WxMpGsonBuilder.create().toJson(this);
+ }
+
+ public Industry getPrimaryIndustry() {
+ return this.primaryIndustry;
+ }
+
+ public void setPrimaryIndustry(Industry primaryIndustry) {
+ this.primaryIndustry = primaryIndustry;
+ }
+
+ public Industry getSecondIndustry() {
+ return this.secondIndustry;
+ }
+
+ public void setSecondIndustry(Industry secondIndustry) {
+ this.secondIndustry = secondIndustry;
+ }
+}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpTemplateMessage.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessage.java
similarity index 98%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpTemplateMessage.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessage.java
index 408abb50..106e5fb6 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/WxMpTemplateMessage.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/template/WxMpTemplateMessage.java
@@ -1,4 +1,4 @@
-package me.chanjar.weixin.mp.bean;
+package me.chanjar.weixin.mp.bean.template;
import java.io.Serializable;
import java.util.ArrayList;
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpGroupGsonAdapter.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpGroupGsonAdapter.java
deleted file mode 100644
index a6a48ed7..00000000
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpGroupGsonAdapter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * KINGSTAR MEDIA SOLUTIONS Co.,LTD. Copyright c 2005-2013. All rights reserved.
- *
- * This source code is the property of KINGSTAR MEDIA SOLUTIONS LTD. It is intended
- * only for the use of KINGSTAR MEDIA application development. Reengineering, reproduction
- * arose from modification of the original source, or other redistribution of this source
- * is not permitted without written permission of the KINGSTAR MEDIA SOLUTIONS LTD.
- */
-package me.chanjar.weixin.mp.util.json;
-
-import com.google.gson.*;
-import me.chanjar.weixin.common.util.json.GsonHelper;
-import me.chanjar.weixin.mp.bean.WxMpGroup;
-
-import java.lang.reflect.Type;
-
-public class WxMpGroupGsonAdapter implements JsonSerializer, JsonDeserializer {
-
- @Override
- public JsonElement serialize(WxMpGroup group, Type typeOfSrc, JsonSerializationContext context) {
- JsonObject json = new JsonObject();
- JsonObject groupJson = new JsonObject();
- groupJson.addProperty("name", group.getName());
- groupJson.addProperty("id", group.getId());
- groupJson.addProperty("count", group.getCount());
- json.add("group", groupJson);
- return json;
- }
-
- @Override
- public WxMpGroup deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
- WxMpGroup group = new WxMpGroup();
- JsonObject groupJson = json.getAsJsonObject();
- if (json.getAsJsonObject().get("group") != null) {
- groupJson = json.getAsJsonObject().get("group").getAsJsonObject();
- }
- if (groupJson.get("name") != null && !groupJson.get("name").isJsonNull()) {
- group.setName(GsonHelper.getAsString(groupJson.get("name")));
- }
- if (groupJson.get("id") != null && !groupJson.get("id").isJsonNull()) {
- group.setId(GsonHelper.getAsPrimitiveLong(groupJson.get("id")));
- }
- if (groupJson.get("count") != null && !groupJson.get("count").isJsonNull()) {
- group.setCount(GsonHelper.getAsPrimitiveLong(groupJson.get("count")));
- }
- return group;
- }
-
-}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpGsonBuilder.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpGsonBuilder.java
index ab3d5769..48932b2c 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpGsonBuilder.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpGsonBuilder.java
@@ -2,10 +2,35 @@ package me.chanjar.weixin.mp.util.json;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
-import me.chanjar.weixin.mp.bean.*;
+
+import me.chanjar.weixin.mp.bean.WxMpCard;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
+import me.chanjar.weixin.mp.bean.WxMpMassNews;
+import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
+import me.chanjar.weixin.mp.bean.WxMpMassPreviewMessage;
+import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
+import me.chanjar.weixin.mp.bean.WxMpMassVideo;
+import me.chanjar.weixin.mp.bean.WxMpMaterialArticleUpdate;
+import me.chanjar.weixin.mp.bean.WxMpMaterialNews;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserCumulate;
import me.chanjar.weixin.mp.bean.datacube.WxDataCubeUserSummary;
-import me.chanjar.weixin.mp.bean.result.*;
+import me.chanjar.weixin.mp.bean.result.WxMediaImgUploadResult;
+import me.chanjar.weixin.mp.bean.result.WxMpCardResult;
+import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
+import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
+import me.chanjar.weixin.mp.bean.result.WxMpMaterialCountResult;
+import me.chanjar.weixin.mp.bean.result.WxMpMaterialFileBatchGetResult;
+import me.chanjar.weixin.mp.bean.result.WxMpMaterialNewsBatchGetResult;
+import me.chanjar.weixin.mp.bean.result.WxMpMaterialUploadResult;
+import me.chanjar.weixin.mp.bean.result.WxMpMaterialVideoInfoResult;
+import me.chanjar.weixin.mp.bean.result.WxMpOAuth2AccessToken;
+import me.chanjar.weixin.mp.bean.result.WxMpQrCodeTicket;
+import me.chanjar.weixin.mp.bean.result.WxMpSemanticQueryResult;
+import me.chanjar.weixin.mp.bean.result.WxMpUser;
+import me.chanjar.weixin.mp.bean.result.WxMpUserBlacklistGetResult;
+import me.chanjar.weixin.mp.bean.result.WxMpUserList;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateIndustry;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
public class WxMpGsonBuilder {
@@ -13,11 +38,10 @@ public class WxMpGsonBuilder {
static {
INSTANCE.disableHtmlEscaping();
- INSTANCE.registerTypeAdapter(WxMpCustomMessage.class, new WxMpCustomMessageGsonAdapter());
+ INSTANCE.registerTypeAdapter(WxMpKefuMessage.class, new WxMpKefuMessageGsonAdapter());
INSTANCE.registerTypeAdapter(WxMpMassNews.class, new WxMpMassNewsGsonAdapter());
- INSTANCE.registerTypeAdapter(WxMpMassGroupMessage.class, new WxMpMassGroupMessageGsonAdapter());
+ INSTANCE.registerTypeAdapter(WxMpMassTagMessage.class, new WxMpMassTagMessageGsonAdapter());
INSTANCE.registerTypeAdapter(WxMpMassOpenIdsMessage.class, new WxMpMassOpenIdsMessageGsonAdapter());
- INSTANCE.registerTypeAdapter(WxMpGroup.class, new WxMpGroupGsonAdapter());
INSTANCE.registerTypeAdapter(WxMpUser.class, new WxMpUserGsonAdapter());
INSTANCE.registerTypeAdapter(WxMpUserList.class, new WxUserListGsonAdapter());
INSTANCE.registerTypeAdapter(WxMpMassVideo.class, new WxMpMassVideoAdapter());
@@ -44,7 +68,7 @@ public class WxMpGsonBuilder {
INSTANCE.registerTypeAdapter(WxMpCard.class, new WxMpCardGsonAdapter());
INSTANCE.registerTypeAdapter(WxMpMassPreviewMessage.class, new WxMpMassPreviewMessageGsonAdapter());
INSTANCE.registerTypeAdapter(WxMediaImgUploadResult.class, new WxMediaImgUploadResultGsonAdapter());
- INSTANCE.registerTypeAdapter(WxMpIndustry.class, new WxMpIndustryGsonAdapter());
+ INSTANCE.registerTypeAdapter(WxMpTemplateIndustry.class, new WxMpIndustryGsonAdapter());
INSTANCE.registerTypeAdapter(WxMpUserBlacklistGetResult.class, new WxUserBlacklistGetResultGsonAdapter());
}
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpIndustryGsonAdapter.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpIndustryGsonAdapter.java
index 60361249..68106bb6 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpIndustryGsonAdapter.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpIndustryGsonAdapter.java
@@ -1,26 +1,18 @@
package me.chanjar.weixin.mp.util.json;
-import java.lang.reflect.Type;
-
-import com.google.gson.JsonDeserializationContext;
-import com.google.gson.JsonDeserializer;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParseException;
-import com.google.gson.JsonSerializationContext;
-import com.google.gson.JsonSerializer;
-
+import com.google.gson.*;
import me.chanjar.weixin.common.util.json.GsonHelper;
-import me.chanjar.weixin.mp.bean.Industry;
-import me.chanjar.weixin.mp.bean.WxMpIndustry;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateIndustry;
+
+import java.lang.reflect.Type;
/**
* @author miller
*/
public class WxMpIndustryGsonAdapter
- implements JsonSerializer, JsonDeserializer {
+ implements JsonSerializer, JsonDeserializer {
@Override
- public JsonElement serialize(WxMpIndustry wxMpIndustry, Type type,
+ public JsonElement serialize(WxMpTemplateIndustry wxMpIndustry, Type type,
JsonSerializationContext jsonSerializationContext) {
JsonObject json = new JsonObject();
json.addProperty("industry_id1", wxMpIndustry.getPrimaryIndustry().getId());
@@ -29,10 +21,10 @@ public class WxMpIndustryGsonAdapter
}
@Override
- public WxMpIndustry deserialize(JsonElement jsonElement, Type type,
+ public WxMpTemplateIndustry deserialize(JsonElement jsonElement, Type type,
JsonDeserializationContext jsonDeserializationContext)
throws JsonParseException {
- WxMpIndustry wxMpIndustry = new WxMpIndustry();
+ WxMpTemplateIndustry wxMpIndustry = new WxMpTemplateIndustry();
JsonObject primaryIndustry = jsonElement.getAsJsonObject()
.get("primary_industry").getAsJsonObject();
wxMpIndustry.setPrimaryIndustry(convertFromJson(primaryIndustry));
@@ -42,8 +34,8 @@ public class WxMpIndustryGsonAdapter
return wxMpIndustry;
}
- private static Industry convertFromJson(JsonObject json) {
- Industry industry = new Industry();
+ private static WxMpTemplateIndustry.Industry convertFromJson(JsonObject json) {
+ WxMpTemplateIndustry.Industry industry = new WxMpTemplateIndustry.Industry();
industry.setFirstClass(GsonHelper.getString(json, "first_class"));
industry.setSecondClass(GsonHelper.getString(json, "second_class"));
return industry;
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpCustomMessageGsonAdapter.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpKefuMessageGsonAdapter.java
similarity index 85%
rename from weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpCustomMessageGsonAdapter.java
rename to weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpKefuMessageGsonAdapter.java
index 973966db..abab87a1 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpCustomMessageGsonAdapter.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpKefuMessageGsonAdapter.java
@@ -10,20 +10,19 @@ package me.chanjar.weixin.mp.util.json;
import com.google.gson.*;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
+import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Type;
-import org.apache.commons.lang3.StringUtils;
-
-public class WxMpCustomMessageGsonAdapter implements JsonSerializer {
+public class WxMpKefuMessageGsonAdapter implements JsonSerializer {
@Override
- public JsonElement serialize(WxMpCustomMessage message, Type typeOfSrc, JsonSerializationContext context) {
+ public JsonElement serialize(WxMpKefuMessage message, Type typeOfSrc, JsonSerializationContext context) {
JsonObject messageJson = new JsonObject();
messageJson.addProperty("touser", message.getToUser());
messageJson.addProperty("msgtype", message.getMsgType());
-
+
if (WxConsts.CUSTOM_MSG_TEXT.equals(message.getMsgType())) {
JsonObject text = new JsonObject();
text.addProperty("content", message.getContent());
@@ -60,11 +59,11 @@ public class WxMpCustomMessageGsonAdapter implements JsonSerializer {
+public class WxMpMassTagMessageGsonAdapter implements JsonSerializer {
@Override
- public JsonElement serialize(WxMpMassGroupMessage message, Type typeOfSrc, JsonSerializationContext context) {
+ public JsonElement serialize(WxMpMassTagMessage message, Type typeOfSrc, JsonSerializationContext context) {
JsonObject messageJson = new JsonObject();
JsonObject filter = new JsonObject();
- if(null == message.getGroupId()) {
+ if(null == message.getTagId()) {
filter.addProperty("is_to_all", true);
} else {
filter.addProperty("is_to_all", false);
- filter.addProperty("group_id", message.getGroupId());
+ filter.addProperty("tag_id", message.getTagId());
}
messageJson.add("filter", filter);
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpTemplateMessageGsonAdapter.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpTemplateMessageGsonAdapter.java
index 4c2d1227..4e263020 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpTemplateMessageGsonAdapter.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpTemplateMessageGsonAdapter.java
@@ -12,8 +12,9 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
-import me.chanjar.weixin.mp.bean.WxMpTemplateData;
-import me.chanjar.weixin.mp.bean.WxMpTemplateMessage;
+
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import java.lang.reflect.Type;
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpUserGsonAdapter.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpUserGsonAdapter.java
index f580a470..7bd1ed80 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpUserGsonAdapter.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/json/WxMpUserGsonAdapter.java
@@ -8,12 +8,17 @@
*/
package me.chanjar.weixin.mp.util.json;
-import com.google.gson.*;
+import java.lang.reflect.Type;
+
+import com.google.gson.JsonDeserializationContext;
+import com.google.gson.JsonDeserializer;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonParseException;
+
import me.chanjar.weixin.common.util.json.GsonHelper;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
-import java.lang.reflect.Type;
-
public class WxMpUserGsonAdapter implements JsonDeserializer {
@Override
@@ -36,6 +41,7 @@ public class WxMpUserGsonAdapter implements JsonDeserializer {
Integer sexId = GsonHelper.getInteger(o, "sex");
wxMpUser.setRemark(GsonHelper.getString(o, "remark"));
wxMpUser.setGroupId(GsonHelper.getInteger(o, "groupid"));
+ wxMpUser.setTagIds(GsonHelper.getIntArray(o, "tagid_list"));
wxMpUser.setSexId(sexId);
if(new Integer(1).equals(sexId)) {
wxMpUser.setSex("男");
diff --git a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/xml/XStreamTransformer.java b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/xml/XStreamTransformer.java
index 39e3d1dc..a05e91c5 100644
--- a/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/xml/XStreamTransformer.java
+++ b/weixin-java-mp/src/main/java/me/chanjar/weixin/mp/util/xml/XStreamTransformer.java
@@ -13,7 +13,7 @@ import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutMusicMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutNewsMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutTextMessage;
-import me.chanjar.weixin.mp.bean.WxMpXmlOutTransferCustomerServiceMessage;
+import me.chanjar.weixin.mp.bean.WxMpXmlOutTransferKefuMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutVideoMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutVoiceMessage;
@@ -62,7 +62,7 @@ public class XStreamTransformer {
map.put(WxMpXmlOutImageMessage.class, config_WxMpXmlOutImageMessage());
map.put(WxMpXmlOutVideoMessage.class, config_WxMpXmlOutVideoMessage());
map.put(WxMpXmlOutVoiceMessage.class, config_WxMpXmlOutVoiceMessage());
- map.put(WxMpXmlOutTransferCustomerServiceMessage.class, config_WxMpXmlOutTransferCustomerServiceMessage());
+ map.put(WxMpXmlOutTransferKefuMessage.class, config_WxMpXmlOutTransferCustomerServiceMessage());
return map;
}
@@ -127,8 +127,8 @@ public class XStreamTransformer {
private static XStream config_WxMpXmlOutTransferCustomerServiceMessage() {
XStream xstream = XStreamInitializer.getInstance();
xstream.processAnnotations(WxMpXmlOutMessage.class);
- xstream.processAnnotations(WxMpXmlOutTransferCustomerServiceMessage.class);
- xstream.processAnnotations(WxMpXmlOutTransferCustomerServiceMessage.TransInfo.class);
+ xstream.processAnnotations(WxMpXmlOutTransferKefuMessage.class);
+ xstream.processAnnotations(WxMpXmlOutTransferKefuMessage.TransInfo.class);
return xstream;
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMassMessageAPITest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMassMessageAPITest.java
index 3f2c28b8..e093d575 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMassMessageAPITest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMassMessageAPITest.java
@@ -14,9 +14,9 @@ import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
-import me.chanjar.weixin.mp.bean.WxMpMassGroupMessage;
import me.chanjar.weixin.mp.bean.WxMpMassNews;
import me.chanjar.weixin.mp.bean.WxMpMassOpenIdsMessage;
+import me.chanjar.weixin.mp.bean.WxMpMassTagMessage;
import me.chanjar.weixin.mp.bean.WxMpMassVideo;
import me.chanjar.weixin.mp.bean.result.WxMpMassSendResult;
import me.chanjar.weixin.mp.bean.result.WxMpMassUploadResult;
@@ -68,11 +68,11 @@ public class WxMpMassMessageAPITest {
@Test
public void testTextMassGroupMessageSend() throws WxErrorException {
- WxMpMassGroupMessage massMessage = new WxMpMassGroupMessage();
+ WxMpMassTagMessage massMessage = new WxMpMassTagMessage();
massMessage.setMsgtype(WxConsts.MASS_MSG_TEXT);
massMessage.setContent("测试群发消息\n欢迎欢迎,热烈欢迎\n换行测试\n超链接:Hello World");
massMessage
- .setGroupId(this.wxService.getGroupService().groupGet().get(0).getId());
+ .setTagId(this.wxService.getUserTagService().tagGet().get(0).getId());
WxMpMassSendResult massResult = this.wxService
.massGroupMessageSend(massMessage);
@@ -83,11 +83,11 @@ public class WxMpMassMessageAPITest {
@Test(dataProvider="massMessages")
public void testMediaMassGroupMessageSend(String massMsgType, String mediaId)
throws WxErrorException {
- WxMpMassGroupMessage massMessage = new WxMpMassGroupMessage();
+ WxMpMassTagMessage massMessage = new WxMpMassTagMessage();
massMessage.setMsgtype(massMsgType);
massMessage.setMediaId(mediaId);
massMessage
- .setGroupId(this.wxService.getGroupService().groupGet().get(0).getId());
+ .setTagId(this.wxService.getUserTagService().tagGet().get(0).getId());
WxMpMassSendResult massResult = this.wxService
.massGroupMessageSend(massMessage);
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMessageRouterTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMessageRouterTest.java
index 07a1b75a..fdc90744 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMessageRouterTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxMpMessageRouterTest.java
@@ -195,7 +195,7 @@ public class WxMpMessageRouterTest {
.rule().async(false).handler(new WxSessionMessageHandler()).end();
WxMpXmlMessage msg = new WxMpXmlMessage();
- msg.setFromUserName("abc");
+ msg.setFromUser("abc");
router.route(msg);
Thread.sleep(2000l);
@@ -215,7 +215,7 @@ public class WxMpMessageRouterTest {
.rule().async(true).handler(new WxSessionMessageHandler()).end();
WxMpXmlMessage msg = new WxMpXmlMessage();
- msg.setFromUserName("abc");
+ msg.setFromUser("abc");
router.route(msg);
Thread.sleep(2000l);
@@ -229,7 +229,7 @@ public class WxMpMessageRouterTest {
.rule().async(false).handler(new WxSessionMessageHandler()).end();
WxMpXmlMessage msg = new WxMpXmlMessage();
- msg.setFromUserName("abc");
+ msg.setFromUser("abc");
router.route(msg);
Thread.sleep(2000l);
@@ -249,7 +249,7 @@ public class WxMpMessageRouterTest {
.rule().async(true).handler(new WxSessionMessageHandler()).end();
WxMpXmlMessage msg = new WxMpXmlMessage();
- msg.setFromUserName("abc");
+ msg.setFromUser("abc");
router.route(msg);
Thread.sleep(2000l);
@@ -268,7 +268,7 @@ public class WxMpMessageRouterTest {
.rule().async(false).handler(new WxSessionMessageHandler()).end();
WxMpXmlMessage msg = new WxMpXmlMessage();
- msg.setFromUserName("abc");
+ msg.setFromUser("abc");
router.route(msg);
Thread.sleep(2000l);
@@ -282,7 +282,7 @@ public class WxMpMessageRouterTest {
.rule().async(true).handler(new WxSessionMessageHandler()).end();
WxMpXmlMessage msg = new WxMpXmlMessage();
- msg.setFromUserName("abc");
+ msg.setFromUser("abc");
router.route(msg);
Thread.sleep(2000l);
@@ -295,7 +295,7 @@ public class WxMpMessageRouterTest {
@Override
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map context, WxMpService wxMpService,
WxSessionManager sessionManager) {
- sessionManager.getSession(wxMessage.getFromUserName());
+ sessionManager.getSession(wxMessage.getFromUser());
return null;
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxXmlMpInMemoryConfigStorage.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxXmlMpInMemoryConfigStorage.java
index 6b28f196..c9835a0a 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxXmlMpInMemoryConfigStorage.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/WxXmlMpInMemoryConfigStorage.java
@@ -1,7 +1,3 @@
-/**
- * Copyright(c) 2011-2016 by UCredit Inc.
- * All Rights Reserved
- */
package me.chanjar.weixin.mp.api;
import org.apache.commons.lang3.builder.ToStringBuilder;
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGroupServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGroupServiceImplTest.java
deleted file mode 100644
index 2216e553..00000000
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpGroupServiceImplTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package me.chanjar.weixin.mp.api.impl;
-
-import com.google.inject.Inject;
-import me.chanjar.weixin.common.exception.WxErrorException;
-import me.chanjar.weixin.mp.api.ApiTestModule;
-import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
-import me.chanjar.weixin.mp.bean.WxMpGroup;
-import org.testng.Assert;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-import java.util.List;
-
-/**
- * 测试分组接口
- *
- * @author chanjarster
- */
-@Deprecated
-@Test(groups = "groupAPI")
-@Guice(modules = ApiTestModule.class)
-public class WxMpGroupServiceImplTest {
-
- @Inject
- protected WxMpServiceImpl wxService;
-
- protected WxMpGroup group;
-
- public void testGroupCreate() throws WxErrorException {
- WxMpGroup res = this.wxService.getGroupService().groupCreate("测试分组1");
- Assert.assertEquals(res.getName(), "测试分组1");
- }
-
- @Test(dependsOnMethods="testGroupCreate")
- public void testGroupGet() throws WxErrorException {
- List groupList = this.wxService.getGroupService().groupGet();
- Assert.assertNotNull(groupList);
- Assert.assertTrue(groupList.size() > 0);
- for (WxMpGroup g : groupList) {
- this.group = g;
- Assert.assertNotNull(g.getName());
- }
- }
-
- @Test(dependsOnMethods={"testGroupGet", "testGroupCreate"})
- public void getGroupUpdate() throws WxErrorException {
- this.group.setName("分组改名");
- this.wxService.getGroupService().groupUpdate(this.group);
- }
-
- public void testGroupQueryUserGroup() throws WxErrorException {
- WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage();
- long groupid = this.wxService.getGroupService().userGetGroup(configStorage.getOpenid());
- Assert.assertTrue(groupid != -1l);
- }
-
- public void testGroupMoveUser() throws WxErrorException {
- WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage();
- this.wxService.getGroupService().userUpdateGroup(configStorage.getOpenid(), this.wxService.getGroupService().groupGet().get(3).getId());
- }
-
-}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImplTest.java
index 32a0118f..224fc994 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImplTest.java
@@ -1,29 +1,21 @@
package me.chanjar.weixin.mp.api.impl;
-import java.io.File;
-import java.util.Date;
-
-import org.joda.time.DateTime;
-import org.testng.Assert;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
import com.google.inject.Inject;
-
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
-import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfInfo;
-import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
-import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfMsgList;
-import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
-import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult;
-import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList;
-import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionWaitCaseList;
+import me.chanjar.weixin.mp.bean.kefu.result.*;
+import org.joda.time.DateTime;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.util.Date;
/**
* 测试客服相关接口
@@ -37,29 +29,40 @@ public class WxMpKefuServiceImplTest {
@Inject
protected WxMpServiceImpl wxService;
- public void testSendCustomMessage() throws WxErrorException {
+ public void testSendKefuMpNewsMessage() throws WxErrorException {
+ WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
+ .getWxMpConfigStorage();
+ WxMpKefuMessage message = new WxMpKefuMessage();
+ message.setMsgType(WxConsts.CUSTOM_MSG_MPNEWS);
+ message.setToUser(configStorage.getOpenid());
+ message.setMpNewsMediaId("52R6dL2FxDpM9N1rCY3sYBqHwq-L7K_lz1sPI71idMg");
+
+ this.wxService.getKefuService().sendKefuMessage(message);
+ }
+
+ public void testSendKefuMessage() throws WxErrorException {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
.getWxMpConfigStorage();
- WxMpCustomMessage message = new WxMpCustomMessage();
+ WxMpKefuMessage message = new WxMpKefuMessage();
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
message.setToUser(configStorage.getOpenid());
message.setContent(
"欢迎欢迎,热烈欢迎\n换行测试\n超链接:Hello World");
- this.wxService.getKefuService().customMessageSend(message);
+ this.wxService.getKefuService().sendKefuMessage(message);
}
- public void testSendCustomMessageWithKfAccount() throws WxErrorException {
+ public void testSendKefuMessageWithKfAccount() throws WxErrorException {
WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
.getWxMpConfigStorage();
- WxMpCustomMessage message = new WxMpCustomMessage();
+ WxMpKefuMessage message = new WxMpKefuMessage();
message.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
message.setToUser(configStorage.getOpenid());
message.setKfAccount(configStorage.getKfAccount());
message.setContent(
"欢迎欢迎,热烈欢迎\n换行测试\n超链接:Hello World");
- this.wxService.getKefuService().customMessageSend(message);
+ this.wxService.getKefuService().sendKefuMessage(message);
}
public void testKfList() throws WxErrorException {
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMaterialServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMaterialServiceImplTest.java
index 5cde8adc..7cde30f4 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMaterialServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpMaterialServiceImplTest.java
@@ -98,41 +98,40 @@ public class WxMpMaterialServiceImplTest {
@Test(dependsOnMethods = {"testUploadMaterial"})
public void testAddNews() throws WxErrorException {
-
// 单图文消息
WxMpMaterialNews wxMpMaterialNewsSingle = new WxMpMaterialNews();
- WxMpMaterialNews.WxMpMaterialNewsArticle mpMaterialNewsArticleSingle = new WxMpMaterialNews.WxMpMaterialNewsArticle();
- mpMaterialNewsArticleSingle.setAuthor("author");
- mpMaterialNewsArticleSingle.setThumbMediaId(this.thumbMediaId);
- mpMaterialNewsArticleSingle.setTitle("single title");
- mpMaterialNewsArticleSingle.setContent("single content");
- mpMaterialNewsArticleSingle.setContentSourceUrl("content url");
- mpMaterialNewsArticleSingle.setShowCoverPic(true);
- mpMaterialNewsArticleSingle.setDigest("single news");
- wxMpMaterialNewsSingle.addArticle(mpMaterialNewsArticleSingle);
+ WxMpMaterialNews.WxMpMaterialNewsArticle article = new WxMpMaterialNews.WxMpMaterialNewsArticle();
+ article.setAuthor("author");
+ article.setThumbMediaId(this.thumbMediaId);
+ article.setTitle("single title");
+ article.setContent("single content");
+ article.setContentSourceUrl("content url");
+ article.setShowCoverPic(true);
+ article.setDigest("single news");
+ wxMpMaterialNewsSingle.addArticle(article);
// 多图文消息
WxMpMaterialNews wxMpMaterialNewsMultiple = new WxMpMaterialNews();
- WxMpMaterialNews.WxMpMaterialNewsArticle wxMpMaterialNewsArticleMultiple1 = new WxMpMaterialNews.WxMpMaterialNewsArticle();
- wxMpMaterialNewsArticleMultiple1.setAuthor("author1");
- wxMpMaterialNewsArticleMultiple1.setThumbMediaId(this.thumbMediaId);
- wxMpMaterialNewsArticleMultiple1.setTitle("multi title1");
- wxMpMaterialNewsArticleMultiple1.setContent("content 1");
- wxMpMaterialNewsArticleMultiple1.setContentSourceUrl("content url");
- wxMpMaterialNewsArticleMultiple1.setShowCoverPic(true);
- wxMpMaterialNewsArticleMultiple1.setDigest("");
-
- WxMpMaterialNews.WxMpMaterialNewsArticle wxMpMaterialNewsArticleMultiple2 = new WxMpMaterialNews.WxMpMaterialNewsArticle();
- wxMpMaterialNewsArticleMultiple2.setAuthor("author2");
- wxMpMaterialNewsArticleMultiple2.setThumbMediaId(this.thumbMediaId);
- wxMpMaterialNewsArticleMultiple2.setTitle("multi title2");
- wxMpMaterialNewsArticleMultiple2.setContent("content 2");
- wxMpMaterialNewsArticleMultiple2.setContentSourceUrl("content url");
- wxMpMaterialNewsArticleMultiple2.setShowCoverPic(true);
- wxMpMaterialNewsArticleMultiple2.setDigest("");
-
- wxMpMaterialNewsMultiple.addArticle(wxMpMaterialNewsArticleMultiple1);
- wxMpMaterialNewsMultiple.addArticle(wxMpMaterialNewsArticleMultiple2);
+ WxMpMaterialNews.WxMpMaterialNewsArticle article1 = new WxMpMaterialNews.WxMpMaterialNewsArticle();
+ article1.setAuthor("author1");
+ article1.setThumbMediaId(this.thumbMediaId);
+ article1.setTitle("multi title1");
+ article1.setContent("content 1");
+ article1.setContentSourceUrl("content url");
+ article1.setShowCoverPic(true);
+ article1.setDigest("");
+
+ WxMpMaterialNews.WxMpMaterialNewsArticle article2 = new WxMpMaterialNews.WxMpMaterialNewsArticle();
+ article2.setAuthor("author2");
+ article2.setThumbMediaId(this.thumbMediaId);
+ article2.setTitle("multi title2");
+ article2.setContent("content 2");
+ article2.setContentSourceUrl("content url");
+ article2.setShowCoverPic(true);
+ article2.setDigest("");
+
+ wxMpMaterialNewsMultiple.addArticle(article1);
+ wxMpMaterialNewsMultiple.addArticle(article2);
WxMpMaterialUploadResult resSingle = this.wxService.getMaterialService().materialNewsUpload(wxMpMaterialNewsSingle);
this.singleNewsMediaId = resSingle.getMediaId();
@@ -268,6 +267,7 @@ public class WxMpMaterialServiceImplTest {
// 以下为media接口的测试
private List mediaIdsToDownload = new ArrayList<>();
+
@Test(dataProvider="mediaFiles")
public void testUploadMedia(String mediaType, String fileType, String fileName) throws WxErrorException, IOException {
try(InputStream inputStream = ClassLoader.getSystemResourceAsStream(fileName)){
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java
index 1982f948..0f946dc3 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImplTest.java
@@ -1,17 +1,20 @@
package me.chanjar.weixin.mp.api.impl;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
import com.google.inject.Inject;
-
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
-import me.chanjar.weixin.mp.bean.pay.WxRedpackResult;
-import me.chanjar.weixin.mp.bean.pay.WxSendRedpackRequest;
-import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest;
-import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderResult;
+import me.chanjar.weixin.mp.bean.pay.request.WxEntPayRequest;
+import me.chanjar.weixin.mp.bean.pay.request.WxPayRefundRequest;
+import me.chanjar.weixin.mp.bean.pay.request.WxPaySendRedpackRequest;
+import me.chanjar.weixin.mp.bean.pay.request.WxPayUnifiedOrderRequest;
+import me.chanjar.weixin.mp.bean.pay.result.WxPayRefundResult;
+import me.chanjar.weixin.mp.bean.pay.result.WxPaySendRedpackResult;
+import me.chanjar.weixin.mp.bean.pay.result.WxPayUnifiedOrderResult;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.io.File;
/**
* 测试支付相关接口
@@ -25,39 +28,21 @@ public class WxMpPayServiceImplTest {
@Inject
protected WxMpServiceImpl wxService;
- @Test
- public void testGetPrepayId() throws Exception {
-
- }
-
- @Test
- public void testGetJsapiPayInfo() throws Exception {
-
- }
-
- @Test
- public void testGetNativePayInfo() throws Exception {
-
- }
-
@Test
public void testGetPayInfo() throws Exception {
}
@Test
- public void testGetJSSDKPayResult() throws Exception {
-
- }
-
- @Test
- public void testGetJSSDKCallbackData() throws Exception {
-
- }
-
- @Test
- public void testRefundPay() throws Exception {
-
+ public void testRefund() throws Exception {
+ WxPayRefundRequest request = new WxPayRefundRequest();
+ request.setOutRefundNo("aaa");
+ request.setOutTradeNo("1111");
+ request.setTotalFee(1222);
+ request.setRefundFee(111);
+ File keyFile = new File("E:\\dlt.p12");
+ WxPayRefundResult result = this.wxService.getPayService().refund(request, keyFile);
+ System.err.println(result);
}
@Test
@@ -67,26 +52,59 @@ public class WxMpPayServiceImplTest {
@Test
public void testSendRedpack() throws Exception {
- WxSendRedpackRequest request = new WxSendRedpackRequest();
+ WxPaySendRedpackRequest request = new WxPaySendRedpackRequest();
request.setActName("abc");
request.setClientIp("aaa");
request.setMchBillno("aaaa");
request
.setReOpenid(((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid());
- WxRedpackResult redpackResult = this.wxService.getPayService().sendRedpack(request);
+ File keyFile = new File("E:\\dlt.p12");
+ WxPaySendRedpackResult redpackResult = this.wxService.getPayService().sendRedpack(request, keyFile);
System.err.println(redpackResult);
}
/**
- * Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#unifiedOrder(me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest)}.
- * @throws WxErrorException
+ * Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#unifiedOrder(WxPayUnifiedOrderRequest)}.
+ * @throws WxErrorException
*/
@Test
public void testUnifiedOrder() throws WxErrorException {
- WxUnifiedOrderResult result = this.wxService.getPayService()
- .unifiedOrder(WxUnifiedOrderRequest.builder().body("1111111")
+ WxPayUnifiedOrderResult result = this.wxService.getPayService()
+ .unifiedOrder(WxPayUnifiedOrderRequest.builder().body("1111111")
.totalFee(1).spbillCreateIp("111111").notifyURL("111111")
.tradeType("JSAPI").openid("122").outTradeNo("111111").build());
System.err.println(result);
}
-}
\ No newline at end of file
+
+ /**
+ * Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#queryOrder(String, String)} .
+ * @throws WxErrorException
+ */
+ @Test
+ public final void testQueryOrder() throws WxErrorException {
+ //System.err.println(this.wxService.getPayService().queryOrder(null, null));
+ System.err.println(this.wxService.getPayService().queryOrder("11212121", null));
+ System.err.println(this.wxService.getPayService().queryOrder(null, "11111"));
+ }
+
+ /**
+ * Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#entPay(WxEntPayRequest, File)}.
+ * @throws WxErrorException
+ */
+ @Test
+ public final void testEntPay() throws WxErrorException {
+ File keyFile = new File("E:\\dlt.p12");
+ WxEntPayRequest request = new WxEntPayRequest();
+ System.err.println(this.wxService.getPayService().entPay(request, keyFile));
+ }
+
+ /**
+ * Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpPayServiceImpl#queryEntPay(String, File)}.
+ * @throws WxErrorException
+ */
+ @Test
+ public final void testQueryEntPay() throws WxErrorException {
+ File keyFile = new File("E:\\dlt.p12");
+ System.err.println(this.wxService.getPayService().queryEntPay("11212121", keyFile));
+ }
+}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImplTest.java
index c108d575..49316948 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpServiceImplTest.java
@@ -1,20 +1,12 @@
package me.chanjar.weixin.mp.api.impl;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.testng.Assert;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
import com.google.inject.Inject;
-
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
-import me.chanjar.weixin.mp.bean.WxMpTemplateData;
-import me.chanjar.weixin.mp.bean.WxMpTemplateMessage;
+import org.testng.Assert;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
@Test
@Guice(modules = ApiTestModule.class)
@@ -88,20 +80,6 @@ public class WxMpServiceImplTest {
Assert.fail("Not yet implemented");
}
- @Test(invocationCount = 100, threadPoolSize = 30)
- public void testTemplateSend() throws WxErrorException {
- SimpleDateFormat dateFormat = new SimpleDateFormat(
- "yyyy-MM-dd HH:mm:ss.SSS");
- WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
- .getWxMpConfigStorage();
- WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
- .toUser(configStorage.getOpenid())
- .templateId(configStorage.getTemplateId()).build();
- templateMessage.addWxMpTemplateData(
- new WxMpTemplateData("first", dateFormat.format(new Date())));
- this.wxService.templateSend(templateMessage);
- }
-
@Test
public void testSetIndustry() {
Assert.fail("Not yet implemented");
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java
index 9c01c431..e610204b 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpStoreServiceImplTest.java
@@ -1,27 +1,22 @@
-/**
- * Copyright(c) 2011-2016 by UCredit Inc.
- * All Rights Reserved
- */
package me.chanjar.weixin.mp.api.impl;
-import static org.junit.Assert.assertNotNull;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
import com.google.inject.Inject;
-
import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo;
import me.chanjar.weixin.mp.bean.store.WxMpStoreInfo;
import me.chanjar.weixin.mp.bean.store.WxMpStoreListResult;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import static org.junit.Assert.assertNotNull;
/**
- * @author 王彬 (Binary Wang)
+ * @author binarywang(Binary Wang)
+ * Created by Binary Wang on 2016-09-23.
*
*/
@Test
@@ -32,18 +27,42 @@ public class WxMpStoreServiceImplTest {
/**
* Test method for {@link me.chanjar.weixin.mp.api.impl.WxMpStoreServiceImpl#add(me.chanjar.weixin.mp.bean.store.WxMpStoreBaseInfo)}.
- * @throws WxErrorException
+ * @throws WxErrorException
*/
public void testAdd() throws WxErrorException {
+ this.wxMpService.getStoreService().add(WxMpStoreBaseInfo.builder().build());
this.wxMpService.getStoreService()
.add(WxMpStoreBaseInfo.builder().businessName("haha").branchName("abc")
- .province("aaa").district("aaa").telephone("122").address("abc")
-.categories(new String[] { "美食,江浙菜" })
+ .province("aaa").district("aaa").telephone("122").address("abc").categories(new String[] { "美食,江浙菜" })
.longitude(new BigDecimal("115.32375"))
.latitude(new BigDecimal("25.097486")).city("aaa").offsetType(1)
.build());
}
+ public void testUpdate() throws WxErrorException {
+ this.wxMpService.getStoreService()
+ .update(WxMpStoreBaseInfo.builder().poiId("291503654").telephone("020-12345678")
+ .sid("aaa").avgPrice(35).openTime("8:00-20:00").special("免费wifi,外卖服务")
+ .introduction("麦当劳是全球大型跨国连锁餐厅,1940 年创立于美国,在世界上大约拥有3 万间分店。主要售卖汉堡包,以及薯条、炸鸡、汽水、冰品、沙拉、水果等快餐食品").offsetType(1)
+ .build());
+ }
+
+ public void testGet() throws WxErrorException {
+ WxMpStoreBaseInfo result = this.wxMpService.getStoreService().get("291503654");
+ assertNotNull(result);
+ System.err.println(result);
+ }
+
+ public void testDelete() throws WxErrorException {
+ this.wxMpService.getStoreService().delete("463558057");
+ }
+
+ public void testListCategories() throws WxErrorException {
+ List result = this.wxMpService.getStoreService().listCategories();
+ assertNotNull(result);
+ System.err.println(result);
+ }
+
public void testList() throws WxErrorException {
WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10);
assertNotNull(result);
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpTemplateMsgServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpTemplateMsgServiceImplTest.java
new file mode 100644
index 00000000..d6f479b5
--- /dev/null
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpTemplateMsgServiceImplTest.java
@@ -0,0 +1,82 @@
+package me.chanjar.weixin.mp.api.impl;
+
+import com.google.inject.Inject;
+import me.chanjar.weixin.common.exception.WxErrorException;
+import me.chanjar.weixin.mp.api.ApiTestModule;
+import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplate;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateIndustry;
+import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
+import org.testng.Assert;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+
+/**
+ *
+ * Created by Binary Wang on 2016-10-14.
+ * @author binarywang(Binary Wang)
+ *
+ */
+@Guice(modules = ApiTestModule.class)
+public class WxMpTemplateMsgServiceImplTest {
+ @Inject
+ protected WxMpServiceImpl wxService;
+
+ @Test(invocationCount = 10, threadPoolSize = 10)
+ public void testSendTemplateMsg() throws WxErrorException {
+ SimpleDateFormat dateFormat = new SimpleDateFormat(
+ "yyyy-MM-dd HH:mm:ss.SSS");
+ WxXmlMpInMemoryConfigStorage configStorage = (WxXmlMpInMemoryConfigStorage) this.wxService
+ .getWxMpConfigStorage();
+ WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
+ .toUser(configStorage.getOpenid())
+ .templateId(configStorage.getTemplateId()).build();
+ templateMessage.addWxMpTemplateData(
+ new WxMpTemplateData("first", dateFormat.format(new Date())));
+ String msgId = this.wxService.getTemplateMsgService().sendTemplateMsg(templateMessage);
+ Assert.assertNotNull(msgId);
+ System.out.println(msgId);
+ }
+
+ @Test
+ public void testGetIndustry() throws Exception {
+ final WxMpTemplateIndustry industry = this.wxService.getTemplateMsgService().getIndustry();
+ Assert.assertNotNull(industry);
+ System.out.println(industry);
+ }
+
+ @Test
+ public void testSetIndustry() throws Exception {
+ WxMpTemplateIndustry industry = new WxMpTemplateIndustry(new WxMpTemplateIndustry.Industry("1"),
+ new WxMpTemplateIndustry.Industry("04"));
+ boolean result = this.wxService.getTemplateMsgService().setIndustry(industry);
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void testAddTemplate() throws Exception {
+ String result = this.wxService.getTemplateMsgService().addTemplate("TM00015");
+ Assert.assertNotNull(result);
+ System.err.println(result);
+ }
+
+ @Test
+ public void testGetAllPrivateTemplate() throws Exception {
+ List result = this.wxService.getTemplateMsgService().getAllPrivateTemplate();
+ Assert.assertNotNull(result);
+ System.err.println(result);
+ }
+
+ @Test
+ public void testDelPrivateTemplate() throws Exception {
+ String templateId = "RPcTe7-4BkU5A2J3imC6W0b4JbjEERcJg0whOMKJKIc";
+ boolean result = this.wxService.getTemplateMsgService().delPrivateTemplate(templateId);
+ Assert.assertTrue(result);
+ }
+
+}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserServiceImplTest.java
index 4133d3a3..4242df10 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserServiceImplTest.java
@@ -1,10 +1,11 @@
-
+
package me.chanjar.weixin.mp.api.impl;
import java.util.ArrayList;
import java.util.List;
import org.testng.Assert;
+import org.testng.annotations.BeforeTest;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
@@ -28,34 +29,42 @@ import me.chanjar.weixin.mp.bean.result.WxMpUserList;
public class WxMpUserServiceImplTest {
@Inject
- protected WxMpServiceImpl wxService;
+ private WxMpServiceImpl wxService;
+
+ private WxXmlMpInMemoryConfigStorage configProvider;
+
+ @BeforeTest
+ public void setup() {
+ this.configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService
+ .getWxMpConfigStorage();
+ }
public void testUserUpdateRemark() throws WxErrorException {
- WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage();
- this.wxService.getUserService().userUpdateRemark(configProvider.getOpenid(), "测试备注名");
+ this.wxService.getUserService()
+ .userUpdateRemark(this.configProvider.getOpenid(), "测试备注名");
}
public void testUserInfo() throws WxErrorException {
- WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage();
- WxMpUser user = this.wxService.getUserService().userInfo(configProvider.getOpenid(), null);
+ WxMpUser user = this.wxService.getUserService()
+ .userInfo(this.configProvider.getOpenid(), null);
Assert.assertNotNull(user);
System.out.println(user);
}
-
+
public void testUserInfoList() throws WxErrorException {
- WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage();
- List openIdList = new ArrayList<>();
- openIdList.add(configProvider.getOpenid());
- List userList = this.wxService.getUserService().userInfoList(openIdList);
+ List openids = new ArrayList<>();
+ openids.add(this.configProvider.getOpenid());
+ List userList = this.wxService.getUserService()
+ .userInfoList(openids);
Assert.assertEquals(userList.size(), 1);
- System.out.println(userList);
+ System.out.println(userList);
}
-
+
public void testUserInfoListByWxMpUserQuery() throws WxErrorException {
- WxXmlMpInMemoryConfigStorage configProvider = (WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage();
WxMpUserQuery query = new WxMpUserQuery();
- query.add(configProvider.getOpenid(), "zh_CN");
- List userList = this.wxService.getUserService().userInfoList(query);
+ query.add(this.configProvider.getOpenid(), "zh_CN");
+ List userList = this.wxService.getUserService()
+ .userInfoList(query);
Assert.assertEquals(userList.size(), 1);
System.out.println(userList);
}
@@ -68,6 +77,5 @@ public class WxMpUserServiceImplTest {
Assert.assertFalse(wxMpUserList.getOpenIds().size() == -1);
System.out.println(wxMpUserList);
}
-
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImplTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImplTest.java
index 74a6cfc4..2c67ea3f 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImplTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/api/impl/WxMpUserTagServiceImplTest.java
@@ -1,19 +1,21 @@
package me.chanjar.weixin.mp.api.impl;
+import java.util.List;
+
+import org.testng.Assert;
+import org.testng.annotations.Guice;
+import org.testng.annotations.Test;
+
import com.google.inject.Inject;
+
import me.chanjar.weixin.mp.api.ApiTestModule;
import me.chanjar.weixin.mp.api.WxXmlMpInMemoryConfigStorage;
import me.chanjar.weixin.mp.bean.tag.WxTagListUser;
import me.chanjar.weixin.mp.bean.tag.WxUserTag;
-import org.testng.Assert;
-import org.testng.annotations.Guice;
-import org.testng.annotations.Test;
-
-import java.util.List;
/**
*
- * @author binarywang(https://github.com/binarywang)
+ * @author binarywang(Binary Wang)
* Created by Binary Wang on 2016/9/2.
*/
@Test
@@ -22,7 +24,7 @@ public class WxMpUserTagServiceImplTest {
@Inject
protected WxMpServiceImpl wxService;
- private Integer tagId = 2;
+ private Long tagId = 2L;
@Test
public void testTagCreate() throws Exception {
@@ -62,6 +64,14 @@ public class WxMpUserTagServiceImplTest {
Assert.assertNotNull(res);
}
+ @Test
+ public void testBatchTagging() throws Exception {
+ String[] openids = new String[]{((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()};
+ boolean res = this.wxService.getUserTagService().batchTagging(this.tagId, openids);
+ System.out.println(res);
+ Assert.assertTrue(res);
+ }
+
@Test
public void testBatchUntagging() throws Exception {
String[] openids = new String[]{((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid()};
@@ -72,7 +82,7 @@ public class WxMpUserTagServiceImplTest {
@Test
public void testUserTagList() throws Exception {
- List res = this.wxService.getUserTagService().userTagList(
+ List res = this.wxService.getUserTagService().userTagList(
((WxXmlMpInMemoryConfigStorage) this.wxService.getWxMpConfigStorage()).getOpenid());
System.out.println(res);
Assert.assertNotNull(res);
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlMessageTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlMessageTest.java
index 3885ec32..87d8428b 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlMessageTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlMessageTest.java
@@ -54,8 +54,8 @@ public class WxMpXmlMessageTest {
+ ""
+ "";
WxMpXmlMessage wxMessage = WxMpXmlMessage.fromXml(xml);
- Assert.assertEquals(wxMessage.getToUserName(), "toUser");
- Assert.assertEquals(wxMessage.getFromUserName(), "fromUser");
+ Assert.assertEquals(wxMessage.getToUser(), "toUser");
+ Assert.assertEquals(wxMessage.getFromUser(), "fromUser");
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l));
Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT);
Assert.assertEquals(wxMessage.getContent(), "this is a test");
@@ -135,8 +135,8 @@ public class WxMpXmlMessageTest {
+ ""
+ "";
WxMpXmlMessage wxMessage = WxMpXmlMessage.fromXml(xml);
- Assert.assertEquals(wxMessage.getToUserName(), "toUser");
- Assert.assertEquals(wxMessage.getFromUserName(), "fromUser");
+ Assert.assertEquals(wxMessage.getToUser(), "toUser");
+ Assert.assertEquals(wxMessage.getFromUser(), "fromUser");
Assert.assertEquals(wxMessage.getCreateTime(), new Long(1348831860l));
Assert.assertEquals(wxMessage.getMsgType(), WxConsts.XML_MSG_TEXT);
Assert.assertEquals(wxMessage.getContent(), "this is a test");
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlOutTransferCustomerServiceMessageTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlOutTransferKefuMessageTest.java
similarity index 84%
rename from weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlOutTransferCustomerServiceMessageTest.java
rename to weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlOutTransferKefuMessageTest.java
index 012a0986..ad167738 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlOutTransferCustomerServiceMessageTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpXmlOutTransferKefuMessageTest.java
@@ -6,10 +6,10 @@ import org.testng.annotations.Test;
/**
* Created by ben on 2015/12/29.
*/
-public class WxMpXmlOutTransferCustomerServiceMessageTest {
+public class WxMpXmlOutTransferKefuMessageTest {
@Test
public void test() {
- WxMpXmlOutTransferCustomerServiceMessage m = new WxMpXmlOutTransferCustomerServiceMessage();
+ WxMpXmlOutTransferKefuMessage m = new WxMpXmlOutTransferKefuMessage();
m.setCreateTime(1399197672L);
m.setFromUserName("fromuser");
m.setToUserName("touser");
@@ -32,7 +32,7 @@ public class WxMpXmlOutTransferCustomerServiceMessageTest {
"" +
"" +
"";
- WxMpXmlOutTransferCustomerServiceMessage.TransInfo transInfo = new WxMpXmlOutTransferCustomerServiceMessage.TransInfo();
+ WxMpXmlOutTransferKefuMessage.TransInfo transInfo = new WxMpXmlOutTransferKefuMessage.TransInfo();
transInfo.setKfAccount("test1@test");
m.setTransInfo(transInfo);
System.out.println(m.toXml());
@@ -41,7 +41,7 @@ public class WxMpXmlOutTransferCustomerServiceMessageTest {
@Test
public void testBuild() {
- WxMpXmlOutTransferCustomerServiceMessage m = WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE().fromUser("fromuser").toUser("touser").build();
+ WxMpXmlOutTransferKefuMessage m = WxMpXmlOutMessage.TRANSFER_CUSTOMER_SERVICE().fromUser("fromuser").toUser("touser").build();
m.setCreateTime(1399197672L);
String expected = "" +
"" +
@@ -67,4 +67,4 @@ public class WxMpXmlOutTransferCustomerServiceMessageTest {
System.out.println(m.toXml());
Assert.assertEquals(m.toXml().replaceAll("\\s", ""), expected.replaceAll("\\s", ""));
}
-}
\ No newline at end of file
+}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxRedpackResultTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxRedpackResultTest.java
deleted file mode 100644
index 5a5275d4..00000000
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxRedpackResultTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package me.chanjar.weixin.mp.bean;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.thoughtworks.xstream.XStream;
-
-import me.chanjar.weixin.common.util.xml.XStreamInitializer;
-import me.chanjar.weixin.mp.bean.pay.WxRedpackResult;
-
-public class WxRedpackResultTest {
-
- private XStream xstream;
-
- @Before
- public void setup() {
- this.xstream = XStreamInitializer.getInstance();
- this.xstream.processAnnotations(WxRedpackResult.class);
- }
-
- @Test public void loadSuccessResult() {
- final String successSample = "\n" +
- "\n" +
- "\n" +
- "\n" +
- "\n" +
- "\n" +
- "\n" +
- "10010404\n" +
- "\n" +
- "\n" +
- "1\n" +
- "100000000020150520314766074200\n" +
- "20150520102602\n" +
- "";
- WxRedpackResult wxMpRedpackResult = (WxRedpackResult) this.xstream.fromXML(successSample);
- assertEquals("SUCCESS", wxMpRedpackResult.getReturnCode());
- assertEquals("SUCCESS", wxMpRedpackResult.getResultCode());
- assertEquals("20150520102602", wxMpRedpackResult.getSendTime());
- }
-
- @Test public void loadFailureResult() {
- final String failureSample = "\n" +
- "\n" +
- "\n" +
- "\n" +
- "\n" +
- "\n" +
- "\n" +
- "10010404\n" +
- "\n" +
- "\n" +
- "1\n" +
- "";
- WxRedpackResult wxMpRedpackResult = (WxRedpackResult) this.xstream.fromXML(failureSample);
- assertEquals("FAIL", wxMpRedpackResult.getReturnCode());
- assertEquals("FAIL", wxMpRedpackResult.getResultCode());
- assertEquals("onqOjjmM1tad-3ROpncN-yUfa6uI", wxMpRedpackResult.getReOpenid());
- assertEquals(1, wxMpRedpackResult.getTotalAmount());
- }
-}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpCustomMessageTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/kefu/WxMpKefuMessageTest.java
similarity index 80%
rename from weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpCustomMessageTest.java
rename to weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/kefu/WxMpKefuMessageTest.java
index aa8de0df..9f19029e 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/WxMpCustomMessageTest.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/kefu/WxMpKefuMessageTest.java
@@ -1,54 +1,54 @@
-package me.chanjar.weixin.mp.bean;
+package me.chanjar.weixin.mp.bean.kefu;
import me.chanjar.weixin.common.api.WxConsts;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage.WxArticle;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage.WxArticle;
import org.testng.Assert;
import org.testng.annotations.Test;
@Test
-public class WxMpCustomMessageTest {
+public class WxMpKefuMessageTest {
public void testTextReply() {
- WxMpCustomMessage reply = new WxMpCustomMessage();
+ WxMpKefuMessage reply = new WxMpKefuMessage();
reply.setToUser("OPENID");
reply.setMsgType(WxConsts.CUSTOM_MSG_TEXT);
reply.setContent("sfsfdsdf");
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"sfsfdsdf\"}}");
}
-
+
public void testTextBuild() {
- WxMpCustomMessage reply = WxMpCustomMessage.TEXT().toUser("OPENID").content("sfsfdsdf").build();
+ WxMpKefuMessage reply = WxMpKefuMessage.TEXT().toUser("OPENID").content("sfsfdsdf").build();
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"text\",\"text\":{\"content\":\"sfsfdsdf\"}}");
}
-
+
public void testImageReply() {
- WxMpCustomMessage reply = new WxMpCustomMessage();
+ WxMpKefuMessage reply = new WxMpKefuMessage();
reply.setToUser("OPENID");
reply.setMsgType(WxConsts.CUSTOM_MSG_IMAGE);
reply.setMediaId("MEDIA_ID");
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"MEDIA_ID\"}}");
}
-
+
public void testImageBuild() {
- WxMpCustomMessage reply = WxMpCustomMessage.IMAGE().toUser("OPENID").mediaId("MEDIA_ID").build();
+ WxMpKefuMessage reply = WxMpKefuMessage.IMAGE().toUser("OPENID").mediaId("MEDIA_ID").build();
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"image\",\"image\":{\"media_id\":\"MEDIA_ID\"}}");
}
-
+
public void testVoiceReply() {
- WxMpCustomMessage reply = new WxMpCustomMessage();
+ WxMpKefuMessage reply = new WxMpKefuMessage();
reply.setToUser("OPENID");
reply.setMsgType(WxConsts.CUSTOM_MSG_VOICE);
reply.setMediaId("MEDIA_ID");
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"voice\",\"voice\":{\"media_id\":\"MEDIA_ID\"}}");
}
-
+
public void testVoiceBuild() {
- WxMpCustomMessage reply = WxMpCustomMessage.VOICE().toUser("OPENID").mediaId("MEDIA_ID").build();
+ WxMpKefuMessage reply = WxMpKefuMessage.VOICE().toUser("OPENID").mediaId("MEDIA_ID").build();
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"voice\",\"voice\":{\"media_id\":\"MEDIA_ID\"}}");
}
-
+
public void testVideoReply() {
- WxMpCustomMessage reply = new WxMpCustomMessage();
+ WxMpKefuMessage reply = new WxMpKefuMessage();
reply.setToUser("OPENID");
reply.setMsgType(WxConsts.CUSTOM_MSG_VIDEO);
reply.setMediaId("MEDIA_ID");
@@ -57,14 +57,14 @@ public class WxMpCustomMessageTest {
reply.setDescription("DESCRIPTION");
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"video\",\"video\":{\"media_id\":\"MEDIA_ID\",\"thumb_media_id\":\"MEDIA_ID\",\"title\":\"TITLE\",\"description\":\"DESCRIPTION\"}}");
}
-
+
public void testVideoBuild() {
- WxMpCustomMessage reply = WxMpCustomMessage.VIDEO().toUser("OPENID").title("TITLE").mediaId("MEDIA_ID").thumbMediaId("MEDIA_ID").description("DESCRIPTION").build();
+ WxMpKefuMessage reply = WxMpKefuMessage.VIDEO().toUser("OPENID").title("TITLE").mediaId("MEDIA_ID").thumbMediaId("MEDIA_ID").description("DESCRIPTION").build();
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"video\",\"video\":{\"media_id\":\"MEDIA_ID\",\"thumb_media_id\":\"MEDIA_ID\",\"title\":\"TITLE\",\"description\":\"DESCRIPTION\"}}");
}
-
+
public void testMusicReply() {
- WxMpCustomMessage reply = new WxMpCustomMessage();
+ WxMpKefuMessage reply = new WxMpKefuMessage();
reply.setToUser("OPENID");
reply.setMsgType(WxConsts.CUSTOM_MSG_MUSIC);
reply.setThumbMediaId("MEDIA_ID");
@@ -74,9 +74,9 @@ public class WxMpCustomMessageTest {
reply.setHqMusicUrl("HQ_MUSIC_URL");
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"music\",\"music\":{\"title\":\"TITLE\",\"description\":\"DESCRIPTION\",\"thumb_media_id\":\"MEDIA_ID\",\"musicurl\":\"MUSIC_URL\",\"hqmusicurl\":\"HQ_MUSIC_URL\"}}");
}
-
+
public void testMusicBuild() {
- WxMpCustomMessage reply = WxMpCustomMessage.MUSIC()
+ WxMpKefuMessage reply = WxMpKefuMessage.MUSIC()
.toUser("OPENID")
.title("TITLE")
.thumbMediaId("MEDIA_ID")
@@ -86,19 +86,19 @@ public class WxMpCustomMessageTest {
.build();
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"music\",\"music\":{\"title\":\"TITLE\",\"description\":\"DESCRIPTION\",\"thumb_media_id\":\"MEDIA_ID\",\"musicurl\":\"MUSIC_URL\",\"hqmusicurl\":\"HQ_MUSIC_URL\"}}");
}
-
+
public void testNewsReply() {
- WxMpCustomMessage reply = new WxMpCustomMessage();
+ WxMpKefuMessage reply = new WxMpKefuMessage();
reply.setToUser("OPENID");
reply.setMsgType(WxConsts.CUSTOM_MSG_NEWS);
-
+
WxArticle article1 = new WxArticle();
article1.setUrl("URL");
article1.setPicUrl("PIC_URL");
article1.setDescription("Is Really A Happy Day");
article1.setTitle("Happy Day");
reply.getArticles().add(article1);
-
+
WxArticle article2 = new WxArticle();
article2.setUrl("URL");
article2.setPicUrl("PIC_URL");
@@ -106,26 +106,26 @@ public class WxMpCustomMessageTest {
article2.setTitle("Happy Day");
reply.getArticles().add(article2);
-
+
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"news\",\"news\":{\"articles\":[{\"title\":\"Happy Day\",\"description\":\"Is Really A Happy Day\",\"url\":\"URL\",\"picurl\":\"PIC_URL\"},{\"title\":\"Happy Day\",\"description\":\"Is Really A Happy Day\",\"url\":\"URL\",\"picurl\":\"PIC_URL\"}]}}");
}
-
+
public void testNewsBuild() {
WxArticle article1 = new WxArticle();
article1.setUrl("URL");
article1.setPicUrl("PIC_URL");
article1.setDescription("Is Really A Happy Day");
article1.setTitle("Happy Day");
-
+
WxArticle article2 = new WxArticle();
article2.setUrl("URL");
article2.setPicUrl("PIC_URL");
article2.setDescription("Is Really A Happy Day");
article2.setTitle("Happy Day");
- WxMpCustomMessage reply = WxMpCustomMessage.NEWS().toUser("OPENID").addArticle(article1).addArticle(article2).build();
+ WxMpKefuMessage reply = WxMpKefuMessage.NEWS().toUser("OPENID").addArticle(article1).addArticle(article2).build();
Assert.assertEquals(reply.toJson(), "{\"touser\":\"OPENID\",\"msgtype\":\"news\",\"news\":{\"articles\":[{\"title\":\"Happy Day\",\"description\":\"Is Really A Happy Day\",\"url\":\"URL\",\"picurl\":\"PIC_URL\"},{\"title\":\"Happy Day\",\"description\":\"Is Really A Happy Day\",\"url\":\"URL\",\"picurl\":\"PIC_URL\"}]}}");
}
-
+
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/WxSendRedpackRequestTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/WxSendRedpackRequestTest.java
deleted file mode 100644
index feb50c5a..00000000
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/WxSendRedpackRequestTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package me.chanjar.weixin.mp.bean.pay;
-
-import java.lang.reflect.Field;
-import java.util.Map.Entry;
-
-import org.joor.Reflect;
-import org.testng.annotations.Test;
-
-import com.thoughtworks.xstream.annotations.XStreamAlias;
-
-@Test
-public class WxSendRedpackRequestTest {
-
- public void test() throws NoSuchFieldException, SecurityException {
-
- WxSendRedpackRequest request = new WxSendRedpackRequest();
- request.setMchBillno("123");
- request.setActName("ab");
- for (Entry entry : Reflect.on(request).fields().entrySet()) {
- Reflect reflect = entry.getValue();
- if (reflect.get() == null) {
- continue;
- }
-
- Field field = WxSendRedpackRequest.class.getDeclaredField(entry.getKey());
- if (field.isAnnotationPresent(XStreamAlias.class)) {
- System.err.println(reflect.get() + " = " + field.getAnnotation(XStreamAlias.class).value());
- }
- }
-
- }
-
-}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/result/WxPaySendRedpackResultTest.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/result/WxPaySendRedpackResultTest.java
new file mode 100644
index 00000000..a07ec972
--- /dev/null
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/bean/pay/result/WxPaySendRedpackResultTest.java
@@ -0,0 +1,61 @@
+package me.chanjar.weixin.mp.bean.pay.result;
+
+import com.thoughtworks.xstream.XStream;
+import me.chanjar.weixin.common.util.xml.XStreamInitializer;
+import org.testng.Assert;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+public class WxPaySendRedpackResultTest {
+
+ private XStream xstream;
+
+ @BeforeTest
+ public void setup() {
+ this.xstream = XStreamInitializer.getInstance();
+ this.xstream.processAnnotations(WxPaySendRedpackResult.class);
+ }
+
+ @Test
+ public void loadSuccessResult() {
+ final String successSample = "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "10010404\n" +
+ "\n" +
+ "\n" +
+ "1\n" +
+ "100000000020150520314766074200\n" +
+ "20150520102602\n" +
+ "";
+ WxPaySendRedpackResult wxMpRedpackResult = (WxPaySendRedpackResult) this.xstream.fromXML(successSample);
+ Assert.assertEquals("SUCCESS", wxMpRedpackResult.getReturnCode());
+ Assert.assertEquals("SUCCESS", wxMpRedpackResult.getResultCode());
+ Assert.assertEquals("20150520102602", wxMpRedpackResult.getSendTime());
+ }
+
+ @Test
+ public void loadFailureResult() {
+ final String failureSample = "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "\n" +
+ "10010404\n" +
+ "\n" +
+ "\n" +
+ "1\n" +
+ "";
+ WxPaySendRedpackResult wxMpRedpackResult = (WxPaySendRedpackResult) this.xstream.fromXML(failureSample);
+ Assert.assertEquals("FAIL", wxMpRedpackResult.getReturnCode());
+ Assert.assertEquals("FAIL", wxMpRedpackResult.getResultCode());
+ Assert.assertEquals("onqOjjmM1tad-3ROpncN-yUfa6uI", wxMpRedpackResult.getReOpenid());
+ Assert.assertEquals(1, wxMpRedpackResult.getTotalAmount());
+ }
+}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoGuessNumberHandler.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoGuessNumberHandler.java
index a6fb1e53..604531b1 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoGuessNumberHandler.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoGuessNumberHandler.java
@@ -10,7 +10,7 @@ import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
import me.chanjar.weixin.mp.api.WxMpMessageMatcher;
import me.chanjar.weixin.mp.api.WxMpService;
-import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
+import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage;
@@ -50,21 +50,21 @@ public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMa
}
protected void letsGo(WxMpXmlMessage wxMessage, WxMpService wxMpService, WxSessionManager sessionManager) throws WxErrorException {
- WxSession session = sessionManager.getSession(wxMessage.getFromUserName());
+ WxSession session = sessionManager.getSession(wxMessage.getFromUser());
if (session.getAttribute("guessing") == null) {
- WxMpCustomMessage m = WxMpCustomMessage
+ WxMpKefuMessage m = WxMpKefuMessage
.TEXT()
- .toUser(wxMessage.getFromUserName())
+ .toUser(wxMessage.getFromUser())
.content("请猜一个100以内的数字")
.build();
- wxMpService.getKefuService().customMessageSend(m);
+ wxMpService.getKefuService().sendKefuMessage(m);
} else {
- WxMpCustomMessage m = WxMpCustomMessage
+ WxMpKefuMessage m = WxMpKefuMessage
.TEXT()
- .toUser(wxMessage.getFromUserName())
+ .toUser(wxMessage.getFromUser())
.content("放弃了吗?那请重新猜一个100以内的数字")
.build();
- wxMpService.getKefuService().customMessageSend(m);
+ wxMpService.getKefuService().sendKefuMessage(m);
}
session.setAttribute("guessing", Boolean.TRUE);
@@ -74,7 +74,7 @@ public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMa
protected void giveHint(WxMpXmlMessage wxMessage, WxMpService wxMpService, WxSessionManager sessionManager) throws WxErrorException {
- WxSession session = sessionManager.getSession(wxMessage.getFromUserName());
+ WxSession session = sessionManager.getSession(wxMessage.getFromUser());
if (session.getAttribute("guessing") == null) {
return;
@@ -87,28 +87,28 @@ public class DemoGuessNumberHandler implements WxMpMessageHandler, WxMpMessageMa
int answer = (Integer) session.getAttribute("number");
int guessNumber = Integer.valueOf(wxMessage.getContent());
if (guessNumber < answer) {
- WxMpCustomMessage m = WxMpCustomMessage
+ WxMpKefuMessage m = WxMpKefuMessage
.TEXT()
- .toUser(wxMessage.getFromUserName())
+ .toUser(wxMessage.getFromUser())
.content("小了")
.build();
- wxMpService.getKefuService().customMessageSend(m);
+ wxMpService.getKefuService().sendKefuMessage(m);
} else if (guessNumber > answer) {
- WxMpCustomMessage m = WxMpCustomMessage
+ WxMpKefuMessage m = WxMpKefuMessage
.TEXT()
- .toUser(wxMessage.getFromUserName())
+ .toUser(wxMessage.getFromUser())
.content("大了")
.build();
- wxMpService.getKefuService().customMessageSend(m);
+ wxMpService.getKefuService().sendKefuMessage(m);
} else {
- WxMpCustomMessage m = WxMpCustomMessage
+ WxMpKefuMessage m = WxMpKefuMessage
.TEXT()
- .toUser(wxMessage.getFromUserName())
+ .toUser(wxMessage.getFromUser())
.content("Bingo!")
.build();
session.removeAttribute("guessing");
- wxMpService.getKefuService().customMessageSend(m);
+ wxMpService.getKefuService().sendKefuMessage(m);
}
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoImageHandler.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoImageHandler.java
index a22f28d7..cd733210 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoImageHandler.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoImageHandler.java
@@ -24,8 +24,8 @@ public class DemoImageHandler implements WxMpMessageHandler {
= WxMpXmlOutMessage
.IMAGE()
.mediaId(wxMediaUploadResult.getMediaId())
- .fromUser(wxMessage.getToUserName())
- .toUser(wxMessage.getFromUserName())
+ .fromUser(wxMessage.getToUser())
+ .toUser(wxMessage.getFromUser())
.build();
return m;
} catch (WxErrorException e) {
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoOAuth2Handler.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoOAuth2Handler.java
index de1c9546..5dc5437d 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoOAuth2Handler.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoOAuth2Handler.java
@@ -21,7 +21,7 @@ public class DemoOAuth2Handler implements WxMpMessageHandler {
wxMpService.getWxMpConfigStorage().getOauth2redirectUri(),
WxConsts.OAUTH2_SCOPE_USER_INFO, null) + "\">测试oauth2";
return WxMpXmlOutMessage.TEXT().content(href)
- .fromUser(wxMessage.getToUserName()).toUser(wxMessage.getFromUserName())
+ .fromUser(wxMessage.getToUser()).toUser(wxMessage.getFromUser())
.build();
}
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoTextHandler.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoTextHandler.java
index 43f017be..9ee15a28 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoTextHandler.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/DemoTextHandler.java
@@ -17,8 +17,8 @@ public class DemoTextHandler implements WxMpMessageHandler {
public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage, Map context,
WxMpService wxMpService, WxSessionManager sessionManager) {
WxMpXmlOutTextMessage m
- = WxMpXmlOutMessage.TEXT().content("测试加密消息").fromUser(wxMessage.getToUserName())
- .toUser(wxMessage.getFromUserName()).build();
+ = WxMpXmlOutMessage.TEXT().content("测试加密消息").fromUser(wxMessage.getToUser())
+ .toUser(wxMessage.getFromUser()).build();
return m;
}
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpEndpointServlet.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpEndpointServlet.java
index d052af6c..63052f8b 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpEndpointServlet.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpEndpointServlet.java
@@ -2,7 +2,6 @@ package me.chanjar.weixin.mp.demo;
import java.io.IOException;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -33,7 +32,7 @@ public class WxMpEndpointServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ throws IOException {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
diff --git a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpOAuth2Servlet.java b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpOAuth2Servlet.java
index 4008e1fb..8eeb9052 100644
--- a/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpOAuth2Servlet.java
+++ b/weixin-java-mp/src/test/java/me/chanjar/weixin/mp/demo/WxMpOAuth2Servlet.java
@@ -2,7 +2,6 @@ package me.chanjar.weixin.mp.demo;
import java.io.IOException;
-import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -23,7 +22,7 @@ public class WxMpOAuth2Servlet extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ throws IOException {
response.setContentType("text/html;charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
diff --git a/weixin-java-mp/src/test/resources/test-config.sample.xml b/weixin-java-mp/src/test/resources/test-config.sample.xml
index ad46a19e..2bbc8d8e 100644
--- a/weixin-java-mp/src/test/resources/test-config.sample.xml
+++ b/weixin-java-mp/src/test/resources/test-config.sample.xml
@@ -6,6 +6,8 @@
可以不填写
可以不填写
某个加你公众号的用户的openId
+ 微信商户平台ID
+ 商户平台设置的API密钥
模版消息的模版ID
网页授权获取用户信息回调地址
网页应用授权登陆回调地址
diff --git a/weixin-java-mp/src/test/resources/testng.xml b/weixin-java-mp/src/test/resources/testng.xml
index d821e398..addf7be4 100644
--- a/weixin-java-mp/src/test/resources/testng.xml
+++ b/weixin-java-mp/src/test/resources/testng.xml
@@ -5,9 +5,6 @@
-
-
-
@@ -20,7 +17,7 @@
-
+
diff --git a/weixin-java-osgi/pom.xml b/weixin-java-osgi/pom.xml
new file mode 100644
index 00000000..381ec5f9
--- /dev/null
+++ b/weixin-java-osgi/pom.xml
@@ -0,0 +1,141 @@
+
+
+ 4.0.0
+
+ com.github.binarywang
+ weixin-java-parent
+ 2.3.0-SNAPSHOT
+
+
+ weixin-java-osgi
+ bundle
+ WeiXin Java Tools - OSGI
+ 微信公众号Java SDK OSGI
+
+
+
+ org.jodd
+ jodd-bean
+ ${jodd-http.version}
+
+
+ org.apache.servicemix.bundles
+ org.apache.servicemix.bundles.xmlpull
+ 1.1.3.1_2
+
+
+ org.apache.servicemix.bundles
+ org.apache.servicemix.bundles.xpp3
+ 1.1.4c_7
+
+
+ com.thoughtworks.xstream
+ xstream
+ 1.4.7
+ provided
+
+
+ xmlpull
+ xmlpull
+
+
+ xpp3
+ xpp3_min
+
+
+
+
+ org.apache.httpcomponents
+ httpcore
+ 4.4.1
+ provided
+
+
+ org.apache.httpcomponents
+ httpclient
+ ${httpclient.version}
+ provided
+
+
+ org.apache.httpcomponents
+ httpmime
+ ${httpclient.version}
+ provided
+
+
+ com.github.binarywang
+ weixin-java-common
+ ${project.version}
+ provided
+
+
+ com.github.binarywang
+ weixin-java-cp
+ ${project.version}
+ provided
+
+
+ com.github.binarywang
+ weixin-java-mp
+ ${project.version}
+ provided
+
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+ 3.2.0
+ true
+
+
+
+ weixin-java-common;inline=true
+ ,weixin-java-cp;inline=true
+ ,weixin-java-mp;inline=true
+ ,httpcore;inline=true
+ ,httpclient;inline=true
+ ,httpmime;inline=true
+ ,xstream;inline=true
+
+ me.chanjar.weixin.*
+
+ !org.apache.commons.logging
+ ,com.bea.xml.stream;resolution:=optional
+ ,com.ctc.wstx.stax;resolution:=optional
+ ,javax.xml.namespace;resolution:=optional
+ ,javax.xml.stream;resolution:=optional,
+ ,net.sf.cglib.proxy;resolution:=optional
+ ,nu.xom;resolution:=optional
+ ,org.codehaus.jettison;version="[1.2,2)";resolution:=optional
+ ,org.codehaus.jettison.mapped;version="[1.2,2)";resolution:=optional
+ ,org.dom4j;resolution:=optional
+ ,org.dom4j.io;resolution:=optional
+ ,org.dom4j.tree;resolution:=op
+ tional,org.jdom;resolution:=optional
+ ,org.jdom.input;resolution:=optional
+ ,org.jdom2;resolution:=optional
+ ,org.jdom2.input;resolution:=optional
+ ,org.joda.time;version="[1.6,2)";resolution:=optional
+ ,org.joda.time.format;version="[1.6,2)";resolution:=optional
+ ,org.kxml2.io;resolution:=optional
+ ,org.w3c.dom;resolution:=optional
+ ,*
+
+
+
+
+ org.apache.felix
+ org.apache.felix.dependencymanager.annotation
+ 4.1.0
+
+
+
+
+
+
+