29 lines
649 B
Go
29 lines
649 B
Go
|
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"),
|
||
|
}
|
||
|
}
|