Versions in this module Expand all Collapse all v1 v1.0.0 Apr 10, 2024 Changes in this version + const DefaultUrl + const PurchaseUrl + const StatusTradeSuccess + func CreateUrlString(keys []string, values []string) string + func GenerateParams(params map[string]string, key string) map[string]string + func MD5String(urlString string, key string) string + func ParamsFilter(params map[string]string) map[string]string + func ParamsSort(params map[string]string) ([]string, []string) + type Client struct + BaseUrl *url.URL + Config *Config + func NewClient(config *Config) *Client + func NewClientWithUrl(config *Config, baseUrl string) (*Client, error) + func (c *Client) Purchase(args *PurchaseArgs) (string, map[string]string, error) + func (c *Client) Verify(params map[string]string) (*VerifyRes, error) + type Config struct + Key string + PartnerID string + type DeviceType string + var MOBILE DeviceType = "mobile" + var PC DeviceType = "pc" + type PurchaseArgs struct + Device DeviceType + Money string + Name string + NotifyUrl *url.URL + ReturnUrl *url.URL + ServiceTradeNo string + Type PurchaseType + type PurchaseType string + var Alipay PurchaseType = "alipay" + var WechatPay PurchaseType = "wxpay" + type Service interface + Purchase func(args *PurchaseArgs) (string, map[string]string, error) + Verify func(params map[string]string) (*VerifyRes, error) + type VerifyRes struct + Money string + Name string + ServiceTradeNo string + TradeNo string + TradeStatus string + Type PurchaseType + VerifyStatus bool