Documentation ¶
Index ¶
- Constants
- type Client
- type ClientResponse
- type Config
- type Jssdk
- type Marketing
- type Notify
- type NotifyMessage
- type NotifyRes
- type Order
- type OrderConfig
- type Payment
- func (p *Payment) Certificates()
- func (p *Payment) GCMDecryte(associateData, cipherText, nonce string) ([]byte, error)
- func (p *Payment) Jssdk(prepayId string) *Jssdk
- func (p *Payment) Marketing() *Marketing
- func (p *Payment) Notify(r *http.Request, w http.ResponseWriter) *Notify
- func (p *Payment) Order(config ...map[string]interface{}) *Order
- func (p *Payment) V2MD5(m map[string]interface{}) string
- func (p *Payment) V2Signature(str string) string
- func (p *Payment) V2SortKey(text map[string]interface{}) string
- func (p *Payment) VerifySignature(header http.Header, body []byte) error
- type QueryOrder
- type Redpack
- type Response
- type ResponseResult
Constants ¶
View Source
const ( KEY_LENGTH_BYTE = 32 AUTH_TAG_LENGTH_BYTE = 16 )
View Source
const ( MessageEventType = "TRANSACTION.SUCCESS" //支付通知状态 MessageResCode = "SUCCESS" //成功返回到code值 PaySuccess = "SUCCESS" //支付成功 PayRefund = "REFUND" //转入退款 PayNotPay = "NOTPAY" //未支付 PayClosed = "CLOSED" //已关闭 Paying = "USERPAYING" //正在支付中(付款码) PayRevoked = "REVOKED" //已撤销(付款码) PayError = "PAYERROR" //支付失败 )
View Source
const (
AUTH_TYPE = "WECHATPAY2-SHA256-RSA2048"
)
View Source
const (
BASE_API_URI = "https://api.mch.weixin.qq.com"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { *ghttp.Client UrlValues url.Values // Logger *log.Logger BaseUri string // contains filtered or unexported fields }
func (*Client) RequestJson ¶
RequestJson v3
type ClientResponse ¶
type ClientResponse struct {
*ghttp.ClientResponse
}
type Config ¶
type Config struct { AppID string `json:"app_id"` //公众号 MchID string `json:"mch_id"` //商户号 //v2接口 Key string `json:"key"` //API 秘钥 CertPath string `json:"cert_path"` //API 证书路径 绝对路径!!! KeyPath string `json:"key_path"` //绝对路径!!! Sandbox bool `json:"sandbox"` //沙盒模式 //v3接口 SerialNo string `json:"serial_no"` //商户证书编号 PriCertPath string `json:"private_cert_path"` //私钥证书路径 绝对路径!!! PubCertPath string `json:"public_cert_Path"` //公钥证书路径 绝对路径!!! PublicCer *x509.Certificate //商户证书公钥 PrivateCer interface{} //商户证书私钥 PFSerialNo string //平台证书编号 PFPublicCer *x509.Certificate //平台证书公钥 PFCertSavePath string //平台证书保存路径 绝对路径!!! PFCertPrefix string //平台证书保存前缀 ApiV3Key string //apiv3 秘钥 //公用 NotifyUrl string `json:"notify_url"` //默认回调地址 //服务商参数 SubMchID string `json:"sub_mch_id"` SubAppID string `json:"sub_appid"` //others Logger *log.Logger LogPath string }
Config
type Notify ¶
type Notify struct { Request *ehttp.Request Response *ehttp.Response Message *NotifyMessage // 消息数据包含原始数据 // contains filtered or unexported fields }
支付通知
func (*Notify) HandlePaid ¶
func (n *Notify) HandlePaid(f func(message *NotifyMessage) (bool, error))
支付通知处理
type NotifyMessage ¶
type OrderConfig ¶
订单
type Payment ¶
type Payment struct { Logger *log.Logger Cache *gcache.Cache // contains filtered or unexported fields }
func (*Payment) Certificates ¶
func (p *Payment) Certificates()
func (*Payment) GCMDecryte ¶
aes-256-gcm
type QueryOrder ¶
QueryOrder @see https://pay.weixin.qq.com/wiki/doc/apiv3/apis/chapter3_1_2.shtml 返回参数
type Redpack ¶
type Redpack struct {
// contains filtered or unexported fields
}
营销红包 v2 @see https://pay.weixin.qq.com/wiki/doc/api/tools/cash_coupon.php?chapter=13_4&index=3
type ResponseResult ¶
Click to show internal directories.
Click to hide internal directories.