base

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//正常模式
	MicroPayURL          = "https://api.mch.weixin.qq.com/pay/micropay"
	UnifiedOrderURL      = "https://api.mch.weixin.qq.com/pay/unifiedorder"
	OrderQueryURL        = "https://api.mch.weixin.qq.com/pay/orderquery"
	ReverseURL           = "https://api.mch.weixin.qq.com/secapi/pay/reverse"
	CloseOrderURL        = "https://api.mch.weixin.qq.com/pay/closeorder"
	RefundURL            = "https://api.mch.weixin.qq.com/secapi/pay/refund"
	RefundQueryURL       = "https://api.mch.weixin.qq.com/pay/refundquery"
	DownloadBillURL      = "https://api.mch.weixin.qq.com/pay/downloadbill"
	DownloadFundFlowURL  = "https://api.mch.weixin.qq.com/pay/downloadfundflow"
	ReportURL            = "https://api.mch.weixin.qq.com/payitil/report"
	BatchQueryCommentURL = "https://api.mch.weixin.qq.com/billcommentsp/batchquerycomment"
	AuthCodeToOpenidURL  = "https://api.mch.weixin.qq.com/tools/authcodetoopenid"

	//沙箱模式
	SandboxMicroPayURL          = "https://api.mch.weixin.qq.com/sandboxnew/pay/micropay"
	SandboxUnifiedOrderURL      = "https://api.mch.weixin.qq.com/sandboxnew/pay/unifiedorder"
	SandboxOrderQueryURL        = "https://api.mch.weixin.qq.com/sandboxnew/pay/orderquery"
	SandboxReverseURL           = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/reverse"
	SandboxCloseOrderURL        = "https://api.mch.weixin.qq.com/sandboxnew/pay/closeorder"
	SandboxRefundURL            = "https://api.mch.weixin.qq.com/sandboxnew/secapi/pay/refund"
	SandboxRefundQueryURL       = "https://api.mch.weixin.qq.com/sandboxnew/pay/refundquery"
	SandboxDownloadBillURL      = "https://api.mch.weixin.qq.com/sandboxnew/pay/downloadbill"
	SandboxDownloadFundFlowURL  = "https://api.mch.weixin.qq.com/sandboxnew/pay/downloadfundflow"
	SandboxReportURL            = "https://api.mch.weixin.qq.com/sandboxnew/payitil/report"
	SandboxBatchQueryCommentURL = "https://api.mch.weixin.qq.com/billcommentsp/batchquerycomment"
	SandboxAuthCodeToOpenidURL  = "https://api.mch.weixin.qq.com/sandboxnew/tools/authcodetoopenid"
)

Variables

This section is empty.

Functions

func AppendConfig

func AppendConfig(p util.Params, config *config.Config) util.Params

AppendConfig 增加 基础config参数

func CertTLSConfig

func CertTLSConfig(mchID, path string) (*tls.Config, error)

CertTLSConfig 证书 tls

func GetAuthCodeToOpenidURL

func GetAuthCodeToOpenidURL(c *config.Config) string

GetAuthCodeToOpenidURL 付款码查询openid

func GetBatchQueryCommentURL

func GetBatchQueryCommentURL(c *config.Config) string

GetBatchQueryCommentURL 拉取订单评价数据

func GetCloseOrderURL

func GetCloseOrderURL(c *config.Config) string

GetCloseOrderURL 关闭订单

func GetDownloadBillURL

func GetDownloadBillURL(c *config.Config) string

GetDownloadBill 下载交易账单

func GetDownloadFundFlowURL

func GetDownloadFundFlowURL(c *config.Config) string

GetDownloadFundFlowURL 下载资金账单

func GetIP

func GetIP() (ip string)

GetIP 获取当前IP地址

func GetMicroPayURL

func GetMicroPayURL(c *config.Config) string

GetMicroPayURL 付款码支付

func GetOrderQueryURL

func GetOrderQueryURL(c *config.Config) string

GetOrderQueryURL 查询订单

func GetRefundQueryURL

func GetRefundQueryURL(c *config.Config) string

GetRefundQueryURL 查询退款接口

func GetRefundURL

func GetRefundURL(c *config.Config) string

GetRefundURL 退款接口

func GetReportURL

func GetReportURL(c *config.Config) string

GetReportURL 交易保障

func GetReverseURL

func GetReverseURL(c *config.Config) string

GetReverseURL 撤销订单

func GetUnifyURL

func GetUnifyURL(c *config.Config) string

GetUnifyURL 统一下单

func MapToXML

func MapToXML(params util.Params) string

MapToXML map to xml

func PostWithTSL

func PostWithTSL(url string, params util.Params, config *tls.Config) (string, error)

PostWithTSL https need cert post

func PostWithoutCert

func PostWithoutCert(url string, params util.Params) (string, error)

PostWithoutCert https no cert post

func Sign

func Sign(p util.Params, config *config.Config) util.Params

Sign 生成签名

func XMLToMap

func XMLToMap(xmlStr string) util.Params

XMLToMap xml to map

Types

type Params

type Params util.Params

Params map[string]interface{}

type Response

type Response struct {
	ReturnCode string      `json:"return_code"`
	ReturnMsg  string      `json:"return_msg"`
	Data       util.Params `json:"data"`
	Detail     string      `json:"detail"`
}

Response 返回结构

func ProcessResponseXML

func ProcessResponseXML(xmlStr string) (*Response, error)

ProcessResponseXML 处理 HTTPS API返回数据,转换成Map对象

Jump to

Keyboard shortcuts

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