优化支付退款钱包链路

This commit is contained in:
yml
2026-06-03 21:47:04 +08:00
parent 04193ae687
commit c80d3f960e
26 changed files with 1342 additions and 504 deletions
@@ -99,6 +99,19 @@ func (h *Handler) WalletRechargeQuery(c *gin.Context) {
response.OK(c, item)
}
func (h *Handler) QueryRefundStatus(c *gin.Context) {
orderID, ok := parseID(c)
if !ok {
return
}
item, err := h.service.QueryRefundStatus(orderID)
if err != nil {
writePaymentError(c, err)
return
}
response.OK(c, item)
}
func (h *Handler) LeshuaNotify(c *gin.Context) {
body, err := io.ReadAll(io.LimitReader(c.Request.Body, 1<<20))
if err != nil {
@@ -157,6 +170,10 @@ func writePaymentError(c *gin.Context, err error) {
response.Error(c, http.StatusBadGateway, "payment_unavailable", "支付渠道暂不可用")
case errors.Is(err, ErrPaymentCannotStart), errors.Is(err, order.ErrOrderCannotPay):
response.Error(c, http.StatusConflict, "payment_cannot_start", "当前订单不能支付")
case errors.Is(err, ErrRefundCannotStart):
response.Error(c, http.StatusConflict, "refund_cannot_start", "当前订单不能退款")
case errors.Is(err, ErrWalletRechargeDisabled):
response.Error(c, http.StatusGone, "wallet_recharge_disabled", "钱包充值已关闭")
case errors.Is(err, ErrPaymentVerifyFailed):
response.Error(c, http.StatusForbidden, "payment_verify_failed", "支付通知验签失败")
case errors.Is(err, ErrPaymentNotFound), errors.Is(err, gorm.ErrRecordNotFound), order.IsNotFound(err):