forked from andika/membership-be
Update:- Membership Plan- Donation- Member detail for Member Directory
This commit is contained in:
26
models.py
26
models.py
@@ -143,10 +143,23 @@ class SubscriptionPlan(Base):
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
name = Column(String, nullable=False)
|
||||
description = Column(Text, nullable=True)
|
||||
price_cents = Column(Integer, nullable=False) # Price in cents
|
||||
billing_cycle = Column(String, default="yearly", nullable=False) # yearly, monthly, etc.
|
||||
stripe_price_id = Column(String, nullable=True) # Stripe Price ID
|
||||
price_cents = Column(Integer, nullable=False) # Price in cents (legacy, kept for backward compatibility)
|
||||
billing_cycle = Column(String, default="yearly", nullable=False) # yearly, monthly, quarterly, lifetime, custom
|
||||
stripe_price_id = Column(String, nullable=True) # Stripe Price ID (legacy, deprecated)
|
||||
active = Column(Boolean, default=True)
|
||||
|
||||
# Custom billing cycle fields (for recurring date ranges like Jan 1 - Dec 31)
|
||||
custom_cycle_enabled = Column(Boolean, default=False, nullable=False)
|
||||
custom_cycle_start_month = Column(Integer, nullable=True) # 1-12
|
||||
custom_cycle_start_day = Column(Integer, nullable=True) # 1-31
|
||||
custom_cycle_end_month = Column(Integer, nullable=True) # 1-12
|
||||
custom_cycle_end_day = Column(Integer, nullable=True) # 1-31
|
||||
|
||||
# Dynamic pricing fields
|
||||
minimum_price_cents = Column(Integer, default=3000, nullable=False) # $30 minimum
|
||||
suggested_price_cents = Column(Integer, nullable=True) # Suggested price (can be higher than minimum)
|
||||
allow_donation = Column(Boolean, default=True, nullable=False) # Allow members to add donations
|
||||
|
||||
created_at = Column(DateTime, default=lambda: datetime.now(timezone.utc))
|
||||
updated_at = Column(DateTime, default=lambda: datetime.now(timezone.utc), onupdate=lambda: datetime.now(timezone.utc))
|
||||
|
||||
@@ -164,7 +177,12 @@ class Subscription(Base):
|
||||
status = Column(SQLEnum(SubscriptionStatus), default=SubscriptionStatus.active, nullable=False)
|
||||
start_date = Column(DateTime, nullable=False)
|
||||
end_date = Column(DateTime, nullable=True)
|
||||
amount_paid_cents = Column(Integer, nullable=True) # Amount paid in cents
|
||||
amount_paid_cents = Column(Integer, nullable=True) # Total amount paid in cents (base + donation)
|
||||
|
||||
# Donation tracking fields (for transparency and tax reporting)
|
||||
base_subscription_cents = Column(Integer, nullable=False) # Plan base price (minimum)
|
||||
donation_cents = Column(Integer, default=0, nullable=False) # Additional donation amount
|
||||
# Note: amount_paid_cents = base_subscription_cents + donation_cents
|
||||
|
||||
# Manual payment fields
|
||||
manual_payment = Column(Boolean, default=False, nullable=False) # Whether this was a manual offline payment
|
||||
|
||||
Reference in New Issue
Block a user