All checks were successful
构建并部署到测试环境(无 SSH) / build-and-deploy (push) Successful in 8m52s
- 受控配置新增代理在线自充允许范围(仅微信/仅支付宝/同时支持),读侧与创建侧取允许范围与可用商户池交集,两侧失败关闭 - 新增允许范围查询与修改端点,读限代理与平台账号、写限超级管理员,复用受控配置写服务留痕 - tb_agent_recharge_record 新增交易流水号、线下收款方式三列快照与其他凭证列(成对迁移 000213) - 线下申请校验启用的收款方式字典项与必填交易流水号,交易流水号独立于在线渠道交易号、不参与去重 - 扩展 offline_recharge_approval 场景可映射字段白名单与字典引用保护 - 新增付款凭证识别能力与交易流水号预填接口,识别不落库、日志不记录载荷
97 lines
3.6 KiB
Go
97 lines
3.6 KiB
Go
package routes
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
|
|
"github.com/break/junhong_cmp_fiber/internal/handler/admin"
|
|
"github.com/break/junhong_cmp_fiber/internal/model/dto"
|
|
"github.com/break/junhong_cmp_fiber/pkg/constants"
|
|
"github.com/break/junhong_cmp_fiber/pkg/errors"
|
|
"github.com/break/junhong_cmp_fiber/pkg/middleware"
|
|
"github.com/break/junhong_cmp_fiber/pkg/openapi"
|
|
)
|
|
|
|
func registerAgentRechargeRoutes(router fiber.Router, handler *admin.AgentRechargeHandler, doc *openapi.Generator, basePath string) {
|
|
group := router.Group("/agent-recharges", func(c *fiber.Ctx) error {
|
|
userType := middleware.GetUserTypeFromContext(c.UserContext())
|
|
if userType == constants.UserTypeEnterprise {
|
|
return errors.New(errors.CodeForbidden, "企业账号无权访问代理充值功能")
|
|
}
|
|
return c.Next()
|
|
})
|
|
groupPath := basePath + "/agent-recharges"
|
|
|
|
Register(group, doc, groupPath, "POST", "", handler.Create, RouteSpec{
|
|
Summary: "创建代理充值订单",
|
|
Tags: []string{"代理预充值"},
|
|
Input: new(dto.CreateAgentRechargeRequest),
|
|
Output: new(dto.AgentRechargeOnlineResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(group, doc, groupPath, "GET", "", handler.List, RouteSpec{
|
|
Summary: "查询代理充值订单列表",
|
|
Description: "平台账号可查看全部;代理账号仅返回自己店铺及下级店铺的充值订单。",
|
|
Tags: []string{"代理预充值"},
|
|
Input: new(dto.AgentRechargeListRequest),
|
|
Output: new(dto.AgentRechargeListResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(group, doc, groupPath, "GET", "/payment-methods", handler.PaymentMethods, RouteSpec{
|
|
Summary: "查询代理在线充值可用支付方式",
|
|
Tags: []string{"代理预充值"},
|
|
Output: new(dto.AgentRechargePaymentMethodsResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(group, doc, groupPath, "POST", "/payment-voucher-ocr", handler.PaymentVoucherOCR, RouteSpec{
|
|
Summary: "识别付款凭证中的交易流水号",
|
|
Description: "按付款凭证对象键调用识别能力,只返回交易流水号预填值供人工确认或更正;识别结果不写入任何资金事实,失败不阻断人工填写。",
|
|
Tags: []string{"代理预充值"},
|
|
Input: new(dto.AgentRechargePaymentVoucherOCRRequest),
|
|
Output: new(dto.AgentRechargePaymentVoucherOCRResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(group, doc, groupPath, "GET", "/:id/payment-status", handler.PaymentStatus, RouteSpec{
|
|
Summary: "查询代理充值本地支付与到账状态",
|
|
Tags: []string{"代理预充值"},
|
|
Input: new(dto.IDReq),
|
|
Output: new(dto.AgentRechargePaymentStatusResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(group, doc, groupPath, "GET", "/:id", handler.Get, RouteSpec{
|
|
Summary: "查询代理充值订单详情",
|
|
Tags: []string{"代理预充值"},
|
|
Input: new(dto.IDReq),
|
|
Output: new(dto.AgentRechargeResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(group, doc, groupPath, "POST", "/:id/trigger-approval", handler.TriggerApproval, RouteSpec{
|
|
Summary: "补发历史线下代理充值审批",
|
|
Tags: []string{"代理预充值"},
|
|
Input: new(dto.IDReq),
|
|
Output: new(dto.AgentRechargeResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(group, doc, groupPath, "POST", "/:id/offline-pay", handler.OfflinePay, RouteSpec{
|
|
Summary: "确认线下充值",
|
|
Tags: []string{"代理预充值"},
|
|
Input: new(dto.AgentOfflinePayParams),
|
|
Output: new(dto.AgentRechargeResponse),
|
|
Auth: true,
|
|
})
|
|
|
|
Register(group, doc, groupPath, "POST", "/:id/reject", handler.Reject, RouteSpec{
|
|
Summary: "驳回代理充值订单",
|
|
Tags: []string{"代理预充值"},
|
|
Input: new(dto.AgentRechargeRejectParams),
|
|
Output: nil,
|
|
Auth: true,
|
|
})
|
|
}
|