wxpay

package module
v0.0.0-...-6db18ff Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2016 License: MIT Imports: 13 Imported by: 0

README

##wxpay

微信支付SDK,因为懒,所以要自己写一个。 有些属性就让他自己设置吧,字段名最好不要自己写,怕写错。

appid、mch_id、notify_url、nonce_str、sign字段会自动补缺

Documentation

Index

Constants

View Source
const (
	DEVICE_INFO_WEB   = "WEB"
	TRADE_TYPE_APP    = "APP"
	TRADE_TYPE_NATIVE = "NATIVE"
	TRADE_TYPE_JSAPI  = "JSAPI"

	URL_UNIFIEDORDER = "https://api.mch.weixin.qq.com/pay/unifiedorder"
	URL_ORDERQUERY   = "https://api.mch.weixin.qq.com/pay/orderquery"
	URL_REFUND       = "https://api.mch.weixin.qq.com/secapi/pay/refund"
	URL_REFUNDQUERY  = "https://api.mch.weixin.qq.com/pay/refundquery"

	RETURN_CODE_SUCCESS = "SUCCESS"
	RETURN_CODE_FAIL    = "FAIL"
	RESULT_CODE_SUCCESS = "SUCCESS"
	RESULT_CODE_FAIL    = "FAIL"
)

Variables

This section is empty.

Functions

func MustGetTlsConfiguration

func MustGetTlsConfiguration() *tls.Config

func MustLoadCertificates

func MustLoadCertificates() (tls.Certificate, *x509.CertPool)

func OrderQuery

func OrderQuery(pm *payMap) (map[string]string, error)

订单查询

func RefundOrder

func RefundOrder(pm *payMap) (map[string]string, error)

退款

func RefundQuery

func RefundQuery(pm *payMap) (map[string]string, error)

退款查询

func Sign

func Sign(paras map[string]string, apiKey string) string

签名函数,待优化效率。

func UnifiedOrder

func UnifiedOrder(pm *payMap) (map[string]string, error)

统一下单

func XMLToMap

func XMLToMap(xmlStr string, isIngoreFirst bool) map[string]string

只能处理一层的xml

Types

type APIInfo

type APIInfo struct {
	AppID     string
	MchID     string
	ApiKey    string
	NotifyURL string
}

func NewAPI

func NewAPI(appID, mchID, apiKey, notifyURL string) *APIInfo

func (*APIInfo) NewMap

func (this *APIInfo) NewMap() *payMap

Jump to

Keyboard shortcuts

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