feat(data): add paywall payment APIs

This commit is contained in:
2026-06-18 12:53:06 +08:00
parent 567d3f9184
commit 35c30ac31e
38 changed files with 840 additions and 10 deletions
+36
View File
@@ -0,0 +1,36 @@
/**
* 支付套餐 DTO
*/
import {
PaymentPlanSchema,
type PaymentPlanData,
type PaymentPlanInput,
} from "@/data/schemas/payment/payment_plan";
export class PaymentPlan {
declare readonly planId: string;
declare readonly planName: string;
declare readonly orderType: string;
declare readonly amountCents: number;
declare readonly currency: string;
declare readonly vipDays: number | null;
declare readonly dolAmount: number | null;
private constructor(input: PaymentPlanInput) {
const data = PaymentPlanSchema.parse(input);
Object.assign(this, data);
Object.freeze(this);
}
static from(input: PaymentPlanInput): PaymentPlan {
return new PaymentPlan(input);
}
static fromJson(json: unknown): PaymentPlan {
return PaymentPlan.from(json as PaymentPlanInput);
}
toJson(): PaymentPlanData {
return PaymentPlanSchema.parse(this);
}
}