Skip to content

Commit

Permalink
h
Browse files Browse the repository at this point in the history
  • Loading branch information
it512 committed Nov 26, 2024
1 parent a782e55 commit 7d898e6
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion wechat/bc/h.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/twiglab/crm/wechat/web"
)

func X() http.HandlerFunc {
func BusiCircleAuth() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
req, err := wechat.V3ParseNotify(r)
if err != nil {
Expand All @@ -22,3 +22,33 @@ func X() http.HandlerFunc {
}
}
}

func BusiCirclePayment() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
req, err := wechat.V3ParseNotify(r)
if err != nil {
_ = web.JsonTo(http.StatusInternalServerError, &wechat.V3NotifyRsp{Code: gopay.FAIL, Message: err.Error()}, w)
return
}
ca := BusinessCirclePaymentSource{}
if err := req.DecryptCipherTextToStruct("", &ca); err != nil {
_ = web.JsonTo(http.StatusInternalServerError, &wechat.V3NotifyRsp{Code: gopay.FAIL, Message: err.Error()}, w)
return
}
}
}

func BusiCircleRefund() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
req, err := wechat.V3ParseNotify(r)
if err != nil {
_ = web.JsonTo(http.StatusInternalServerError, &wechat.V3NotifyRsp{Code: gopay.FAIL, Message: err.Error()}, w)
return
}
ca := BusinessCircleRefundSource{}
if err := req.DecryptCipherTextToStruct("", &ca); err != nil {
_ = web.JsonTo(http.StatusInternalServerError, &wechat.V3NotifyRsp{Code: gopay.FAIL, Message: err.Error()}, w)
return
}
}
}

0 comments on commit 7d898e6

Please sign in to comment.