alipayopen

package
v1.0.215 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizationCode = "authorization_code" // 表示换取使用用户授权码code换取授权令牌
View Source
const (
	LogTable = "alipayopen"
)
View Source
const RefreshToken = "refresh_token" // 表示使用refresh_token刷新获取新授权令牌

Variables

This section is empty.

Functions

This section is empty.

Types

type AlipaySystemOauthTokenResponse

type AlipaySystemOauthTokenResponse struct {
	AlipaySystemOauthTokenResponse struct {
		AlipayUserId string `json:"alipay_user_id,omitempty"`
		UserId       string `json:"user_id"`       // 支付宝用户的唯一标识。以2088开头的16位数字。
		AccessToken  string `json:"access_token"`  // 访问令牌。通过该令牌调用需要授权类接口
		ExpiresIn    string `json:"expires_in"`    // 	访问令牌的有效时间,单位是秒。
		RefreshToken string `json:"refresh_token"` // 刷新令牌。通过该令牌可以刷新access_token
		ReExpiresIn  string `json:"re_expires_in"` // 刷新令牌的有效时间,单位是秒。
		AuthStart    string `json:"auth_start"`    // 授权token开始时间,作为有效期计算的起点
	} `json:"alipay_system_oauth_token_response"`
}

type AlipaySystemOauthTokenResult

type AlipaySystemOauthTokenResult struct {
	Result AlipaySystemOauthTokenResponse // 结果
	Body   []byte                         // 内容
	Http   gorequest.Response             // 请求
}

type AlipayUserInfoShareResponse

type AlipayUserInfoShareResponse struct {
	AlipayUserInfoShareResponse struct {
		AlipayUserId string `json:"alipay_user_id,omitempty"`
		UserId       string `json:"user_id"`       // 支付宝用户的唯一标识。以2088开头的16位数字。
		AccessToken  string `json:"access_token"`  // 访问令牌。通过该令牌调用需要授权类接口
		ExpiresIn    string `json:"expires_in"`    // 	访问令牌的有效时间,单位是秒。
		RefreshToken string `json:"refresh_token"` // 刷新令牌。通过该令牌可以刷新access_token
		ReExpiresIn  string `json:"re_expires_in"` // 刷新令牌的有效时间,单位是秒。
		AuthStart    string `json:"auth_start"`    // 授权token开始时间,作为有效期计算的起点
	} `json:"alipay_system_oauth_token_response"`
}

type AlipayUserInfoShareResult

type AlipayUserInfoShareResult struct {
	Result AlipayUserInfoShareResponse // 结果
	Body   []byte                      // 内容
	Http   gorequest.Response          // 请求
}

type ApiError

type ApiError struct {
	ErrorResponse struct {
		Code    string `json:"code"`
		Msg     string `json:"msg"`
		SubCode string `json:"sub_code"`
		SubMsg  string `json:"sub_msg"`
	} `json:"error_response"`
	Sign string `json:"sign"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 实例

func NewClient

func NewClient(config *ClientConfig) (*Client, error)

NewClient 创建实例化

func (*Client) AlipaySystemOauthToken

func (c *Client) AlipaySystemOauthToken(ctx context.Context, grantType, code, refreshToken string, notMustParams ...gorequest.Params) (*AlipaySystemOauthTokenResult, ApiError, error)

AlipaySystemOauthToken 换取授权访问令牌 https://opendocs.alipay.com/open/02xtla

func (*Client) AlipayUserInfoShare

func (c *Client) AlipayUserInfoShare(ctx context.Context, authToken string, notMustParams ...gorequest.Params) (*AlipayUserInfoShareResult, ApiError, error)

AlipayUserInfoShare 换取授权访问令牌 https://opendocs.alipay.com/open/02xtlb

func (*Client) ConfigSLogClientFun added in v1.0.162

func (c *Client) ConfigSLogClientFun(apiSLogFun golog.ApiSLogFun)

ConfigSLogClientFun 日志配置

func (*Client) DefaultHttp added in v1.0.177

func (c *Client) DefaultHttp()

DefaultHttp 默认请求

func (*Client) Get added in v1.0.109

func (c *Client) Get(ctx context.Context, _method string, notMustParams ...gorequest.Params) ([]byte, error)

func (*Client) GetAes

func (c *Client) GetAes() string

func (*Client) GetAlipayRSA2

func (c *Client) GetAlipayRSA2() string

func (*Client) GetAppId

func (c *Client) GetAppId() string

func (*Client) GetAppKey

func (c *Client) GetAppKey() string

func (*Client) GetAppRSA2

func (c *Client) GetAppRSA2() string

func (*Client) SetHttp added in v1.0.177

func (c *Client) SetHttp(app *gorequest.App)

SetHttp 配置请求

type ClientConfig

type ClientConfig struct {
	AppId      string // 支付宝分配给开发者的应用ID
	AppKey     string // 支付宝分配给开发者的应用私钥
	AppRSA2    string // 应用公钥
	AlipayRSA2 string // 支付宝公钥
	Aes        string // 接口内容加密方式
}

ClientConfig 实例配置

Jump to

Keyboard shortcuts

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