gopay: github.com/iGoogle-ink/gopay Index | Files | Directories

package gopay

import "github.com/iGoogle-ink/gopay"

Index

Package Files

body_map.go constant.go http_client.go util.go

Constants

const (
    NULL       = ""
    TimeLayout = "2006-01-02 15:04:05"
    DateLayout = "2006-01-02"
    SUCCESS    = "SUCCESS"
    FAIL       = "FAIL"
    OK         = "OK"
    Version    = "1.5.12"
)
const (
    POST           = "POST"
    GET            = "GET"
    TypeJSON       = "json"
    TypeXML        = "xml"
    TypeUrlencoded = "urlencoded"
    TypeForm       = "form"
    TypeFormData   = "form-data"
)

Variables

var Types = map[string]string{
    TypeJSON:       "application/json",
    TypeXML:        "application/xml",
    TypeForm:       "application/x-www-form-urlencoded",
    TypeFormData:   "application/x-www-form-urlencoded",
    TypeUrlencoded: "application/x-www-form-urlencoded",
}

func Float32ToString Uses

func Float32ToString(floatNum float32, prec ...int) (floatStr string)

Float32转字符串

floatNum:float32数字
prec:精度位数(不传则默认float数字精度)

func Float64ToString Uses

func Float64ToString(floatNum float64, prec ...int) (floatStr string)

Float64转字符串

floatNum:float64数字
prec:精度位数(不传则默认float数字精度)

func GetRandomString Uses

func GetRandomString(length int) string

获取随机字符串

length:字符串长度

func Int2String Uses

func Int2String(intNum int) (intStr string)

Int转字符串

func Int322String Uses

func Int322String(intNum int32) (int32Str string)

Int32转字符串

func Int642String Uses

func Int642String(intNum int64) (int64Str string)

Int64转字符串

func PKCS5UnPadding Uses

func PKCS5UnPadding(origData []byte) (bs []byte)

解密填充模式(去除补全码) PKCS5UnPadding 解密时,需要在最后面去掉加密时添加的填充byte

func PKCS7UnPadding Uses

func PKCS7UnPadding(origData []byte) (bs []byte)

解密填充模式(去除补全码) PKCS7UnPadding 解密时,需要在最后面去掉加密时添加的填充byte

func ParseDateTime Uses

func ParseDateTime(timeStr string) (datetime time.Time)

解析时间

func String2Float32 Uses

func String2Float32(floatStr string) (floatNum float32)

字符串转Float32

func String2Float64 Uses

func String2Float64(floatStr string) (floatNum float64)

字符串转Float64

func String2Int Uses

func String2Int(intStr string) (intNum int)

字符串转Int

func String2Int32 Uses

func String2Int32(intStr string) (int32Num int32)

字符串转Int32

func String2Int64 Uses

func String2Int64(intStr string) (int64Num int64)

字符串转Int64

type BodyMap Uses

type BodyMap map[string]interface{}

func (BodyMap) CheckEmptyError Uses

func (bm BodyMap) CheckEmptyError(keys ...string) error

func (BodyMap) EncodeAliPaySignParams Uses

func (bm BodyMap) EncodeAliPaySignParams() string

("bar=baz&foo=quux") sorted by key.

func (BodyMap) EncodeGetParams Uses

func (bm BodyMap) EncodeGetParams() string

func (BodyMap) EncodeWeChatSignParams Uses

func (bm BodyMap) EncodeWeChatSignParams(apiKey string) string

("bar=baz&foo=quux") sorted by key.

func (BodyMap) Get Uses

func (bm BodyMap) Get(key string) string

获取参数

func (BodyMap) MarshalXML Uses

func (bm BodyMap) MarshalXML(e *xml.Encoder, start xml.StartElement) (err error)

func (BodyMap) Remove Uses

func (bm BodyMap) Remove(key string)

删除参数

func (BodyMap) Set Uses

func (bm BodyMap) Set(key string, value interface{})

设置参数

func (*BodyMap) UnmarshalXML Uses

func (bm *BodyMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)

type Client Uses

type Client struct {
    HttpClient    *http.Client
    Transport     *http.Transport
    Header        http.Header
    Timeout       time.Duration
    Url           string
    Method        string
    RequestType   string
    FormString    string
    ContentType   string
    UnmarshalType string
    Types         map[string]string
    JsonByte      []byte
    Errors        []error
    // contains filtered or unexported fields
}

func NewHttpClient Uses

func NewHttpClient() (client *Client)

NewHttpClient , default tls.Config{InsecureSkipVerify: true}

func (*Client) EndBytes Uses

func (c *Client) EndBytes() (res *http.Response, bs []byte, errs []error)

func (*Client) EndStruct Uses

func (c *Client) EndStruct(v interface{}) (res *http.Response, errs []error)

func (*Client) Get Uses

func (c *Client) Get(url string) (client *Client)

func (*Client) Post Uses

func (c *Client) Post(url string) (client *Client)

func (*Client) SendString Uses

func (c *Client) SendString(v string) (client *Client)

func (*Client) SendStruct Uses

func (c *Client) SendStruct(v interface{}) (client *Client)

func (*Client) SetTLSConfig Uses

func (c *Client) SetTLSConfig(tlsCfg *tls.Config) (client *Client)

func (*Client) SetTimeout Uses

func (c *Client) SetTimeout(timeout time.Duration) (client *Client)

func (*Client) Type Uses

func (c *Client) Type(typeStr string) (client *Client)

Directories

PathSynopsis
alipay
qq
wechat

Package gopay imports 14 packages (graph) and is imported by 3 packages. Updated 2020-05-20. Refresh now. Tools for package owners.