* 修复(#21): 禁止通用订单状态写入claimed Co-authored-by: multica-agent <github@multica.ai> * 文档(#21): 补充PR说明 Co-authored-by: multica-agent <github@multica.ai> --------- Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -15,6 +15,10 @@ import (
|
||||
queue "github.com/perfect-panel/server/queue/types"
|
||||
)
|
||||
|
||||
const (
|
||||
orderStatusClaimed = 6
|
||||
)
|
||||
|
||||
type UpdateOrderStatusLogic struct {
|
||||
logger.Logger
|
||||
ctx context.Context
|
||||
@@ -31,8 +35,8 @@ func NewUpdateOrderStatusLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||
}
|
||||
|
||||
func (l *UpdateOrderStatusLogic) UpdateOrderStatus(req *types.UpdateOrderStatusRequest) error {
|
||||
if req.Status == orderStatusRefunded {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.OrderStatusError), "refund status must use refund order endpoint")
|
||||
if req.Status == orderStatusClaimed || req.Status == orderStatusRefunded {
|
||||
return errors.Wrapf(xerr.NewErrCode(xerr.OrderStatusError), "claimed/refund statuses are reserved for internal refund and activation flows")
|
||||
}
|
||||
|
||||
info, err := l.svcCtx.OrderModel.FindOne(l.ctx, req.Id)
|
||||
|
||||
Reference in New Issue
Block a user