123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- // Copyright 2021 Tencent Inc. All rights reserved.
- //
- // 营销商家券对外API
- //
- // No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
- //
- // API version: 0.0.11
- // Code generated by WechatPay APIv3 Generator based on [OpenAPI Generator](https://openapi-generator.tech); DO NOT EDIT.
- package merchantexclusivecoupon
- import (
- "context"
- nethttp "net/http"
- neturl "net/url"
- "git.nanodreamtech.com/sg/wechatpay-go/core"
- "git.nanodreamtech.com/sg/wechatpay-go/core/consts"
- "git.nanodreamtech.com/sg/wechatpay-go/services"
- )
- type CallBackApiService services.Service
- // GetCouponNotify 获取商家券事件通知地址
- //
- // 使用场景:用于查询设置的通知URL
- // 限制条件:仅可以查询由请求商户号设置的商家券通知URL
- func (a *CallBackApiService) GetCouponNotify(ctx context.Context, req GetCouponNotifyRequest) (resp *GetCouponNotifyResponse, result *core.APIResult, err error) {
- var (
- localVarHTTPMethod = nethttp.MethodGet
- localVarPostBody interface{}
- localVarQueryParams neturl.Values
- localVarHeaderParams = nethttp.Header{}
- )
- localVarPath := consts.WechatPayAPIServer + "/v3/marketing/busifavor/callbacks"
- // Make sure All Required Params are properly set
- // Setup Query Params
- localVarQueryParams = neturl.Values{}
- if req.Mchid != nil {
- localVarQueryParams.Add("mchid", core.ParameterToString(*req.Mchid, ""))
- }
- // 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 GetCouponNotifyResponse from Http Response
- resp = new(GetCouponNotifyResponse)
- err = core.UnMarshalResponse(result.Response, resp)
- if err != nil {
- return nil, result, err
- }
- return resp, result, nil
- }
- // SetCouponNotify 设置商家券事件通知地址
- //
- // 用于设置接收商家券相关事件通知的URL,可接收商家券相关的事件通知、包括发放通知等。需要设置接收通知的URL,并在商户平台开通[营销事件推送](https://pay.weixin.qq.com/index.php/xphp/cmkt_product/index#/pages/product/product?pid=3)的能力,即可接收到相关通知。
- // 营销事件推送:[点击开通产品权限](https://pay.weixin.qq.com/index.php/core/home/login?return_url=%2Findex.php%2Fxphp%2Fcmkt_product%2Findex#/pages/product/product?pid=3)。由商家券批次创建方登录Pay平台,操作开通
- //
- // #### 注意
- // • 仅可以收到由商户自己创建的批次相关的通知
- // • 需要设置apiv3密钥,否则无法收到回调。
- // • 如果需要领券回调中的参数OpenID。需要创券时候传入notify\_appid参数。
- func (a *CallBackApiService) SetCouponNotify(ctx context.Context, req SetCouponNotifyRequest) (resp *SetCouponNotifyResponse, result *core.APIResult, err error) {
- var (
- localVarHTTPMethod = nethttp.MethodPost
- localVarPostBody interface{}
- localVarQueryParams neturl.Values
- localVarHeaderParams = nethttp.Header{}
- )
- localVarPath := consts.WechatPayAPIServer + "/v3/marketing/busifavor/callbacks"
- // 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 SetCouponNotifyResponse from Http Response
- resp = new(SetCouponNotifyResponse)
- err = core.UnMarshalResponse(result.Response, resp)
- if err != nil {
- return nil, result, err
- }
- return resp, result, nil
- }
|