douyin

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DyCheckSign

func DyCheckSign(timestamp, nonce, body, signature, pubKeyStr string) (bool, error)

验签示例

func PemToRSAPublicKey

func PemToRSAPublicKey(pemKeyStr string) (*rsa.PublicKey, error)

Types

type AccessTokenData

type AccessTokenData struct {
	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
}

type AccessTokenReq

type AccessTokenReq struct {
	AppId     string `json:"appid"`
	Secret    string `json:"secret"`
	GrantType string `json:"grant_type"`
}

type AccessTokenResp

type AccessTokenResp struct {
	Data    *AccessTokenData `json:"data,omitempty"`
	ErrCode int              `json:"err_no"`
	ErrMsg  string           `json:"err_tips"`
}

type CensorImgResponse

type CensorImgResponse struct {
	ErrCode   int       `json:"error,omitempty"`
	ErrMsg    string    `json:"message,omitempty"`
	Predicts  []Predict `json:"predicts,omitempty"`
	ModelName string    `json:"model_name,omitempty"`
	Hit       bool      `json:"hit,omitempty"`
}

type Client

type Client struct {
	AppId     string
	MchId     string
	ApiKey    string
	BaseURL   string
	NotifyUrl string
	Salt      string // 盐值
	Token     string // 支付设置 token
	IsProd    bool   // 是否生产环境

	DebugSwitch gopay.DebugSwitch // 调试开关,是否打印日志
	// contains filtered or unexported fields
}

Client douyin

func NewClient

func NewClient(appId, mchId, apiKey string, isProd bool) (client *Client)

NewClient 初始化抖音支付客户端 appId:应用ID mchId:商户ID ApiKey:API秘钥值 IsProd:是否是正式环境

func (*Client) GetByteAuthorization

func (u *Client) GetByteAuthorization(orderInfo *RequestOrderData, privateKeyStr, timestamp, keyVersion string) (string, error)

通用交易支付

func (*Client) SetBodySize

func (c *Client) SetBodySize(sizeMB int)

SetBodySize 设置http response body size(MB)

func (*Client) SetToken

func (c *Client) SetToken(token string)

func (*Client) VerifySign

func (c *Client) VerifySign(notifyReq *NotifyRequest) (err error)

担保支付回调签名算法 参数:"strArr" 所有字段(验证时注意不包含 sign 签名本身,不包含空字段与 type 常量字段)内容与平台上配置的 token

type Code2SessionData

type Code2SessionData struct {
	SessionKey      string `json:"session_key,omitempty"`
	OpenId          string `json:"openid,omitempty"`
	AnonymousOpenId string `json:"anonymous_openid,omitempty"`
	UnionId         string `json:"unionid,omitempty"`
}

type Code2SessionResponse

type Code2SessionResponse struct {
	ErrNo   int               `json:"err_no,omitempty"`   // 执行结果
	ErrTips string            `json:"err_tips,omitempty"` // 返回错误信息
	Data    *Code2SessionData `json:"data,omitempty"`
}

type CpsInfoData

type CpsInfoData struct {
	TotalFee string `json:"share_amount,omitempty"` // 达人分佣金额
	DouyinId string `json:"douyin_id,omitempty"`    // 达人抖音号
	Nickname string `json:"nickname,omitempty"`     // 达人昵称
}

type CreateOrderData

type CreateOrderData struct {
	OrderId    string `json:"order_id,omitempty"` // 抖音侧的订单号
	OrderToken string `json:"order_token,omitempty"`
}

type CreateOrderResponse

type CreateOrderResponse struct {
	ErrNo   int              `json:"err_no,omitempty"`   // 执行结果
	ErrTips string           `json:"err_tips,omitempty"` // 返回错误信息
	Data    *CreateOrderData `json:"data"`
}

type NotifyMsgResp

type NotifyMsgResp struct {
	AppId          string `json:"appid,omitempty"`            // 当前交易发起的小程序id
	CpOrderno      string `json:"cp_orderno,omitempty"`       // 开发者侧的订单号
	CpExtra        string `json:"cp_extra,omitempty"`         // 预下单时开发者传入字段
	Way            string `json:"way,omitempty"`              // 支付渠道 1-微信支付,2-支付宝支付,10-抖音支付
	ChannelNo      string `json:"channel_no,omitempty"`       // 支付渠道侧单号
	PaymentOrderNo string `json:"payment_order_no,omitempty"` // 支付渠道侧PC单号
	TotalAmount    int    `json:"total_amount,omitempty"`     // 支付金额,单位为分
	Status         string `json:"status,omitempty"`           // 固定 SUCCESS
	ItemId         string `json:"item_id,omitempty"`          // 订单来源视频对应视频 id
	SellerUid      string `json:"seller_uid,omitempty"`       // 该笔交易卖家商户号
	PaidAt         int64  `json:"paid_at,omitempty"`          // 支付时间,Unix 时间戳
	OrderId        string `json:"order_id,omitempty"`         // 抖音侧订单号
}

type NotifyRequest

type NotifyRequest struct {
	Timestamp    string `json:"timestamp,omitempty"` // UTC时间戳
	Nonce        string `json:"nonce,omitempty"`     // 随机字符串
	Msg          string `json:"msg,omitempty"`
	MsgSignature string `json:"msg_signature,omitempty"`
	Type         string `json:"type,omitempty"`
}

type NotifyResp

