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
@@ -0,0 +1,38 @@
/**
* 支付订单状态响应 DTO
*/
import {
PaymentOrderStatusResponseSchema,
type PaymentOrderStatus,
type PaymentOrderStatusResponseData,
type PaymentOrderStatusResponseInput,
} from "@/data/schemas/payment/payment_order_status_response";
export class PaymentOrderStatusResponse {
declare readonly orderId: string;
declare readonly status: PaymentOrderStatus;
declare readonly orderType: string;
declare readonly planId: string;
private constructor(input: PaymentOrderStatusResponseInput) {
const data = PaymentOrderStatusResponseSchema.parse(input);
Object.assign(this, data);
Object.freeze(this);
}
static from(
input: PaymentOrderStatusResponseInput,
): PaymentOrderStatusResponse {
return new PaymentOrderStatusResponse(input);
}
static fromJson(json: unknown): PaymentOrderStatusResponse {
return PaymentOrderStatusResponse.from(
json as PaymentOrderStatusResponseInput,
);
}
toJson(): PaymentOrderStatusResponseData {
return PaymentOrderStatusResponseSchema.parse(this);
}
}