payment

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alipay

type Alipay struct {
	Client *alipay.Client
	Config AlipayConfig
}

Alipay 支付宝对象结构体

func NewAlipay

func NewAlipay(conf AlipayConfig) *Alipay

NewAlipay 创建支付宝客户端

func (*Alipay) CloseOrder

func (that *Alipay) CloseOrder(orderID string) (*alipay.TradeCloseResponse, error)

CloseOrder 关闭订单

func (*Alipay) DownloadBill

func (that *Alipay) DownloadBill(billDate string) (*alipay.DataBillDownloadUrlQueryResponse, error)

DownloadBill 下载对账单

func (*Alipay) Notify

func (that *Alipay) Notify(request *http.Request) (gopay.BodyMap, error)

Notify 获取支付宝支付/退款的回调参数

func (*Alipay) Pay

func (that *Alipay) Pay(title, orderID, amount string) (*alipay.TradePrecreateResponse, error)

Pay 发起支付宝支付

func (*Alipay) QueryOrder

func (that *Alipay) QueryOrder(orderID string) (*alipay.TradeQueryResponse, error)

QueryOrder 查询订单

func (*Alipay) QueryRefund

func (that *Alipay) QueryRefund(orderID, refundID string) (*alipay.TradeFastpayRefundQueryResponse, error)

QueryRefund 退款查询

func (*Alipay) Refund

func (that *Alipay) Refund(orderID, amount string) (*alipay.TradeRefundResponse, error)

Refund 发起支付宝退款

type AlipayConfig

type AlipayConfig struct {
	Appid         string `json:"appid"`           // 支付宝APPID
	AppPubKey     string `json:"app_pub_key"`     // 应用公钥
	AppPrivateKey string `json:"app_private_key"` // 应用私钥
	AlipayPubKey  string `json:"alipay_pub_key"`  // 支付宝公钥
	ReturnURL     string `json:"return_url"`      // 用户支付后跳转到商户指定的地址
	NotifyURL     string `json:"notify_url"`      // 通知地址
	IsProd        bool   `json:"is_prod"`         // 是否应用生产
}

AlipayConfig 支付宝配置

type WxConfig

type WxConfig struct {
	Appid           string `json:"appid"`             // 商户APPID
	MchID           string `json:"mchid"`             // 商户ID
	APIKey          string `json:"api_key"`           // 用于解密支付/退款的回调参数
	AppSecret       string `json:"app_secret"`        // appSecret
	P12FilePath     string `json:"p12_file_content"`  // 退款时需要的证书信息
	NotifyURL       string `json:"return_url"`        // 支付通知地址
	RefundNotifyURL string `json:"refund_notify_url"` // 退款通知地址
	IsProd          bool   `json:"is_prod"`           // 是否生产环境
}

WxConfig 微信支付配置

type WxPay

type WxPay struct {
	Client *wechat.Client
	Config WxConfig
}

WxPay 微信支付客户端结构体

func NewWxPay

func NewWxPay(conf WxConfig) *WxPay

NewWxPay 创建微信支付客户端

func (*WxPay) CloseOrder

func (that *WxPay) CloseOrder(orderID string) (*wechat.CloseOrderResponse, error)

CloseOrder 关闭订单

func (*WxPay) DownloadBill

func (that *WxPay) DownloadBill(billDate string) (string, error)

DownloadBill 下载对账单

func (*WxPay) Pay

func (that *WxPay) Pay(title, orderID string, amount int64) (wxRsp *wechat.UnifiedOrderResponse, err error)

Pay 发起支付

func (*WxPay) PayNotify

func (that *WxPay) PayNotify(req *http.Request) (gopay.BodyMap, error)

PayNotify 获取支付回调的请求参数

func (*WxPay) QueryOrder

func (that *WxPay) QueryOrder(orderID string) (gopay.BodyMap, error)

QueryOrder 查询支付订单

func (*WxPay) QueryRefund

func (that *WxPay) QueryRefund(refundOrderID string) (gopay.BodyMap, error)

QueryRefund 查询退款

func (*WxPay) Refund

func (that *WxPay) Refund(orderID, refundOrderID string, totalAmount, amount int64) (gopay.BodyMap, error)

Refund 发起退款

func (*WxPay) RefundNotify

func (that *WxPay) RefundNotify(req *http.Request) (gopay.BodyMap, error)

RefundNotify 获取退款回调的请求参数

Jump to

Keyboard shortcuts

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