根据《微信商户平台文档》修缮Pay3Api类 & mp-server新增客服创建、关闭、转接会话的事件
This commit is contained in:
@@ -67,4 +67,8 @@ weixin4j-mp-server
|
||||
|
||||
* 2014-11-23
|
||||
|
||||
+ `WeixinServerBootstrap`重命名为`WeixinMpServerBootstrap`
|
||||
+ `WeixinServerBootstrap`重命名为`WeixinMpServerBootstrap`
|
||||
|
||||
* 2015-03-25
|
||||
|
||||
+ 新增客服创建、关闭、转接会话事件
|
||||
+12
-3
@@ -5,6 +5,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.io.SAXReader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -16,6 +18,7 @@ import com.foxinmy.weixin4j.model.WeixinMpAccount;
|
||||
import com.foxinmy.weixin4j.mp.payment.JsPayNotify;
|
||||
import com.foxinmy.weixin4j.mp.payment.PayPackage;
|
||||
import com.foxinmy.weixin4j.mp.payment.PayUtil;
|
||||
import com.foxinmy.weixin4j.mp.payment.conver.CouponConverter;
|
||||
import com.foxinmy.weixin4j.mp.payment.v2.NativePayNotifyV2;
|
||||
import com.foxinmy.weixin4j.mp.payment.v2.NativePayResponseV2;
|
||||
import com.foxinmy.weixin4j.mp.payment.v2.PayFeedback;
|
||||
@@ -149,16 +152,22 @@ public class PayAction {
|
||||
* <return_code>SUCCESS/FAIL</return_code><br>
|
||||
* <return_msg>如非空,为错误 原因签名失败参数格式校验错误</return_msg><br>
|
||||
* </xml>
|
||||
* @throws DocumentException
|
||||
* @see <a
|
||||
* href="http://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_7">支付结果通知</a>
|
||||
*/
|
||||
public String jsNotifyV3(InputStream inputStream) {
|
||||
com.foxinmy.weixin4j.mp.payment.v3.Order order = XmlStream.get(
|
||||
inputStream, com.foxinmy.weixin4j.mp.payment.v3.Order.class);
|
||||
public String jsNotifyV3(InputStream inputStream) throws DocumentException {
|
||||
SAXReader sax = new SAXReader();
|
||||
String orderXml = sax.read(inputStream).asXML();
|
||||
com.foxinmy.weixin4j.mp.payment.v3.Order order = CouponConverter
|
||||
.fromXML(orderXml, com.foxinmy.weixin4j.mp.payment.v3.Order.class);
|
||||
log.info("jsapi_notify_order_info:", order);
|
||||
String sign = order.getSign();
|
||||
order.setSign(null);
|
||||
WeixinMpAccount weixinAccount = ConfigUtil.getWeixinMpAccount();
|
||||
String valid_sign = PayUtil.paysignMd5(order,
|
||||
weixinAccount.getPaySignKey());
|
||||
// 如果订单中存在代金券的情况并不适用
|
||||
log.info("微信签名----->sign={},vaild_sign={}", sign, valid_sign);
|
||||
if (!sign.equals(valid_sign)) {
|
||||
return XmlStream.to(new XmlResult(Consts.FAIL, "签名错误"));
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.foxinmy.weixin4j.mp.action.event;
|
||||
|
||||
import com.foxinmy.weixin4j.action.DebugAction;
|
||||
import com.foxinmy.weixin4j.action.mapping.ActionAnnotation;
|
||||
import com.foxinmy.weixin4j.msg.event.KfCloseEventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 客服关闭会话消息
|
||||
*
|
||||
* @className KfCloseAction
|
||||
* @author jy
|
||||
* @date 2015年3月25日
|
||||
* @since JDK 1.7
|
||||
* @see com.foxinmy.weixin4j.msg.event.KfCloseEventMessage
|
||||
*/
|
||||
@ActionAnnotation(msgType = MessageType.event, eventType = { EventType.kf_close_session })
|
||||
public class KfCloseAction extends DebugAction<KfCloseEventMessage> {
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.foxinmy.weixin4j.mp.action.event;
|
||||
|
||||
import com.foxinmy.weixin4j.action.DebugAction;
|
||||
import com.foxinmy.weixin4j.action.mapping.ActionAnnotation;
|
||||
import com.foxinmy.weixin4j.msg.event.KfCreateEventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 客服接入会话消息
|
||||
*
|
||||
* @className KfCreateAction
|
||||
* @author jy
|
||||
* @date 2015年3月25日
|
||||
* @since JDK 1.7
|
||||
* @see com.foxinmy.weixin4j.msg.event.KfCreateEventMessage
|
||||
*/
|
||||
@ActionAnnotation(msgType = MessageType.event, eventType = { EventType.kf_create_session })
|
||||
public class KfCreateAction extends DebugAction<KfCreateEventMessage> {
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.foxinmy.weixin4j.mp.action.event;
|
||||
|
||||
import com.foxinmy.weixin4j.action.DebugAction;
|
||||
import com.foxinmy.weixin4j.action.mapping.ActionAnnotation;
|
||||
import com.foxinmy.weixin4j.msg.event.KfSwitchEventMessage;
|
||||
import com.foxinmy.weixin4j.type.EventType;
|
||||
import com.foxinmy.weixin4j.type.MessageType;
|
||||
|
||||
/**
|
||||
* 客服转接会话消息
|
||||
*
|
||||
* @className KfSwitchAction
|
||||
* @author jy
|
||||
* @date 2015年3月25日
|
||||
* @since JDK 1.7
|
||||
* @see com.foxinmy.weixin4j.msg.event.KfSwitchEventMessage
|
||||
*/
|
||||
@ActionAnnotation(msgType = MessageType.event, eventType = { EventType.kf_switch_session })
|
||||
public class KfSwitchAction extends DebugAction<KfSwitchEventMessage> {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user