feat(payment): implement first recharge offer functionality and UI updates

This commit is contained in:
2026-07-02 14:39:09 +08:00
parent 7b35fd18c5
commit d4de1370e8
20 changed files with 607 additions and 50 deletions
+3
View File
@@ -14,6 +14,9 @@ export const PaymentPlanSchema = z.object({
originalAmountCents: z.number().nullable().default(null),
dailyPriceCents: z.number().nullable().default(null),
currency: z.string(),
isFirstRechargeOffer: z.boolean().default(false),
firstRechargeDiscountPercent: z.number().nullable().default(null),
promotionType: z.string().nullable().default(null),
});
export type PaymentPlanInput = z.input<typeof PaymentPlanSchema>;
@@ -5,7 +5,15 @@ import { z } from "zod";
import { PaymentPlanSchema } from "./payment_plan";
export const FirstRechargeOfferSchema = z.object({
enabled: z.boolean(),
type: z.string(),
discountPercent: z.number(),
});
export const PaymentPlansResponseSchema = z.object({
isFirstRecharge: z.boolean().default(false),
firstRechargeOffer: FirstRechargeOfferSchema.nullable().default(null),
plans: z.array(PaymentPlanSchema),
});
@@ -15,3 +23,4 @@ export type PaymentPlansResponseInput = z.input<
export type PaymentPlansResponseData = z.output<
typeof PaymentPlansResponseSchema
>;
export type FirstRechargeOfferData = z.output<typeof FirstRechargeOfferSchema>;