goldplan

package
v0.2.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeCustomPageStatusRequest

type ChangeCustomPageStatusRequest struct {
	// 开通或关闭“商家自定义小票”的特约商户商户号,由微信支付生成并下发。
	SubMchid *string `json:"sub_mchid"`
	// 开通或关闭“商家自定义小票”的动作,枚举值:  OPEN:表示开通  CLOSE:表示关闭
	OperationType *OperationType `json:"operation_type"`
}

ChangeCustomPageStatusRequest

func (ChangeCustomPageStatusRequest) Clone

func (ChangeCustomPageStatusRequest) MarshalJSON

func (o ChangeCustomPageStatusRequest) MarshalJSON() ([]byte, error)

func (ChangeCustomPageStatusRequest) String

type ChangeCustomPageStatusResponse

type ChangeCustomPageStatusResponse struct {
	// 开通或关闭“商家自定义小票”的特约商户商户号,由微信支付生成并下发。
	SubMchid *string `json:"sub_mchid"`
}

ChangeCustomPageStatusResponse

func (ChangeCustomPageStatusResponse) Clone

func (ChangeCustomPageStatusResponse) MarshalJSON

func (o ChangeCustomPageStatusResponse) MarshalJSON() ([]byte, error)

func (ChangeCustomPageStatusResponse) String

type ChangeGoldPlanStatusRequest

type ChangeGoldPlanStatusRequest struct {
	// 开通或关闭点金计划的特约商户商户号,由微信支付生成并下发。
	SubMchid *string `json:"sub_mchid"`
	// 开通或关闭点金计划的动作,枚举值:  OPEN:表示开通点金计划  CLOSE:表示关闭点金计划
	OperationType *OperationType `json:"operation_type"`
	// 支付场景,指定开通点金计划的支付场景。如果未指定,则默认全部打开
	OperationPayScene *OperationPayScene `json:"operation_pay_scene,omitempty"`
}

ChangeGoldPlanStatusRequest

func (ChangeGoldPlanStatusRequest) Clone

func (ChangeGoldPlanStatusRequest) MarshalJSON

func (o ChangeGoldPlanStatusRequest) MarshalJSON() ([]byte, error)

func (ChangeGoldPlanStatusRequest) String

type ChangeGoldPlanStatusResponse

type ChangeGoldPlanStatusResponse struct {
	// 开通或关闭“商家自定义小票”的特约商户商户号,由微信支付生成并下发。
	SubMchid *string `json:"sub_mchid"`
}

ChangeGoldPlanStatusResponse

func (ChangeGoldPlanStatusResponse) Clone

func (ChangeGoldPlanStatusResponse) MarshalJSON

func (o ChangeGoldPlanStatusResponse) MarshalJSON() ([]byte, error)

func (ChangeGoldPlanStatusResponse) String

type CloseAdvertisingShowRequest

type CloseAdvertisingShowRequest struct {
	// 需要关闭广告展示的特约商户号,由微信支付生成并下发。
	SubMchid *string `json:"sub_mchid"`
}

CloseAdvertisingShowRequest

func (CloseAdvertisingShowRequest) Clone

func (CloseAdvertisingShowRequest) MarshalJSON

func (o CloseAdvertisingShowRequest) MarshalJSON() ([]byte, error)

func (CloseAdvertisingShowRequest) String

type IndustryType

type IndustryType string

IndustryType 同业过滤标签枚举值

