epay

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormArgsSignType   = "MD5"
	FormSubmitUrl      = "/submit.php"
	TradeStatusSuccess = "TRADE_SUCCESS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	PayDomain string `json:"pay_domain"`
	PartnerID string `json:"partner_id"`
	Key       string `json:"key"`
}

func (*Client) FormPay

func (c *Client) FormPay(args *PayArgs) (string, map[string]string, error)

FormPay 表单支付

func (*Client) Sign

func (c *Client) Sign(args map[string]string) string

Sign 签名

func (*Client) Verify

func (c *Client) Verify(params map[string]string) (*PaymentResult, bool)

type Epay

type Epay struct{}

func (*Epay) CreatedPay

func (e *Epay) CreatedPay(_ string, _ *model.Payment) error

func (*Epay) HandleCallback

func (e *Epay) HandleCallback(c *gin.Context, gatewayConfig string) (*types.PayNotify, error)

func (*Epay) Name

func (e *Epay) Name() string

func (*Epay) Pay

func (e *Epay) Pay(config *types.PayConfig, gatewayConfig string) (*types.PayRequest, error)

type EpayConfig

type EpayConfig struct {
	PayType PayType `json:"pay_type"`
	Client
}

type PayArgs

type PayArgs struct {
	Type       PayType `json:"type,omitempty"`
	OutTradeNo string  `json:"out_trade_no"`
	NotifyUrl  string  `json:"notify_url"`
	ReturnUrl  string  `json:"return_url"`
	Name       string  `json:"name"`
	Money      string  `json:"money"`
}

type PayType

type PayType string
var (
	EpayPay PayType = ""       // 网关
	Alipay  PayType = "alipay" // 支付宝
	Wechat  PayType = "wxpay"  // 微信
	QQ      PayType = "qqpay"  // QQ
	Bank    PayType = "bank"   // 银行
	JD      PayType = "jdpay"  // 京东
	PayPal  PayType = "paypal" // PayPal
	USDT    PayType = "usdt"   // USDT
)

type PaymentResult

type PaymentResult struct {
	Type        PayType `mapstructure:"type"`
	TradeNo     string  `mapstructure:"trade_no"`
	OutTradeNo  string  `mapstructure:"out_trade_no"`
	Name        string  `mapstructure:"name"`
	Money       string  `mapstructure:"money"`
	TradeStatus string  `mapstructure:"trade_status"`
}

Jump to

Keyboard shortcuts

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