notify

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package notify 用于处理微信回调通知

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Response

type Response struct {
	XMLName xml.Name   `xml:"xml"`
	Code    xxml.CData `xml:"return_code"`
	Message xxml.CData `xml:"return_msg"`
}

Response 向微信返馈的信息

func Fail

func Fail(message string) *Response

Fail 构建一个表示出错的 Response 实例,message 为出错信息

func Success

func Success() *Response

Success 构建一个表示正常的 Response 实例

func (*Response) Render

func (r *Response) Render(state int, w http.ResponseWriter) error

Render 输出到客户端

type Return

type Return struct {
	DeviceInfo         string `xml:"device_info"`          // 设备号
	OpenID             string `xml:"openid"`               // 用户标识
	IsSubscribe        string `xml:"is_subscribe"`         // 是否关注公众账号,Y-关注,N-未关注
	TradeType          string `xml:"trade_type"`           // 交易类型,JSAPI、NATIVE、APP
	BankType           string `xml:"bank_type"`            // 付款银行
	TotalFee           int    `xml:"total_fee"`            // 订单金额,单位为分
	SettlementTotalFee int    `xml:"settlement_total_fee"` // 应结订单金额
	FeeType            string `xml:"fee_type"`             // 货币种类,符合 ISO4217 标准的三位字母代码,默认:CNY
	CashFee            int    `xml:"cash_fee"`             // 现金支付金额
	CashFeeType        string `xml:"cash_fee_type"`        // 现金支付货币类型,符合 ISO4217 标准的三位字母代码
	CouponFee          int    `xml:"coupon_fee"`           // 总代金券金额
	CouponCount        int    `xml:"coupon_count"`         // 代金券使用数量
	TransactionID      string `xml:"transaction_id"`       // 微信支付订单号
	OutTradeNO         string `xml:"out_trade_no"`         // 商户订单号
	Attach             string `xml:"attach"`               // 商家数据包
	TimeEnd            string `xml:"time_end"`             // 支付完成时间,格式为yyyyMMddHHmmss

	Coupons []*pay.Coupon
	// contains filtered or unexported fields
}

Return 微信返回的信息结构

func Read

func Read(p *pay.Pay, r io.Reader) (*Return, error)

Read 从 r 读取内容,并尝试转换成 Return 实例

func (*Return) End

func (ret *Return) End() time.Time

End 返回 TimeEnd 的 time.Time 格式数据

func (*Return) Subscribed

func (ret *Return) Subscribed() bool

Subscribed 当前用户是否已经关注公众账号

Jump to

Keyboard shortcuts

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