From f0f635c7b8c7a5e88fbe0ad4af1dcdf96a6674eb Mon Sep 17 00:00:00 2001 From: colindhlin <69178517+colindhlin@users.noreply.github.com> Date: Mon, 31 Jul 2023 10:24:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E5=BA=97=E6=B4=BB=E5=8A=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=B4=BB=E5=8A=A8=E9=97=A8=E5=BA=97=E7=AE=A1=E7=90=86?= =?UTF-8?q?API=20(#198)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tives.md => AddRepresentativesResponse.md} | 2 +- docs/retailstore/AddStoresBody.md | 15 + docs/retailstore/AddStoresRequest.md | 16 + docs/retailstore/AddStoresResponse.md | 14 + docs/retailstore/DeleteStoresBody.md | 15 + docs/retailstore/DeleteStoresRequest.md | 16 + docs/retailstore/DeleteStoresResponse.md | 14 + docs/retailstore/GetStoreRequest.md | 14 + docs/retailstore/ListStoreRequest.md | 15 + docs/retailstore/ListStoreResponse.md | 16 + docs/retailstore/README.md | 18 +- docs/retailstore/RetailStoreActApi.md | 355 ++++++- docs/retailstore/RetailStoreInfo.md | 14 + services/retailstore/api_activity.go | 2 +- .../retailstore/api_activity_example_test.go | 2 +- services/retailstore/api_qualification.go | 2 +- .../api_qualification_example_test.go | 2 +- services/retailstore/api_retail_store_act.go | 205 +++- .../api_retail_store_act_example_test.go | 181 +++- services/retailstore/models.go | 878 ++++++++++++++++-- 20 files changed, 1692 insertions(+), 104 deletions(-) rename docs/retailstore/{Representatives.md => AddRepresentativesResponse.md} (94%) create mode 100644 docs/retailstore/AddStoresBody.md create mode 100644 docs/retailstore/AddStoresRequest.md create mode 100644 docs/retailstore/AddStoresResponse.md create mode 100644 docs/retailstore/DeleteStoresBody.md create mode 100644 docs/retailstore/DeleteStoresRequest.md create mode 100644 docs/retailstore/DeleteStoresResponse.md create mode 100644 docs/retailstore/GetStoreRequest.md create mode 100644 docs/retailstore/ListStoreRequest.md create mode 100644 docs/retailstore/ListStoreResponse.md create mode 100644 docs/retailstore/RetailStoreInfo.md diff --git a/docs/retailstore/Representatives.md b/docs/retailstore/AddRepresentativesResponse.md similarity index 94% rename from docs/retailstore/Representatives.md rename to docs/retailstore/AddRepresentativesResponse.md index cae374f..4651266 100644 --- a/docs/retailstore/Representatives.md +++ b/docs/retailstore/AddRepresentativesResponse.md @@ -1,4 +1,4 @@ -# Representatives +# AddRepresentativesResponse ## 属性列表 diff --git a/docs/retailstore/AddStoresBody.md b/docs/retailstore/AddStoresBody.md new file mode 100644 index 0000000..f2a5d65 --- /dev/null +++ b/docs/retailstore/AddStoresBody.md @@ -0,0 +1,15 @@ +# AddStoresBody + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**OutRequestNo** | **string** | 商户新增小店活动门店凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 | +**AddTime** | **string** | 添加时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 | +**Stores** | [**[]RetailStoreInfo**](RetailStoreInfo.md) | 待新增的小店活动门店列表 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/AddStoresRequest.md b/docs/retailstore/AddStoresRequest.md new file mode 100644 index 0000000..967db72 --- /dev/null +++ b/docs/retailstore/AddStoresRequest.md @@ -0,0 +1,16 @@ +# AddStoresRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**BrandId** | **string** | 品牌ID | +**OutRequestNo** | **string** | 商户新增小店活动门店凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 | +**AddTime** | **string** | 添加时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 | +**Stores** | [**[]RetailStoreInfo**](RetailStoreInfo.md) | 待新增的小店活动门店列表 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/AddStoresResponse.md b/docs/retailstore/AddStoresResponse.md new file mode 100644 index 0000000..5c9c6cf --- /dev/null +++ b/docs/retailstore/AddStoresResponse.md @@ -0,0 +1,14 @@ +# AddStoresResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**AddTime** | **string** | 添加时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 | [可选] +**FailedStores** | [**[]RetailStoreInfo**](RetailStoreInfo.md) | 添加失败的小店活动门店列表 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/DeleteStoresBody.md b/docs/retailstore/DeleteStoresBody.md new file mode 100644 index 0000000..5205dd0 --- /dev/null +++ b/docs/retailstore/DeleteStoresBody.md @@ -0,0 +1,15 @@ +# DeleteStoresBody + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**OutRequestNo** | **string** | 商户删除小店活动门店凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 | +**DeleteTime** | **string** | 删除时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 | +**Stores** | [**[]RetailStoreInfo**](RetailStoreInfo.md) | 待删除的小店活动门店列表 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/DeleteStoresRequest.md b/docs/retailstore/DeleteStoresRequest.md new file mode 100644 index 0000000..48f40aa --- /dev/null +++ b/docs/retailstore/DeleteStoresRequest.md @@ -0,0 +1,16 @@ +# DeleteStoresRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**BrandId** | **string** | 品牌ID | +**OutRequestNo** | **string** | 商户删除小店活动门店凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 | +**DeleteTime** | **string** | 删除时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 | +**Stores** | [**[]RetailStoreInfo**](RetailStoreInfo.md) | 待删除的小店活动门店列表 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/DeleteStoresResponse.md b/docs/retailstore/DeleteStoresResponse.md new file mode 100644 index 0000000..cb114f0 --- /dev/null +++ b/docs/retailstore/DeleteStoresResponse.md @@ -0,0 +1,14 @@ +# DeleteStoresResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**DeleteTime** | **string** | 删除时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 | [可选] +**FailedStores** | [**[]RetailStoreInfo**](RetailStoreInfo.md) | 删除失败的小店活动门店列表 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/GetStoreRequest.md b/docs/retailstore/GetStoreRequest.md new file mode 100644 index 0000000..012ef40 --- /dev/null +++ b/docs/retailstore/GetStoreRequest.md @@ -0,0 +1,14 @@ +# GetStoreRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**BrandId** | **string** | 品牌ID | +**StoreCode** | **string** | 门店编码,可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ListStoreRequest.md b/docs/retailstore/ListStoreRequest.md new file mode 100644 index 0000000..999b927 --- /dev/null +++ b/docs/retailstore/ListStoreRequest.md @@ -0,0 +1,15 @@ +# ListStoreRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**BrandId** | **string** | 品牌ID | +**Offset** | **int64** | 页码从0开始,默认第0页 | +**Limit** | **int64** | 分页大小,默认查询10家门店 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ListStoreResponse.md b/docs/retailstore/ListStoreResponse.md new file mode 100644 index 0000000..c4ce724 --- /dev/null +++ b/docs/retailstore/ListStoreResponse.md @@ -0,0 +1,16 @@ +# ListStoreResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**TotalCount** | **int64** | 小店活动门店总数 | [可选] +**Data** | [**[]RetailStoreInfo**](RetailStoreInfo.md) | 小店活动门店集合 | [可选] +**Offset** | **int64** | 页码从0开始,默认第0页 | [可选] +**Limit** | **int64** | 分页大小 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/README.md b/docs/retailstore/README.md index dab6d91..7c41e12 100644 --- a/docs/retailstore/README.md +++ b/docs/retailstore/README.md @@ -5,7 +5,7 @@ ## 总览 本 SDK 由 WechatPay APIv3 SDK 生成器生成。生成器基于 [OpenAPI Generator](https://openapi-generator.tech) 构建。 -- API 版本: 1.3.0 +- API 版本: 1.4.0 ## 接口列表 @@ -18,9 +18,13 @@ *QualificationApi* | [**LockQualification**](QualificationApi.md#lockqualification) | **Post** /v3/marketing/goods-subsidy-activity/qualification/lock | 锁定品牌加价购活动资格 *QualificationApi* | [**UnlockQualification**](QualificationApi.md#unlockqualification) | **Post** /v3/marketing/goods-subsidy-activity/qualification/unlock | 解锁品牌加价购活动资格 *RetailStoreActApi* | [**AddRepresentative**](RetailStoreActApi.md#addrepresentative) | **Put** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative | 添加零售小店活动业务代理 +*RetailStoreActApi* | [**AddStores**](RetailStoreActApi.md#addstores) | **Post** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores | 添加小店活动门店 *RetailStoreActApi* | [**CreateMaterials**](RetailStoreActApi.md#creatematerials) | **Post** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/materials | 生成小店活动物料码 *RetailStoreActApi* | [**DeleteRepresentative**](RetailStoreActApi.md#deleterepresentative) | **Delete** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative | 删除零售小店活动业务代理 +*RetailStoreActApi* | [**DeleteStores**](RetailStoreActApi.md#deletestores) | **Delete** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores | 删除小店活动门店 +*RetailStoreActApi* | [**GetStore**](RetailStoreActApi.md#getstore) | **Get** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores/{store_code} | 查询小店活动门店详情 *RetailStoreActApi* | [**ListRepresentative**](RetailStoreActApi.md#listrepresentative) | **Get** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representatives | 查询零售小店活动业务代理 +*RetailStoreActApi* | [**ListStore**](RetailStoreActApi.md#liststore) | **Get** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores | 查询小店活动门店列表 ## 类型列表 @@ -31,6 +35,10 @@ - [ActRule](ActRule.md) - [AddRepresentativeRequest](AddRepresentativeRequest.md) - [AddRepresentativesRequest](AddRepresentativesRequest.md) + - [AddRepresentativesResponse](AddRepresentativesResponse.md) + - [AddStoresBody](AddStoresBody.md) + - [AddStoresRequest](AddStoresRequest.md) + - [AddStoresResponse](AddStoresResponse.md) - [ApplyActivityBody](ApplyActivityBody.md) - [ApplyActivityRequest](ApplyActivityRequest.md) - [ApplyActivityResponse](ApplyActivityResponse.md) @@ -39,19 +47,25 @@ - [DeleteRepresentativeBody](DeleteRepresentativeBody.md) - [DeleteRepresentativeRequest](DeleteRepresentativeRequest.md) - [DeleteRepresentativeResponse](DeleteRepresentativeResponse.md) + - [DeleteStoresBody](DeleteStoresBody.md) + - [DeleteStoresRequest](DeleteStoresRequest.md) + - [DeleteStoresResponse](DeleteStoresResponse.md) - [FmcgAct](FmcgAct.md) + - [GetStoreRequest](GetStoreRequest.md) - [GoodsInfo](GoodsInfo.md) - [ListActsByAreaRequest](ListActsByAreaRequest.md) - [ListActsByAreaResponse](ListActsByAreaResponse.md) - [ListRepresentativeRequest](ListRepresentativeRequest.md) - [ListRepresentativeResponse](ListRepresentativeResponse.md) + - [ListStoreRequest](ListStoreRequest.md) + - [ListStoreResponse](ListStoreResponse.md) - [LockQualificationRequest](LockQualificationRequest.md) - [LockQualificationResponse](LockQualificationResponse.md) - [MaterialInfo](MaterialInfo.md) - [Materials](Materials.md) - [OrderInfo](OrderInfo.md) - [RepresentativeInfo](RepresentativeInfo.md) - - [Representatives](Representatives.md) + - [RetailStoreInfo](RetailStoreInfo.md) - [StoreInfo](StoreInfo.md) - [UnlockQualificationRequest](UnlockQualificationRequest.md) - [UnlockQualificationResponse](UnlockQualificationResponse.md) diff --git a/docs/retailstore/RetailStoreActApi.md b/docs/retailstore/RetailStoreActApi.md index 0706c63..1c32a36 100644 --- a/docs/retailstore/RetailStoreActApi.md +++ b/docs/retailstore/RetailStoreActApi.md @@ -5,15 +5,19 @@ 方法名 | HTTP 请求 | 描述 ------------- | ------------- | ------------- [**AddRepresentative**](#addrepresentative) | **Put** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative | 添加零售小店活动业务代理 +[**AddStores**](#addstores) | **Post** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores | 添加小店活动门店 [**CreateMaterials**](#creatematerials) | **Post** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/materials | 生成小店活动物料码 [**DeleteRepresentative**](#deleterepresentative) | **Delete** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative | 删除零售小店活动业务代理 +[**DeleteStores**](#deletestores) | **Delete** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores | 删除小店活动门店 +[**GetStore**](#getstore) | **Get** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores/{store_code} | 查询小店活动门店详情 [**ListRepresentative**](#listrepresentative) | **Get** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representatives | 查询零售小店活动业务代理 +[**ListStore**](#liststore) | **Get** /v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores | 查询小店活动门店列表 ## AddRepresentative -> Representatives AddRepresentative(AddRepresentativeRequest) +> AddRepresentativesResponse AddRepresentative(AddRepresentativeRequest) 添加零售小店活动业务代理 @@ -89,7 +93,96 @@ func main() { ### 返回结果 Name | Type | Description ------------- | ------------- | ------------- -**resp** | \*[**Representatives**](Representatives.md) | 结构化的接口返回结果 +**resp** | \*[**AddRepresentativesResponse**](AddRepresentativesResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreretailstoreactapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + + +## AddStores + +> AddStoresResponse AddStores(AddStoresRequest) + +添加小店活动门店 + + + +### 调用示例 + +```go +package main + +import ( + "context" + "log" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/services/retailstore" + "github.com/wechatpay-apiv3/wechatpay-go/utils" +) + +func main() { + var ( + mchID string = "190000****" // 商户号 + mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 + mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 + ) + + // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") + if err != nil { + log.Printf("load merchant private key error:%s", err) + return + } + + ctx := context.Background() + // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 + opts := []core.ClientOption{ + option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), + } + client, err := core.NewClient(ctx, opts...) + if err != nil { + log.Printf("new wechat pay client err:%s", err) + return + } + + svc := retailstore.RetailStoreActApiService{Client: client} + resp, result, err := svc.AddStores(ctx, + retailstore.AddStoresRequest{ + BrandId: core.String("1001"), + OutRequestNo: core.String("1002600620019090123143254436"), + AddTime: core.String("2015-05-20T13:29:35+08:00"), + Stores: []retailstore.RetailStoreInfo{retailstore.RetailStoreInfo{ + StoreCode: core.String("abc_001"), + StoreName: core.String("幸福小店"), + }}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call AddStores err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**AddStoresRequest**](AddStoresRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**AddStoresResponse**](AddStoresResponse.md) | 结构化的接口返回结果 **result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 **err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 @@ -272,6 +365,179 @@ Name | Type | Description [\[返回服务README\]](README.md) +## DeleteStores + +> DeleteStoresResponse DeleteStores(DeleteStoresRequest) + +删除小店活动门店 + + + +### 调用示例 + +```go +package main + +import ( + "context" + "log" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/services/retailstore" + "github.com/wechatpay-apiv3/wechatpay-go/utils" +) + +func main() { + var ( + mchID string = "190000****" // 商户号 + mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 + mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 + ) + + // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") + if err != nil { + log.Printf("load merchant private key error:%s", err) + return + } + + ctx := context.Background() + // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 + opts := []core.ClientOption{ + option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), + } + client, err := core.NewClient(ctx, opts...) + if err != nil { + log.Printf("new wechat pay client err:%s", err) + return + } + + svc := retailstore.RetailStoreActApiService{Client: client} + resp, result, err := svc.DeleteStores(ctx, + retailstore.DeleteStoresRequest{ + BrandId: core.String("1001"), + OutRequestNo: core.String("1002600620019090123143254436"), + DeleteTime: core.String("2015-05-20T13:29:35+08:00"), + Stores: []retailstore.RetailStoreInfo{retailstore.RetailStoreInfo{ + StoreCode: core.String("abc_001"), + StoreName: core.String("幸福小店"), + }}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call DeleteStores err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**DeleteStoresRequest**](DeleteStoresRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**DeleteStoresResponse**](DeleteStoresResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreretailstoreactapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + + +## GetStore + +> RetailStoreInfo GetStore(GetStoreRequest) + +查询小店活动门店详情 + + + +### 调用示例 + +```go +package main + +import ( + "context" + "log" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/services/retailstore" + "github.com/wechatpay-apiv3/wechatpay-go/utils" +) + +func main() { + var ( + mchID string = "190000****" // 商户号 + mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 + mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 + ) + + // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") + if err != nil { + log.Printf("load merchant private key error:%s", err) + return + } + + ctx := context.Background() + // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 + opts := []core.ClientOption{ + option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), + } + client, err := core.NewClient(ctx, opts...) + if err != nil { + log.Printf("new wechat pay client err:%s", err) + return + } + + svc := retailstore.RetailStoreActApiService{Client: client} + resp, result, err := svc.GetStore(ctx, + retailstore.GetStoreRequest{ + BrandId: core.String("1001"), + StoreCode: core.String("abc_001"), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call GetStore err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**GetStoreRequest**](GetStoreRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**RetailStoreInfo**](RetailStoreInfo.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreretailstoreactapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + + ## ListRepresentative > ListRepresentativeResponse ListRepresentative(ListRepresentativeRequest) @@ -356,3 +622,88 @@ Name | Type | Description [\[返回类型列表\]](README.md#类型列表) [\[返回服务README\]](README.md) + +## ListStore + +> ListStoreResponse ListStore(ListStoreRequest) + +查询小店活动门店列表 + + + +### 调用示例 + +```go +package main + +import ( + "context" + "log" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/services/retailstore" + "github.com/wechatpay-apiv3/wechatpay-go/utils" +) + +func main() { + var ( + mchID string = "190000****" // 商户号 + mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 + mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 + ) + + // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") + if err != nil { + log.Printf("load merchant private key error:%s", err) + return + } + + ctx := context.Background() + // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 + opts := []core.ClientOption{ + option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), + } + client, err := core.NewClient(ctx, opts...) + if err != nil { + log.Printf("new wechat pay client err:%s", err) + return + } + + svc := retailstore.RetailStoreActApiService{Client: client} + resp, result, err := svc.ListStore(ctx, + retailstore.ListStoreRequest{ + BrandId: core.String("1001"), + Offset: core.Int64(0), + Limit: core.Int64(10), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call ListStore err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**ListStoreRequest**](ListStoreRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**ListStoreResponse**](ListStoreResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreretailstoreactapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + diff --git a/docs/retailstore/RetailStoreInfo.md b/docs/retailstore/RetailStoreInfo.md new file mode 100644 index 0000000..d744295 --- /dev/null +++ b/docs/retailstore/RetailStoreInfo.md @@ -0,0 +1,14 @@ +# RetailStoreInfo + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**StoreCode** | **string** | 门店编码,可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 | [可选] +**StoreName** | **string** | 门店名称 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/services/retailstore/api_activity.go b/services/retailstore/api_activity.go index 43e9297..c9249f0 100644 --- a/services/retailstore/api_activity.go +++ b/services/retailstore/api_activity.go @@ -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. diff --git a/services/retailstore/api_activity_example_test.go b/services/retailstore/api_activity_example_test.go index 86b11b7..bd9cf08 100644 --- a/services/retailstore/api_activity_example_test.go +++ b/services/retailstore/api_activity_example_test.go @@ -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. diff --git a/services/retailstore/api_qualification.go b/services/retailstore/api_qualification.go index 2c707c0..f753e29 100644 --- a/services/retailstore/api_qualification.go +++ b/services/retailstore/api_qualification.go @@ -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. diff --git a/services/retailstore/api_qualification_example_test.go b/services/retailstore/api_qualification_example_test.go index 0fee117..40a03b8 100644 --- a/services/retailstore/api_qualification_example_test.go +++ b/services/retailstore/api_qualification_example_test.go @@ -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. diff --git a/services/retailstore/api_retail_store_act.go b/services/retailstore/api_retail_store_act.go index 86d6d87..fa59148 100644 --- a/services/retailstore/api_retail_store_act.go +++ b/services/retailstore/api_retail_store_act.go @@ -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. @@ -27,7 +27,7 @@ type RetailStoreActApiService services.Service // AddRepresentative 添加零售小店活动业务代理 // // 该接口为服务商或商户给零售小店活动添加业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。 -func (a *RetailStoreActApiService) AddRepresentative(ctx context.Context, req AddRepresentativeRequest) (resp *Representatives, result *core.APIResult, err error) { +func (a *RetailStoreActApiService) AddRepresentative(ctx context.Context, req AddRepresentativeRequest) (resp *AddRepresentativesResponse, result *core.APIResult, err error) { var ( localVarHTTPMethod = nethttp.MethodPut localVarPostBody interface{} @@ -64,8 +64,57 @@ func (a *RetailStoreActApiService) AddRepresentative(ctx context.Context, req Ad return nil, result, err } - // Extract Representatives from Http Response - resp = new(Representatives) + // Extract AddRepresentativesResponse from Http Response + resp = new(AddRepresentativesResponse) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} + +// AddStores 添加小店活动门店 +// +// 该接口为服务商或商户给零售小店活动添加门店专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。 +func (a *RetailStoreActApiService) AddStores(ctx context.Context, req AddStoresRequest) (resp *AddStoresResponse, result *core.APIResult, err error) { + var ( + localVarHTTPMethod = nethttp.MethodPost + localVarPostBody interface{} + localVarQueryParams neturl.Values + localVarHeaderParams = nethttp.Header{} + ) + + // Make sure Path Params are properly set + if req.BrandId == nil { + return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in AddStoresRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores" + // Build Path with Path Params + localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1) + + // Make sure All Required Params are properly set + + // Setup Body Params + localVarPostBody = &AddStoresBody{ + OutRequestNo: req.OutRequestNo, + AddTime: req.AddTime, + Stores: req.Stores, + } + + // Determine the Content-Type Header + localVarHTTPContentTypes := []string{"application/json"} + // Setup Content-Type + localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes) + + // Perform Http Request + result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType) + if err != nil { + return nil, result, err + } + + // Extract AddStoresResponse from Http Response + resp = new(AddStoresResponse) err = core.UnMarshalResponse(result.Response, resp) if err != nil { return nil, result, err @@ -170,6 +219,101 @@ func (a *RetailStoreActApiService) DeleteRepresentative(ctx context.Context, req return resp, result, nil } +// DeleteStores 删除小店活动门店 +// +// 该接口为服务商或商户给零售小店活动删除门店专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。 +func (a *RetailStoreActApiService) DeleteStores(ctx context.Context, req DeleteStoresRequest) (resp *DeleteStoresResponse, result *core.APIResult, err error) { + var ( + localVarHTTPMethod = nethttp.MethodDelete + localVarPostBody interface{} + localVarQueryParams neturl.Values + localVarHeaderParams = nethttp.Header{} + ) + + // Make sure Path Params are properly set + if req.BrandId == nil { + return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in DeleteStoresRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores" + // Build Path with Path Params + localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1) + + // Make sure All Required Params are properly set + + // Setup Body Params + localVarPostBody = &DeleteStoresBody{ + OutRequestNo: req.OutRequestNo, + DeleteTime: req.DeleteTime, + Stores: req.Stores, + } + + // Determine the Content-Type Header + localVarHTTPContentTypes := []string{"application/json"} + // Setup Content-Type + localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes) + + // Perform Http Request + result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType) + if err != nil { + return nil, result, err + } + + // Extract DeleteStoresResponse from Http Response + resp = new(DeleteStoresResponse) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} + +// GetStore 查询小店活动门店详情 +// +// 该接口为服务商或商户给零售小店活动查询门店详情专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。 +func (a *RetailStoreActApiService) GetStore(ctx context.Context, req GetStoreRequest) (resp *RetailStoreInfo, result *core.APIResult, err error) { + var ( + localVarHTTPMethod = nethttp.MethodGet + localVarPostBody interface{} + localVarQueryParams neturl.Values + localVarHeaderParams = nethttp.Header{} + ) + + // Make sure Path Params are properly set + if req.BrandId == nil { + return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in GetStoreRequest") + } + if req.StoreCode == nil { + return nil, nil, fmt.Errorf("field `StoreCode` is required and must be specified in GetStoreRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores/{store_code}" + // Build Path with Path Params + localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"store_code"+"}", neturl.PathEscape(core.ParameterToString(*req.StoreCode, "")), -1) + + // Make sure All Required Params are properly set + + // Determine the Content-Type Header + localVarHTTPContentTypes := []string{} + // Setup Content-Type + localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes) + + // Perform Http Request + result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType) + if err != nil { + return nil, result, err + } + + // Extract RetailStoreInfo from Http Response + resp = new(RetailStoreInfo) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} + // ListRepresentative 查询零售小店活动业务代理 // // 该接口为服务商或商户给零售小店活动查询业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。 @@ -222,3 +366,56 @@ func (a *RetailStoreActApiService) ListRepresentative(ctx context.Context, req L } return resp, result, nil } + +// ListStore 查询小店活动门店列表 +// +// 该接口为服务商或商户给零售小店活动查询门店列表专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。 +func (a *RetailStoreActApiService) ListStore(ctx context.Context, req ListStoreRequest) (resp *ListStoreResponse, result *core.APIResult, err error) { + var ( + localVarHTTPMethod = nethttp.MethodGet + localVarPostBody interface{} + localVarQueryParams neturl.Values + localVarHeaderParams = nethttp.Header{} + ) + + // Make sure Path Params are properly set + if req.BrandId == nil { + return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in ListStoreRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores" + // Build Path with Path Params + localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1) + + // Make sure All Required Params are properly set + if req.Offset == nil { + return nil, nil, fmt.Errorf("field `Offset` is required and must be specified in ListStoreRequest") + } + if req.Limit == nil { + return nil, nil, fmt.Errorf("field `Limit` is required and must be specified in ListStoreRequest") + } + + // Setup Query Params + localVarQueryParams = neturl.Values{} + localVarQueryParams.Add("offset", core.ParameterToString(*req.Offset, "")) + localVarQueryParams.Add("limit", core.ParameterToString(*req.Limit, "")) + + // Determine the Content-Type Header + localVarHTTPContentTypes := []string{} + // Setup Content-Type + localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes) + + // Perform Http Request + result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType) + if err != nil { + return nil, result, err + } + + // Extract ListStoreResponse from Http Response + resp = new(ListStoreResponse) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} diff --git a/services/retailstore/api_retail_store_act_example_test.go b/services/retailstore/api_retail_store_act_example_test.go index db644c5..0ea5d7e 100644 --- a/services/retailstore/api_retail_store_act_example_test.go +++ b/services/retailstore/api_retail_store_act_example_test.go @@ -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. @@ -66,6 +66,53 @@ func ExampleRetailStoreActApiService_AddRepresentative() { } } +func ExampleRetailStoreActApiService_AddStores() { + var ( + mchID string = "190000****" // 商户号 + mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 + mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 + ) + + // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") + if err != nil { + log.Printf("load merchant private key error:%s", err) + return + } + + ctx := context.Background() + // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 + opts := []core.ClientOption{ + option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), + } + client, err := core.NewClient(ctx, opts...) + if err != nil { + log.Printf("new wechat pay client err:%s", err) + return + } + + svc := retailstore.RetailStoreActApiService{Client: client} + resp, result, err := svc.AddStores(ctx, + retailstore.AddStoresRequest{ + BrandId: core.String("1001"), + OutRequestNo: core.String("1002600620019090123143254436"), + AddTime: core.String("2015-05-20T13:29:35+08:00"), + Stores: []retailstore.RetailStoreInfo{retailstore.RetailStoreInfo{ + StoreCode: core.String("abc_001"), + StoreName: core.String("幸福小店"), + }}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call AddStores err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} + func ExampleRetailStoreActApiService_CreateMaterials() { var ( mchID string = "190000****" // 商户号 @@ -155,6 +202,95 @@ func ExampleRetailStoreActApiService_DeleteRepresentative() { } } +func ExampleRetailStoreActApiService_DeleteStores() { + var ( + mchID string = "190000****" // 商户号 + mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 + mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 + ) + + // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") + if err != nil { + log.Printf("load merchant private key error:%s", err) + return + } + + ctx := context.Background() + // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 + opts := []core.ClientOption{ + option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), + } + client, err := core.NewClient(ctx, opts...) + if err != nil { + log.Printf("new wechat pay client err:%s", err) + return + } + + svc := retailstore.RetailStoreActApiService{Client: client} + resp, result, err := svc.DeleteStores(ctx, + retailstore.DeleteStoresRequest{ + BrandId: core.String("1001"), + OutRequestNo: core.String("1002600620019090123143254436"), + DeleteTime: core.String("2015-05-20T13:29:35+08:00"), + Stores: []retailstore.RetailStoreInfo{retailstore.RetailStoreInfo{ + StoreCode: core.String("abc_001"), + StoreName: core.String("幸福小店"), + }}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call DeleteStores err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} + +func ExampleRetailStoreActApiService_GetStore() { + var ( + mchID string = "190000****" // 商户号 + mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 + mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 + ) + + // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") + if err != nil { + log.Printf("load merchant private key error:%s", err) + return + } + + ctx := context.Background() + // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 + opts := []core.ClientOption{ + option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), + } + client, err := core.NewClient(ctx, opts...) + if err != nil { + log.Printf("new wechat pay client err:%s", err) + return + } + + svc := retailstore.RetailStoreActApiService{Client: client} + resp, result, err := svc.GetStore(ctx, + retailstore.GetStoreRequest{ + BrandId: core.String("1001"), + StoreCode: core.String("abc_001"), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call GetStore err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} + func ExampleRetailStoreActApiService_ListRepresentative() { var ( mchID string = "190000****" // 商户号 @@ -197,3 +333,46 @@ func ExampleRetailStoreActApiService_ListRepresentative() { log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) } } + +func ExampleRetailStoreActApiService_ListStore() { + var ( + mchID string = "190000****" // 商户号 + mchCertificateSerialNumber string = "3775************************************" // 商户证书序列号 + mchAPIv3Key string = "2ab9****************************" // 商户APIv3密钥 + ) + + // 使用 utils 提供的函数从本地文件中加载商户私钥,商户私钥会用来生成请求的签名 + mchPrivateKey, err := utils.LoadPrivateKeyWithPath("/path/to/merchant/apiclient_key.pem") + if err != nil { + log.Printf("load merchant private key error:%s", err) + return + } + + ctx := context.Background() + // 使用商户私钥等初始化 client,并使它具有自动定时获取微信支付平台证书的能力 + opts := []core.ClientOption{ + option.WithWechatPayAutoAuthCipher(mchID, mchCertificateSerialNumber, mchPrivateKey, mchAPIv3Key), + } + client, err := core.NewClient(ctx, opts...) + if err != nil { + log.Printf("new wechat pay client err:%s", err) + return + } + + svc := retailstore.RetailStoreActApiService{Client: client} + resp, result, err := svc.ListStore(ctx, + retailstore.ListStoreRequest{ + BrandId: core.String("1001"), + Offset: core.Int64(0), + Limit: core.Int64(10), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call ListStore err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} diff --git a/services/retailstore/models.go b/services/retailstore/models.go index fcf62b5..0458310 100644 --- a/services/retailstore/models.go +++ b/services/retailstore/models.go @@ -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. @@ -522,6 +522,291 @@ func (o AddRepresentativesRequest) Clone() *AddRepresentativesRequest { return &ret } +// AddRepresentativesResponse +type AddRepresentativesResponse struct { + // 零售小店活动ID + ActivityId *string `json:"activity_id"` + // 添加失败业务代理信息列表 + FailedRepresentativeInfoList []RepresentativeInfo `json:"failed_representative_info_list,omitempty"` + // 添加时间 + AddTime *string `json:"add_time"` +} + +func (o AddRepresentativesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ActivityId == nil { + return nil, fmt.Errorf("field `ActivityId` is required and must be specified in AddRepresentativesResponse") + } + toSerialize["activity_id"] = o.ActivityId + + if o.FailedRepresentativeInfoList != nil { + toSerialize["failed_representative_info_list"] = o.FailedRepresentativeInfoList + } + + if o.AddTime == nil { + return nil, fmt.Errorf("field `AddTime` is required and must be specified in AddRepresentativesResponse") + } + toSerialize["add_time"] = o.AddTime + return json.Marshal(toSerialize) +} + +func (o AddRepresentativesResponse) String() string { + var ret string + if o.ActivityId == nil { + ret += "ActivityId:, " + } else { + ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) + } + + ret += fmt.Sprintf("FailedRepresentativeInfoList:%v, ", o.FailedRepresentativeInfoList) + + if o.AddTime == nil { + ret += "AddTime:" + } else { + ret += fmt.Sprintf("AddTime:%v", *o.AddTime) + } + + return fmt.Sprintf("AddRepresentativesResponse{%s}", ret) +} + +func (o AddRepresentativesResponse) Clone() *AddRepresentativesResponse { + ret := AddRepresentativesResponse{} + + if o.ActivityId != nil { + ret.ActivityId = new(string) + *ret.ActivityId = *o.ActivityId + } + + if o.FailedRepresentativeInfoList != nil { + ret.FailedRepresentativeInfoList = make([]RepresentativeInfo, len(o.FailedRepresentativeInfoList)) + for i, item := range o.FailedRepresentativeInfoList { + ret.FailedRepresentativeInfoList[i] = *item.Clone() + } + } + + if o.AddTime != nil { + ret.AddTime = new(string) + *ret.AddTime = *o.AddTime + } + + return &ret +} + +// AddStoresBody +type AddStoresBody struct { + // 商户新增小店活动门店凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 添加时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 + AddTime *string `json:"add_time"` + // 待新增的小店活动门店列表 + Stores []RetailStoreInfo `json:"stores"` +} + +func (o AddStoresBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in AddStoresBody") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.AddTime == nil { + return nil, fmt.Errorf("field `AddTime` is required and must be specified in AddStoresBody") + } + toSerialize["add_time"] = o.AddTime + + if o.Stores == nil { + return nil, fmt.Errorf("field `Stores` is required and must be specified in AddStoresBody") + } + toSerialize["stores"] = o.Stores + return json.Marshal(toSerialize) +} + +func (o AddStoresBody) String() string { + var ret string + if o.OutRequestNo == nil { + ret += "OutRequestNo:, " + } else { + ret += fmt.Sprintf("OutRequestNo:%v, ", *o.OutRequestNo) + } + + if o.AddTime == nil { + ret += "AddTime:, " + } else { + ret += fmt.Sprintf("AddTime:%v, ", *o.AddTime) + } + + ret += fmt.Sprintf("Stores:%v", o.Stores) + + return fmt.Sprintf("AddStoresBody{%s}", ret) +} + +func (o AddStoresBody) Clone() *AddStoresBody { + ret := AddStoresBody{} + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.AddTime != nil { + ret.AddTime = new(string) + *ret.AddTime = *o.AddTime + } + + if o.Stores != nil { + ret.Stores = make([]RetailStoreInfo, len(o.Stores)) + for i, item := range o.Stores { + ret.Stores[i] = *item.Clone() + } + } + + return &ret +} + +// AddStoresRequest +type AddStoresRequest struct { + // 品牌ID + BrandId *string `json:"brand_id"` + // 商户新增小店活动门店凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 添加时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 + AddTime *string `json:"add_time"` + // 待新增的小店活动门店列表 + Stores []RetailStoreInfo `json:"stores"` +} + +func (o AddStoresRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.BrandId == nil { + return nil, fmt.Errorf("field `BrandId` is required and must be specified in AddStoresRequest") + } + toSerialize["brand_id"] = o.BrandId + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in AddStoresRequest") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.AddTime == nil { + return nil, fmt.Errorf("field `AddTime` is required and must be specified in AddStoresRequest") + } + toSerialize["add_time"] = o.AddTime + + if o.Stores == nil { + return nil, fmt.Errorf("field `Stores` is required and must be specified in AddStoresRequest") + } + toSerialize["stores"] = o.Stores + return json.Marshal(toSerialize) +} + +func (o AddStoresRequest) String() string { + var ret string + if o.BrandId == nil { + ret += "BrandId:, " + } else { + ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId) + } + + if o.OutRequestNo == nil { + ret += "OutRequestNo:, " + } else { + ret += fmt.Sprintf("OutRequestNo:%v, ", *o.OutRequestNo) + } + + if o.AddTime == nil { + ret += "AddTime:, " + } else { + ret += fmt.Sprintf("AddTime:%v, ", *o.AddTime) + } + + ret += fmt.Sprintf("Stores:%v", o.Stores) + + return fmt.Sprintf("AddStoresRequest{%s}", ret) +} + +func (o AddStoresRequest) Clone() *AddStoresRequest { + ret := AddStoresRequest{} + + if o.BrandId != nil { + ret.BrandId = new(string) + *ret.BrandId = *o.BrandId + } + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.AddTime != nil { + ret.AddTime = new(string) + *ret.AddTime = *o.AddTime + } + + if o.Stores != nil { + ret.Stores = make([]RetailStoreInfo, len(o.Stores)) + for i, item := range o.Stores { + ret.Stores[i] = *item.Clone() + } + } + + return &ret +} + +// AddStoresResponse +type AddStoresResponse struct { + // 添加时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 + AddTime *string `json:"add_time,omitempty"` + // 添加失败的小店活动门店列表 + FailedStores []RetailStoreInfo `json:"failed_stores,omitempty"` +} + +func (o AddStoresResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.AddTime != nil { + toSerialize["add_time"] = o.AddTime + } + + if o.FailedStores != nil { + toSerialize["failed_stores"] = o.FailedStores + } + return json.Marshal(toSerialize) +} + +func (o AddStoresResponse) String() string { + var ret string + if o.AddTime == nil { + ret += "AddTime:, " + } else { + ret += fmt.Sprintf("AddTime:%v, ", *o.AddTime) + } + + ret += fmt.Sprintf("FailedStores:%v", o.FailedStores) + + return fmt.Sprintf("AddStoresResponse{%s}", ret) +} + +func (o AddStoresResponse) Clone() *AddStoresResponse { + ret := AddStoresResponse{} + + if o.AddTime != nil { + ret.AddTime = new(string) + *ret.AddTime = *o.AddTime + } + + if o.FailedStores != nil { + ret.FailedStores = make([]RetailStoreInfo, len(o.FailedStores)) + for i, item := range o.FailedStores { + ret.FailedStores[i] = *item.Clone() + } + } + + return &ret +} + // ApplyActivityBody type ApplyActivityBody struct { // 调用报名活动API的商户的商户号 @@ -1005,74 +1290,288 @@ func (o DeleteRepresentativeRequest) Clone() *DeleteRepresentativeRequest { return &ret } -// DeleteRepresentativeResponse -type DeleteRepresentativeResponse struct { - // 零售小店活动ID - ActivityId *string `json:"activity_id"` - // 删除失败业务代理信息列表 - FailedRepresentativeInfoList []RepresentativeInfo `json:"failed_representative_info_list,omitempty"` - // 删除时间 - DeleteTime *string `json:"delete_time"` +// DeleteRepresentativeResponse +type DeleteRepresentativeResponse struct { + // 零售小店活动ID + ActivityId *string `json:"activity_id"` + // 删除失败业务代理信息列表 + FailedRepresentativeInfoList []RepresentativeInfo `json:"failed_representative_info_list,omitempty"` + // 删除时间 + DeleteTime *string `json:"delete_time"` +} + +func (o DeleteRepresentativeResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ActivityId == nil { + return nil, fmt.Errorf("field `ActivityId` is required and must be specified in DeleteRepresentativeResponse") + } + toSerialize["activity_id"] = o.ActivityId + + if o.FailedRepresentativeInfoList != nil { + toSerialize["failed_representative_info_list"] = o.FailedRepresentativeInfoList + } + + if o.DeleteTime == nil { + return nil, fmt.Errorf("field `DeleteTime` is required and must be specified in DeleteRepresentativeResponse") + } + toSerialize["delete_time"] = o.DeleteTime + return json.Marshal(toSerialize) +} + +func (o DeleteRepresentativeResponse) String() string { + var ret string + if o.ActivityId == nil { + ret += "ActivityId:, " + } else { + ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) + } + + ret += fmt.Sprintf("FailedRepresentativeInfoList:%v, ", o.FailedRepresentativeInfoList) + + if o.DeleteTime == nil { + ret += "DeleteTime:" + } else { + ret += fmt.Sprintf("DeleteTime:%v", *o.DeleteTime) + } + + return fmt.Sprintf("DeleteRepresentativeResponse{%s}", ret) +} + +func (o DeleteRepresentativeResponse) Clone() *DeleteRepresentativeResponse { + ret := DeleteRepresentativeResponse{} + + if o.ActivityId != nil { + ret.ActivityId = new(string) + *ret.ActivityId = *o.ActivityId + } + + if o.FailedRepresentativeInfoList != nil { + ret.FailedRepresentativeInfoList = make([]RepresentativeInfo, len(o.FailedRepresentativeInfoList)) + for i, item := range o.FailedRepresentativeInfoList { + ret.FailedRepresentativeInfoList[i] = *item.Clone() + } + } + + if o.DeleteTime != nil { + ret.DeleteTime = new(string) + *ret.DeleteTime = *o.DeleteTime + } + + return &ret +} + +// DeleteStoresBody +type DeleteStoresBody struct { + // 商户删除小店活动门店凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 删除时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 + DeleteTime *string `json:"delete_time"` + // 待删除的小店活动门店列表 + Stores []RetailStoreInfo `json:"stores"` +} + +func (o DeleteStoresBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in DeleteStoresBody") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.DeleteTime == nil { + return nil, fmt.Errorf("field `DeleteTime` is required and must be specified in DeleteStoresBody") + } + toSerialize["delete_time"] = o.DeleteTime + + if o.Stores == nil { + return nil, fmt.Errorf("field `Stores` is required and must be specified in DeleteStoresBody") + } + toSerialize["stores"] = o.Stores + return json.Marshal(toSerialize) +} + +func (o DeleteStoresBody) String() string { + var ret string + if o.OutRequestNo == nil { + ret += "OutRequestNo:, " + } else { + ret += fmt.Sprintf("OutRequestNo:%v, ", *o.OutRequestNo) + } + + if o.DeleteTime == nil { + ret += "DeleteTime:, " + } else { + ret += fmt.Sprintf("DeleteTime:%v, ", *o.DeleteTime) + } + + ret += fmt.Sprintf("Stores:%v", o.Stores) + + return fmt.Sprintf("DeleteStoresBody{%s}", ret) +} + +func (o DeleteStoresBody) Clone() *DeleteStoresBody { + ret := DeleteStoresBody{} + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.DeleteTime != nil { + ret.DeleteTime = new(string) + *ret.DeleteTime = *o.DeleteTime + } + + if o.Stores != nil { + ret.Stores = make([]RetailStoreInfo, len(o.Stores)) + for i, item := range o.Stores { + ret.Stores[i] = *item.Clone() + } + } + + return &ret +} + +// DeleteStoresRequest +type DeleteStoresRequest struct { + // 品牌ID + BrandId *string `json:"brand_id"` + // 商户删除小店活动门店凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 删除时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 + DeleteTime *string `json:"delete_time"` + // 待删除的小店活动门店列表 + Stores []RetailStoreInfo `json:"stores"` +} + +func (o DeleteStoresRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.BrandId == nil { + return nil, fmt.Errorf("field `BrandId` is required and must be specified in DeleteStoresRequest") + } + toSerialize["brand_id"] = o.BrandId + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in DeleteStoresRequest") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.DeleteTime == nil { + return nil, fmt.Errorf("field `DeleteTime` is required and must be specified in DeleteStoresRequest") + } + toSerialize["delete_time"] = o.DeleteTime + + if o.Stores == nil { + return nil, fmt.Errorf("field `Stores` is required and must be specified in DeleteStoresRequest") + } + toSerialize["stores"] = o.Stores + return json.Marshal(toSerialize) +} + +func (o DeleteStoresRequest) String() string { + var ret string + if o.BrandId == nil { + ret += "BrandId:, " + } else { + ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId) + } + + if o.OutRequestNo == nil { + ret += "OutRequestNo:, " + } else { + ret += fmt.Sprintf("OutRequestNo:%v, ", *o.OutRequestNo) + } + + if o.DeleteTime == nil { + ret += "DeleteTime:, " + } else { + ret += fmt.Sprintf("DeleteTime:%v, ", *o.DeleteTime) + } + + ret += fmt.Sprintf("Stores:%v", o.Stores) + + return fmt.Sprintf("DeleteStoresRequest{%s}", ret) +} + +func (o DeleteStoresRequest) Clone() *DeleteStoresRequest { + ret := DeleteStoresRequest{} + + if o.BrandId != nil { + ret.BrandId = new(string) + *ret.BrandId = *o.BrandId + } + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.DeleteTime != nil { + ret.DeleteTime = new(string) + *ret.DeleteTime = *o.DeleteTime + } + + if o.Stores != nil { + ret.Stores = make([]RetailStoreInfo, len(o.Stores)) + for i, item := range o.Stores { + ret.Stores[i] = *item.Clone() + } + } + + return &ret +} + +// DeleteStoresResponse +type DeleteStoresResponse struct { + // 删除时间,遵循rfc3339标准格式,格式为yyyy-MM-DDTHH:mm:ss+TIMEZONE,yyyy-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC8小时,即北京时间)。例如:2015-05-20T13:29:35+08:00表示,北京时间2015年5月20日 13点29分35秒。 + DeleteTime *string `json:"delete_time,omitempty"` + // 删除失败的小店活动门店列表 + FailedStores []RetailStoreInfo `json:"failed_stores,omitempty"` } -func (o DeleteRepresentativeResponse) MarshalJSON() ([]byte, error) { +func (o DeleteStoresResponse) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.ActivityId == nil { - return nil, fmt.Errorf("field `ActivityId` is required and must be specified in DeleteRepresentativeResponse") - } - toSerialize["activity_id"] = o.ActivityId - - if o.FailedRepresentativeInfoList != nil { - toSerialize["failed_representative_info_list"] = o.FailedRepresentativeInfoList + if o.DeleteTime != nil { + toSerialize["delete_time"] = o.DeleteTime } - if o.DeleteTime == nil { - return nil, fmt.Errorf("field `DeleteTime` is required and must be specified in DeleteRepresentativeResponse") + if o.FailedStores != nil { + toSerialize["failed_stores"] = o.FailedStores } - toSerialize["delete_time"] = o.DeleteTime return json.Marshal(toSerialize) } -func (o DeleteRepresentativeResponse) String() string { +func (o DeleteStoresResponse) String() string { var ret string - if o.ActivityId == nil { - ret += "ActivityId:, " - } else { - ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) - } - - ret += fmt.Sprintf("FailedRepresentativeInfoList:%v, ", o.FailedRepresentativeInfoList) - if o.DeleteTime == nil { - ret += "DeleteTime:" + ret += "DeleteTime:, " } else { - ret += fmt.Sprintf("DeleteTime:%v", *o.DeleteTime) + ret += fmt.Sprintf("DeleteTime:%v, ", *o.DeleteTime) } - return fmt.Sprintf("DeleteRepresentativeResponse{%s}", ret) -} - -func (o DeleteRepresentativeResponse) Clone() *DeleteRepresentativeResponse { - ret := DeleteRepresentativeResponse{} + ret += fmt.Sprintf("FailedStores:%v", o.FailedStores) - if o.ActivityId != nil { - ret.ActivityId = new(string) - *ret.ActivityId = *o.ActivityId - } + return fmt.Sprintf("DeleteStoresResponse{%s}", ret) +} - if o.FailedRepresentativeInfoList != nil { - ret.FailedRepresentativeInfoList = make([]RepresentativeInfo, len(o.FailedRepresentativeInfoList)) - for i, item := range o.FailedRepresentativeInfoList { - ret.FailedRepresentativeInfoList[i] = *item.Clone() - } - } +func (o DeleteStoresResponse) Clone() *DeleteStoresResponse { + ret := DeleteStoresResponse{} if o.DeleteTime != nil { ret.DeleteTime = new(string) *ret.DeleteTime = *o.DeleteTime } + if o.FailedStores != nil { + ret.FailedStores = make([]RetailStoreInfo, len(o.FailedStores)) + for i, item := range o.FailedStores { + ret.FailedStores[i] = *item.Clone() + } + } + return &ret } @@ -1183,6 +1682,62 @@ func (o FmcgAct) Clone() *FmcgAct { return &ret } +// GetStoreRequest +type GetStoreRequest struct { + // 品牌ID + BrandId *string `json:"brand_id"` + // 门店编码,可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 + StoreCode *string `json:"store_code"` +} + +func (o GetStoreRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.BrandId == nil { + return nil, fmt.Errorf("field `BrandId` is required and must be specified in GetStoreRequest") + } + toSerialize["brand_id"] = o.BrandId + + if o.StoreCode == nil { + return nil, fmt.Errorf("field `StoreCode` is required and must be specified in GetStoreRequest") + } + toSerialize["store_code"] = o.StoreCode + return json.Marshal(toSerialize) +} + +func (o GetStoreRequest) String() string { + var ret string + if o.BrandId == nil { + ret += "BrandId:, " + } else { + ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId) + } + + if o.StoreCode == nil { + ret += "StoreCode:" + } else { + ret += fmt.Sprintf("StoreCode:%v", *o.StoreCode) + } + + return fmt.Sprintf("GetStoreRequest{%s}", ret) +} + +func (o GetStoreRequest) Clone() *GetStoreRequest { + ret := GetStoreRequest{} + + if o.BrandId != nil { + ret.BrandId = new(string) + *ret.BrandId = *o.BrandId + } + + if o.StoreCode != nil { + ret.StoreCode = new(string) + *ret.StoreCode = *o.StoreCode + } + + return &ret +} + // GoodsInfo type GoodsInfo struct { // 商品ID @@ -1578,6 +2133,166 @@ func (o ListRepresentativeResponse) Clone() *ListRepresentativeResponse { return &ret } +// ListStoreRequest +type ListStoreRequest struct { + // 品牌ID + BrandId *string `json:"brand_id"` + // 页码从0开始,默认第0页 + Offset *int64 `json:"offset"` + // 分页大小,默认查询10家门店 + Limit *int64 `json:"limit"` +} + +func (o ListStoreRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.BrandId == nil { + return nil, fmt.Errorf("field `BrandId` is required and must be specified in ListStoreRequest") + } + toSerialize["brand_id"] = o.BrandId + + if o.Offset == nil { + return nil, fmt.Errorf("field `Offset` is required and must be specified in ListStoreRequest") + } + toSerialize["offset"] = o.Offset + + if o.Limit == nil { + return nil, fmt.Errorf("field `Limit` is required and must be specified in ListStoreRequest") + } + toSerialize["limit"] = o.Limit + return json.Marshal(toSerialize) +} + +func (o ListStoreRequest) String() string { + var ret string + if o.BrandId == nil { + ret += "BrandId:, " + } else { + ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId) + } + + if o.Offset == nil { + ret += "Offset:, " + } else { + ret += fmt.Sprintf("Offset:%v, ", *o.Offset) + } + + if o.Limit == nil { + ret += "Limit:" + } else { + ret += fmt.Sprintf("Limit:%v", *o.Limit) + } + + return fmt.Sprintf("ListStoreRequest{%s}", ret) +} + +func (o ListStoreRequest) Clone() *ListStoreRequest { + ret := ListStoreRequest{} + + if o.BrandId != nil { + ret.BrandId = new(string) + *ret.BrandId = *o.BrandId + } + + if o.Offset != nil { + ret.Offset = new(int64) + *ret.Offset = *o.Offset + } + + if o.Limit != nil { + ret.Limit = new(int64) + *ret.Limit = *o.Limit + } + + return &ret +} + +// ListStoreResponse +type ListStoreResponse struct { + // 小店活动门店总数 + TotalCount *int64 `json:"total_count,omitempty"` + // 小店活动门店集合 + Data []RetailStoreInfo `json:"data,omitempty"` + // 页码从0开始,默认第0页 + Offset *int64 `json:"offset,omitempty"` + // 分页大小 + Limit *int64 `json:"limit,omitempty"` +} + +func (o ListStoreResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.TotalCount != nil { + toSerialize["total_count"] = o.TotalCount + } + + if o.Data != nil { + toSerialize["data"] = o.Data + } + + if o.Offset != nil { + toSerialize["offset"] = o.Offset + } + + if o.Limit != nil { + toSerialize["limit"] = o.Limit + } + return json.Marshal(toSerialize) +} + +func (o ListStoreResponse) String() string { + var ret string + if o.TotalCount == nil { + ret += "TotalCount:, " + } else { + ret += fmt.Sprintf("TotalCount:%v, ", *o.TotalCount) + } + + ret += fmt.Sprintf("Data:%v, ", o.Data) + + if o.Offset == nil { + ret += "Offset:, " + } else { + ret += fmt.Sprintf("Offset:%v, ", *o.Offset) + } + + if o.Limit == nil { + ret += "Limit:" + } else { + ret += fmt.Sprintf("Limit:%v", *o.Limit) + } + + return fmt.Sprintf("ListStoreResponse{%s}", ret) +} + +func (o ListStoreResponse) Clone() *ListStoreResponse { + ret := ListStoreResponse{} + + if o.TotalCount != nil { + ret.TotalCount = new(int64) + *ret.TotalCount = *o.TotalCount + } + + if o.Data != nil { + ret.Data = make([]RetailStoreInfo, len(o.Data)) + for i, item := range o.Data { + ret.Data[i] = *item.Clone() + } + } + + if o.Offset != nil { + ret.Offset = new(int64) + *ret.Offset = *o.Offset + } + + if o.Limit != nil { + ret.Limit = new(int64) + *ret.Limit = *o.Limit + } + + return &ret +} + // LockQualificationRequest type LockQualificationRequest struct { // 订单信息 @@ -1930,72 +2645,55 @@ func (o RepresentativeInfo) Clone() *RepresentativeInfo { return &ret } -// Representatives -type Representatives struct { - // 零售小店活动ID - ActivityId *string `json:"activity_id"` - // 添加失败业务代理信息列表 - FailedRepresentativeInfoList []RepresentativeInfo `json:"failed_representative_info_list,omitempty"` - // 添加时间 - AddTime *string `json:"add_time"` +// RetailStoreInfo +type RetailStoreInfo struct { + // 门店编码,可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 + StoreCode *string `json:"store_code,omitempty"` + // 门店名称 + StoreName *string `json:"store_name,omitempty"` } -func (o Representatives) MarshalJSON() ([]byte, error) { +func (o RetailStoreInfo) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} - if o.ActivityId == nil { - return nil, fmt.Errorf("field `ActivityId` is required and must be specified in Representatives") - } - toSerialize["activity_id"] = o.ActivityId - - if o.FailedRepresentativeInfoList != nil { - toSerialize["failed_representative_info_list"] = o.FailedRepresentativeInfoList + if o.StoreCode != nil { + toSerialize["store_code"] = o.StoreCode } - if o.AddTime == nil { - return nil, fmt.Errorf("field `AddTime` is required and must be specified in Representatives") + if o.StoreName != nil { + toSerialize["store_name"] = o.StoreName } - toSerialize["add_time"] = o.AddTime return json.Marshal(toSerialize) } -func (o Representatives) String() string { +func (o RetailStoreInfo) String() string { var ret string - if o.ActivityId == nil { - ret += "ActivityId:, " + if o.StoreCode == nil { + ret += "StoreCode:, " } else { - ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) + ret += fmt.Sprintf("StoreCode:%v, ", *o.StoreCode) } - ret += fmt.Sprintf("FailedRepresentativeInfoList:%v, ", o.FailedRepresentativeInfoList) - - if o.AddTime == nil { - ret += "AddTime:" + if o.StoreName == nil { + ret += "StoreName:" } else { - ret += fmt.Sprintf("AddTime:%v", *o.AddTime) + ret += fmt.Sprintf("StoreName:%v", *o.StoreName) } - return fmt.Sprintf("Representatives{%s}", ret) + return fmt.Sprintf("RetailStoreInfo{%s}", ret) } -func (o Representatives) Clone() *Representatives { - ret := Representatives{} - - if o.ActivityId != nil { - ret.ActivityId = new(string) - *ret.ActivityId = *o.ActivityId - } +func (o RetailStoreInfo) Clone() *RetailStoreInfo { + ret := RetailStoreInfo{} - if o.FailedRepresentativeInfoList != nil { - ret.FailedRepresentativeInfoList = make([]RepresentativeInfo, len(o.FailedRepresentativeInfoList)) - for i, item := range o.FailedRepresentativeInfoList { - ret.FailedRepresentativeInfoList[i] = *item.Clone() - } + if o.StoreCode != nil { + ret.StoreCode = new(string) + *ret.StoreCode = *o.StoreCode } - if o.AddTime != nil { - ret.AddTime = new(string) - *ret.AddTime = *o.AddTime + if o.StoreName != nil { + ret.StoreName = new(string) + *ret.StoreName = *o.StoreName } return &ret