const (
	INDUSTRYTYPE_E_COMMERCE        IndustryType = "E_COMMERCE"
	INDUSTRYTYPE_LOVE_MARRIAGE     IndustryType = "LOVE_MARRIAGE"
	INDUSTRYTYPE_POTOGRAPHY        IndustryType = "POTOGRAPHY"
	INDUSTRYTYPE_EDUCATION         IndustryType = "EDUCATION"
	INDUSTRYTYPE_FINANCE           IndustryType = "FINANCE"
	INDUSTRYTYPE_TOURISM           IndustryType = "TOURISM"
	INDUSTRYTYPE_SKINCARE          IndustryType = "SKINCARE"
	INDUSTRYTYPE_FOOD              IndustryType = "FOOD"
	INDUSTRYTYPE_SPORT             IndustryType = "SPORT"
	INDUSTRYTYPE_JEWELRY_WATCH     IndustryType = "JEWELRY_WATCH"
	INDUSTRYTYPE_HEALTHCARE        IndustryType = "HEALTHCARE"
	INDUSTRYTYPE_BUSSINESS         IndustryType = "BUSSINESS"
	INDUSTRYTYPE_PARENTING         IndustryType = "PARENTING"
	INDUSTRYTYPE_CATERING          IndustryType = "CATERING"
	INDUSTRYTYPE_RETAIL            IndustryType = "RETAIL"
	INDUSTRYTYPE_SERVICES          IndustryType = "SERVICES"
	INDUSTRYTYPE_LAW               IndustryType = "LAW"
	INDUSTRYTYPE_ESTATE            IndustryType = "ESTATE"
	INDUSTRYTYPE_TRANSPORTATION    IndustryType = "TRANSPORTATION"
	INDUSTRYTYPE_ENERGY_SAVING     IndustryType = "ENERGY_SAVING"
	INDUSTRYTYPE_SECURITY          IndustryType = "SECURITY"
	INDUSTRYTYPE_BUILDING_MATERIAL IndustryType = "BUILDING_MATERIAL"
	INDUSTRYTYPE_COMMUNICATION     IndustryType = "COMMUNICATION"
	INDUSTRYTYPE_MERCHANDISE       IndustryType = "MERCHANDISE"
	INDUSTRYTYPE_ASSOCIATION       IndustryType = "ASSOCIATION"
	INDUSTRYTYPE_COMMUNITY         IndustryType = "COMMUNITY"
	INDUSTRYTYPE_ONLINE_AVR        IndustryType = "ONLINE_AVR"
	INDUSTRYTYPE_WE_MEDIA          IndustryType = "WE_MEDIA"
	INDUSTRYTYPE_CAR               IndustryType = "CAR"
	INDUSTRYTYPE_SOFTWARE          IndustryType = "SOFTWARE"
	INDUSTRYTYPE_GAME              IndustryType = "GAME"
	INDUSTRYTYPE_CLOTHING          IndustryType = "CLOTHING"
	INDUSTRYTYPE_INDUSTY           IndustryType = "INDUSTY"
	INDUSTRYTYPE_AGRICULTURE       IndustryType = "AGRICULTURE"
	INDUSTRYTYPE_PUBLISHING_MEDIA  IndustryType = "PUBLISHING_MEDIA"
	INDUSTRYTYPE_HOME_DIGITAL      IndustryType = "HOME_DIGITAL"
)

Enums of IndustryType

func (IndustryType) Ptr

func (e IndustryType) Ptr() *IndustryType

type MerchantsApiService

type MerchantsApiService services.Service

func (*MerchantsApiService) CloseAdvertisingShow

func (a *MerchantsApiService) CloseAdvertisingShow(ctx context.Context, req CloseAdvertisingShowRequest) (result *core.APIResult, err error)

CloseAdvertisingShow 关闭广告展示

使用此接口为特约商户的点金计划页面关闭广告展示功能

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/goldplan"
	"github.com/rjm521/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 := goldplan.MerchantsApiService{Client: client}
	result, err := svc.CloseAdvertisingShow(ctx,
		goldplan.CloseAdvertisingShowRequest{
			SubMchid: core.String("1900000109"),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call CloseAdvertisingShow err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d", result.Response.StatusCode)
	}
}
Output:

func (*MerchantsApiService) OpenAdvertisingShow

func (a *MerchantsApiService) OpenAdvertisingShow(ctx context.Context, req OpenAdvertisingShowRequest) (result *core.APIResult, err error)

OpenAdvertisingShow 开通广告展示

此接口为特约商户的点金计划页面开通广告展示功能,可同时配置同业过滤标签,防止特约商户支付后出现同行业的广告内容。最多传入3个同业过滤标签值

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/goldplan"
	"github.com/rjm521/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 := goldplan.MerchantsApiService{Client: client}
	result, err := svc.OpenAdvertisingShow(ctx,
		goldplan.OpenAdvertisingShowRequest{
			SubMchid:                   core.String("1900000109"),
			AdvertisingIndustryFilters: []goldplan.IndustryType{goldplan.INDUSTRYTYPE_E_COMMERCE},
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call OpenAdvertisingShow err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d", result.Response.StatusCode)
	}
}
Output:

func (*MerchantsApiService) SetAdvertisingIndustryFilter

func (a *MerchantsApiService) SetAdvertisingIndustryFilter(ctx context.Context, req SetAdvertisingIndustryFilterRequest) (result *core.APIResult, err error)

SetAdvertisingIndustryFilter 同业过滤标签管理

服务商帮助特约商户设置点金计划同业过滤信息,最多传入3个同业过滤标签值

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/goldplan"
	"github.com/rjm521/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 := goldplan.MerchantsApiService{Client: client}
	result, err := svc.SetAdvertisingIndustryFilter(ctx,
		goldplan.SetAdvertisingIndustryFilterRequest{
			SubMchid:                   core.String("1900000109"),
			AdvertisingIndustryFilters: []goldplan.IndustryType{goldplan.INDUSTRYTYPE_E_COMMERCE},
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call SetAdvertisingIndustryFilter err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d", result.Response.StatusCode)
	}
}
Output:

type OpenAdvertisingShowRequest

