wechat

package
v0.0.0-...-e14c0b9 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TradeStateSucc   = "SUCCESS"
	TradeStateNotPay = "NOTPAY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AppId    string    `yaml:"app_id"`
	Secret   string    `yaml:"secret"`
	Pay      PayConfig `yaml:"pay"`
	RobotUrl string    `yaml:"robot_url"`
}

type PayConfig

type PayConfig struct {
	Enable                     bool   `yaml:"enable"`
	PrivateKeyPath             string `yaml:"private_key_path"`
	MchID                      string `yaml:"mch_id"`
	MchCertificateSerialNumber string `yaml:"mch_certificate_serial_number"`
	MchAPIv3Key                string `yaml:"mch_api_v3_key"`
	NotifyUrl                  string `yaml:"notify_url"`
}

type Wechat

type Wechat struct {
	Conf *Config
	// contains filtered or unexported fields
}

func NewWechat

func NewWechat(ctx context.Context, conf *Config) (*Wechat, error)

func (*Wechat) GetAccessToken

func (w *Wechat) GetAccessToken(ctx context.Context) (string, error)

func (*Wechat) GetUserPhone

func (w *Wechat) GetUserPhone(ctx context.Context, code string) (string, string, error)

func (*Wechat) ParseNotifyReqParams

func (w *Wechat) ParseNotifyReqParams(ctx context.Context, request *http.Request) (*payments.Transaction, error)

func (*Wechat) Prepay

func (w *Wechat) Prepay(ctx context.Context, prepayRequest jsapi.PrepayRequest) (string, *model.PrepaySign, error)

func (*Wechat) QueryOrderByOutTradeNo

func (w *Wechat) QueryOrderByOutTradeNo(ctx context.Context, orderID int64) (*payments.Transaction, error)

func (*Wechat) QueryWxSession

func (w *Wechat) QueryWxSession(ctx context.Context, code string) (*model.WXSessionRet, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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