Documentation ¶
Index ¶
Constants ¶
View Source
const ( SubmitUrl = "/submit.php" MAPIUrl = "/mapi.php" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) MApiSubmit ¶
func (c *Client) MApiSubmit(ctx context.Context, args *MApiSubmitArgs) (*MApiSubmitRes, *http.Response, error)
type CommonErrorRes ¶
type DeviceType ¶
type DeviceType string
var ( PC DeviceType = "pc" // PC PC端 MOBILE DeviceType = "mobile" // MOBILE 移动端 WECHAT DeviceType = "wechat" // WECHAT 微信 )
type MApiSubmitArgs ¶
type MApiSubmitArgs struct { Type PaymentType `json:"type"` // Type 支付类型 OutTradeNo string `json:"out_trade_no"` // OutTradeNo 商户订单号 NotifyUrl string `json:"notify_url"` // NotifyUrl 异步通知地址 ReturnUrl *string `json:"return_url"` // ReturnUrl 同步通知地址 Name string `json:"name"` // Name 商品名称 Money string `json:"money"` // Money 金额 保留两位小数 ClientIP string `json:"clientip"` // ClientIP 客户端IP Device *DeviceType `json:"device,omitempty"` // Device 设备类型 Param *string `json:"param,omitempty"` // Param 附加参数 Sign string `json:"sign"` // Sign 签名 SignType string `json:"sign_type"` // SignType 签名类型 }
type MApiSubmitRes ¶
type PaymentType ¶
type PaymentType string
var ( Alipay PaymentType = "alipay" // Alipay 支付宝 WechatPay PaymentType = "wxpay" // WechatPay 微信 )
type Service ¶
type Service interface { Submit(ctx context.Context, args *SubmitArgs) (string, map[string]string, error) // Submit 生成支付链接和参数 Verify(ctx context.Context, params map[string]string) (*VerifyRes, error) // Verify 验证回调参数是否符合签名 MApiSubmit(ctx context.Context, args *MApiSubmitArgs) (*MApiSubmitRes, *http.Response, error) // MApiSubmit 生成支付链接和参数 }
Service 易支付API
type SubmitArgs ¶
type VerifyRes ¶
type VerifyRes struct { Type PaymentType // 支付类型 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.