type OpenAdvertisingShowRequest struct {
	// 需要开通广告展示的特约商户号,由微信支付生成并下发。
	SubMchid *string `json:"sub_mchid"`
	// 特约商户同业过滤的同业过滤标签值。如已设置同业过滤标签,再次请求传入,视为新增,将覆盖原有同业标签配置
	AdvertisingIndustryFilters []IndustryType `json:"advertising_industry_filters,omitempty"`
}

OpenAdvertisingShowRequest

func (OpenAdvertisingShowRequest) Clone

func (OpenAdvertisingShowRequest) MarshalJSON

func (o OpenAdvertisingShowRequest) MarshalJSON() ([]byte, error)

func (OpenAdvertisingShowRequest) String

type OperationPayScene

type OperationPayScene string

OperationPayScene

const (
	OPERATIONPAYSCENE_JSAPI_AND_MINIPROGRAM OperationPayScene = "JSAPI_AND_MINIPROGRAM"
	OPERATIONPAYSCENE_JSAPI                 OperationPayScene = "JSAPI"
	OPERATIONPAYSCENE_MINIPROGRAM           OperationPayScene = "MINIPROGRAM"
)

Enums of OperationPayScene

func (OperationPayScene) Ptr

type OperationType

type OperationType string

OperationType

const (
	OPERATIONTYPE_OPEN  OperationType = "OPEN"
	OPERATIONTYPE_CLOSE OperationType = "CLOSE"
)

Enums of OperationType

func (OperationType) Ptr

func (e OperationType) Ptr() *OperationType

type SetAdvertisingIndustryFilterRequest

type SetAdvertisingIndustryFilterRequest struct {
	// 需要设置“同业过滤标签”的特约商户号,由微信支付生成并下发。
	SubMchid *string `json:"sub_mchid"`
	// 特约商户同业过滤的同业过滤标签值,同业过滤标签最少传一个,最多三个。如已设置同业过滤标签,再次请求传入,视为新增,将覆盖原有同业标签配置。 注:若配置完成后需清空标签的,可登陆商户平台手动清空(路径:商户平台->服务商功能->点金计划->特约商户管理->同业过滤标签)
	AdvertisingIndustryFilters []IndustryType `json:"advertising_industry_filters"`
}

SetAdvertisingIndustryFilterRequest

func (SetAdvertisingIndustryFilterRequest) Clone

func (SetAdvertisingIndustryFilterRequest) MarshalJSON

func (o SetAdvertisingIndustryFilterRequest) MarshalJSON() ([]byte, error)

func (SetAdvertisingIndustryFilterRequest) String

type StatusApiService

type StatusApiService services.Service

func (*StatusApiService) ChangeCustomPageStatus

func (a *StatusApiService) ChangeCustomPageStatus(ctx context.Context, req ChangeCustomPageStatusRequest) (resp *ChangeCustomPageStatusResponse, result *core.APIResult, err error)

ChangeCustomPageStatus 商家小票管理

服务商使用此接口为特约商户开通或关闭商家小票功能。

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/goldplan"
	"github.com/rjm521/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 := goldplan.StatusApiService{Client: client}
	resp, result, err := svc.ChangeCustomPageStatus(ctx,
		goldplan.ChangeCustomPageStatusRequest{
			SubMchid:      core.String("1900000109"),
			OperationType: goldplan.OPERATIONTYPE_OPEN.Ptr(),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call ChangeCustomPageStatus err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

func (*StatusApiService) ChangeGoldPlanStatus

func (a *StatusApiService) ChangeGoldPlanStatus(ctx context.Context, req ChangeGoldPlanStatusRequest) (resp *ChangeGoldPlanStatusResponse, result *core.APIResult, err error)

ChangeGoldPlanStatus 点金计划管理

服务商为特约商户开通或关闭点金计划。

Example
package main

import (
	"context"
	"log"

	"github.com/rjm521/wechatpay-go/core"
	"github.com/rjm521/wechatpay-go/core/option"
	"github.com/rjm521/wechatpay-go/services/goldplan"
	"github.com/rjm521/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 := goldplan.StatusApiService{Client: client}
	resp, result, err := svc.ChangeGoldPlanStatus(ctx,
		goldplan.ChangeGoldPlanStatusRequest{
			SubMchid:          core.String("1900000109"),
			OperationType:     goldplan.OPERATIONTYPE_OPEN.Ptr(),
			OperationPayScene: goldplan.OPERATIONPAYSCENE_JSAPI_AND_MINIPROGRAM.Ptr(),
		},
	)

	if err != nil {
		// 处理错误
		log.Printf("call ChangeGoldPlanStatus err:%s", err)
	} else {
		// 处理返回结果
		log.Printf("status=%d resp=%s", result.Response.StatusCode, resp)
	}
}
Output:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL