Documentation
¶
Index ¶
- Constants
- 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
- type Config
- type DeviceType
- type PurchaseArgs
- type PurchaseType
- type Service
- type VerifyRes
Constants ¶
View Source
const DefaultUrl = "https://payment.moe/"
View Source
const (
PurchaseUrl = "/submit.php"
)
View Source
const StatusTradeSuccess = "TRADE_SUCCESS"
Variables ¶
This section is empty.
Functions ¶
func CreateUrlString ¶
CreateUrlString 生成待签名字符串, ["a", "b", "c"], ["d", "e", "f"] => "a=d&b=e&c=f"
func GenerateParams ¶
GenerateParams 生成加签参数
func ParamsFilter ¶
ParamsFilter 过滤参数,生成签名时需删除 “sign” 和 “sign_type” 参数
Types ¶
type Client ¶
func NewClientWithUrl ¶
NewClientWithUrl 创建一个新的易支付客户端
type DeviceType ¶
type DeviceType string
var ( PC DeviceType = "pc" // PC PC端 MOBILE DeviceType = "mobile" // MOBILE 移动端 )
type PurchaseArgs ¶
type PurchaseArgs struct { // 支付类型 Type PurchaseType // 商家订单号 ServiceTradeNo string // 商品名称 Name string // 金额 Money string // 设备类型 Device DeviceType NotifyUrl *url.URL ReturnUrl *url.URL }
type PurchaseType ¶
type PurchaseType string
var ( Alipay PurchaseType = "alipay" // Alipay 支付宝 WechatPay PurchaseType = "wxpay" // WechatPay 微信 )
type Service ¶
type Service interface { // Purchase 生成支付链接和参数 Purchase(args *PurchaseArgs) (string, map[string]string, error) // Verify 验证回调参数是否符合签名 Verify(params map[string]string) (*VerifyRes, error) }
Service 易支付API
type VerifyRes ¶
type VerifyRes struct { // 支付类型 Type PurchaseType // 易支付订单号 TradeNo string `mapstructure:"trade_no"` // 商家订单号 ServiceTradeNo string `mapstructure:"out_trade_no"` // 商品名称 Name string // 金额 Money string // 订单支付状态 TradeStatus string `mapstructure:"trade_status"` // 签名检验 VerifyStatus bool `mapstructure:"-"` }
Click to show internal directories.
Click to hide internal directories.