refactor(payment): remove websocket event dto
This commit is contained in:
@@ -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
|
||||
>;
|
||||
Reference in New Issue
Block a user