修复(#10): 禁止通用订单状态接口标记退款 (#12)

Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
2026-06-05 23:35:42 -07:00
committed by GitHub
parent 34cd1c524e
commit bcb8cd222c
2 changed files with 31 additions and 0 deletions
@@ -0,0 +1,27 @@
package order
import (
"context"
"testing"
"github.com/perfect-panel/server/internal/svc"
"github.com/perfect-panel/server/internal/types"
"github.com/perfect-panel/server/pkg/logger"
"github.com/perfect-panel/server/pkg/xerr"
)
func TestUpdateOrderStatus_RejectsRefundStatus(t *testing.T) {
logic := &UpdateOrderStatusLogic{
Logger: logger.WithContext(context.Background()),
ctx: context.Background(),
svcCtx: &svc.ServiceContext{},
}
err := logic.UpdateOrderStatus(&types.UpdateOrderStatusRequest{
Id: 1001,
Status: orderStatusRefunded,
})
if !isErrCode(err, xerr.OrderStatusError) {
t.Fatalf("UpdateOrderStatus error code = %v, want OrderStatusError; raw=%v", errCodeOf(err), err)
}
}