1
0
mirror of synced 2025-12-29 14:50:03 +08:00

🆕 #1474 企业微信新增客户联系「联系我」管理接口 修正 / #1590 开放平台刷新AccessToken同步更新RefreshToken

* #1474 新增客户联系「联系我」管理接口

* fix #1590 提及的me.chanjar.weixin.open.api.impl.WxOpenComponentServiceImpl#getAuthorizerAccessToken()刷新AccessToken后没有同步对应的refreshToken

* 补充 me.chanjar.weixin.open.api.impl.WxOpenInMemoryConfigStorage#updateToken 方法对 expireInSeconds 边界判断
This commit is contained in:
爱因斯唐
2020-07-21 10:23:56 +08:00
committed by GitHub
parent 04fb35d1ba
commit 0758049ea9
12 changed files with 563 additions and 19 deletions

View File

@@ -1,13 +1,18 @@
package me.chanjar.weixin.cp.api.impl;
import com.google.common.collect.Lists;
import com.google.inject.Inject;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.cp.api.ApiTestModule;
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.WxCpBaseResp;
import me.chanjar.weixin.cp.bean.WxCpContactWayInfo;
import me.chanjar.weixin.cp.bean.WxCpUserExternalContactInfo;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.testng.annotations.Guice;
import org.testng.annotations.Test;
import java.util.Date;
import java.util.List;
import static org.testng.Assert.assertNotNull;
@@ -28,6 +33,55 @@ public class WxCpExternalContactServiceImplTest {
assertNotNull(result);
}
@Test
public void testAddContactWay() throws WxErrorException {
final String concatUserId = "符合要求的userId";
WxCpContactWayInfo info = new WxCpContactWayInfo();
info.setType(WxCpContactWayInfo.TYPE.SIGLE);
info.setScene(WxCpContactWayInfo.SCENE.MINIPROGRAM);
info.setUsers(Lists.newArrayList(concatUserId));
info.setRemark("CreateDate:" + DateFormatUtils.ISO_8601_EXTENDED_DATETIME_FORMAT.format(new Date()));
this.wxCpService.getExternalContactService().addContactWay(info);
}
@Test
public void testGetContactWay() throws WxErrorException {
final String configId = "2d7a68c657663afbd1d90db19a4b5ee9";
WxCpContactWayInfo contactWayInfo = this.wxCpService.getExternalContactService().getContactWay(configId);
System.out.println(contactWayInfo);
assertNotNull(contactWayInfo);
}
@Test
public void testUpdateContactWay() throws WxErrorException {
final String configId = "2d7a68c657663afbd1d90db19a4b5ee9";
final String concatUserId = "符合要求的userId";
WxCpContactWayInfo info = new WxCpContactWayInfo();
info.setConfigId(configId);
info.setUsers(Lists.newArrayList(concatUserId));
info.setRemark("CreateDate:" + DateFormatUtils.ISO_8601_EXTENDED_DATETIME_FORMAT.format(new Date()));
WxCpBaseResp resp = this.wxCpService.getExternalContactService().updateContactWay(info);
System.out.println(resp);
assertNotNull(resp);
}
@Test
public void testDelContactWay() throws WxErrorException {
final String configId = "2d7a68c657663afbd1d90db19a4b5ee9";
WxCpBaseResp resp = this.wxCpService.getExternalContactService().deleteContactWay(configId);
System.out.println(resp);
assertNotNull(resp);
}
@Test
public void testCloseTempChat() throws WxErrorException {
final String externalUserId = "externalUserId";
WxCpBaseResp resp = this.wxCpService.getExternalContactService().closeTempChat(userId, externalUserId);
System.out.println(resp);
}
@Test
public void testListExternalContacts() throws WxErrorException {
String userId = this.configStorage.getUserId();