// Code generated by go-mir. DO NOT EDIT. // versions: // - mir v3.1.1 package v1 import ( "net/http" "github.com/alimy/mir/v3" "github.com/gin-gonic/gin" "github.com/rocboss/paopao-ce/internal/model/web" ) type AlipayPub interface { AlipayNotify(*web.AlipayNotifyReq) mir.Error mustEmbedUnimplementedAlipayPubServant() } type AlipayPubBinding interface { BindAlipayNotify(*gin.Context) (*web.AlipayNotifyReq, mir.Error) mustEmbedUnimplementedAlipayPubBinding() } type AlipayPubRender interface { RenderAlipayNotify(*gin.Context, mir.Error) mustEmbedUnimplementedAlipayPubRender() } // RegisterAlipayPubServant register AlipayPub servant to gin func RegisterAlipayPubServant(e *gin.Engine, s AlipayPub, b AlipayPubBinding, r AlipayPubRender) { 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)) }) } // UnimplementedAlipayPubServant can be embedded to have forward compatible implementations. type UnimplementedAlipayPubServant struct { } func (UnimplementedAlipayPubServant) AlipayNotify(req *web.AlipayNotifyReq) mir.Error { return mir.Errorln(http.StatusNotImplemented, http.StatusText(http.StatusNotImplemented)) } func (UnimplementedAlipayPubServant) mustEmbedUnimplementedAlipayPubServant() {} // UnimplementedAlipayPubRender can be embedded to have forward compatible implementations. type UnimplementedAlipayPubRender struct { RenderAny func(*gin.Context, any, mir.Error) } func (r *UnimplementedAlipayPubRender) RenderAlipayNotify(c *gin.Context, err mir.Error) { r.RenderAny(c, nil, err) } func (r *UnimplementedAlipayPubRender) mustEmbedUnimplementedAlipayPubRender() {} // UnimplementedAlipayPubBinding can be embedded to have forward compatible implementations. type UnimplementedAlipayPubBinding struct { BindAny func(*gin.Context, any) mir.Error } func (b *UnimplementedAlipayPubBinding) BindAlipayNotify(c *gin.Context) (*web.AlipayNotifyReq, mir.Error) { obj := new(web.AlipayNotifyReq) err := b.BindAny(c, obj) return obj, err } func (b *UnimplementedAlipayPubBinding) mustEmbedUnimplementedAlipayPubBinding() {}