From 4963ce5bf91c28d5177fb10c698c9149b9c824bb Mon Sep 17 00:00:00 2001 From: colindhlin <69178517+colindhlin@users.noreply.github.com> Date: Thu, 29 Jun 2023 16:33:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=B6=E5=94=AE=E5=B0=8F=E5=BA=97SDK=20(#191?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/retailstore/ActApplyInfo.md | 14 + docs/retailstore/ActArea.md | 15 + docs/retailstore/ActInfo.md | 18 + docs/retailstore/ActRule.md | 17 + docs/retailstore/ActivityApi.md | 187 ++ docs/retailstore/AddRepresentativeRequest.md | 16 + docs/retailstore/AddRepresentativesRequest.md | 15 + docs/retailstore/ApplyActivityBody.md | 14 + docs/retailstore/ApplyActivityRequest.md | 15 + docs/retailstore/ApplyActivityResponse.md | 15 + docs/retailstore/CreateMaterialsBody.md | 14 + docs/retailstore/CreateMaterialsRequest.md | 15 + docs/retailstore/DeleteRepresentativeBody.md | 15 + .../DeleteRepresentativeRequest.md | 16 + .../DeleteRepresentativeResponse.md | 15 + docs/retailstore/FmcgAct.md | 18 + docs/retailstore/GoodsInfo.md | 15 + docs/retailstore/ListActsByAreaRequest.md | 15 + docs/retailstore/ListActsByAreaResponse.md | 16 + docs/retailstore/ListRepresentativeRequest.md | 15 + .../retailstore/ListRepresentativeResponse.md | 16 + docs/retailstore/LockQualificationRequest.md | 14 + docs/retailstore/LockQualificationResponse.md | 15 + docs/retailstore/MaterialInfo.md | 14 + docs/retailstore/Materials.md | 13 + docs/retailstore/OrderInfo.md | 17 + docs/retailstore/QualificationApi.md | 190 ++ docs/retailstore/README.md | 58 + docs/retailstore/RepresentativeInfo.md | 13 + docs/retailstore/Representatives.md | 15 + docs/retailstore/RetailStoreActApi.md | 358 +++ docs/retailstore/StoreInfo.md | 15 + .../retailstore/UnlockQualificationRequest.md | 14 + .../UnlockQualificationResponse.md | 15 + services/README.md | 1 + services/retailstore/api_activity.go | 124 + .../retailstore/api_activity_example_test.go | 114 + services/retailstore/api_qualification.go | 99 + .../api_qualification_example_test.go | 117 + services/retailstore/api_retail_store_act.go | 224 ++ .../api_retail_store_act_example_test.go | 199 ++ services/retailstore/models.go | 2191 +++++++++++++++++ 42 files changed, 4316 insertions(+) create mode 100644 docs/retailstore/ActApplyInfo.md create mode 100644 docs/retailstore/ActArea.md create mode 100644 docs/retailstore/ActInfo.md create mode 100644 docs/retailstore/ActRule.md create mode 100644 docs/retailstore/ActivityApi.md create mode 100644 docs/retailstore/AddRepresentativeRequest.md create mode 100644 docs/retailstore/AddRepresentativesRequest.md create mode 100644 docs/retailstore/ApplyActivityBody.md create mode 100644 docs/retailstore/ApplyActivityRequest.md create mode 100644 docs/retailstore/ApplyActivityResponse.md create mode 100644 docs/retailstore/CreateMaterialsBody.md create mode 100644 docs/retailstore/CreateMaterialsRequest.md create mode 100644 docs/retailstore/DeleteRepresentativeBody.md create mode 100644 docs/retailstore/DeleteRepresentativeRequest.md create mode 100644 docs/retailstore/DeleteRepresentativeResponse.md create mode 100644 docs/retailstore/FmcgAct.md create mode 100644 docs/retailstore/GoodsInfo.md create mode 100644 docs/retailstore/ListActsByAreaRequest.md create mode 100644 docs/retailstore/ListActsByAreaResponse.md create mode 100644 docs/retailstore/ListRepresentativeRequest.md create mode 100644 docs/retailstore/ListRepresentativeResponse.md create mode 100644 docs/retailstore/LockQualificationRequest.md create mode 100644 docs/retailstore/LockQualificationResponse.md create mode 100644 docs/retailstore/MaterialInfo.md create mode 100644 docs/retailstore/Materials.md create mode 100644 docs/retailstore/OrderInfo.md create mode 100644 docs/retailstore/QualificationApi.md create mode 100644 docs/retailstore/README.md create mode 100644 docs/retailstore/RepresentativeInfo.md create mode 100644 docs/retailstore/Representatives.md create mode 100644 docs/retailstore/RetailStoreActApi.md create mode 100644 docs/retailstore/StoreInfo.md create mode 100644 docs/retailstore/UnlockQualificationRequest.md create mode 100644 docs/retailstore/UnlockQualificationResponse.md create mode 100644 services/retailstore/api_activity.go create mode 100644 services/retailstore/api_activity_example_test.go create mode 100644 services/retailstore/api_qualification.go create mode 100644 services/retailstore/api_qualification_example_test.go create mode 100644 services/retailstore/api_retail_store_act.go create mode 100644 services/retailstore/api_retail_store_act_example_test.go create mode 100644 services/retailstore/models.go diff --git a/docs/retailstore/ActApplyInfo.md b/docs/retailstore/ActApplyInfo.md new file mode 100644 index 0000000..7190975 --- /dev/null +++ b/docs/retailstore/ActApplyInfo.md @@ -0,0 +1,14 @@ +# ActApplyInfo + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**StoreInfo** | [**StoreInfo**](StoreInfo.md) | 门店信息 | +**GoodsOriginalPrice** | **int64** | 品牌加价购活动商品的原价,该价格会在加价购小程序插件中展示(单位:分) | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ActArea.md b/docs/retailstore/ActArea.md new file mode 100644 index 0000000..9adb521 --- /dev/null +++ b/docs/retailstore/ActArea.md @@ -0,0 +1,15 @@ +# ActArea + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**Province** | **string** | 省名称 | [可选] +**City** | **string** | 市名称 | [可选] +**District** | **string** | 区名称 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ActInfo.md b/docs/retailstore/ActInfo.md new file mode 100644 index 0000000..a6b7213 --- /dev/null +++ b/docs/retailstore/ActInfo.md @@ -0,0 +1,18 @@ +# ActInfo + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ActivityName** | **string** | 活动名称 | [可选] +**ApplyStartTime** | **string** | 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) | [可选] +**ApplyEndTime** | **string** | 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) | [可选] +**ActivityStartTime** | **string** | 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) | [可选] +**ActivityEndTime** | **string** | 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) | [可选] +**ActivityDescription** | **string** | 活动描述 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ActRule.md b/docs/retailstore/ActRule.md new file mode 100644 index 0000000..915bcec --- /dev/null +++ b/docs/retailstore/ActRule.md @@ -0,0 +1,17 @@ +# ActRule + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**StoreSubsidy** | **int64** | 购买单件商品,补贴给门店的金额(单位:分) | [可选] +**ServiceProviderSubsidy** | **int64** | 购买单件商品,补贴给服务商的佣金(单位:分) | [可选] +**StoreSubsidyQuota** | **int64** | 活动门店补贴商品数上限 | [可选] +**UserSubsidyQuota** | **int64** | 单用户享受加价购优惠次数上限 | [可选] +**Areas** | [**[]ActArea**](ActArea.md) | 活动区域列表 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ActivityApi.md b/docs/retailstore/ActivityApi.md new file mode 100644 index 0000000..7e3ebd0 --- /dev/null +++ b/docs/retailstore/ActivityApi.md @@ -0,0 +1,187 @@ +# retailstore/ActivityApi + +所有URI均基于微信支付 API 地址: *https://api.mch.weixin.qq.com* + +方法名 | HTTP 请求 | 描述 +------------- | ------------- | ------------- +[**ApplyActivity**](#applyactivity) | **Post** /v3/marketing/goods-subsidy-activity/activity/{activity_id}/apply | 门店报名品牌加价购活动 +[**ListActsByArea**](#listactsbyarea) | **Get** /v3/marketing/goods-subsidy-activity/activities | 按区域查询品牌加价购活动 + + + +## ApplyActivity + +> ApplyActivityResponse ApplyActivity(ApplyActivityRequest) + +门店报名品牌加价购活动 + + + +### 调用示例 + +```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.ActivityApiService{Client: client} + resp, result, err := svc.ApplyActivity(ctx, + retailstore.ApplyActivityRequest{ + ActivityId: core.String("123"), + CallerMerchantId: core.String("1894101023"), + ApplyInfos: []retailstore.ActApplyInfo{retailstore.ActApplyInfo{ + StoreInfo: &retailstore.StoreInfo{ + StoreId: core.String("100"), + AccountingMerchantId: core.String("2831255701"), + MerchantId: core.String("6281399112"), + }, + GoodsOriginalPrice: core.Int64(100), + }}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call ApplyActivity err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**ApplyActivityRequest**](ApplyActivityRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**ApplyActivityResponse**](ApplyActivityResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreactivityapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + + +## ListActsByArea + +> ListActsByAreaResponse ListActsByArea(ListActsByAreaRequest) + +按区域查询品牌加价购活动 + + + +### 调用示例 + +```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.ActivityApiService{Client: client} + resp, result, err := svc.ListActsByArea(ctx, + retailstore.ListActsByAreaRequest{ + CityId: core.String("123"), + Offset: core.Int64(0), + Limit: core.Int64(20), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call ListActsByArea err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**ListActsByAreaRequest**](ListActsByAreaRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**ListActsByAreaResponse**](ListActsByAreaResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreactivityapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + diff --git a/docs/retailstore/AddRepresentativeRequest.md b/docs/retailstore/AddRepresentativeRequest.md new file mode 100644 index 0000000..a324430 --- /dev/null +++ b/docs/retailstore/AddRepresentativeRequest.md @@ -0,0 +1,16 @@ +# AddRepresentativeRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ActivityId** | **string** | 零售小店活动ID | +**RepresentativeInfoList** | [**[]RepresentativeInfo**](RepresentativeInfo.md) | 业务代理信息列表 | +**OutRequestNo** | **string** | 商户新增业务代理请求的唯一标识,商户需保证唯一。可包含英文字母,数字,\\|,\\_,\\*,\\-等内容,不允许出现其他不合法符号。 | +**AddTime** | **string** | 添加时间 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/AddRepresentativesRequest.md b/docs/retailstore/AddRepresentativesRequest.md new file mode 100644 index 0000000..84100d5 --- /dev/null +++ b/docs/retailstore/AddRepresentativesRequest.md @@ -0,0 +1,15 @@ +# AddRepresentativesRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**RepresentativeInfoList** | [**[]RepresentativeInfo**](RepresentativeInfo.md) | 业务代理信息列表 | +**OutRequestNo** | **string** | 商户新增业务代理请求的唯一标识,商户需保证唯一。可包含英文字母,数字,\\|,\\_,\\*,\\-等内容,不允许出现其他不合法符号。 | +**AddTime** | **string** | 添加时间 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ApplyActivityBody.md b/docs/retailstore/ApplyActivityBody.md new file mode 100644 index 0000000..309b5d0 --- /dev/null +++ b/docs/retailstore/ApplyActivityBody.md @@ -0,0 +1,14 @@ +# ApplyActivityBody + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**CallerMerchantId** | **string** | 调用报名活动API的商户的商户号 | +**ApplyInfos** | [**[]ActApplyInfo**](ActApplyInfo.md) | 门店报名信息 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ApplyActivityRequest.md b/docs/retailstore/ApplyActivityRequest.md new file mode 100644 index 0000000..ded2699 --- /dev/null +++ b/docs/retailstore/ApplyActivityRequest.md @@ -0,0 +1,15 @@ +# ApplyActivityRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ActivityId** | **string** | 活动ID | +**CallerMerchantId** | **string** | 调用报名活动API的商户的商户号 | +**ApplyInfos** | [**[]ActApplyInfo**](ActApplyInfo.md) | 门店报名信息 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ApplyActivityResponse.md b/docs/retailstore/ApplyActivityResponse.md new file mode 100644 index 0000000..bbc85ba --- /dev/null +++ b/docs/retailstore/ApplyActivityResponse.md @@ -0,0 +1,15 @@ +# ApplyActivityResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ReturnMessage** | **string** | 返回结果文案 | [可选] +**FailedApplyInfos** | [**[]ActApplyInfo**](ActApplyInfo.md) | 失败的报名记录 | [可选] +**SucceedApplyInfos** | [**[]ActApplyInfo**](ActApplyInfo.md) | 成功的报名记录 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/CreateMaterialsBody.md b/docs/retailstore/CreateMaterialsBody.md new file mode 100644 index 0000000..42e14cd --- /dev/null +++ b/docs/retailstore/CreateMaterialsBody.md @@ -0,0 +1,14 @@ +# CreateMaterialsBody + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**OutRequestNo** | **string** | 商户添加业务代理信息凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 | +**MaterialNum** | **int64** | 生成物料码数量 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/CreateMaterialsRequest.md b/docs/retailstore/CreateMaterialsRequest.md new file mode 100644 index 0000000..ed8d73a --- /dev/null +++ b/docs/retailstore/CreateMaterialsRequest.md @@ -0,0 +1,15 @@ +# CreateMaterialsRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**BrandId** | **string** | 品牌ID | +**OutRequestNo** | **string** | 商户添加业务代理信息凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 | +**MaterialNum** | **int64** | 生成物料码数量 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/DeleteRepresentativeBody.md b/docs/retailstore/DeleteRepresentativeBody.md new file mode 100644 index 0000000..0dcfd1a --- /dev/null +++ b/docs/retailstore/DeleteRepresentativeBody.md @@ -0,0 +1,15 @@ +# DeleteRepresentativeBody + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**RepresentativeInfoList** | [**[]RepresentativeInfo**](RepresentativeInfo.md) | 业务代理信息列表 | +**OutRequestNo** | **string** | 商户删除业务代理请求的唯一标识,商户需保证唯一。可包含英文字母,数字,\\|,\\_,\\*,\\-等内容,不允许出现其他不合法符号。 | +**DeleteTime** | **string** | 删除时间 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/DeleteRepresentativeRequest.md b/docs/retailstore/DeleteRepresentativeRequest.md new file mode 100644 index 0000000..118c29d --- /dev/null +++ b/docs/retailstore/DeleteRepresentativeRequest.md @@ -0,0 +1,16 @@ +# DeleteRepresentativeRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ActivityId** | **string** | 零售小店活动ID | +**RepresentativeInfoList** | [**[]RepresentativeInfo**](RepresentativeInfo.md) | 业务代理信息列表 | +**OutRequestNo** | **string** | 商户删除业务代理请求的唯一标识,商户需保证唯一。可包含英文字母,数字,\\|,\\_,\\*,\\-等内容,不允许出现其他不合法符号。 | +**DeleteTime** | **string** | 删除时间 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/DeleteRepresentativeResponse.md b/docs/retailstore/DeleteRepresentativeResponse.md new file mode 100644 index 0000000..5a81a46 --- /dev/null +++ b/docs/retailstore/DeleteRepresentativeResponse.md @@ -0,0 +1,15 @@ +# DeleteRepresentativeResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ActivityId** | **string** | 零售小店活动ID | +**FailedRepresentativeInfoList** | [**[]RepresentativeInfo**](RepresentativeInfo.md) | 删除失败业务代理信息列表 | [可选] +**DeleteTime** | **string** | 删除时间 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/FmcgAct.md b/docs/retailstore/FmcgAct.md new file mode 100644 index 0000000..e723d2e --- /dev/null +++ b/docs/retailstore/FmcgAct.md @@ -0,0 +1,18 @@ +# FmcgAct + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ActivityId** | **string** | 活动ID | [可选] +**BrandId** | **string** | 品牌ID | [可选] +**CreatorMerchantId** | **string** | 活动创建方商户号 | [可选] +**ActivityInfo** | [**ActInfo**](ActInfo.md) | 活动信息 | [可选] +**GoodsInformation** | [**GoodsInfo**](GoodsInfo.md) | 活动商品列表 | [可选] +**RuleInformation** | [**ActRule**](ActRule.md) | 活动规则 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/GoodsInfo.md b/docs/retailstore/GoodsInfo.md new file mode 100644 index 0000000..0bcb6c5 --- /dev/null +++ b/docs/retailstore/GoodsInfo.md @@ -0,0 +1,15 @@ +# GoodsInfo + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**GoodsId** | **string** | 商品ID | [可选] +**GoodsName** | **string** | 商品名称 | [可选] +**GoodsPictureUrl** | **string** | 商品图片URL | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ListActsByAreaRequest.md b/docs/retailstore/ListActsByAreaRequest.md new file mode 100644 index 0000000..c700edd --- /dev/null +++ b/docs/retailstore/ListActsByAreaRequest.md @@ -0,0 +1,15 @@ +# ListActsByAreaRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**CityId** | **string** | 活动所属城市的ID | +**Offset** | **int64** | 非负整数,该次请求资源的起始位置,从0开始计数 | +**Limit** | **int64** | 非0非负的整数 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ListActsByAreaResponse.md b/docs/retailstore/ListActsByAreaResponse.md new file mode 100644 index 0000000..76a0d21 --- /dev/null +++ b/docs/retailstore/ListActsByAreaResponse.md @@ -0,0 +1,16 @@ +# ListActsByAreaResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**TotalCount** | **int64** | 活动总数 | [可选] +**Data** | [**[]FmcgAct**](FmcgAct.md) | 活动集合 | [可选] +**Offset** | **int64** | 非负整数,该次请求资源的起始位置,从0开始计数 | +**Limit** | **int64** | 非0非负的整数 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ListRepresentativeRequest.md b/docs/retailstore/ListRepresentativeRequest.md new file mode 100644 index 0000000..a9ad1fc --- /dev/null +++ b/docs/retailstore/ListRepresentativeRequest.md @@ -0,0 +1,15 @@ +# ListRepresentativeRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ActivityId** | **string** | 零售小店活动ID | +**Offset** | **int64** | 页码从0开始,默认第0页 | +**Limit** | **int64** | 分页大小,默认查询10个业代 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/ListRepresentativeResponse.md b/docs/retailstore/ListRepresentativeResponse.md new file mode 100644 index 0000000..f00d62c --- /dev/null +++ b/docs/retailstore/ListRepresentativeResponse.md @@ -0,0 +1,16 @@ +# ListRepresentativeResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**TotalCount** | **int64** | 小店活动业代总数 | [可选] +**Data** | [**[]RepresentativeInfo**](RepresentativeInfo.md) | 小店活动业代集合 | [可选] +**Offset** | **int64** | 页码从0开始,默认第0页 | +**Limit** | **int64** | 分页大小 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/LockQualificationRequest.md b/docs/retailstore/LockQualificationRequest.md new file mode 100644 index 0000000..8b46512 --- /dev/null +++ b/docs/retailstore/LockQualificationRequest.md @@ -0,0 +1,14 @@ +# LockQualificationRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**OrderInformation** | [**OrderInfo**](OrderInfo.md) | 订单信息 | +**QualificationIds** | **[]string** | 待锁定的加价购资格ID列表 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/LockQualificationResponse.md b/docs/retailstore/LockQualificationResponse.md new file mode 100644 index 0000000..90e0483 --- /dev/null +++ b/docs/retailstore/LockQualificationResponse.md @@ -0,0 +1,15 @@ +# LockQualificationResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ReturnMessage** | **string** | 返回结果文案 | [可选] +**SucceedQualificationIds** | **[]string** | 锁定成功的资格ID列表 | [可选] +**FailedQualificationIds** | **[]string** | 锁定失败的资格ID列表 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/MaterialInfo.md b/docs/retailstore/MaterialInfo.md new file mode 100644 index 0000000..89b5bed --- /dev/null +++ b/docs/retailstore/MaterialInfo.md @@ -0,0 +1,14 @@ +# MaterialInfo + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**MaterialId** | **string** | 物料码ID | [可选] +**MaterialUrl** | **string** | 物料码链接, 用于生成活动物料二维码 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/Materials.md b/docs/retailstore/Materials.md new file mode 100644 index 0000000..e2af781 --- /dev/null +++ b/docs/retailstore/Materials.md @@ -0,0 +1,13 @@ +# Materials + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**MaterialList** | [**[]MaterialInfo**](MaterialInfo.md) | 成功的物料码列表 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/OrderInfo.md b/docs/retailstore/OrderInfo.md new file mode 100644 index 0000000..9df9b77 --- /dev/null +++ b/docs/retailstore/OrderInfo.md @@ -0,0 +1,17 @@ +# OrderInfo + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**PayerOpenid** | **string** | 支付订单的微信用户OpenID | +**OutTradeNo** | **string** | 商户订单号 | +**TotalFee** | **int64** | 订单总金额(单位:分) | +**StoreId** | **string** | 门店ID | +**StoreMerchantId** | **string** | 门店商户号 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/QualificationApi.md b/docs/retailstore/QualificationApi.md new file mode 100644 index 0000000..f5b5590 --- /dev/null +++ b/docs/retailstore/QualificationApi.md @@ -0,0 +1,190 @@ +# retailstore/QualificationApi + +所有URI均基于微信支付 API 地址: *https://api.mch.weixin.qq.com* + +方法名 | HTTP 请求 | 描述 +------------- | ------------- | ------------- +[**LockQualification**](#lockqualification) | **Post** /v3/marketing/goods-subsidy-activity/qualification/lock | 锁定品牌加价购活动资格 +[**UnlockQualification**](#unlockqualification) | **Post** /v3/marketing/goods-subsidy-activity/qualification/unlock | 解锁品牌加价购活动资格 + + + +## LockQualification + +> LockQualificationResponse LockQualification(LockQualificationRequest) + +锁定品牌加价购活动资格 + + + +### 调用示例 + +```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.QualificationApiService{Client: client} + resp, result, err := svc.LockQualification(ctx, + retailstore.LockQualificationRequest{ + OrderInformation: &retailstore.OrderInfo{ + PayerOpenid: core.String("oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"), + OutTradeNo: core.String("1217752501201407033233368018"), + TotalFee: core.Int64(100), + StoreId: core.String("123"), + StoreMerchantId: core.String("1230000109"), + }, + QualificationIds: []string{"8495134018"}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call LockQualification err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**LockQualificationRequest**](LockQualificationRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**LockQualificationResponse**](LockQualificationResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstorequalificationapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + + +## UnlockQualification + +> UnlockQualificationResponse UnlockQualification(UnlockQualificationRequest) + +解锁品牌加价购活动资格 + + + +### 调用示例 + +```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.QualificationApiService{Client: client} + resp, result, err := svc.UnlockQualification(ctx, + retailstore.UnlockQualificationRequest{ + OrderInformation: &retailstore.OrderInfo{ + PayerOpenid: core.String("oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"), + OutTradeNo: core.String("1217752501201407033233368018"), + TotalFee: core.Int64(100), + StoreId: core.String("123"), + StoreMerchantId: core.String("1230000109"), + }, + QualificationIds: []string{"8495134018"}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call UnlockQualification err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**UnlockQualificationRequest**](UnlockQualificationRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**UnlockQualificationResponse**](UnlockQualificationResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstorequalificationapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + diff --git a/docs/retailstore/README.md b/docs/retailstore/README.md new file mode 100644 index 0000000..dab6d91 --- /dev/null +++ b/docs/retailstore/README.md @@ -0,0 +1,58 @@ +# 微信支付 API v3 Go SDK - retailstore + +指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。 + +## 总览 +本 SDK 由 WechatPay APIv3 SDK 生成器生成。生成器基于 [OpenAPI Generator](https://openapi-generator.tech) 构建。 + +- API 版本: 1.3.0 + +## 接口列表 + +所有URI均基于微信支付 API 地址:*https://api.mch.weixin.qq.com* + +服务名 | 方法名 | HTTP 请求 | 描述 +------------ | ------------- | ------------- | ------------- +*ActivityApi* | [**ApplyActivity**](ActivityApi.md#applyactivity) | **Post** /v3/marketing/goods-subsidy-activity/activity/{activity_id}/apply | 门店报名品牌加价购活动 +*ActivityApi* | [**ListActsByArea**](ActivityApi.md#listactsbyarea) | **Get** /v3/marketing/goods-subsidy-activity/activities | 按区域查询品牌加价购活动 +*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* | [**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* | [**ListRepresentative**](RetailStoreActApi.md#listrepresentative) | **Get** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representatives | 查询零售小店活动业务代理 + + +## 类型列表 + + - [ActApplyInfo](ActApplyInfo.md) + - [ActArea](ActArea.md) + - [ActInfo](ActInfo.md) + - [ActRule](ActRule.md) + - [AddRepresentativeRequest](AddRepresentativeRequest.md) + - [AddRepresentativesRequest](AddRepresentativesRequest.md) + - [ApplyActivityBody](ApplyActivityBody.md) + - [ApplyActivityRequest](ApplyActivityRequest.md) + - [ApplyActivityResponse](ApplyActivityResponse.md) + - [CreateMaterialsBody](CreateMaterialsBody.md) + - [CreateMaterialsRequest](CreateMaterialsRequest.md) + - [DeleteRepresentativeBody](DeleteRepresentativeBody.md) + - [DeleteRepresentativeRequest](DeleteRepresentativeRequest.md) + - [DeleteRepresentativeResponse](DeleteRepresentativeResponse.md) + - [FmcgAct](FmcgAct.md) + - [GoodsInfo](GoodsInfo.md) + - [ListActsByAreaRequest](ListActsByAreaRequest.md) + - [ListActsByAreaResponse](ListActsByAreaResponse.md) + - [ListRepresentativeRequest](ListRepresentativeRequest.md) + - [ListRepresentativeResponse](ListRepresentativeResponse.md) + - [LockQualificationRequest](LockQualificationRequest.md) + - [LockQualificationResponse](LockQualificationResponse.md) + - [MaterialInfo](MaterialInfo.md) + - [Materials](Materials.md) + - [OrderInfo](OrderInfo.md) + - [RepresentativeInfo](RepresentativeInfo.md) + - [Representatives](Representatives.md) + - [StoreInfo](StoreInfo.md) + - [UnlockQualificationRequest](UnlockQualificationRequest.md) + - [UnlockQualificationResponse](UnlockQualificationResponse.md) + diff --git a/docs/retailstore/RepresentativeInfo.md b/docs/retailstore/RepresentativeInfo.md new file mode 100644 index 0000000..b6ec161 --- /dev/null +++ b/docs/retailstore/RepresentativeInfo.md @@ -0,0 +1,13 @@ +# RepresentativeInfo + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**Openid** | **string** | [获取openid请查看文档](https://pay.weixin.qq.com/wiki/doc/apiv3_partner/terms_definition/chapter1_1_3.shtml) | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/Representatives.md b/docs/retailstore/Representatives.md new file mode 100644 index 0000000..cae374f --- /dev/null +++ b/docs/retailstore/Representatives.md @@ -0,0 +1,15 @@ +# Representatives + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ActivityId** | **string** | 零售小店活动ID | +**FailedRepresentativeInfoList** | [**[]RepresentativeInfo**](RepresentativeInfo.md) | 添加失败业务代理信息列表 | [可选] +**AddTime** | **string** | 添加时间 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/RetailStoreActApi.md b/docs/retailstore/RetailStoreActApi.md new file mode 100644 index 0000000..0706c63 --- /dev/null +++ b/docs/retailstore/RetailStoreActApi.md @@ -0,0 +1,358 @@ +# retailstore/RetailStoreActApi + +所有URI均基于微信支付 API 地址: *https://api.mch.weixin.qq.com* + +方法名 | HTTP 请求 | 描述 +------------- | ------------- | ------------- +[**AddRepresentative**](#addrepresentative) | **Put** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative | 添加零售小店活动业务代理 +[**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 | 删除零售小店活动业务代理 +[**ListRepresentative**](#listrepresentative) | **Get** /v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representatives | 查询零售小店活动业务代理 + + + +## AddRepresentative + +> Representatives AddRepresentative(AddRepresentativeRequest) + +添加零售小店活动业务代理 + + + +### 调用示例 + +```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.AddRepresentative(ctx, + retailstore.AddRepresentativeRequest{ + ActivityId: core.String("3118550000000004"), + RepresentativeInfoList: []retailstore.RepresentativeInfo{retailstore.RepresentativeInfo{ + Openid: core.String("oK7fFt8zzEZ909XH-LE2#"), + }}, + OutRequestNo: core.String("1002600620019090123143254436"), + AddTime: core.String("2015-05-20T13:29:35+08:00"), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call AddRepresentative err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**AddRepresentativeRequest**](AddRepresentativeRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**Representatives**](Representatives.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreretailstoreactapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + + +## CreateMaterials + +> Materials CreateMaterials(CreateMaterialsRequest) + +生成小店活动物料码 + + + +### 调用示例 + +```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.CreateMaterials(ctx, + retailstore.CreateMaterialsRequest{ + BrandId: core.String("1001"), + OutRequestNo: core.String("1002600620019090123143254436"), + MaterialNum: core.Int64(100), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call CreateMaterials err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**CreateMaterialsRequest**](CreateMaterialsRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**Materials**](Materials.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreretailstoreactapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + + +## DeleteRepresentative + +> DeleteRepresentativeResponse DeleteRepresentative(DeleteRepresentativeRequest) + +删除零售小店活动业务代理 + + + +### 调用示例 + +```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.DeleteRepresentative(ctx, + retailstore.DeleteRepresentativeRequest{ + ActivityId: core.String("3118550000000004"), + RepresentativeInfoList: []retailstore.RepresentativeInfo{retailstore.RepresentativeInfo{ + Openid: core.String("oK7fFt8zzEZ909XH-LE2#"), + }}, + OutRequestNo: core.String("1002600620019090123143254436"), + DeleteTime: core.String("2015-05-20T13:29:35.120+08:00"), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call DeleteRepresentative err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**DeleteRepresentativeRequest**](DeleteRepresentativeRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**DeleteRepresentativeResponse**](DeleteRepresentativeResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreretailstoreactapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + + +## ListRepresentative + +> ListRepresentativeResponse ListRepresentative(ListRepresentativeRequest) + +查询零售小店活动业务代理 + + + +### 调用示例 + +```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.ListRepresentative(ctx, + retailstore.ListRepresentativeRequest{ + ActivityId: core.String("3118550000000004"), + Offset: core.Int64(0), + Limit: core.Int64(10), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call ListRepresentative err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} +``` + +### 参数列表 +参数名 | 参数类型 | 参数描述 +------------- | ------------- | ------------- +**ctx** | **context.Context** | Golang 上下文,可用于日志、请求取消、请求跟踪等功能| +**req** | [**ListRepresentativeRequest**](ListRepresentativeRequest.md) | API `retailstore` 所定义的本接口需要的所有参数,包括`Path`/`Query`/`Body` 3类参数| + +### 返回结果 +Name | Type | Description +------------- | ------------- | ------------- +**resp** | \*[**ListRepresentativeResponse**](ListRepresentativeResponse.md) | 结构化的接口返回结果 +**result** | **\*core.APIResult** | 本次 API 访问的请求与应答信息 +**err** | **error** | 本次 API 访问中发生的错误,当且仅当 API 失败时存在 + +[\[返回顶部\]](#retailstoreretailstoreactapi) +[\[返回接口列表\]](README.md#接口列表) +[\[返回类型列表\]](README.md#类型列表) +[\[返回服务README\]](README.md) + diff --git a/docs/retailstore/StoreInfo.md b/docs/retailstore/StoreInfo.md new file mode 100644 index 0000000..194f232 --- /dev/null +++ b/docs/retailstore/StoreInfo.md @@ -0,0 +1,15 @@ +# StoreInfo + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**StoreId** | **string** | 门店ID | +**AccountingMerchantId** | **string** | 门店指定的品牌补贴收款商户号 | +**MerchantId** | **string** | 报名门店的商户号,即门店收款商户号 | + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/UnlockQualificationRequest.md b/docs/retailstore/UnlockQualificationRequest.md new file mode 100644 index 0000000..2f656cb --- /dev/null +++ b/docs/retailstore/UnlockQualificationRequest.md @@ -0,0 +1,14 @@ +# UnlockQualificationRequest + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**OrderInformation** | [**OrderInfo**](OrderInfo.md) | 订单信息 | +**QualificationIds** | **[]string** | 待锁定的加价购资格ID列表 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/docs/retailstore/UnlockQualificationResponse.md b/docs/retailstore/UnlockQualificationResponse.md new file mode 100644 index 0000000..09ad7db --- /dev/null +++ b/docs/retailstore/UnlockQualificationResponse.md @@ -0,0 +1,15 @@ +# UnlockQualificationResponse + +## 属性列表 + +名称 | 类型 | 描述 | 补充说明 +------------ | ------------- | ------------- | ------------- +**ReturnMessage** | **string** | 返回结果文案 | [可选] +**SucceedQualificationIds** | **[]string** | 解锁成功的资格列表 | [可选] +**FailedQualificationIds** | **[]string** | 解锁失败的资格ID列表 | [可选] + +[\[返回类型列表\]](README.md#类型列表) +[\[返回接口列表\]](README.md#接口列表) +[\[返回服务README\]](README.md) + + diff --git a/services/README.md b/services/README.md index 390aecb..74fa020 100644 --- a/services/README.md +++ b/services/README.md @@ -24,3 +24,4 @@ | merchantexclusivecoupon | 商家券 |✔️|✔️| | giftactivity | 支付有礼 |✔️|✔️| | cashcoupons | 代金券 |✔️|✔️| +| retailstore | 零售小店 |✔️|✔️| diff --git a/services/retailstore/api_activity.go b/services/retailstore/api_activity.go new file mode 100644 index 0000000..43e9297 --- /dev/null +++ b/services/retailstore/api_activity.go @@ -0,0 +1,124 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// 营销加价购对外API +// +// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。 +// +// API version: 1.3.0 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT. + +package retailstore + +import ( + "context" + "fmt" + nethttp "net/http" + neturl "net/url" + "strings" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/core/consts" + "github.com/wechatpay-apiv3/wechatpay-go/services" +) + +type ActivityApiService services.Service + +// ApplyActivity 门店报名品牌加价购活动 +// +// 接口介绍:该接口为服务商替门店报名品牌加价购活动专用接口。 +// 使用对象:指定服务商。 +func (a *ActivityApiService) ApplyActivity(ctx context.Context, req ApplyActivityRequest) (resp *ApplyActivityResponse, 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.ActivityId == nil { + return nil, nil, fmt.Errorf("field `ActivityId` is required and must be specified in ApplyActivityRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/activity/{activity_id}/apply" + // Build Path with Path Params + localVarPath = strings.Replace(localVarPath, "{"+"activity_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ActivityId, "")), -1) + + // Make sure All Required Params are properly set + + // Setup Body Params + localVarPostBody = &ApplyActivityBody{ + CallerMerchantId: req.CallerMerchantId, + ApplyInfos: req.ApplyInfos, + } + + // 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 ApplyActivityResponse from Http Response + resp = new(ApplyActivityResponse) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} + +// ListActsByArea 按区域查询品牌加价购活动 +// +// 接口介绍:该接口为服务商查询门店报名的品牌加价购活动的专用接口。 +// 使用对象:指定服务商。 +func (a *ActivityApiService) ListActsByArea(ctx context.Context, req ListActsByAreaRequest) (resp *ListActsByAreaResponse, result *core.APIResult, err error) { + var ( + localVarHTTPMethod = nethttp.MethodGet + localVarPostBody interface{} + localVarQueryParams neturl.Values + localVarHeaderParams = nethttp.Header{} + ) + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/activities" + // Make sure All Required Params are properly set + if req.CityId == nil { + return nil, nil, fmt.Errorf("field `CityId` is required and must be specified in ListActsByAreaRequest") + } + if req.Offset == nil { + return nil, nil, fmt.Errorf("field `Offset` is required and must be specified in ListActsByAreaRequest") + } + if req.Limit == nil { + return nil, nil, fmt.Errorf("field `Limit` is required and must be specified in ListActsByAreaRequest") + } + + // Setup Query Params + localVarQueryParams = neturl.Values{} + localVarQueryParams.Add("city_id", core.ParameterToString(*req.CityId, "")) + 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 ListActsByAreaResponse from Http Response + resp = new(ListActsByAreaResponse) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} diff --git a/services/retailstore/api_activity_example_test.go b/services/retailstore/api_activity_example_test.go new file mode 100644 index 0000000..86b11b7 --- /dev/null +++ b/services/retailstore/api_activity_example_test.go @@ -0,0 +1,114 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// 营销加价购对外API +// +// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。 +// +// API version: 1.3.0 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT. + +package retailstore_test + +import ( + "context" + "log" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/core/option" + "github.com/wechatpay-apiv3/wechatpay-go/services/retailstore" + "github.com/wechatpay-apiv3/wechatpay-go/utils" +) + +func ExampleActivityApiService_ApplyActivity() { + 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.ActivityApiService{Client: client} + resp, result, err := svc.ApplyActivity(ctx, + retailstore.ApplyActivityRequest{ + ActivityId: core.String("123"), + CallerMerchantId: core.String("1894101023"), + ApplyInfos: []retailstore.ActApplyInfo{retailstore.ActApplyInfo{ + StoreInfo: &retailstore.StoreInfo{ + StoreId: core.String("100"), + AccountingMerchantId: core.String("2831255701"), + MerchantId: core.String("6281399112"), + }, + GoodsOriginalPrice: core.Int64(100), + }}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call ApplyActivity err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} + +func ExampleActivityApiService_ListActsByArea() { + 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.ActivityApiService{Client: client} + resp, result, err := svc.ListActsByArea(ctx, + retailstore.ListActsByAreaRequest{ + CityId: core.String("123"), + Offset: core.Int64(0), + Limit: core.Int64(20), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call ListActsByArea err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} diff --git a/services/retailstore/api_qualification.go b/services/retailstore/api_qualification.go new file mode 100644 index 0000000..2c707c0 --- /dev/null +++ b/services/retailstore/api_qualification.go @@ -0,0 +1,99 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// 营销加价购对外API +// +// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。 +// +// API version: 1.3.0 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT. + +package retailstore + +import ( + "context" + nethttp "net/http" + neturl "net/url" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/core/consts" + "github.com/wechatpay-apiv3/wechatpay-go/services" +) + +type QualificationApiService services.Service + +// LockQualification 锁定品牌加价购活动资格 +// +// 接口介绍:指定服务商仅能通过该接口锁定品牌加价购活动资格。品牌加价购活动资格被成功锁定后不能被其它订单使用,且成功锁定品牌加价购活动资格是微信支付系统对门店和服务商发放补贴资金的前置条件,否则微信支付系统不对门店和服务商发放补贴资金。品牌加价购活动资格被锁定后,如未被解锁,则不能被其它订单使用。 +// 使用对象:指定服务商。 +func (a *QualificationApiService) LockQualification(ctx context.Context, req LockQualificationRequest) (resp *LockQualificationResponse, result *core.APIResult, err error) { + var ( + localVarHTTPMethod = nethttp.MethodPost + localVarPostBody interface{} + localVarQueryParams neturl.Values + localVarHeaderParams = nethttp.Header{} + ) + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/qualification/lock" + // Make sure All Required Params are properly set + + // Setup Body Params + localVarPostBody = req + + // 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 LockQualificationResponse from Http Response + resp = new(LockQualificationResponse) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} + +// UnlockQualification 解锁品牌加价购活动资格 +// +// 接口介绍:指定服务商仅能通过该接口解锁品牌加价购活动资格。商户调用微信支付下单接口失败或者在其它交易流程被阻断的场景下,如果此时品牌加价购活动资格已被当前订单锁定,需调用该接口解锁被锁定的品牌加价购活动资格,否则,如果被锁定的品牌加价购活动资格未被成功解锁,该品牌加价购活动资格无法被使用。 +// 使用对象:指定服务商。 +func (a *QualificationApiService) UnlockQualification(ctx context.Context, req UnlockQualificationRequest) (resp *UnlockQualificationResponse, result *core.APIResult, err error) { + var ( + localVarHTTPMethod = nethttp.MethodPost + localVarPostBody interface{} + localVarQueryParams neturl.Values + localVarHeaderParams = nethttp.Header{} + ) + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/qualification/unlock" + // Make sure All Required Params are properly set + + // Setup Body Params + localVarPostBody = req + + // 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 UnlockQualificationResponse from Http Response + resp = new(UnlockQualificationResponse) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} diff --git a/services/retailstore/api_qualification_example_test.go b/services/retailstore/api_qualification_example_test.go new file mode 100644 index 0000000..0fee117 --- /dev/null +++ b/services/retailstore/api_qualification_example_test.go @@ -0,0 +1,117 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// 营销加价购对外API +// +// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。 +// +// API version: 1.3.0 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT. + +package retailstore_test + +import ( + "context" + "log" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/core/option" + "github.com/wechatpay-apiv3/wechatpay-go/services/retailstore" + "github.com/wechatpay-apiv3/wechatpay-go/utils" +) + +func ExampleQualificationApiService_LockQualification() { + 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.QualificationApiService{Client: client} + resp, result, err := svc.LockQualification(ctx, + retailstore.LockQualificationRequest{ + OrderInformation: &retailstore.OrderInfo{ + PayerOpenid: core.String("oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"), + OutTradeNo: core.String("1217752501201407033233368018"), + TotalFee: core.Int64(100), + StoreId: core.String("123"), + StoreMerchantId: core.String("1230000109"), + }, + QualificationIds: []string{"8495134018"}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call LockQualification err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} + +func ExampleQualificationApiService_UnlockQualification() { + 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.QualificationApiService{Client: client} + resp, result, err := svc.UnlockQualification(ctx, + retailstore.UnlockQualificationRequest{ + OrderInformation: &retailstore.OrderInfo{ + PayerOpenid: core.String("oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"), + OutTradeNo: core.String("1217752501201407033233368018"), + TotalFee: core.Int64(100), + StoreId: core.String("123"), + StoreMerchantId: core.String("1230000109"), + }, + QualificationIds: []string{"8495134018"}, + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call UnlockQualification err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} diff --git a/services/retailstore/api_retail_store_act.go b/services/retailstore/api_retail_store_act.go new file mode 100644 index 0000000..86d6d87 --- /dev/null +++ b/services/retailstore/api_retail_store_act.go @@ -0,0 +1,224 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// 营销加价购对外API +// +// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。 +// +// API version: 1.3.0 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT. + +package retailstore + +import ( + "context" + "fmt" + nethttp "net/http" + neturl "net/url" + "strings" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/core/consts" + "github.com/wechatpay-apiv3/wechatpay-go/services" +) + +type RetailStoreActApiService services.Service + +// AddRepresentative 添加零售小店活动业务代理 +// +// 该接口为服务商或商户给零售小店活动添加业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。 +func (a *RetailStoreActApiService) AddRepresentative(ctx context.Context, req AddRepresentativeRequest) (resp *Representatives, result *core.APIResult, err error) { + var ( + localVarHTTPMethod = nethttp.MethodPut + localVarPostBody interface{} + localVarQueryParams neturl.Values + localVarHeaderParams = nethttp.Header{} + ) + + // Make sure Path Params are properly set + if req.ActivityId == nil { + return nil, nil, fmt.Errorf("field `ActivityId` is required and must be specified in AddRepresentativeRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative" + // Build Path with Path Params + localVarPath = strings.Replace(localVarPath, "{"+"activity_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ActivityId, "")), -1) + + // Make sure All Required Params are properly set + + // Setup Body Params + localVarPostBody = &AddRepresentativesRequest{ + RepresentativeInfoList: req.RepresentativeInfoList, + OutRequestNo: req.OutRequestNo, + AddTime: req.AddTime, + } + + // 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 Representatives from Http Response + resp = new(Representatives) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} + +// CreateMaterials 生成小店活动物料码 +// +// 该接口为服务商或商户给零售小店活动申请物料码专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。 +func (a *RetailStoreActApiService) CreateMaterials(ctx context.Context, req CreateMaterialsRequest) (resp *Materials, 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 CreateMaterialsRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/materials" + // 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 = &CreateMaterialsBody{ + OutRequestNo: req.OutRequestNo, + MaterialNum: req.MaterialNum, + } + + // 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 Materials from Http Response + resp = new(Materials) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} + +// DeleteRepresentative 删除零售小店活动业务代理 +// +// 该接口为服务商或商户给零售小店活动删除业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。 +func (a *RetailStoreActApiService) DeleteRepresentative(ctx context.Context, req DeleteRepresentativeRequest) (resp *DeleteRepresentativeResponse, 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.ActivityId == nil { + return nil, nil, fmt.Errorf("field `ActivityId` is required and must be specified in DeleteRepresentativeRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative" + // Build Path with Path Params + localVarPath = strings.Replace(localVarPath, "{"+"activity_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ActivityId, "")), -1) + + // Make sure All Required Params are properly set + + // Setup Body Params + localVarPostBody = &DeleteRepresentativeBody{ + RepresentativeInfoList: req.RepresentativeInfoList, + OutRequestNo: req.OutRequestNo, + DeleteTime: req.DeleteTime, + } + + // 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 DeleteRepresentativeResponse from Http Response + resp = new(DeleteRepresentativeResponse) + err = core.UnMarshalResponse(result.Response, resp) + if err != nil { + return nil, result, err + } + return resp, result, nil +} + +// ListRepresentative 查询零售小店活动业务代理 +// +// 该接口为服务商或商户给零售小店活动查询业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。 +func (a *RetailStoreActApiService) ListRepresentative(ctx context.Context, req ListRepresentativeRequest) (resp *ListRepresentativeResponse, 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.ActivityId == nil { + return nil, nil, fmt.Errorf("field `ActivityId` is required and must be specified in ListRepresentativeRequest") + } + + localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representatives" + // Build Path with Path Params + localVarPath = strings.Replace(localVarPath, "{"+"activity_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ActivityId, "")), -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 ListRepresentativeRequest") + } + if req.Limit == nil { + return nil, nil, fmt.Errorf("field `Limit` is required and must be specified in ListRepresentativeRequest") + } + + // 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 ListRepresentativeResponse from Http Response + resp = new(ListRepresentativeResponse) + 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 new file mode 100644 index 0000000..db644c5 --- /dev/null +++ b/services/retailstore/api_retail_store_act_example_test.go @@ -0,0 +1,199 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// 营销加价购对外API +// +// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。 +// +// API version: 1.3.0 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT. + +package retailstore_test + +import ( + "context" + "log" + + "github.com/wechatpay-apiv3/wechatpay-go/core" + "github.com/wechatpay-apiv3/wechatpay-go/core/option" + "github.com/wechatpay-apiv3/wechatpay-go/services/retailstore" + "github.com/wechatpay-apiv3/wechatpay-go/utils" +) + +func ExampleRetailStoreActApiService_AddRepresentative() { + 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.AddRepresentative(ctx, + retailstore.AddRepresentativeRequest{ + ActivityId: core.String("3118550000000004"), + RepresentativeInfoList: []retailstore.RepresentativeInfo{retailstore.RepresentativeInfo{ + Openid: core.String("oK7fFt8zzEZ909XH-LE2#"), + }}, + OutRequestNo: core.String("1002600620019090123143254436"), + AddTime: core.String("2015-05-20T13:29:35+08:00"), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call AddRepresentative err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} + +func ExampleRetailStoreActApiService_CreateMaterials() { + 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.CreateMaterials(ctx, + retailstore.CreateMaterialsRequest{ + BrandId: core.String("1001"), + OutRequestNo: core.String("1002600620019090123143254436"), + MaterialNum: core.Int64(100), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call CreateMaterials err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} + +func ExampleRetailStoreActApiService_DeleteRepresentative() { + 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.DeleteRepresentative(ctx, + retailstore.DeleteRepresentativeRequest{ + ActivityId: core.String("3118550000000004"), + RepresentativeInfoList: []retailstore.RepresentativeInfo{retailstore.RepresentativeInfo{ + Openid: core.String("oK7fFt8zzEZ909XH-LE2#"), + }}, + OutRequestNo: core.String("1002600620019090123143254436"), + DeleteTime: core.String("2015-05-20T13:29:35.120+08:00"), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call DeleteRepresentative err:%s", err) + } else { + // 处理返回结果 + log.Printf("status=%d resp=%s", result.Response.StatusCode, resp) + } +} + +func ExampleRetailStoreActApiService_ListRepresentative() { + 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.ListRepresentative(ctx, + retailstore.ListRepresentativeRequest{ + ActivityId: core.String("3118550000000004"), + Offset: core.Int64(0), + Limit: core.Int64(10), + }, + ) + + if err != nil { + // 处理错误 + log.Printf("call ListRepresentative 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 new file mode 100644 index 0000000..fcf62b5 --- /dev/null +++ b/services/retailstore/models.go @@ -0,0 +1,2191 @@ +// Copyright 2021 Tencent Inc. All rights reserved. +// +// 营销加价购对外API +// +// 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。 +// +// API version: 1.3.0 + +// Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT. + +package retailstore + +import ( + "encoding/json" + "fmt" +) + +// ActApplyInfo +type ActApplyInfo struct { + // 门店信息 + StoreInfo *StoreInfo `json:"store_info"` + // 品牌加价购活动商品的原价,该价格会在加价购小程序插件中展示(单位:分) + GoodsOriginalPrice *int64 `json:"goods_original_price"` +} + +func (o ActApplyInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.StoreInfo == nil { + return nil, fmt.Errorf("field `StoreInfo` is required and must be specified in ActApplyInfo") + } + toSerialize["store_info"] = o.StoreInfo + + if o.GoodsOriginalPrice == nil { + return nil, fmt.Errorf("field `GoodsOriginalPrice` is required and must be specified in ActApplyInfo") + } + toSerialize["goods_original_price"] = o.GoodsOriginalPrice + return json.Marshal(toSerialize) +} + +func (o ActApplyInfo) String() string { + var ret string + ret += fmt.Sprintf("StoreInfo:%v, ", o.StoreInfo) + + if o.GoodsOriginalPrice == nil { + ret += "GoodsOriginalPrice:" + } else { + ret += fmt.Sprintf("GoodsOriginalPrice:%v", *o.GoodsOriginalPrice) + } + + return fmt.Sprintf("ActApplyInfo{%s}", ret) +} + +func (o ActApplyInfo) Clone() *ActApplyInfo { + ret := ActApplyInfo{} + + if o.StoreInfo != nil { + ret.StoreInfo = o.StoreInfo.Clone() + } + + if o.GoodsOriginalPrice != nil { + ret.GoodsOriginalPrice = new(int64) + *ret.GoodsOriginalPrice = *o.GoodsOriginalPrice + } + + return &ret +} + +// ActArea +type ActArea struct { + // 省名称 + Province *string `json:"province,omitempty"` + // 市名称 + City *string `json:"city,omitempty"` + // 区名称 + District *string `json:"district,omitempty"` +} + +func (o ActArea) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Province != nil { + toSerialize["province"] = o.Province + } + + if o.City != nil { + toSerialize["city"] = o.City + } + + if o.District != nil { + toSerialize["district"] = o.District + } + return json.Marshal(toSerialize) +} + +func (o ActArea) String() string { + var ret string + if o.Province == nil { + ret += "Province:, " + } else { + ret += fmt.Sprintf("Province:%v, ", *o.Province) + } + + if o.City == nil { + ret += "City:, " + } else { + ret += fmt.Sprintf("City:%v, ", *o.City) + } + + if o.District == nil { + ret += "District:" + } else { + ret += fmt.Sprintf("District:%v", *o.District) + } + + return fmt.Sprintf("ActArea{%s}", ret) +} + +func (o ActArea) Clone() *ActArea { + ret := ActArea{} + + if o.Province != nil { + ret.Province = new(string) + *ret.Province = *o.Province + } + + if o.City != nil { + ret.City = new(string) + *ret.City = *o.City + } + + if o.District != nil { + ret.District = new(string) + *ret.District = *o.District + } + + return &ret +} + +// ActInfo +type ActInfo struct { + // 活动名称 + ActivityName *string `json:"activity_name,omitempty"` + // 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) + ApplyStartTime *string `json:"apply_start_time,omitempty"` + // 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) + ApplyEndTime *string `json:"apply_end_time,omitempty"` + // 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) + ActivityStartTime *string `json:"activity_start_time,omitempty"` + // 遵循rfc3339标准格式,格式为YYYY-MM-DDTHH:mm:ss+TIMEZONE,YYYY-MM-DD表示年月日,T出现在字符串中,表示time元素的开头,HH:mm:ss表示时分秒,TIMEZONE表示时区(+08:00表示东八区时间,领先UTC 8小时,即北京时间) + ActivityEndTime *string `json:"activity_end_time,omitempty"` + // 活动描述 + ActivityDescription *string `json:"activity_description,omitempty"` +} + +func (o ActInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ActivityName != nil { + toSerialize["activity_name"] = o.ActivityName + } + + if o.ApplyStartTime != nil { + toSerialize["apply_start_time"] = o.ApplyStartTime + } + + if o.ApplyEndTime != nil { + toSerialize["apply_end_time"] = o.ApplyEndTime + } + + if o.ActivityStartTime != nil { + toSerialize["activity_start_time"] = o.ActivityStartTime + } + + if o.ActivityEndTime != nil { + toSerialize["activity_end_time"] = o.ActivityEndTime + } + + if o.ActivityDescription != nil { + toSerialize["activity_description"] = o.ActivityDescription + } + return json.Marshal(toSerialize) +} + +func (o ActInfo) String() string { + var ret string + if o.ActivityName == nil { + ret += "ActivityName:, " + } else { + ret += fmt.Sprintf("ActivityName:%v, ", *o.ActivityName) + } + + if o.ApplyStartTime == nil { + ret += "ApplyStartTime:, " + } else { + ret += fmt.Sprintf("ApplyStartTime:%v, ", *o.ApplyStartTime) + } + + if o.ApplyEndTime == nil { + ret += "ApplyEndTime:, " + } else { + ret += fmt.Sprintf("ApplyEndTime:%v, ", *o.ApplyEndTime) + } + + if o.ActivityStartTime == nil { + ret += "ActivityStartTime:, " + } else { + ret += fmt.Sprintf("ActivityStartTime:%v, ", *o.ActivityStartTime) + } + + if o.ActivityEndTime == nil { + ret += "ActivityEndTime:, " + } else { + ret += fmt.Sprintf("ActivityEndTime:%v, ", *o.ActivityEndTime) + } + + if o.ActivityDescription == nil { + ret += "ActivityDescription:" + } else { + ret += fmt.Sprintf("ActivityDescription:%v", *o.ActivityDescription) + } + + return fmt.Sprintf("ActInfo{%s}", ret) +} + +func (o ActInfo) Clone() *ActInfo { + ret := ActInfo{} + + if o.ActivityName != nil { + ret.ActivityName = new(string) + *ret.ActivityName = *o.ActivityName + } + + if o.ApplyStartTime != nil { + ret.ApplyStartTime = new(string) + *ret.ApplyStartTime = *o.ApplyStartTime + } + + if o.ApplyEndTime != nil { + ret.ApplyEndTime = new(string) + *ret.ApplyEndTime = *o.ApplyEndTime + } + + if o.ActivityStartTime != nil { + ret.ActivityStartTime = new(string) + *ret.ActivityStartTime = *o.ActivityStartTime + } + + if o.ActivityEndTime != nil { + ret.ActivityEndTime = new(string) + *ret.ActivityEndTime = *o.ActivityEndTime + } + + if o.ActivityDescription != nil { + ret.ActivityDescription = new(string) + *ret.ActivityDescription = *o.ActivityDescription + } + + return &ret +} + +// ActRule +type ActRule struct { + // 购买单件商品,补贴给门店的金额(单位:分) + StoreSubsidy *int64 `json:"store_subsidy,omitempty"` + // 购买单件商品,补贴给服务商的佣金(单位:分) + ServiceProviderSubsidy *int64 `json:"service_provider_subsidy,omitempty"` + // 活动门店补贴商品数上限 + StoreSubsidyQuota *int64 `json:"store_subsidy_quota,omitempty"` + // 单用户享受加价购优惠次数上限 + UserSubsidyQuota *int64 `json:"user_subsidy_quota,omitempty"` + // 活动区域列表 + Areas []ActArea `json:"areas,omitempty"` +} + +func (o ActRule) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.StoreSubsidy != nil { + toSerialize["store_subsidy"] = o.StoreSubsidy + } + + if o.ServiceProviderSubsidy != nil { + toSerialize["service_provider_subsidy"] = o.ServiceProviderSubsidy + } + + if o.StoreSubsidyQuota != nil { + toSerialize["store_subsidy_quota"] = o.StoreSubsidyQuota + } + + if o.UserSubsidyQuota != nil { + toSerialize["user_subsidy_quota"] = o.UserSubsidyQuota + } + + if o.Areas != nil { + toSerialize["areas"] = o.Areas + } + return json.Marshal(toSerialize) +} + +func (o ActRule) String() string { + var ret string + if o.StoreSubsidy == nil { + ret += "StoreSubsidy:, " + } else { + ret += fmt.Sprintf("StoreSubsidy:%v, ", *o.StoreSubsidy) + } + + if o.ServiceProviderSubsidy == nil { + ret += "ServiceProviderSubsidy:, " + } else { + ret += fmt.Sprintf("ServiceProviderSubsidy:%v, ", *o.ServiceProviderSubsidy) + } + + if o.StoreSubsidyQuota == nil { + ret += "StoreSubsidyQuota:, " + } else { + ret += fmt.Sprintf("StoreSubsidyQuota:%v, ", *o.StoreSubsidyQuota) + } + + if o.UserSubsidyQuota == nil { + ret += "UserSubsidyQuota:, " + } else { + ret += fmt.Sprintf("UserSubsidyQuota:%v, ", *o.UserSubsidyQuota) + } + + ret += fmt.Sprintf("Areas:%v", o.Areas) + + return fmt.Sprintf("ActRule{%s}", ret) +} + +func (o ActRule) Clone() *ActRule { + ret := ActRule{} + + if o.StoreSubsidy != nil { + ret.StoreSubsidy = new(int64) + *ret.StoreSubsidy = *o.StoreSubsidy + } + + if o.ServiceProviderSubsidy != nil { + ret.ServiceProviderSubsidy = new(int64) + *ret.ServiceProviderSubsidy = *o.ServiceProviderSubsidy + } + + if o.StoreSubsidyQuota != nil { + ret.StoreSubsidyQuota = new(int64) + *ret.StoreSubsidyQuota = *o.StoreSubsidyQuota + } + + if o.UserSubsidyQuota != nil { + ret.UserSubsidyQuota = new(int64) + *ret.UserSubsidyQuota = *o.UserSubsidyQuota + } + + if o.Areas != nil { + ret.Areas = make([]ActArea, len(o.Areas)) + for i, item := range o.Areas { + ret.Areas[i] = *item.Clone() + } + } + + return &ret +} + +// AddRepresentativeRequest +type AddRepresentativeRequest struct { + // 零售小店活动ID + ActivityId *string `json:"activity_id"` + // 业务代理信息列表 + RepresentativeInfoList []RepresentativeInfo `json:"representative_info_list"` + // 商户新增业务代理请求的唯一标识,商户需保证唯一。可包含英文字母,数字,\\|,\\_,\\*,\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 添加时间 + AddTime *string `json:"add_time,omitempty"` +} + +func (o AddRepresentativeRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ActivityId == nil { + return nil, fmt.Errorf("field `ActivityId` is required and must be specified in AddRepresentativeRequest") + } + toSerialize["activity_id"] = o.ActivityId + + if o.RepresentativeInfoList == nil { + return nil, fmt.Errorf("field `RepresentativeInfoList` is required and must be specified in AddRepresentativeRequest") + } + toSerialize["representative_info_list"] = o.RepresentativeInfoList + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in AddRepresentativeRequest") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.AddTime != nil { + toSerialize["add_time"] = o.AddTime + } + return json.Marshal(toSerialize) +} + +func (o AddRepresentativeRequest) String() string { + var ret string + if o.ActivityId == nil { + ret += "ActivityId:, " + } else { + ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) + } + + ret += fmt.Sprintf("RepresentativeInfoList:%v, ", o.RepresentativeInfoList) + + 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) + } + + return fmt.Sprintf("AddRepresentativeRequest{%s}", ret) +} + +func (o AddRepresentativeRequest) Clone() *AddRepresentativeRequest { + ret := AddRepresentativeRequest{} + + if o.ActivityId != nil { + ret.ActivityId = new(string) + *ret.ActivityId = *o.ActivityId + } + + if o.RepresentativeInfoList != nil { + ret.RepresentativeInfoList = make([]RepresentativeInfo, len(o.RepresentativeInfoList)) + for i, item := range o.RepresentativeInfoList { + ret.RepresentativeInfoList[i] = *item.Clone() + } + } + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.AddTime != nil { + ret.AddTime = new(string) + *ret.AddTime = *o.AddTime + } + + return &ret +} + +// AddRepresentativesRequest +type AddRepresentativesRequest struct { + // 业务代理信息列表 + RepresentativeInfoList []RepresentativeInfo `json:"representative_info_list"` + // 商户新增业务代理请求的唯一标识,商户需保证唯一。可包含英文字母,数字,\\|,\\_,\\*,\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 添加时间 + AddTime *string `json:"add_time,omitempty"` +} + +func (o AddRepresentativesRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.RepresentativeInfoList == nil { + return nil, fmt.Errorf("field `RepresentativeInfoList` is required and must be specified in AddRepresentativesRequest") + } + toSerialize["representative_info_list"] = o.RepresentativeInfoList + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in AddRepresentativesRequest") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.AddTime != nil { + toSerialize["add_time"] = o.AddTime + } + return json.Marshal(toSerialize) +} + +func (o AddRepresentativesRequest) String() string { + var ret string + ret += fmt.Sprintf("RepresentativeInfoList:%v, ", o.RepresentativeInfoList) + + 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) + } + + return fmt.Sprintf("AddRepresentativesRequest{%s}", ret) +} + +func (o AddRepresentativesRequest) Clone() *AddRepresentativesRequest { + ret := AddRepresentativesRequest{} + + if o.RepresentativeInfoList != nil { + ret.RepresentativeInfoList = make([]RepresentativeInfo, len(o.RepresentativeInfoList)) + for i, item := range o.RepresentativeInfoList { + ret.RepresentativeInfoList[i] = *item.Clone() + } + } + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.AddTime != nil { + ret.AddTime = new(string) + *ret.AddTime = *o.AddTime + } + + return &ret +} + +// ApplyActivityBody +type ApplyActivityBody struct { + // 调用报名活动API的商户的商户号 + CallerMerchantId *string `json:"caller_merchant_id"` + // 门店报名信息 + ApplyInfos []ActApplyInfo `json:"apply_infos,omitempty"` +} + +func (o ApplyActivityBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.CallerMerchantId == nil { + return nil, fmt.Errorf("field `CallerMerchantId` is required and must be specified in ApplyActivityBody") + } + toSerialize["caller_merchant_id"] = o.CallerMerchantId + + if o.ApplyInfos != nil { + toSerialize["apply_infos"] = o.ApplyInfos + } + return json.Marshal(toSerialize) +} + +func (o ApplyActivityBody) String() string { + var ret string + if o.CallerMerchantId == nil { + ret += "CallerMerchantId:, " + } else { + ret += fmt.Sprintf("CallerMerchantId:%v, ", *o.CallerMerchantId) + } + + ret += fmt.Sprintf("ApplyInfos:%v", o.ApplyInfos) + + return fmt.Sprintf("ApplyActivityBody{%s}", ret) +} + +func (o ApplyActivityBody) Clone() *ApplyActivityBody { + ret := ApplyActivityBody{} + + if o.CallerMerchantId != nil { + ret.CallerMerchantId = new(string) + *ret.CallerMerchantId = *o.CallerMerchantId + } + + if o.ApplyInfos != nil { + ret.ApplyInfos = make([]ActApplyInfo, len(o.ApplyInfos)) + for i, item := range o.ApplyInfos { + ret.ApplyInfos[i] = *item.Clone() + } + } + + return &ret +} + +// ApplyActivityRequest +type ApplyActivityRequest struct { + // 活动ID + ActivityId *string `json:"activity_id"` + // 调用报名活动API的商户的商户号 + CallerMerchantId *string `json:"caller_merchant_id"` + // 门店报名信息 + ApplyInfos []ActApplyInfo `json:"apply_infos,omitempty"` +} + +func (o ApplyActivityRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ActivityId == nil { + return nil, fmt.Errorf("field `ActivityId` is required and must be specified in ApplyActivityRequest") + } + toSerialize["activity_id"] = o.ActivityId + + if o.CallerMerchantId == nil { + return nil, fmt.Errorf("field `CallerMerchantId` is required and must be specified in ApplyActivityRequest") + } + toSerialize["caller_merchant_id"] = o.CallerMerchantId + + if o.ApplyInfos != nil { + toSerialize["apply_infos"] = o.ApplyInfos + } + return json.Marshal(toSerialize) +} + +func (o ApplyActivityRequest) String() string { + var ret string + if o.ActivityId == nil { + ret += "ActivityId:, " + } else { + ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) + } + + if o.CallerMerchantId == nil { + ret += "CallerMerchantId:, " + } else { + ret += fmt.Sprintf("CallerMerchantId:%v, ", *o.CallerMerchantId) + } + + ret += fmt.Sprintf("ApplyInfos:%v", o.ApplyInfos) + + return fmt.Sprintf("ApplyActivityRequest{%s}", ret) +} + +func (o ApplyActivityRequest) Clone() *ApplyActivityRequest { + ret := ApplyActivityRequest{} + + if o.ActivityId != nil { + ret.ActivityId = new(string) + *ret.ActivityId = *o.ActivityId + } + + if o.CallerMerchantId != nil { + ret.CallerMerchantId = new(string) + *ret.CallerMerchantId = *o.CallerMerchantId + } + + if o.ApplyInfos != nil { + ret.ApplyInfos = make([]ActApplyInfo, len(o.ApplyInfos)) + for i, item := range o.ApplyInfos { + ret.ApplyInfos[i] = *item.Clone() + } + } + + return &ret +} + +// ApplyActivityResponse +type ApplyActivityResponse struct { + // 返回结果文案 + ReturnMessage *string `json:"return_message,omitempty"` + // 失败的报名记录 + FailedApplyInfos []ActApplyInfo `json:"failed_apply_infos,omitempty"` + // 成功的报名记录 + SucceedApplyInfos []ActApplyInfo `json:"succeed_apply_infos,omitempty"` +} + +func (o ApplyActivityResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ReturnMessage != nil { + toSerialize["return_message"] = o.ReturnMessage + } + + if o.FailedApplyInfos != nil { + toSerialize["failed_apply_infos"] = o.FailedApplyInfos + } + + if o.SucceedApplyInfos != nil { + toSerialize["succeed_apply_infos"] = o.SucceedApplyInfos + } + return json.Marshal(toSerialize) +} + +func (o ApplyActivityResponse) String() string { + var ret string + if o.ReturnMessage == nil { + ret += "ReturnMessage:, " + } else { + ret += fmt.Sprintf("ReturnMessage:%v, ", *o.ReturnMessage) + } + + ret += fmt.Sprintf("FailedApplyInfos:%v, ", o.FailedApplyInfos) + + ret += fmt.Sprintf("SucceedApplyInfos:%v", o.SucceedApplyInfos) + + return fmt.Sprintf("ApplyActivityResponse{%s}", ret) +} + +func (o ApplyActivityResponse) Clone() *ApplyActivityResponse { + ret := ApplyActivityResponse{} + + if o.ReturnMessage != nil { + ret.ReturnMessage = new(string) + *ret.ReturnMessage = *o.ReturnMessage + } + + if o.FailedApplyInfos != nil { + ret.FailedApplyInfos = make([]ActApplyInfo, len(o.FailedApplyInfos)) + for i, item := range o.FailedApplyInfos { + ret.FailedApplyInfos[i] = *item.Clone() + } + } + + if o.SucceedApplyInfos != nil { + ret.SucceedApplyInfos = make([]ActApplyInfo, len(o.SucceedApplyInfos)) + for i, item := range o.SucceedApplyInfos { + ret.SucceedApplyInfos[i] = *item.Clone() + } + } + + return &ret +} + +// CreateMaterialsBody +type CreateMaterialsBody struct { + // 商户添加业务代理信息凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 生成物料码数量 + MaterialNum *int64 `json:"material_num"` +} + +func (o CreateMaterialsBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in CreateMaterialsBody") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.MaterialNum == nil { + return nil, fmt.Errorf("field `MaterialNum` is required and must be specified in CreateMaterialsBody") + } + toSerialize["material_num"] = o.MaterialNum + return json.Marshal(toSerialize) +} + +func (o CreateMaterialsBody) String() string { + var ret string + if o.OutRequestNo == nil { + ret += "OutRequestNo:, " + } else { + ret += fmt.Sprintf("OutRequestNo:%v, ", *o.OutRequestNo) + } + + if o.MaterialNum == nil { + ret += "MaterialNum:" + } else { + ret += fmt.Sprintf("MaterialNum:%v", *o.MaterialNum) + } + + return fmt.Sprintf("CreateMaterialsBody{%s}", ret) +} + +func (o CreateMaterialsBody) Clone() *CreateMaterialsBody { + ret := CreateMaterialsBody{} + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.MaterialNum != nil { + ret.MaterialNum = new(int64) + *ret.MaterialNum = *o.MaterialNum + } + + return &ret +} + +// CreateMaterialsRequest +type CreateMaterialsRequest struct { + // 品牌ID + BrandId *string `json:"brand_id"` + // 商户添加业务代理信息凭据号,商户侧需保持唯一性。可包含英文字母,数字,\\\\|,\\\\_,\\\\*,\\\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 生成物料码数量 + MaterialNum *int64 `json:"material_num"` +} + +func (o CreateMaterialsRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.BrandId == nil { + return nil, fmt.Errorf("field `BrandId` is required and must be specified in CreateMaterialsRequest") + } + toSerialize["brand_id"] = o.BrandId + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in CreateMaterialsRequest") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.MaterialNum == nil { + return nil, fmt.Errorf("field `MaterialNum` is required and must be specified in CreateMaterialsRequest") + } + toSerialize["material_num"] = o.MaterialNum + return json.Marshal(toSerialize) +} + +func (o CreateMaterialsRequest) 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.MaterialNum == nil { + ret += "MaterialNum:" + } else { + ret += fmt.Sprintf("MaterialNum:%v", *o.MaterialNum) + } + + return fmt.Sprintf("CreateMaterialsRequest{%s}", ret) +} + +func (o CreateMaterialsRequest) Clone() *CreateMaterialsRequest { + ret := CreateMaterialsRequest{} + + 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.MaterialNum != nil { + ret.MaterialNum = new(int64) + *ret.MaterialNum = *o.MaterialNum + } + + return &ret +} + +// DeleteRepresentativeBody +type DeleteRepresentativeBody struct { + // 业务代理信息列表 + RepresentativeInfoList []RepresentativeInfo `json:"representative_info_list"` + // 商户删除业务代理请求的唯一标识,商户需保证唯一。可包含英文字母,数字,\\|,\\_,\\*,\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 删除时间 + DeleteTime *string `json:"delete_time"` +} + +func (o DeleteRepresentativeBody) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.RepresentativeInfoList == nil { + return nil, fmt.Errorf("field `RepresentativeInfoList` is required and must be specified in DeleteRepresentativeBody") + } + toSerialize["representative_info_list"] = o.RepresentativeInfoList + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in DeleteRepresentativeBody") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.DeleteTime == nil { + return nil, fmt.Errorf("field `DeleteTime` is required and must be specified in DeleteRepresentativeBody") + } + toSerialize["delete_time"] = o.DeleteTime + return json.Marshal(toSerialize) +} + +func (o DeleteRepresentativeBody) String() string { + var ret string + ret += fmt.Sprintf("RepresentativeInfoList:%v, ", o.RepresentativeInfoList) + + 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) + } + + return fmt.Sprintf("DeleteRepresentativeBody{%s}", ret) +} + +func (o DeleteRepresentativeBody) Clone() *DeleteRepresentativeBody { + ret := DeleteRepresentativeBody{} + + if o.RepresentativeInfoList != nil { + ret.RepresentativeInfoList = make([]RepresentativeInfo, len(o.RepresentativeInfoList)) + for i, item := range o.RepresentativeInfoList { + ret.RepresentativeInfoList[i] = *item.Clone() + } + } + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.DeleteTime != nil { + ret.DeleteTime = new(string) + *ret.DeleteTime = *o.DeleteTime + } + + return &ret +} + +// DeleteRepresentativeRequest +type DeleteRepresentativeRequest struct { + // 零售小店活动ID + ActivityId *string `json:"activity_id"` + // 业务代理信息列表 + RepresentativeInfoList []RepresentativeInfo `json:"representative_info_list"` + // 商户删除业务代理请求的唯一标识,商户需保证唯一。可包含英文字母,数字,\\|,\\_,\\*,\\-等内容,不允许出现其他不合法符号。 + OutRequestNo *string `json:"out_request_no"` + // 删除时间 + DeleteTime *string `json:"delete_time"` +} + +func (o DeleteRepresentativeRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ActivityId == nil { + return nil, fmt.Errorf("field `ActivityId` is required and must be specified in DeleteRepresentativeRequest") + } + toSerialize["activity_id"] = o.ActivityId + + if o.RepresentativeInfoList == nil { + return nil, fmt.Errorf("field `RepresentativeInfoList` is required and must be specified in DeleteRepresentativeRequest") + } + toSerialize["representative_info_list"] = o.RepresentativeInfoList + + if o.OutRequestNo == nil { + return nil, fmt.Errorf("field `OutRequestNo` is required and must be specified in DeleteRepresentativeRequest") + } + toSerialize["out_request_no"] = o.OutRequestNo + + if o.DeleteTime == nil { + return nil, fmt.Errorf("field `DeleteTime` is required and must be specified in DeleteRepresentativeRequest") + } + toSerialize["delete_time"] = o.DeleteTime + return json.Marshal(toSerialize) +} + +func (o DeleteRepresentativeRequest) String() string { + var ret string + if o.ActivityId == nil { + ret += "ActivityId:, " + } else { + ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) + } + + ret += fmt.Sprintf("RepresentativeInfoList:%v, ", o.RepresentativeInfoList) + + 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) + } + + return fmt.Sprintf("DeleteRepresentativeRequest{%s}", ret) +} + +func (o DeleteRepresentativeRequest) Clone() *DeleteRepresentativeRequest { + ret := DeleteRepresentativeRequest{} + + if o.ActivityId != nil { + ret.ActivityId = new(string) + *ret.ActivityId = *o.ActivityId + } + + if o.RepresentativeInfoList != nil { + ret.RepresentativeInfoList = make([]RepresentativeInfo, len(o.RepresentativeInfoList)) + for i, item := range o.RepresentativeInfoList { + ret.RepresentativeInfoList[i] = *item.Clone() + } + } + + if o.OutRequestNo != nil { + ret.OutRequestNo = new(string) + *ret.OutRequestNo = *o.OutRequestNo + } + + if o.DeleteTime != nil { + ret.DeleteTime = new(string) + *ret.DeleteTime = *o.DeleteTime + } + + 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"` +} + +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 +} + +// FmcgAct +type FmcgAct struct { + // 活动ID + ActivityId *string `json:"activity_id,omitempty"` + // 品牌ID + BrandId *string `json:"brand_id,omitempty"` + // 活动创建方商户号 + CreatorMerchantId *string `json:"creator_merchant_id,omitempty"` + // 活动信息 + ActivityInfo *ActInfo `json:"activity_info,omitempty"` + // 活动商品列表 + GoodsInformation *GoodsInfo `json:"goods_information,omitempty"` + // 活动规则 + RuleInformation *ActRule `json:"rule_information,omitempty"` +} + +func (o FmcgAct) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ActivityId != nil { + toSerialize["activity_id"] = o.ActivityId + } + + if o.BrandId != nil { + toSerialize["brand_id"] = o.BrandId + } + + if o.CreatorMerchantId != nil { + toSerialize["creator_merchant_id"] = o.CreatorMerchantId + } + + if o.ActivityInfo != nil { + toSerialize["activity_info"] = o.ActivityInfo + } + + if o.GoodsInformation != nil { + toSerialize["goods_information"] = o.GoodsInformation + } + + if o.RuleInformation != nil { + toSerialize["rule_information"] = o.RuleInformation + } + return json.Marshal(toSerialize) +} + +func (o FmcgAct) String() string { + var ret string + if o.ActivityId == nil { + ret += "ActivityId:, " + } else { + ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) + } + + if o.BrandId == nil { + ret += "BrandId:, " + } else { + ret += fmt.Sprintf("BrandId:%v, ", *o.BrandId) + } + + if o.CreatorMerchantId == nil { + ret += "CreatorMerchantId:, " + } else { + ret += fmt.Sprintf("CreatorMerchantId:%v, ", *o.CreatorMerchantId) + } + + ret += fmt.Sprintf("ActivityInfo:%v, ", o.ActivityInfo) + + ret += fmt.Sprintf("GoodsInformation:%v, ", o.GoodsInformation) + + ret += fmt.Sprintf("RuleInformation:%v", o.RuleInformation) + + return fmt.Sprintf("FmcgAct{%s}", ret) +} + +func (o FmcgAct) Clone() *FmcgAct { + ret := FmcgAct{} + + if o.ActivityId != nil { + ret.ActivityId = new(string) + *ret.ActivityId = *o.ActivityId + } + + if o.BrandId != nil { + ret.BrandId = new(string) + *ret.BrandId = *o.BrandId + } + + if o.CreatorMerchantId != nil { + ret.CreatorMerchantId = new(string) + *ret.CreatorMerchantId = *o.CreatorMerchantId + } + + if o.ActivityInfo != nil { + ret.ActivityInfo = o.ActivityInfo.Clone() + } + + if o.GoodsInformation != nil { + ret.GoodsInformation = o.GoodsInformation.Clone() + } + + if o.RuleInformation != nil { + ret.RuleInformation = o.RuleInformation.Clone() + } + + return &ret +} + +// GoodsInfo +type GoodsInfo struct { + // 商品ID + GoodsId *string `json:"goods_id,omitempty"` + // 商品名称 + GoodsName *string `json:"goods_name,omitempty"` + // 商品图片URL + GoodsPictureUrl *string `json:"goods_picture_url,omitempty"` +} + +func (o GoodsInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.GoodsId != nil { + toSerialize["goods_id"] = o.GoodsId + } + + if o.GoodsName != nil { + toSerialize["goods_name"] = o.GoodsName + } + + if o.GoodsPictureUrl != nil { + toSerialize["goods_picture_url"] = o.GoodsPictureUrl + } + return json.Marshal(toSerialize) +} + +func (o GoodsInfo) String() string { + var ret string + if o.GoodsId == nil { + ret += "GoodsId:, " + } else { + ret += fmt.Sprintf("GoodsId:%v, ", *o.GoodsId) + } + + if o.GoodsName == nil { + ret += "GoodsName:, " + } else { + ret += fmt.Sprintf("GoodsName:%v, ", *o.GoodsName) + } + + if o.GoodsPictureUrl == nil { + ret += "GoodsPictureUrl:" + } else { + ret += fmt.Sprintf("GoodsPictureUrl:%v", *o.GoodsPictureUrl) + } + + return fmt.Sprintf("GoodsInfo{%s}", ret) +} + +func (o GoodsInfo) Clone() *GoodsInfo { + ret := GoodsInfo{} + + if o.GoodsId != nil { + ret.GoodsId = new(string) + *ret.GoodsId = *o.GoodsId + } + + if o.GoodsName != nil { + ret.GoodsName = new(string) + *ret.GoodsName = *o.GoodsName + } + + if o.GoodsPictureUrl != nil { + ret.GoodsPictureUrl = new(string) + *ret.GoodsPictureUrl = *o.GoodsPictureUrl + } + + return &ret +} + +// ListActsByAreaRequest +type ListActsByAreaRequest struct { + // 活动所属城市的ID + CityId *string `json:"city_id"` + // 非负整数,该次请求资源的起始位置,从0开始计数 + Offset *int64 `json:"offset"` + // 非0非负的整数 + Limit *int64 `json:"limit"` +} + +func (o ListActsByAreaRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.CityId == nil { + return nil, fmt.Errorf("field `CityId` is required and must be specified in ListActsByAreaRequest") + } + toSerialize["city_id"] = o.CityId + + if o.Offset == nil { + return nil, fmt.Errorf("field `Offset` is required and must be specified in ListActsByAreaRequest") + } + toSerialize["offset"] = o.Offset + + if o.Limit == nil { + return nil, fmt.Errorf("field `Limit` is required and must be specified in ListActsByAreaRequest") + } + toSerialize["limit"] = o.Limit + return json.Marshal(toSerialize) +} + +func (o ListActsByAreaRequest) String() string { + var ret string + if o.CityId == nil { + ret += "CityId:, " + } else { + ret += fmt.Sprintf("CityId:%v, ", *o.CityId) + } + + 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("ListActsByAreaRequest{%s}", ret) +} + +func (o ListActsByAreaRequest) Clone() *ListActsByAreaRequest { + ret := ListActsByAreaRequest{} + + if o.CityId != nil { + ret.CityId = new(string) + *ret.CityId = *o.CityId + } + + 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 +} + +// ListActsByAreaResponse +type ListActsByAreaResponse struct { + // 活动总数 + TotalCount *int64 `json:"total_count,omitempty"` + // 活动集合 + Data []FmcgAct `json:"data,omitempty"` + // 非负整数,该次请求资源的起始位置,从0开始计数 + Offset *int64 `json:"offset"` + // 非0非负的整数 + Limit *int64 `json:"limit"` +} + +func (o ListActsByAreaResponse) 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 { + return nil, fmt.Errorf("field `Offset` is required and must be specified in ListActsByAreaResponse") + } + toSerialize["offset"] = o.Offset + + if o.Limit == nil { + return nil, fmt.Errorf("field `Limit` is required and must be specified in ListActsByAreaResponse") + } + toSerialize["limit"] = o.Limit + return json.Marshal(toSerialize) +} + +func (o ListActsByAreaResponse) 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("ListActsByAreaResponse{%s}", ret) +} + +func (o ListActsByAreaResponse) Clone() *ListActsByAreaResponse { + ret := ListActsByAreaResponse{} + + if o.TotalCount != nil { + ret.TotalCount = new(int64) + *ret.TotalCount = *o.TotalCount + } + + if o.Data != nil { + ret.Data = make([]FmcgAct, 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 +} + +// ListRepresentativeRequest +type ListRepresentativeRequest struct { + // 零售小店活动ID + ActivityId *string `json:"activity_id"` + // 页码从0开始,默认第0页 + Offset *int64 `json:"offset"` + // 分页大小,默认查询10个业代 + Limit *int64 `json:"limit"` +} + +func (o ListRepresentativeRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ActivityId == nil { + return nil, fmt.Errorf("field `ActivityId` is required and must be specified in ListRepresentativeRequest") + } + toSerialize["activity_id"] = o.ActivityId + + if o.Offset == nil { + return nil, fmt.Errorf("field `Offset` is required and must be specified in ListRepresentativeRequest") + } + toSerialize["offset"] = o.Offset + + if o.Limit == nil { + return nil, fmt.Errorf("field `Limit` is required and must be specified in ListRepresentativeRequest") + } + toSerialize["limit"] = o.Limit + return json.Marshal(toSerialize) +} + +func (o ListRepresentativeRequest) String() string { + var ret string + if o.ActivityId == nil { + ret += "ActivityId:, " + } else { + ret += fmt.Sprintf("ActivityId:%v, ", *o.ActivityId) + } + + 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("ListRepresentativeRequest{%s}", ret) +} + +func (o ListRepresentativeRequest) Clone() *ListRepresentativeRequest { + ret := ListRepresentativeRequest{} + + if o.ActivityId != nil { + ret.ActivityId = new(string) + *ret.ActivityId = *o.ActivityId + } + + 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 +} + +// ListRepresentativeResponse +type ListRepresentativeResponse struct { + // 小店活动业代总数 + TotalCount *int64 `json:"total_count,omitempty"` + // 小店活动业代集合 + Data []RepresentativeInfo `json:"data,omitempty"` + // 页码从0开始,默认第0页 + Offset *int64 `json:"offset"` + // 分页大小 + Limit *int64 `json:"limit"` +} + +func (o ListRepresentativeResponse) 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 { + return nil, fmt.Errorf("field `Offset` is required and must be specified in ListRepresentativeResponse") + } + toSerialize["offset"] = o.Offset + + if o.Limit == nil { + return nil, fmt.Errorf("field `Limit` is required and must be specified in ListRepresentativeResponse") + } + toSerialize["limit"] = o.Limit + return json.Marshal(toSerialize) +} + +func (o ListRepresentativeResponse) 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("ListRepresentativeResponse{%s}", ret) +} + +func (o ListRepresentativeResponse) Clone() *ListRepresentativeResponse { + ret := ListRepresentativeResponse{} + + if o.TotalCount != nil { + ret.TotalCount = new(int64) + *ret.TotalCount = *o.TotalCount + } + + if o.Data != nil { + ret.Data = make([]RepresentativeInfo, 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 { + // 订单信息 + OrderInformation *OrderInfo `json:"order_information"` + // 待锁定的加价购资格ID列表 + QualificationIds []string `json:"qualification_ids,omitempty"` +} + +func (o LockQualificationRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.OrderInformation == nil { + return nil, fmt.Errorf("field `OrderInformation` is required and must be specified in LockQualificationRequest") + } + toSerialize["order_information"] = o.OrderInformation + + if o.QualificationIds != nil { + toSerialize["qualification_ids"] = o.QualificationIds + } + return json.Marshal(toSerialize) +} + +func (o LockQualificationRequest) String() string { + var ret string + ret += fmt.Sprintf("OrderInformation:%v, ", o.OrderInformation) + + ret += fmt.Sprintf("QualificationIds:%v", o.QualificationIds) + + return fmt.Sprintf("LockQualificationRequest{%s}", ret) +} + +func (o LockQualificationRequest) Clone() *LockQualificationRequest { + ret := LockQualificationRequest{} + + if o.OrderInformation != nil { + ret.OrderInformation = o.OrderInformation.Clone() + } + + if o.QualificationIds != nil { + ret.QualificationIds = make([]string, len(o.QualificationIds)) + for i, item := range o.QualificationIds { + ret.QualificationIds[i] = item + } + } + + return &ret +} + +// LockQualificationResponse +type LockQualificationResponse struct { + // 返回结果文案 + ReturnMessage *string `json:"return_message,omitempty"` + // 锁定成功的资格ID列表 + SucceedQualificationIds []string `json:"succeed_qualification_ids,omitempty"` + // 锁定失败的资格ID列表 + FailedQualificationIds []string `json:"failed_qualification_ids,omitempty"` +} + +func (o LockQualificationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ReturnMessage != nil { + toSerialize["return_message"] = o.ReturnMessage + } + + if o.SucceedQualificationIds != nil { + toSerialize["succeed_qualification_ids"] = o.SucceedQualificationIds + } + + if o.FailedQualificationIds != nil { + toSerialize["failed_qualification_ids"] = o.FailedQualificationIds + } + return json.Marshal(toSerialize) +} + +func (o LockQualificationResponse) String() string { + var ret string + if o.ReturnMessage == nil { + ret += "ReturnMessage:, " + } else { + ret += fmt.Sprintf("ReturnMessage:%v, ", *o.ReturnMessage) + } + + ret += fmt.Sprintf("SucceedQualificationIds:%v, ", o.SucceedQualificationIds) + + ret += fmt.Sprintf("FailedQualificationIds:%v", o.FailedQualificationIds) + + return fmt.Sprintf("LockQualificationResponse{%s}", ret) +} + +func (o LockQualificationResponse) Clone() *LockQualificationResponse { + ret := LockQualificationResponse{} + + if o.ReturnMessage != nil { + ret.ReturnMessage = new(string) + *ret.ReturnMessage = *o.ReturnMessage + } + + if o.SucceedQualificationIds != nil { + ret.SucceedQualificationIds = make([]string, len(o.SucceedQualificationIds)) + for i, item := range o.SucceedQualificationIds { + ret.SucceedQualificationIds[i] = item + } + } + + if o.FailedQualificationIds != nil { + ret.FailedQualificationIds = make([]string, len(o.FailedQualificationIds)) + for i, item := range o.FailedQualificationIds { + ret.FailedQualificationIds[i] = item + } + } + + return &ret +} + +// MaterialInfo +type MaterialInfo struct { + // 物料码ID + MaterialId *string `json:"material_id,omitempty"` + // 物料码链接, 用于生成活动物料二维码 + MaterialUrl *string `json:"material_url,omitempty"` +} + +func (o MaterialInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.MaterialId != nil { + toSerialize["material_id"] = o.MaterialId + } + + if o.MaterialUrl != nil { + toSerialize["material_url"] = o.MaterialUrl + } + return json.Marshal(toSerialize) +} + +func (o MaterialInfo) String() string { + var ret string + if o.MaterialId == nil { + ret += "MaterialId:, " + } else { + ret += fmt.Sprintf("MaterialId:%v, ", *o.MaterialId) + } + + if o.MaterialUrl == nil { + ret += "MaterialUrl:" + } else { + ret += fmt.Sprintf("MaterialUrl:%v", *o.MaterialUrl) + } + + return fmt.Sprintf("MaterialInfo{%s}", ret) +} + +func (o MaterialInfo) Clone() *MaterialInfo { + ret := MaterialInfo{} + + if o.MaterialId != nil { + ret.MaterialId = new(string) + *ret.MaterialId = *o.MaterialId + } + + if o.MaterialUrl != nil { + ret.MaterialUrl = new(string) + *ret.MaterialUrl = *o.MaterialUrl + } + + return &ret +} + +// Materials +type Materials struct { + // 成功的物料码列表 + MaterialList []MaterialInfo `json:"material_list,omitempty"` +} + +func (o Materials) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.MaterialList != nil { + toSerialize["material_list"] = o.MaterialList + } + return json.Marshal(toSerialize) +} + +func (o Materials) String() string { + var ret string + ret += fmt.Sprintf("MaterialList:%v", o.MaterialList) + + return fmt.Sprintf("Materials{%s}", ret) +} + +func (o Materials) Clone() *Materials { + ret := Materials{} + + if o.MaterialList != nil { + ret.MaterialList = make([]MaterialInfo, len(o.MaterialList)) + for i, item := range o.MaterialList { + ret.MaterialList[i] = *item.Clone() + } + } + + return &ret +} + +// OrderInfo +type OrderInfo struct { + // 支付订单的微信用户OpenID + PayerOpenid *string `json:"payer_openid"` + // 商户订单号 + OutTradeNo *string `json:"out_trade_no"` + // 订单总金额(单位:分) + TotalFee *int64 `json:"total_fee"` + // 门店ID + StoreId *string `json:"store_id"` + // 门店商户号 + StoreMerchantId *string `json:"store_merchant_id"` +} + +func (o OrderInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.PayerOpenid == nil { + return nil, fmt.Errorf("field `PayerOpenid` is required and must be specified in OrderInfo") + } + toSerialize["payer_openid"] = o.PayerOpenid + + if o.OutTradeNo == nil { + return nil, fmt.Errorf("field `OutTradeNo` is required and must be specified in OrderInfo") + } + toSerialize["out_trade_no"] = o.OutTradeNo + + if o.TotalFee == nil { + return nil, fmt.Errorf("field `TotalFee` is required and must be specified in OrderInfo") + } + toSerialize["total_fee"] = o.TotalFee + + if o.StoreId == nil { + return nil, fmt.Errorf("field `StoreId` is required and must be specified in OrderInfo") + } + toSerialize["store_id"] = o.StoreId + + if o.StoreMerchantId == nil { + return nil, fmt.Errorf("field `StoreMerchantId` is required and must be specified in OrderInfo") + } + toSerialize["store_merchant_id"] = o.StoreMerchantId + return json.Marshal(toSerialize) +} + +func (o OrderInfo) String() string { + var ret string + if o.PayerOpenid == nil { + ret += "PayerOpenid:, " + } else { + ret += fmt.Sprintf("PayerOpenid:%v, ", *o.PayerOpenid) + } + + if o.OutTradeNo == nil { + ret += "OutTradeNo:, " + } else { + ret += fmt.Sprintf("OutTradeNo:%v, ", *o.OutTradeNo) + } + + if o.TotalFee == nil { + ret += "TotalFee:, " + } else { + ret += fmt.Sprintf("TotalFee:%v, ", *o.TotalFee) + } + + if o.StoreId == nil { + ret += "StoreId:, " + } else { + ret += fmt.Sprintf("StoreId:%v, ", *o.StoreId) + } + + if o.StoreMerchantId == nil { + ret += "StoreMerchantId:" + } else { + ret += fmt.Sprintf("StoreMerchantId:%v", *o.StoreMerchantId) + } + + return fmt.Sprintf("OrderInfo{%s}", ret) +} + +func (o OrderInfo) Clone() *OrderInfo { + ret := OrderInfo{} + + if o.PayerOpenid != nil { + ret.PayerOpenid = new(string) + *ret.PayerOpenid = *o.PayerOpenid + } + + if o.OutTradeNo != nil { + ret.OutTradeNo = new(string) + *ret.OutTradeNo = *o.OutTradeNo + } + + if o.TotalFee != nil { + ret.TotalFee = new(int64) + *ret.TotalFee = *o.TotalFee + } + + if o.StoreId != nil { + ret.StoreId = new(string) + *ret.StoreId = *o.StoreId + } + + if o.StoreMerchantId != nil { + ret.StoreMerchantId = new(string) + *ret.StoreMerchantId = *o.StoreMerchantId + } + + return &ret +} + +// RepresentativeInfo +type RepresentativeInfo struct { + // [获取openid请查看文档](https://pay.weixin.qq.com/wiki/doc/apiv3_partner/terms_definition/chapter1_1_3.shtml) + Openid *string `json:"openid"` +} + +func (o RepresentativeInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.Openid == nil { + return nil, fmt.Errorf("field `Openid` is required and must be specified in RepresentativeInfo") + } + toSerialize["openid"] = o.Openid + return json.Marshal(toSerialize) +} + +func (o RepresentativeInfo) String() string { + var ret string + if o.Openid == nil { + ret += "Openid:" + } else { + ret += fmt.Sprintf("Openid:%v", *o.Openid) + } + + return fmt.Sprintf("RepresentativeInfo{%s}", ret) +} + +func (o RepresentativeInfo) Clone() *RepresentativeInfo { + ret := RepresentativeInfo{} + + if o.Openid != nil { + ret.Openid = new(string) + *ret.Openid = *o.Openid + } + + 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"` +} + +func (o Representatives) 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.AddTime == nil { + return nil, fmt.Errorf("field `AddTime` is required and must be specified in Representatives") + } + toSerialize["add_time"] = o.AddTime + return json.Marshal(toSerialize) +} + +func (o Representatives) 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("Representatives{%s}", ret) +} + +func (o Representatives) Clone() *Representatives { + ret := Representatives{} + + 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 +} + +// StoreInfo +type StoreInfo struct { + // 门店ID + StoreId *string `json:"store_id"` + // 门店指定的品牌补贴收款商户号 + AccountingMerchantId *string `json:"accounting_merchant_id"` + // 报名门店的商户号,即门店收款商户号 + MerchantId *string `json:"merchant_id"` +} + +func (o StoreInfo) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.StoreId == nil { + return nil, fmt.Errorf("field `StoreId` is required and must be specified in StoreInfo") + } + toSerialize["store_id"] = o.StoreId + + if o.AccountingMerchantId == nil { + return nil, fmt.Errorf("field `AccountingMerchantId` is required and must be specified in StoreInfo") + } + toSerialize["accounting_merchant_id"] = o.AccountingMerchantId + + if o.MerchantId == nil { + return nil, fmt.Errorf("field `MerchantId` is required and must be specified in StoreInfo") + } + toSerialize["merchant_id"] = o.MerchantId + return json.Marshal(toSerialize) +} + +func (o StoreInfo) String() string { + var ret string + if o.StoreId == nil { + ret += "StoreId:, " + } else { + ret += fmt.Sprintf("StoreId:%v, ", *o.StoreId) + } + + if o.AccountingMerchantId == nil { + ret += "AccountingMerchantId:, " + } else { + ret += fmt.Sprintf("AccountingMerchantId:%v, ", *o.AccountingMerchantId) + } + + if o.MerchantId == nil { + ret += "MerchantId:" + } else { + ret += fmt.Sprintf("MerchantId:%v", *o.MerchantId) + } + + return fmt.Sprintf("StoreInfo{%s}", ret) +} + +func (o StoreInfo) Clone() *StoreInfo { + ret := StoreInfo{} + + if o.StoreId != nil { + ret.StoreId = new(string) + *ret.StoreId = *o.StoreId + } + + if o.AccountingMerchantId != nil { + ret.AccountingMerchantId = new(string) + *ret.AccountingMerchantId = *o.AccountingMerchantId + } + + if o.MerchantId != nil { + ret.MerchantId = new(string) + *ret.MerchantId = *o.MerchantId + } + + return &ret +} + +// UnlockQualificationRequest +type UnlockQualificationRequest struct { + // 订单信息 + OrderInformation *OrderInfo `json:"order_information"` + // 待锁定的加价购资格ID列表 + QualificationIds []string `json:"qualification_ids,omitempty"` +} + +func (o UnlockQualificationRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.OrderInformation == nil { + return nil, fmt.Errorf("field `OrderInformation` is required and must be specified in UnlockQualificationRequest") + } + toSerialize["order_information"] = o.OrderInformation + + if o.QualificationIds != nil { + toSerialize["qualification_ids"] = o.QualificationIds + } + return json.Marshal(toSerialize) +} + +func (o UnlockQualificationRequest) String() string { + var ret string + ret += fmt.Sprintf("OrderInformation:%v, ", o.OrderInformation) + + ret += fmt.Sprintf("QualificationIds:%v", o.QualificationIds) + + return fmt.Sprintf("UnlockQualificationRequest{%s}", ret) +} + +func (o UnlockQualificationRequest) Clone() *UnlockQualificationRequest { + ret := UnlockQualificationRequest{} + + if o.OrderInformation != nil { + ret.OrderInformation = o.OrderInformation.Clone() + } + + if o.QualificationIds != nil { + ret.QualificationIds = make([]string, len(o.QualificationIds)) + for i, item := range o.QualificationIds { + ret.QualificationIds[i] = item + } + } + + return &ret +} + +// UnlockQualificationResponse +type UnlockQualificationResponse struct { + // 返回结果文案 + ReturnMessage *string `json:"return_message,omitempty"` + // 解锁成功的资格列表 + SucceedQualificationIds []string `json:"succeed_qualification_ids,omitempty"` + // 解锁失败的资格ID列表 + FailedQualificationIds []string `json:"failed_qualification_ids,omitempty"` +} + +func (o UnlockQualificationResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + + if o.ReturnMessage != nil { + toSerialize["return_message"] = o.ReturnMessage + } + + if o.SucceedQualificationIds != nil { + toSerialize["succeed_qualification_ids"] = o.SucceedQualificationIds + } + + if o.FailedQualificationIds != nil { + toSerialize["failed_qualification_ids"] = o.FailedQualificationIds + } + return json.Marshal(toSerialize) +} + +func (o UnlockQualificationResponse) String() string { + var ret string + if o.ReturnMessage == nil { + ret += "ReturnMessage:, " + } else { + ret += fmt.Sprintf("ReturnMessage:%v, ", *o.ReturnMessage) + } + + ret += fmt.Sprintf("SucceedQualificationIds:%v, ", o.SucceedQualificationIds) + + ret += fmt.Sprintf("FailedQualificationIds:%v", o.FailedQualificationIds) + + return fmt.Sprintf("UnlockQualificationResponse{%s}", ret) +} + +func (o UnlockQualificationResponse) Clone() *UnlockQualificationResponse { + ret := UnlockQualificationResponse{} + + if o.ReturnMessage != nil { + ret.ReturnMessage = new(string) + *ret.ReturnMessage = *o.ReturnMessage + } + + if o.SucceedQualificationIds != nil { + ret.SucceedQualificationIds = make([]string, len(o.SucceedQualificationIds)) + for i, item := range o.SucceedQualificationIds { + ret.SucceedQualificationIds[i] = item + } + } + + if o.FailedQualificationIds != nil { + ret.FailedQualificationIds = make([]string, len(o.FailedQualificationIds)) + for i, item := range o.FailedQualificationIds { + ret.FailedQualificationIds[i] = item + } + } + + return &ret +}