type NotifyResp struct {
	ErrNo   int    `json:"err_no"`
	ErrTips string `json:"err_tips"`
}

type PaymentInfoData

type PaymentInfoData struct {
	TotalFee    int    `json:"total_fee,omitempty"`    // 支付金额
	OrderStatus string `json:"order_status,omitempty"` // 支付状态枚举值
	PayTime     string `json:"pay_time,omitempty"`     // 支付完成时间
	Way         int    `json:"way,omitempty"`          // 支付渠道
	ChannelNo   string `json:"channel_no,omitempty"`   // 支付渠道侧的支付单号
	SellerUid   string `json:"seller_uid,omitempty"`   // 该笔交易卖家商户号
	ItemId      string `json:"item_id,omitempty"`      // 订单来源视频对应视频 id
	CpExtra     string `json:"cp_extra,omitempty"`     // 预下单时开发者传入字段
}

type Predict

type Predict struct {
	ModelName string `json:"model_name,omitempty"`
	Hit       bool   `json:"hit,omitempty"`
}

type PushOrderResponse

type PushOrderResponse struct {
	ErrCode int64  `json:"err_code,omitempty"` // 执行结果
	ErrMsg  string `json:"err_msg,omitempty"`  // 返回错误信息
	Body    string `json:"data,omitempty"`     // POI 等关联业务推送结果,非 POI 订单为空,JSON 字符串
}

type QueryOrderResponse

type QueryOrderResponse struct {
	ErrNo       int              `json:"err_no,omitempty"`       // 执行结果
	ErrTips     string           `json:"err_tips,omitempty"`     // 返回错误信息
	OutOrderNo  string           `json:"out_order_no,omitempty"` // 开发者侧的订单号
	OrderId     string           `json:"order_id,omitempty"`     // 抖音侧的订单号
	PaymentInfo *PaymentInfoData `json:"payment_info,omitempty"` // 支付信息
	CpsInfo     *CpsInfoData     `json:"cps_info,omitempty"`     // cps信息
}

type RequestOrderData

type RequestOrderData struct {
	SkuList          []*RequestOrderSkuList `json:"skuList,omitempty"`          // 下单商品信息
	OutOrderNo       string                 `json:"outOrderNo,omitempty"`       // 外部订单号
	TotalAmount      int64                  `json:"totalAmount,omitempty"`      // 订单总金额
	PayExpireSeconds int                    `json:"payExpireSeconds,omitempty"` // 支付超时时间
	PayNotifyUrl     string                 `json:"payNotifyUrl,omitempty"`     // 支付结果通知地址
	MerchantUid      string                 `json:"merchantUid,omitempty"`      // 开发者自定义收款商户号
	OrderEntrySchema *RequestOrderSchema    `json:"orderEntrySchema,omitempty"` // 订单详情页
	LimitPayWayList  []int                  `json:"limitPayWayList,omitempty"`  // 屏蔽的支付方式
}

type RequestOrderRespFail

type RequestOrderRespFail struct {
	ErrNo    string `json:"errNo,omitempty"`
	ErrMsg   string `json:"errMsg,omitempty"`
	ErrLogId string `json:"errLogId,omitempty"`
}

type RequestOrderRespSuccess

type RequestOrderRespSuccess struct {
	OrderId       string           `json:"orderId,omitempty"` // 抖音开放平台内部的交易订单号
	ItemOrderList []*itemOrderList `json:"itemOrderList,omitempty"`
	LogId         string           `json:"logId,omitempty"`
}

type RequestOrderSchema

type RequestOrderSchema struct {
	Path   string `json:"path,omitempty"`
	Params string `json:"params,omitempty"`
}

商品详情页链接

type RequestOrderSkuList

type RequestOrderSkuList struct {
	SkuId       string              `json:"skuId,omitempty"`    // 外部商品id
	Price       int64               `json:"price,omitempty"`    // 价格 单位:分
	Quantity    int                 `json:"quantity,omitempty"` // 购买数量 0 < quantity <= 100
	Title       string              `json:"title,omitempty"`
	ImageList   []string            `json:"imageList,omitempty"`
	Type        int                 `json:"type,omitempty"` // 根据接入规范,选择适合的商品类型ID传入
	TagGroupId  string              `json:"tagGroupId,omitempty"`
	EntrySchema *RequestOrderSchema `json:"entrySchema,omitempty"` // 商品详情页链接
}

type TextAntiData

type TextAntiData struct {
	Msg      string        `json:"msg,omitempty"`
	Code     int           `json:"code,omitempty"`
	TaskId   string        `json:"task_id,omitempty"`
	Predicts []TextPredict `json:"predicts,omitempty"`
}

type TextAntiResponse

type TextAntiResponse struct {
	ErrId     string         `json:"error_id,omitempty"`
	ErrCode   int            `json:"code,omitempty"`
	ErrMsg    string         `json:"message,omitempty"`
	Exception string         `json:"exception,omitempty"`
	LogId     string         `json:"log_id,omitempty"`
	Data      []TextAntiData `json:"data,omitempty"`
}

type TextPredict

type TextPredict struct {
	Prob      int         `json:"prob,omitempty"`
	Hit       bool        `json:"hit,omitempty"`
	Target    interface{} `json:"target,omitempty"`
	ModelName string      `json:"model_name,omitempty"`
}

Jump to

Keyboard shortcuts

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