refactor(payment): remove websocket event dto

This commit is contained in:
2026-06-23 18:11:26 +08:00
parent a47038c46f
commit 18617ac7e5
4 changed files with 0 additions and 87 deletions
-1
View File
@@ -8,4 +8,3 @@ export * from "./payment_order_status_response";
export * from "./payment_plan";
export * from "./payment_plans_response";
export * from "./payment_vip_status_response";
export * from "./payment_websocket_event";
@@ -1,52 +0,0 @@
/**
* 支付 WebSocket 事件
*/
import { z } from "zod";
export const PaymentSuccessVipEventSchema = z.object({
type: z.literal("payment_success"),
orderId: z.string(),
payType: z.literal("vip"),
planName: z.string(),
vipExpiresAt: z.string().nullable(),
});
export const PaymentSuccessDolEventSchema = z.object({
type: z.literal("payment_success"),
orderId: z.string(),
payType: z.literal("dol"),
planName: z.string(),
dolAmount: z.number(),
dolBalance: z.number(),
});
export const PaymentFailedEventSchema = z.object({
type: z.literal("payment_failed"),
orderId: z.string(),
info: z.string(),
});
export const PaymentSuccessEventSchema = z.discriminatedUnion("payType", [
PaymentSuccessVipEventSchema,
PaymentSuccessDolEventSchema,
]);
export const PaymentWebSocketEventSchema = z.union([
PaymentSuccessEventSchema,
PaymentFailedEventSchema,
]);
export type PaymentSuccessVipEventData = z.output<
typeof PaymentSuccessVipEventSchema
>;
export type PaymentSuccessDolEventData = z.output<
typeof PaymentSuccessDolEventSchema
>;
export type PaymentFailedEventData = z.output<typeof PaymentFailedEventSchema>;
export type PaymentSuccessEventData = z.output<typeof PaymentSuccessEventSchema>;
export type PaymentWebSocketEventInput = z.input<
typeof PaymentWebSocketEventSchema
>;
export type PaymentWebSocketEventData = z.output<
typeof PaymentWebSocketEventSchema
>;