light-pkg/myPay/alipay_notify.go

29 lines
649 B
Go
Raw Normal View History

2024-12-18 03:41:30 +08:00
package myPay
import "github.com/go-pay/gopay"
type AlipayNotifyResp struct {
resp gopay.BodyMap
}
type AlipayNotifyRespInfo struct {
TradeStatus string
OutTradeNo string
SellerId string
TradeNo string
GmtPayment string
}
func (t *AlipayNotifyResp) IsSuccess() bool {
return t.resp.Get("trade_status") == "TRADE_SUCCESS"
}
func (t *AlipayNotifyResp) GetResult() *AlipayNotifyRespInfo {
return &AlipayNotifyRespInfo{
TradeStatus: t.resp.Get("trade_status"),
OutTradeNo: t.resp.Get("out_trade_no"),
SellerId: t.resp.Get("seller_id"),
TradeNo: t.resp.Get("trade_no"),
GmtPayment: t.resp.Get("gmt_payment"),
}
}