api_retail_store_act.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. // Copyright 2021 Tencent Inc. All rights reserved.
  2. //
  3. // 营销加价购对外API
  4. //
  5. // 指定服务商可通过该接口报名加价购活动、查询某个区域内的加价购活动列表、锁定加价活动购资格以及解锁加价购活动资格。
  6. //
  7. // API version: 1.4.0
  8. // Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
  9. package retailstore
  10. import (
  11. "context"
  12. "fmt"
  13. nethttp "net/http"
  14. neturl "net/url"
  15. "strings"
  16. "git.nanodreamtech.com/sg/wechatpay-go/core"
  17. "git.nanodreamtech.com/sg/wechatpay-go/core/consts"
  18. "git.nanodreamtech.com/sg/wechatpay-go/services"
  19. )
  20. type RetailStoreActApiService services.Service
  21. // AddRepresentative 添加零售小店活动业务代理
  22. //
  23. // 该接口为服务商或商户给零售小店活动添加业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。
  24. func (a *RetailStoreActApiService) AddRepresentative(ctx context.Context, req AddRepresentativeRequest) (resp *AddRepresentativesResponse, result *core.APIResult, err error) {
  25. var (
  26. localVarHTTPMethod = nethttp.MethodPut
  27. localVarPostBody interface{}
  28. localVarQueryParams neturl.Values
  29. localVarHeaderParams = nethttp.Header{}
  30. )
  31. // Make sure Path Params are properly set
  32. if req.ActivityId == nil {
  33. return nil, nil, fmt.Errorf("field `ActivityId` is required and must be specified in AddRepresentativeRequest")
  34. }
  35. localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative"
  36. // Build Path with Path Params
  37. localVarPath = strings.Replace(localVarPath, "{"+"activity_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ActivityId, "")), -1)
  38. // Make sure All Required Params are properly set
  39. // Setup Body Params
  40. localVarPostBody = &AddRepresentativesRequest{
  41. RepresentativeInfoList: req.RepresentativeInfoList,
  42. OutRequestNo: req.OutRequestNo,
  43. AddTime: req.AddTime,
  44. }
  45. // Determine the Content-Type Header
  46. localVarHTTPContentTypes := []string{"application/json"}
  47. // Setup Content-Type
  48. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  49. // Perform Http Request
  50. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  51. if err != nil {
  52. return nil, result, err
  53. }
  54. // Extract AddRepresentativesResponse from Http Response
  55. resp = new(AddRepresentativesResponse)
  56. err = core.UnMarshalResponse(result.Response, resp)
  57. if err != nil {
  58. return nil, result, err
  59. }
  60. return resp, result, nil
  61. }
  62. // AddStores 添加小店活动门店
  63. //
  64. // 该接口为服务商或商户给零售小店活动添加门店专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。
  65. func (a *RetailStoreActApiService) AddStores(ctx context.Context, req AddStoresRequest) (resp *AddStoresResponse, result *core.APIResult, err error) {
  66. var (
  67. localVarHTTPMethod = nethttp.MethodPost
  68. localVarPostBody interface{}
  69. localVarQueryParams neturl.Values
  70. localVarHeaderParams = nethttp.Header{}
  71. )
  72. // Make sure Path Params are properly set
  73. if req.BrandId == nil {
  74. return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in AddStoresRequest")
  75. }
  76. localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores"
  77. // Build Path with Path Params
  78. localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1)
  79. // Make sure All Required Params are properly set
  80. // Setup Body Params
  81. localVarPostBody = &AddStoresBody{
  82. OutRequestNo: req.OutRequestNo,
  83. AddTime: req.AddTime,
  84. Stores: req.Stores,
  85. }
  86. // Determine the Content-Type Header
  87. localVarHTTPContentTypes := []string{"application/json"}
  88. // Setup Content-Type
  89. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  90. // Perform Http Request
  91. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  92. if err != nil {
  93. return nil, result, err
  94. }
  95. // Extract AddStoresResponse from Http Response
  96. resp = new(AddStoresResponse)
  97. err = core.UnMarshalResponse(result.Response, resp)
  98. if err != nil {
  99. return nil, result, err
  100. }
  101. return resp, result, nil
  102. }
  103. // CreateMaterials 生成小店活动物料码
  104. //
  105. // 该接口为服务商或商户给零售小店活动申请物料码专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。
  106. func (a *RetailStoreActApiService) CreateMaterials(ctx context.Context, req CreateMaterialsRequest) (resp *Materials, result *core.APIResult, err error) {
  107. var (
  108. localVarHTTPMethod = nethttp.MethodPost
  109. localVarPostBody interface{}
  110. localVarQueryParams neturl.Values
  111. localVarHeaderParams = nethttp.Header{}
  112. )
  113. // Make sure Path Params are properly set
  114. if req.BrandId == nil {
  115. return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in CreateMaterialsRequest")
  116. }
  117. localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/materials"
  118. // Build Path with Path Params
  119. localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1)
  120. // Make sure All Required Params are properly set
  121. // Setup Body Params
  122. localVarPostBody = &CreateMaterialsBody{
  123. OutRequestNo: req.OutRequestNo,
  124. MaterialNum: req.MaterialNum,
  125. }
  126. // Determine the Content-Type Header
  127. localVarHTTPContentTypes := []string{"application/json"}
  128. // Setup Content-Type
  129. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  130. // Perform Http Request
  131. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  132. if err != nil {
  133. return nil, result, err
  134. }
  135. // Extract Materials from Http Response
  136. resp = new(Materials)
  137. err = core.UnMarshalResponse(result.Response, resp)
  138. if err != nil {
  139. return nil, result, err
  140. }
  141. return resp, result, nil
  142. }
  143. // DeleteRepresentative 删除零售小店活动业务代理
  144. //
  145. // 该接口为服务商或商户给零售小店活动删除业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。
  146. func (a *RetailStoreActApiService) DeleteRepresentative(ctx context.Context, req DeleteRepresentativeRequest) (resp *DeleteRepresentativeResponse, result *core.APIResult, err error) {
  147. var (
  148. localVarHTTPMethod = nethttp.MethodDelete
  149. localVarPostBody interface{}
  150. localVarQueryParams neturl.Values
  151. localVarHeaderParams = nethttp.Header{}
  152. )
  153. // Make sure Path Params are properly set
  154. if req.ActivityId == nil {
  155. return nil, nil, fmt.Errorf("field `ActivityId` is required and must be specified in DeleteRepresentativeRequest")
  156. }
  157. localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representative"
  158. // Build Path with Path Params
  159. localVarPath = strings.Replace(localVarPath, "{"+"activity_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ActivityId, "")), -1)
  160. // Make sure All Required Params are properly set
  161. // Setup Body Params
  162. localVarPostBody = &DeleteRepresentativeBody{
  163. RepresentativeInfoList: req.RepresentativeInfoList,
  164. OutRequestNo: req.OutRequestNo,
  165. DeleteTime: req.DeleteTime,
  166. }
  167. // Determine the Content-Type Header
  168. localVarHTTPContentTypes := []string{"application/json"}
  169. // Setup Content-Type
  170. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  171. // Perform Http Request
  172. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  173. if err != nil {
  174. return nil, result, err
  175. }
  176. // Extract DeleteRepresentativeResponse from Http Response
  177. resp = new(DeleteRepresentativeResponse)
  178. err = core.UnMarshalResponse(result.Response, resp)
  179. if err != nil {
  180. return nil, result, err
  181. }
  182. return resp, result, nil
  183. }
  184. // DeleteStores 删除小店活动门店
  185. //
  186. // 该接口为服务商或商户给零售小店活动删除门店专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。
  187. func (a *RetailStoreActApiService) DeleteStores(ctx context.Context, req DeleteStoresRequest) (resp *DeleteStoresResponse, result *core.APIResult, err error) {
  188. var (
  189. localVarHTTPMethod = nethttp.MethodDelete
  190. localVarPostBody interface{}
  191. localVarQueryParams neturl.Values
  192. localVarHeaderParams = nethttp.Header{}
  193. )
  194. // Make sure Path Params are properly set
  195. if req.BrandId == nil {
  196. return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in DeleteStoresRequest")
  197. }
  198. localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores"
  199. // Build Path with Path Params
  200. localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1)
  201. // Make sure All Required Params are properly set
  202. // Setup Body Params
  203. localVarPostBody = &DeleteStoresBody{
  204. OutRequestNo: req.OutRequestNo,
  205. DeleteTime: req.DeleteTime,
  206. Stores: req.Stores,
  207. }
  208. // Determine the Content-Type Header
  209. localVarHTTPContentTypes := []string{"application/json"}
  210. // Setup Content-Type
  211. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  212. // Perform Http Request
  213. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  214. if err != nil {
  215. return nil, result, err
  216. }
  217. // Extract DeleteStoresResponse from Http Response
  218. resp = new(DeleteStoresResponse)
  219. err = core.UnMarshalResponse(result.Response, resp)
  220. if err != nil {
  221. return nil, result, err
  222. }
  223. return resp, result, nil
  224. }
  225. // GetStore 查询小店活动门店详情
  226. //
  227. // 该接口为服务商或商户给零售小店活动查询门店详情专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。
  228. func (a *RetailStoreActApiService) GetStore(ctx context.Context, req GetStoreRequest) (resp *RetailStoreInfo, result *core.APIResult, err error) {
  229. var (
  230. localVarHTTPMethod = nethttp.MethodGet
  231. localVarPostBody interface{}
  232. localVarQueryParams neturl.Values
  233. localVarHeaderParams = nethttp.Header{}
  234. )
  235. // Make sure Path Params are properly set
  236. if req.BrandId == nil {
  237. return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in GetStoreRequest")
  238. }
  239. if req.StoreCode == nil {
  240. return nil, nil, fmt.Errorf("field `StoreCode` is required and must be specified in GetStoreRequest")
  241. }
  242. localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores/{store_code}"
  243. // Build Path with Path Params
  244. localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1)
  245. localVarPath = strings.Replace(localVarPath, "{"+"store_code"+"}", neturl.PathEscape(core.ParameterToString(*req.StoreCode, "")), -1)
  246. // Make sure All Required Params are properly set
  247. // Determine the Content-Type Header
  248. localVarHTTPContentTypes := []string{}
  249. // Setup Content-Type
  250. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  251. // Perform Http Request
  252. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  253. if err != nil {
  254. return nil, result, err
  255. }
  256. // Extract RetailStoreInfo from Http Response
  257. resp = new(RetailStoreInfo)
  258. err = core.UnMarshalResponse(result.Response, resp)
  259. if err != nil {
  260. return nil, result, err
  261. }
  262. return resp, result, nil
  263. }
  264. // ListRepresentative 查询零售小店活动业务代理
  265. //
  266. // 该接口为服务商或商户给零售小店活动查询业务代理的专用接口。 使用对象:活动创建方商户号、活动归属品牌的品牌主商户号或品牌经营商户号。
  267. func (a *RetailStoreActApiService) ListRepresentative(ctx context.Context, req ListRepresentativeRequest) (resp *ListRepresentativeResponse, result *core.APIResult, err error) {
  268. var (
  269. localVarHTTPMethod = nethttp.MethodGet
  270. localVarPostBody interface{}
  271. localVarQueryParams neturl.Values
  272. localVarHeaderParams = nethttp.Header{}
  273. )
  274. // Make sure Path Params are properly set
  275. if req.ActivityId == nil {
  276. return nil, nil, fmt.Errorf("field `ActivityId` is required and must be specified in ListRepresentativeRequest")
  277. }
  278. localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{activity_id}/representatives"
  279. // Build Path with Path Params
  280. localVarPath = strings.Replace(localVarPath, "{"+"activity_id"+"}", neturl.PathEscape(core.ParameterToString(*req.ActivityId, "")), -1)
  281. // Make sure All Required Params are properly set
  282. if req.Offset == nil {
  283. return nil, nil, fmt.Errorf("field `Offset` is required and must be specified in ListRepresentativeRequest")
  284. }
  285. if req.Limit == nil {
  286. return nil, nil, fmt.Errorf("field `Limit` is required and must be specified in ListRepresentativeRequest")
  287. }
  288. // Setup Query Params
  289. localVarQueryParams = neturl.Values{}
  290. localVarQueryParams.Add("offset", core.ParameterToString(*req.Offset, ""))
  291. localVarQueryParams.Add("limit", core.ParameterToString(*req.Limit, ""))
  292. // Determine the Content-Type Header
  293. localVarHTTPContentTypes := []string{}
  294. // Setup Content-Type
  295. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  296. // Perform Http Request
  297. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  298. if err != nil {
  299. return nil, result, err
  300. }
  301. // Extract ListRepresentativeResponse from Http Response
  302. resp = new(ListRepresentativeResponse)
  303. err = core.UnMarshalResponse(result.Response, resp)
  304. if err != nil {
  305. return nil, result, err
  306. }
  307. return resp, result, nil
  308. }
  309. // ListStore 查询小店活动门店列表
  310. //
  311. // 该接口为服务商或商户给零售小店活动查询门店列表专用接口。 使用对象:品牌的品牌主商户号或品牌服务商。
  312. func (a *RetailStoreActApiService) ListStore(ctx context.Context, req ListStoreRequest) (resp *ListStoreResponse, result *core.APIResult, err error) {
  313. var (
  314. localVarHTTPMethod = nethttp.MethodGet
  315. localVarPostBody interface{}
  316. localVarQueryParams neturl.Values
  317. localVarHeaderParams = nethttp.Header{}
  318. )
  319. // Make sure Path Params are properly set
  320. if req.BrandId == nil {
  321. return nil, nil, fmt.Errorf("field `BrandId` is required and must be specified in ListStoreRequest")
  322. }
  323. localVarPath := consts.WechatPayAPIServer + "/v3/marketing/goods-subsidy-activity/retail-store-act/{brand_id}/stores"
  324. // Build Path with Path Params
  325. localVarPath = strings.Replace(localVarPath, "{"+"brand_id"+"}", neturl.PathEscape(core.ParameterToString(*req.BrandId, "")), -1)
  326. // Make sure All Required Params are properly set
  327. if req.Offset == nil {
  328. return nil, nil, fmt.Errorf("field `Offset` is required and must be specified in ListStoreRequest")
  329. }
  330. if req.Limit == nil {
  331. return nil, nil, fmt.Errorf("field `Limit` is required and must be specified in ListStoreRequest")
  332. }
  333. // Setup Query Params
  334. localVarQueryParams = neturl.Values{}
  335. localVarQueryParams.Add("offset", core.ParameterToString(*req.Offset, ""))
  336. localVarQueryParams.Add("limit", core.ParameterToString(*req.Limit, ""))
  337. // Determine the Content-Type Header
  338. localVarHTTPContentTypes := []string{}
  339. // Setup Content-Type
  340. localVarHTTPContentType := core.SelectHeaderContentType(localVarHTTPContentTypes)
  341. // Perform Http Request
  342. result, err = a.Client.Request(ctx, localVarHTTPMethod, localVarPath, localVarHeaderParams, localVarQueryParams, localVarPostBody, localVarHTTPContentType)
  343. if err != nil {
  344. return nil, result, err
  345. }
  346. // Extract ListStoreResponse from Http Response
  347. resp = new(ListStoreResponse)
  348. err = core.UnMarshalResponse(result.Response, resp)
  349. if err != nil {
  350. return nil, result, err
  351. }
  352. return resp, result, nil
  353. }