Jun 28 - Implement payment functions (Stripe)

This commit is contained in:
2026-06-28 12:01:25 -04:00
parent 61ede27093
commit f292c8fb7b
21 changed files with 1112 additions and 18 deletions
+13 -1
View File
@@ -41,9 +41,10 @@ class Plan(ControlBase):
allow_scheduled_reports = Column(Boolean, nullable=False, default=False)
allow_branding = Column(Boolean, nullable=False, default=False)
# Billing (future — MT-8)
# Billing (MT-8)
price_cents = Column(Integer, nullable=True)
billing_period = Column(String(16), nullable=True)
stripe_price_id = Column(String(100), nullable=True)
created_at = Column(DateTime, nullable=False, default=now_eastern)
@@ -100,6 +101,17 @@ class Tenant(ControlBase):
suspended_at = Column(DateTime, nullable=True)
notes = Column(Text, nullable=True)
# ── Billing (MT-8) ─────────────────────────────────────────────────────
stripe_customer_id = Column(String(64), nullable=True, index=True)
stripe_subscription_id = Column(String(64), nullable=True, index=True)
subscription_status = Column(
Enum('trial', 'active', 'past_due', 'cancelled', name='subscription_status'),
nullable=True,
)
trial_ends_at = Column(DateTime, nullable=True)
current_period_end = Column(DateTime, nullable=True)
billing_email = Column(String(255), nullable=True)
plan = relationship('Plan', back_populates='tenants')
domains = relationship('TenantDomain', back_populates='tenant',
cascade='all, delete-orphan')