namespace JiDangJia.Contracts;
public sealed record CardPlan(string Id,string Name,int PriceCents,int OriginalPriceCents,int Days,bool Permanent);
public sealed record PurchaseOffer(List<CardPlan> Plans,bool AlipayEnabled,string Message,string Url="",long Revision=0);
public sealed record PurchasePrices(long Revision,List<CardPlan> Plans);
public sealed record CardPrice(string PlanId,int PriceCents,int OriginalPriceCents);
public sealed record UpdatePurchasePricesRequest(long ExpectedRevision,List<CardPrice>? Plans);
public sealed record CreatePurchaseRequest(string PlanId,string RequestId,string ReceiptKey);
public sealed record PurchaseOrder(string Id,string PlanId,int AmountCents,string Status,string CreatedAt,string ExpiresAt,string PaidAt,string CardCode);
public sealed record PurchaseCheckout(string Url);
public static class PurchaseCatalog
{
public const string ExperienceLabel="首批体验价";
public const string DouyinId="28173761260";
public const string SupportName="辽宁金禧实业";
public const int MaximumPriceCents=100000000;
// Initial database values only. Public displays and orders read the server's saved prices.
public static List<CardPlan> Plans => [new("YEAR","一年卡",8800,16800,365,false),new("PERMANENT","永久卡",19800,32800,0,true)];
public static CardPlan Plan(string id)=>Plans.FirstOrDefault(p=>p.Id==id)??throw new ArgumentException("请选择一年卡或永久卡");
}
namespace JiDangJia.Contracts;
public sealed record CardPlan(string Id,string Name,int PriceCents,int OriginalPriceCents,int Days,bool Permanent);
public sealed record PurchaseOffer(List<CardPlan> Plans,bool AlipayEnabled,string Message,string Url="",long Revision=0);
public sealed record PurchasePrices(long Revision,List<CardPlan> Plans);
public sealed record CardPrice(string PlanId,int PriceCents,int OriginalPriceCents);
public sealed record UpdatePurchasePricesRequest(long ExpectedRevision,List<CardPrice>? Plans);
public sealed record CreatePurchaseRequest(string PlanId,string RequestId,string ReceiptKey);
public sealed record PurchaseOrder(string Id,string PlanId,int AmountCents,string Status,string CreatedAt,string ExpiresAt,string PaidAt,string CardCode);
public sealed record PurchaseCheckout(string Url);
public static class PurchaseCatalog
{
public const string ExperienceLabel="首批体验价";
public const string DouyinId="28173761260";
public const string SupportName="辽宁金禧实业";
public const int MaximumPriceCents=100000000;
// Initial database values only. Public displays and orders read the server's saved prices.
public static List<CardPlan> Plans => [new("YEAR","一年卡",8800,16800,365,false),new("PERMANENT","永久卡",19800,32800,0,true)];
public static CardPlan Plan(string id)=>Plans.FirstOrDefault(p=>p.Id==id)??throw new ArgumentException("请选择一年卡或永久卡");
}