mirror of https://github.com/rocboss/paopao-ce
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
2.4 KiB
86 lines
2.4 KiB
// Code generated by go-mir. DO NOT EDIT.
|
|
|
|
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/alimy/mir/v3"
|
|
"github.com/gin-gonic/gin"
|
|
"github.com/rocboss/paopao-ce/internal/model/web"
|
|
)
|
|
|
|
type WebAlipayPub interface {
|
|
AlipayNotify(*web.AlipayNotifyReq) mir.Error
|
|
|
|
mustEmbedUnimplementedWebAlipayPubServant()
|
|
}
|
|
|
|
type WebAlipayPubBinding interface {
|
|
BindAlipayNotify(*gin.Context) (*web.AlipayNotifyReq, mir.Error)
|
|
|
|
mustEmbedUnimplementedWebAlipayPubBinding()
|
|
}
|
|
|
|
type WebAlipayPubRender interface {
|
|
RenderAlipayNotify(*gin.Context, mir.Error)
|
|
|
|
mustEmbedUnimplementedWebAlipayPubRender()
|
|
}
|
|
|
|
// RegisterWebAlipayPubServant register WebAlipayPub servant to gin
|
|
func RegisterWebAlipayPubServant(e *gin.Engine, s WebAlipayPub, b WebAlipayPubBinding, r WebAlipayPubRender) {
|
|
router := e.Group("v1")
|
|
|
|
// register routes info to router
|
|
router.Handle("POST", "/alipay/notify", func(c *gin.Context) {
|
|
select {
|
|
case <-c.Request.Context().Done():
|
|
return
|
|
default:
|
|
}
|
|
|
|
req, err := b.BindAlipayNotify(c)
|
|
if err != nil {
|
|
r.RenderAlipayNotify(c, err)
|
|
return
|
|
}
|
|
r.RenderAlipayNotify(c, s.AlipayNotify(req))
|
|
})
|
|
|
|
}
|
|
|
|
// UnimplementedWebAlipayPubServant can be embedded to have forward compatible implementations.
|
|
type UnimplementedWebAlipayPubServant struct {
|
|
}
|
|
|
|
func (UnimplementedWebAlipayPubServant) AlipayNotify(req *web.AlipayNotifyReq) mir.Error {
|
|
return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented))
|
|
}
|
|
|
|
func (UnimplementedWebAlipayPubServant) mustEmbedUnimplementedWebAlipayPubServant() {}
|
|
|
|
// UnimplementedWebAlipayPubRender can be embedded to have forward compatible implementations.
|
|
type UnimplementedWebAlipayPubRender struct {
|
|
RenderAny func(*gin.Context, any, mir.Error)
|
|
}
|
|
|
|
func (r *UnimplementedWebAlipayPubRender) RenderAlipayNotify(c *gin.Context, err mir.Error) {
|
|
r.RenderAny(c, nil, err)
|
|
}
|
|
|
|
func (r *UnimplementedWebAlipayPubRender) mustEmbedUnimplementedWebAlipayPubRender() {}
|
|
|
|
// UnimplementedWebAlipayPubBinding can be embedded to have forward compatible implementations.
|
|
type UnimplementedWebAlipayPubBinding struct {
|
|
BindAny func(*gin.Context, any) mir.Error
|
|
}
|
|
|
|
func (b *UnimplementedWebAlipayPubBinding) BindAlipayNotify(c *gin.Context) (*web.AlipayNotifyReq, mir.Error) {
|
|
obj := new(web.AlipayNotifyReq)
|
|
err := b.BindAny(c, obj)
|
|
return obj, err
|
|
}
|
|
|
|
func (b *UnimplementedWebAlipayPubBinding) mustEmbedUnimplementedWebAlipayPubBinding() {}
|