wx

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodedUrl   = "https://api.weixin.qq.com/sns/jscode2session?"
	AppCodeUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?"
	TokenUrl   = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="
	PayUrl     = "https://api.mch.weixin.qq.com/pay/unifiedorder"
	Query      = "https://api.mch.weixin.qq.com/pay/orderquery"
	RefundUrl  = "https://api.mch.weixin.qq.com/secapi/pay/refund"
)

Variables

View Source
var (
	OrderParam interface{}
	Order      = make(map[string]interface{})
)

Functions

func GetRemoteClientIp

func GetRemoteClientIp() string

func MapXml

func MapXml(o map[string]interface{}) string

MapXml Map转换为XML

Types

type Config

type Config struct {
	Appid     string
	Secret    string
	MchId     int64
	MchKey    string
	NotifyUrl string
	TradeType string
	KeyPem    string
	CertPem   string
}

func Init

func Init(s string, p string) *Config

func (*Config) GetOpenid

func (w *Config) GetOpenid(c string) *Openid

func (*Config) GetOrderParam

func (w *Config) GetOrderParam(o string, m int32, d string, openid string) (interface{}, error)

GetOrderParam 设置订单

type Openid

type Openid struct {
	SessionKey string `json:"session_key"`
	ExpiresIn  int64  `json:"expires_in"`
	Openid     string `json:"openid"`
	Unionid    string `json:"unionid"`
}

type ReturnData

type ReturnData struct {
	ReturnCode string `xml:"return_code"`
	ReturnMsg  string `xml:"return_msg"`
	ResultCode string `xml:"result_code"`
	Appid      string `xml:"appid"`
	NonceStr   string `xml:"nonce_str"`
	Sign       string `xml:"sign"`
	PrepayId   string `xml:"prepay_id"`
	TradeType  string `xml:"trade_type"`
}

Jump to

Keyboard shortcuts

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