dike

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2026 License: MulanPSL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateJourNo

func GenerateJourNo(prefix string) string

GenerateJourNo 生成商户流水号 格式: 前缀_时间戳_随机数

func NewClient

func NewClient(cfg *payment.Config) (payment.Gateway, error)

NewClient 创建迪科支付客户端

func ParseNotifyFromRequest

func ParseNotifyFromRequest(gateway payment.Gateway, r *http.Request) (*payment.NotifyResult, error)

ParseNotifyFromRequest 从 HTTP 请求中解析异步通知

func ParseReturnFromRequest

func ParseReturnFromRequest(gateway payment.Gateway, r *http.Request) (*payment.NotifyResult, error)

ParseReturnFromRequest 从 HTTP 请求中解析同步跳转

Types

type CallbackHandler

type CallbackHandler struct {
	// contains filtered or unexported fields
}

CallbackHandler 回调处理器 用于处理支付平台的异步通知和同步跳转

func NewCallbackHandler

func NewCallbackHandler(gateway payment.Gateway, handler NotifyHandler) *CallbackHandler

NewCallbackHandler 创建回调处理器

func (*CallbackHandler) HandleNotify

func (h *CallbackHandler) HandleNotify(w http.ResponseWriter, r *http.Request)

HandleNotify 处理异步通知(用于 http.HandleFunc)

func (*CallbackHandler) HandleReturn

func (h *CallbackHandler) HandleReturn(redirectURL string) http.HandlerFunc

HandleReturn 处理同步跳转(用于 http.HandleFunc) redirectURL: 处理完成后跳转的 URL(支持模板变量 {journo}, {status})

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client 迪科支付客户端

func (*Client) ApplyInvoiceChange

ApplyInvoiceChange 换票申请

func (*Client) CreateOrder

CreateOrder 预下单

func (*Client) ParseNotify

func (c *Client) ParseNotify(data []byte) (*payment.NotifyResult, error)

ParseNotify 解析异步通知

func (*Client) ParseReturn

func (c *Client) ParseReturn(data []byte) (*payment.NotifyResult, error)

ParseReturn 解析同步跳转

func (*Client) QueryInvoiceStatus

func (c *Client) QueryInvoiceStatus(ctx context.Context, req *payment.QueryInvoiceRequest) (*payment.QueryInvoiceResponse, error)

QueryInvoiceStatus 查询票据状态

func (*Client) QueryOrder

QueryOrder 查询订单状态

type NotifyHandler

type NotifyHandler func(result *payment.NotifyResult) error

NotifyHandler 通知处理函数

Jump to

Keyboard shortcuts

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