Documentation
¶
Index ¶
- Variables
- type Client
- func (c *Client) CloseTrade(ctx context.Context, orderNo string) error
- func (c *Client) DecodeNotification(form url.Values) (*Notification, error)
- func (c *Client) PreCreateTrade(ctx context.Context, order Order) (string, error)
- func (c *Client) QueryTrade(ctx context.Context, orderNo string) (*Trade, error)
- type Config
- type Notification
- type Order
- type Status
- type Trade
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrTradeNotExist = errors.New("alipay trade does not exist")
ErrTradeNotExist reports that the gateway holds no trade for the order. A face-to-face trade is created only when the buyer scans the QR code, so a missing trade proves no money was collected for the order.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Config
// contains filtered or unexported fields
}
func (*Client) CloseTrade ¶ added in v1.15.20
CloseTrade voids an unpaid trade at the gateway so its QR code can no longer collect money. Closing a trade the gateway never created reports ErrTradeNotExist, and the gateway rejects closing a trade that was already paid, so a success here proves no payment can arrive afterwards.
func (*Client) DecodeNotification ¶
func (c *Client) DecodeNotification(form url.Values) (*Notification, error)
func (*Client) PreCreateTrade ¶
type Config ¶
type Config struct {
AppId string
PrivateKey string
PublicKey string
InvoiceName string
NotifyURL string
Sandbox bool
// Gateway overrides the sandbox gateway URL; Alipay has retired sandbox
// hosts before, and tests point it at a local fake gateway. Ignored in
// production, where only the official gateway may receive credentials.
Gateway string
}
type Notification ¶
Click to show internal directories.
Click to hide internal directories.