Skip to content

Commit

Permalink
小店活动新增活动门店管理API (#209)
Browse files Browse the repository at this point in the history
  • Loading branch information
colindhlin authored Jul 31, 2023
1 parent 51c870b commit fd355a2
Show file tree
Hide file tree
Showing 42 changed files with 905 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,27 @@

import com.wechat.pay.java.core.RSAConfig;
import com.wechat.pay.java.service.retailstore.model.AddRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.AddRepresentativesResponse;
import com.wechat.pay.java.service.retailstore.model.AddStoresRequest;
import com.wechat.pay.java.service.retailstore.model.AddStoresResponse;
import com.wechat.pay.java.service.retailstore.model.ApplyActivityRequest;
import com.wechat.pay.java.service.retailstore.model.ApplyActivityResponse;
import com.wechat.pay.java.service.retailstore.model.CreateMaterialsRequest;
import com.wechat.pay.java.service.retailstore.model.DeleteRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.DeleteRepresentativeResponse;
import com.wechat.pay.java.service.retailstore.model.DeleteStoresRequest;
import com.wechat.pay.java.service.retailstore.model.DeleteStoresResponse;
import com.wechat.pay.java.service.retailstore.model.GetStoreRequest;
import com.wechat.pay.java.service.retailstore.model.ListActsByAreaRequest;
import com.wechat.pay.java.service.retailstore.model.ListActsByAreaResponse;
import com.wechat.pay.java.service.retailstore.model.ListRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.ListRepresentativeResponse;
import com.wechat.pay.java.service.retailstore.model.ListStoreRequest;
import com.wechat.pay.java.service.retailstore.model.ListStoreResponse;
import com.wechat.pay.java.service.retailstore.model.LockQualificationRequest;
import com.wechat.pay.java.service.retailstore.model.LockQualificationResponse;
import com.wechat.pay.java.service.retailstore.model.Materials;
import com.wechat.pay.java.service.retailstore.model.Representatives;
import com.wechat.pay.java.service.retailstore.model.RetailStoreInfo;
import com.wechat.pay.java.service.retailstore.model.UnlockQualificationRequest;
import com.wechat.pay.java.service.retailstore.model.UnlockQualificationResponse;

Expand Down Expand Up @@ -65,11 +73,17 @@ public static UnlockQualificationResponse unlockQualification() {
return service.unlockQualification(request);
}
/** 添加零售小店活动业务代理 */
public static Representatives addRepresentative() {
public static AddRepresentativesResponse addRepresentative() {

AddRepresentativeRequest request = new AddRepresentativeRequest();
return service.addRepresentative(request);
}
/** 添加小店活动门店 */
public static AddStoresResponse addStores() {

AddStoresRequest request = new AddStoresRequest();
return service.addStores(request);
}
/** 生成小店活动物料码 */
public static Materials createMaterials() {

Expand All @@ -82,10 +96,28 @@ public static DeleteRepresentativeResponse deleteRepresentative() {
DeleteRepresentativeRequest request = new DeleteRepresentativeRequest();
return service.deleteRepresentative(request);
}
/** 删除小店活动门店 */
public static DeleteStoresResponse deleteStores() {

DeleteStoresRequest request = new DeleteStoresRequest();
return service.deleteStores(request);
}
/** 查询小店活动门店详情 */
public static RetailStoreInfo getStore() {

GetStoreRequest request = new GetStoreRequest();
return service.getStore(request);
}
/** 查询零售小店活动业务代理 */
public static ListRepresentativeResponse listRepresentative() {

ListRepresentativeRequest request = new ListRepresentativeRequest();
return service.listRepresentative(request);
}
/** 查询小店活动门店列表 */
public static ListStoreResponse listStore() {

ListStoreRequest request = new ListStoreRequest();
return service.listStore(request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
//
// API version: 1.3.0
// API version: 1.4.0

// Code generated by WechatPay APIv3 Generator based on [OpenAPI
// Generator](https://openapi-generator.tech); DO NOT EDIT.
Expand Down Expand Up @@ -33,19 +33,27 @@
import com.wechat.pay.java.core.http.QueryParameter;
import com.wechat.pay.java.core.http.RequestBody;
import com.wechat.pay.java.service.retailstore.model.AddRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.AddRepresentativesResponse;
import com.wechat.pay.java.service.retailstore.model.AddStoresRequest;
import com.wechat.pay.java.service.retailstore.model.AddStoresResponse;
import com.wechat.pay.java.service.retailstore.model.ApplyActivityRequest;
import com.wechat.pay.java.service.retailstore.model.ApplyActivityResponse;
import com.wechat.pay.java.service.retailstore.model.CreateMaterialsRequest;
import com.wechat.pay.java.service.retailstore.model.DeleteRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.DeleteRepresentativeResponse;
import com.wechat.pay.java.service.retailstore.model.DeleteStoresRequest;
import com.wechat.pay.java.service.retailstore.model.DeleteStoresResponse;
import com.wechat.pay.java.service.retailstore.model.GetStoreRequest;
import com.wechat.pay.java.service.retailstore.model.ListActsByAreaRequest;
import com.wechat.pay.java.service.retailstore.model.ListActsByAreaResponse;
import com.wechat.pay.java.service.retailstore.model.ListRepresentativeRequest;
import com.wechat.pay.java.service.retailstore.model.ListRepresentativeResponse;
import com.wechat.pay.java.service.retailstore.model.ListStoreRequest;
import com.wechat.pay.java.service.retailstore.model.ListStoreResponse;
import com.wechat.pay.java.service.retailstore.model.LockQualificationRequest;
import com.wechat.pay.java.service.retailstore.model.LockQualificationResponse;
import com.wechat.pay.java.service.retailstore.model.Materials;
import com.wechat.pay.java.service.retailstore.model.Representatives;
import com.wechat.pay.java.service.retailstore.model.RetailStoreInfo;
import com.wechat.pay.java.service.retailstore.model.UnlockQualificationRequest;
import com.wechat.pay.java.service.retailstore.model.UnlockQualificationResponse;

Expand Down Expand Up @@ -231,13 +239,13 @@ public UnlockQualificationResponse unlockQualification(UnlockQualificationReques
* 添加零售小店活动业务代理
*
* @param request 请求参数
* @return Representatives
* @return AddRepresentativesResponse
* @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。
* @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。
* @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。
* @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。
*/
public Representatives addRepresentative(AddRepresentativeRequest request) {
public AddRepresentativesResponse addRepresentative(AddRepresentativeRequest request) {
String requestPath =
"https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative";

Expand All @@ -259,8 +267,43 @@ public Representatives addRepresentative(AddRepresentativeRequest request) {
.headers(headers)
.body(createRequestBody(realRequest))
.build();
HttpResponse<Representatives> httpResponse =
httpClient.execute(httpRequest, Representatives.class);
HttpResponse<AddRepresentativesResponse> httpResponse =
httpClient.execute(httpRequest, AddRepresentativesResponse.class);
return httpResponse.getServiceResponse();
}
/**
* 添加小店活动门店
*
* @param request 请求参数
* @return AddStoresResponse
* @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。
* @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。
* @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。
* @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。
*/
public AddStoresResponse addStores(AddStoresRequest request) {
String requestPath =
"https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores";

AddStoresRequest realRequest = request;
// 添加 path param
requestPath = requestPath.replace("{" + "brand_id" + "}", urlEncode(realRequest.getBrandId()));

if (this.hostName != null) {
requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue());
}
HttpHeaders headers = new HttpHeaders();
headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
HttpRequest httpRequest =
new HttpRequest.Builder()
.httpMethod(HttpMethod.POST)
.url(requestPath)
.headers(headers)
.body(createRequestBody(realRequest))
.build();
HttpResponse<AddStoresResponse> httpResponse =
httpClient.execute(httpRequest, AddStoresResponse.class);
return httpResponse.getServiceResponse();
}
/**
Expand Down Expand Up @@ -333,6 +376,78 @@ public DeleteRepresentativeResponse deleteRepresentative(DeleteRepresentativeReq
httpClient.execute(httpRequest, DeleteRepresentativeResponse.class);
return httpResponse.getServiceResponse();
}
/**
* 删除小店活动门店
*
* @param request 请求参数
* @return DeleteStoresResponse
* @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。
* @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。
* @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。
* @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。
*/
public DeleteStoresResponse deleteStores(DeleteStoresRequest request) {
String requestPath =
"https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores";

DeleteStoresRequest realRequest = request;
// 添加 path param
requestPath = requestPath.replace("{" + "brand_id" + "}", urlEncode(realRequest.getBrandId()));

if (this.hostName != null) {
requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue());
}
HttpHeaders headers = new HttpHeaders();
headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
HttpRequest httpRequest =
new HttpRequest.Builder()
.httpMethod(HttpMethod.DELETE)
.url(requestPath)
.headers(headers)
.body(createRequestBody(realRequest))
.build();
HttpResponse<DeleteStoresResponse> httpResponse =
httpClient.execute(httpRequest, DeleteStoresResponse.class);
return httpResponse.getServiceResponse();
}
/**
* 查询小店活动门店详情
*
* @param request 请求参数
* @return RetailStoreInfo
* @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。
* @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。
* @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。
* @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。
*/
public RetailStoreInfo getStore(GetStoreRequest request) {
String requestPath =
"https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores/{store_code}";

GetStoreRequest realRequest = request;
// 添加 path param
requestPath = requestPath.replace("{" + "brand_id" + "}", urlEncode(realRequest.getBrandId()));

requestPath =
requestPath.replace("{" + "store_code" + "}", urlEncode(realRequest.getStoreCode()));

if (this.hostName != null) {
requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue());
}
HttpHeaders headers = new HttpHeaders();
headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
HttpRequest httpRequest =
new HttpRequest.Builder()
.httpMethod(HttpMethod.GET)
.url(requestPath)
.headers(headers)
.build();
HttpResponse<RetailStoreInfo> httpResponse =
httpClient.execute(httpRequest, RetailStoreInfo.class);
return httpResponse.getServiceResponse();
}
/**
* 查询零售小店活动业务代理
*
Expand Down Expand Up @@ -377,6 +492,49 @@ public ListRepresentativeResponse listRepresentative(ListRepresentativeRequest r
httpClient.execute(httpRequest, ListRepresentativeResponse.class);
return httpResponse.getServiceResponse();
}
/**
* 查询小店活动门店列表
*
* @param request 请求参数
* @return ListStoreResponse
* @throws HttpException 发送HTTP请求失败。例如构建请求参数失败、发送请求失败、I/O错误等。包含请求信息。
* @throws ValidationException 发送HTTP请求成功,验证微信支付返回签名失败。
* @throws ServiceException 发送HTTP请求成功,服务返回异常。例如返回状态码小于200或大于等于300。
* @throws MalformedMessageException 服务返回成功,content-type不为application/json、解析返回体失败。
*/
public ListStoreResponse listStore(ListStoreRequest request) {
String requestPath =
"https://api.mch.weixin.qq.com/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores";

ListStoreRequest realRequest = request;
// 添加 path param
requestPath = requestPath.replace("{" + "brand_id" + "}", urlEncode(realRequest.getBrandId()));

// 添加 query param
QueryParameter queryParameter = new QueryParameter();
if (realRequest.getOffset() != null) {
queryParameter.add("offset", urlEncode(realRequest.getOffset().toString()));
}
if (realRequest.getLimit() != null) {
queryParameter.add("limit", urlEncode(realRequest.getLimit().toString()));
}
requestPath += queryParameter.getQueryStr();
if (this.hostName != null) {
requestPath = requestPath.replaceFirst(HostName.API.getValue(), hostName.getValue());
}
HttpHeaders headers = new HttpHeaders();
headers.addHeader(Constant.ACCEPT, MediaType.APPLICATION_JSON.getValue());
headers.addHeader(Constant.CONTENT_TYPE, MediaType.APPLICATION_JSON.getValue());
HttpRequest httpRequest =
new HttpRequest.Builder()
.httpMethod(HttpMethod.GET)
.url(requestPath)
.headers(headers)
.build();
HttpResponse<ListStoreResponse> httpResponse =
httpClient.execute(httpRequest, ListStoreResponse.class);
return httpResponse.getServiceResponse();
}

private RequestBody createRequestBody(Object request) {
return new JsonRequestBody.Builder().body(toJson(request)).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
//
// API version: 1.3.0
// API version: 1.4.0

// Code generated by WechatPay APIv3 Generator based on [OpenAPI
// Generator](https://openapi-generator.tech); DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
//
// API version: 1.3.0
// API version: 1.4.0

// Code generated by WechatPay APIv3 Generator based on [OpenAPI
// Generator](https://openapi-generator.tech); DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
//
// API version: 1.3.0
// API version: 1.4.0

// Code generated by WechatPay APIv3 Generator based on [OpenAPI
// Generator](https://openapi-generator.tech); DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
//
// API version: 1.3.0
// API version: 1.4.0

// Code generated by WechatPay APIv3 Generator based on [OpenAPI
// Generator](https://openapi-generator.tech); DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
//
// API version: 1.3.0
// API version: 1.4.0

// Code generated by WechatPay APIv3 Generator based on [OpenAPI
// Generator](https://openapi-generator.tech); DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
//
// API version: 1.3.0
// API version: 1.4.0

// Code generated by WechatPay APIv3 Generator based on [OpenAPI
// Generator](https://openapi-generator.tech); DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
//
// API version: 1.3.0
// API version: 1.4.0

// Code generated by WechatPay APIv3 Generator based on [OpenAPI
// Generator](https://openapi-generator.tech); DO NOT EDIT.
Expand All @@ -16,8 +16,8 @@
import com.google.gson.annotations.SerializedName;
import java.util.List;

/** Representatives */
public class Representatives {
/** AddRepresentativesResponse */
public class AddRepresentativesResponse {
/** 零售小店活动ID 说明:零售小店活动ID */
@SerializedName("activity_id")
private String activityId;
Expand Down Expand Up @@ -56,7 +56,7 @@ public void setAddTime(String addTime) {
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Representatives {\n");
sb.append("class AddRepresentativesResponse {\n");
sb.append(" activityId: ").append(toIndentedString(activityId)).append("\n");
sb.append(" failedRepresentativeInfoList: ")
.append(toIndentedString(failedRepresentativeInfoList))
Expand Down
Loading

0 comments on commit fd355a2

Please sign in to comment.