@@ -36,11 +36,22 @@ public interface WxMpStoreService { | |||||
* 注:扩展字段为公共编辑信息(大家都可修改),修改将会审核,并决定是否对修改建议进行采纳,但不会影响该门店的生效可用状态。 | * 注:扩展字段为公共编辑信息(大家都可修改),修改将会审核,并决定是否对修改建议进行采纳,但不会影响该门店的生效可用状态。 | ||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> | * 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> | ||||
* </pre> | * </pre> | ||||
* @param poiId 门店poiId | |||||
* @param poiId 门店Id | |||||
* @throws WxErrorException | * @throws WxErrorException | ||||
*/ | */ | ||||
WxMpStoreBaseInfo get(String poiId) throws WxErrorException; | WxMpStoreBaseInfo get(String poiId) throws WxErrorException; | ||||
/** | |||||
* <pre> | |||||
* 删除门店 | |||||
* 商户可以通过该接口,删除已经成功创建的门店。请商户慎重调用该接口。 | |||||
* 详情请见: <a href="https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1444378120&token=&lang=zh_CN">微信门店接口</a> | |||||
* </pre> | |||||
* @param poiId 门店Id | |||||
* @throws WxErrorException | |||||
*/ | |||||
void delete(String poiId) throws WxErrorException; | |||||
/** | /** | ||||
* <pre> | * <pre> | ||||
* 查询门店列表(指定查询起始位置和个数) | * 查询门店列表(指定查询起始位置和个数) | ||||
@@ -57,6 +57,18 @@ public class WxMpStoreServiceImpl implements WxMpStoreService { | |||||
.get("business").getAsJsonObject().get("base_info").toString()); | .get("business").getAsJsonObject().get("base_info").toString()); | ||||
} | } | ||||
@Override | |||||
public void delete(String poiId) throws WxErrorException { | |||||
String url = API_BASE_URL + "/delpoi"; | |||||
JsonObject paramObject = new JsonObject(); | |||||
paramObject.addProperty("poi_id",poiId); | |||||
String response = this.wxMpService.post(url, paramObject.toString()); | |||||
WxError wxError = WxError.fromJson(response); | |||||
if (wxError.getErrorCode() != 0) { | |||||
throw new WxErrorException(wxError); | |||||
} | |||||
} | |||||
private void checkParameters(WxMpStoreBaseInfo request) { | private void checkParameters(WxMpStoreBaseInfo request) { | ||||
List<String> nullFields = Lists.newArrayList(); | List<String> nullFields = Lists.newArrayList(); | ||||
for (Entry<String, Reflect> entry : Reflect.on(request).fields() | for (Entry<String, Reflect> entry : Reflect.on(request).fields() | ||||
@@ -52,6 +52,10 @@ public class WxMpStoreServiceImplTest { | |||||
System.err.println(result); | System.err.println(result); | ||||
} | } | ||||
public void testDelete() throws WxErrorException { | |||||
this.wxMpService.getStoreService().delete("463558057"); | |||||
} | |||||
public void testList() throws WxErrorException { | public void testList() throws WxErrorException { | ||||
WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10); | WxMpStoreListResult result = this.wxMpService.getStoreService().list(0, 10); | ||||
assertNotNull(result); | assertNotNull(result); | ||||