epay

package
v1.14.4 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatMoney added in v1.14.0

func FormatMoney(amount float64) string

FormatMoney returns the exact two-decimal amount sent to an EPay-compatible gateway. It intentionally preserves the historical truncation behaviour.

func ParseMoney added in v1.14.0

func ParseMoney(value string) (int64, error)

ParseMoney converts a non-negative decimal amount to its integer minor unit. It rejects floats, exponents and values with more than two decimal places.

Types

type Client

type Client struct {
	Pid  string
	Url  string
	Key  string
	Type string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(pid, url, key string, Type string) *Client

func (*Client) CreatePayUrl

func (c *Client) CreatePayUrl(order Order) string

func (*Client) QueryOrder added in v1.14.0

func (c *Client) QueryOrder(orderNo string) (*QueryResult, error)

QueryOrder obtains authoritative payment details directly from the gateway. A successful HTTP response is not enough: EPay-compatible gateways use code=1 to indicate a successful lookup and status=1 to indicate a paid order.

func (*Client) QueryOrderStatus

func (c *Client) QueryOrderStatus(orderNo string) bool

QueryOrderStatus is kept for callers that only need a status boolean.

func (*Client) VerifySign

func (c *Client) VerifySign(params map[string]string) bool

type Order

type Order struct {
	Name      string
	OrderNo   string
	Amount    float64
	SignType  string
	NotifyUrl string
	ReturnUrl string
}

type QueryResult added in v1.14.0

type QueryResult struct {
	MerchantID string
	TradeNo    string
	OrderNo    string
	Type       string
	Money      string
	Paid       bool
	Message    string
}

Jump to

Keyboard shortcuts

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