generated from coulomb/repo-seed
Fix cumulative platform cost Stripe double-counting
Split infrastructure vs payment-processing costs. Liquidity burn now uses infrastructure cash out only (€1,155.20 cumulative) because Stripe fees are already deducted from net member payments. Total platform cost (€1,158.24) remains visible for gross-margin economics.
This commit is contained in:
@@ -27,19 +27,16 @@ def test_active_members_counts_only_active_status() -> None:
|
||||
assert active_members(members) == 1
|
||||
|
||||
|
||||
def test_rate_card_matches_documented_platform_cost_without_revenue() -> None:
|
||||
def test_rate_card_splits_infrastructure_and_payment_processing() -> None:
|
||||
rate_card, fx_rates = load_cost_rate_card(DATA_DIR)
|
||||
total = monthly_cost_from_rate_card(rate_card, fx_rates, Decimal("0"), 0)
|
||||
assert total == Decimal("72.20")
|
||||
infrastructure = monthly_cost_from_rate_card(rate_card, fx_rates, Decimal("0"), 0)
|
||||
with_revenue = monthly_cost_from_rate_card(rate_card, fx_rates, Decimal("8.99"), 1)
|
||||
assert infrastructure == Decimal("72.20")
|
||||
assert with_revenue == Decimal("72.58")
|
||||
assert with_revenue - infrastructure == Decimal("0.38")
|
||||
|
||||
|
||||
def test_rate_card_matches_platform_cost_with_one_member() -> None:
|
||||
rate_card, fx_rates = load_cost_rate_card(DATA_DIR)
|
||||
total = monthly_cost_from_rate_card(rate_card, fx_rates, Decimal("8.99"), 1)
|
||||
assert total == Decimal("72.58")
|
||||
|
||||
|
||||
def test_build_snapshot_june_2026_shows_liquidity_burn() -> None:
|
||||
def test_build_snapshot_june_2026_avoids_stripe_double_count_in_liquidity() -> None:
|
||||
product = load_product(DATA_DIR)
|
||||
models = load_pricing_models(DATA_DIR)
|
||||
members = load_membership(DATA_DIR)
|
||||
@@ -48,37 +45,34 @@ def test_build_snapshot_june_2026_shows_liquidity_burn() -> None:
|
||||
|
||||
snapshot = build_snapshot("2026-06", product, models, members, revenue, monthly_costs)
|
||||
|
||||
assert snapshot.active_members == 1
|
||||
assert snapshot.monthly_revenue == Decimal("8.99")
|
||||
assert snapshot.monthly_platform_cost == Decimal("72.58")
|
||||
assert snapshot.period_net_liquidity == Decimal("-63.97")
|
||||
assert snapshot.liquidity_status == "burning"
|
||||
assert snapshot.monthly_infrastructure_cost == Decimal("72.20")
|
||||
assert snapshot.monthly_payment_processing_cost == Decimal("0.38")
|
||||
assert snapshot.monthly_total_platform_cost == Decimal("72.58")
|
||||
assert snapshot.period_net_liquidity == Decimal("-63.59")
|
||||
assert snapshot.gross_margin == Decimal("-63.59")
|
||||
|
||||
|
||||
def test_liquidity_summary_tracks_budget_burn_through_june_2026() -> None:
|
||||
def test_liquidity_summary_uses_infrastructure_only_for_cumulative_burn() -> None:
|
||||
budget = load_budget(DATA_DIR)
|
||||
revenue = load_revenue(DATA_DIR)
|
||||
monthly_costs = load_monthly_platform_costs(DATA_DIR)
|
||||
|
||||
summary = build_liquidity_summary(budget, revenue, monthly_costs, "2026-06")
|
||||
|
||||
assert summary.initial_budget == Decimal("1000.00")
|
||||
assert summary.cumulative_platform_cost == Decimal("1158.24")
|
||||
assert summary.cumulative_infrastructure_cost == Decimal("1155.20")
|
||||
assert summary.cumulative_payment_processing_cost == Decimal("3.04")
|
||||
assert summary.cumulative_total_platform_cost == Decimal("1158.24")
|
||||
assert summary.cumulative_member_payments == Decimal("68.88")
|
||||
assert summary.cumulative_net_liquidity == Decimal("-1089.36")
|
||||
assert summary.remaining_budget == Decimal("-89.36")
|
||||
assert summary.cumulative_net_liquidity == Decimal("-1086.32")
|
||||
assert summary.remaining_budget == Decimal("-86.32")
|
||||
assert summary.liquidity_status == "burning"
|
||||
assert summary.months_tracked == 16
|
||||
|
||||
|
||||
def test_dashboard_renders_liquidity_sections() -> None:
|
||||
def test_dashboard_renders_split_cost_columns() -> None:
|
||||
from observatory.dashboard import generate_dashboard
|
||||
|
||||
report = generate_dashboard(DATA_DIR, "2026-06")
|
||||
assert "Liquidity & Budget" in report
|
||||
assert "Monthly History" in report
|
||||
assert "2025-03" in report
|
||||
assert "2025-11" in report
|
||||
assert "remaining budget" not in report.lower() or "Remaining budget" in report
|
||||
assert "-89.36" in report
|
||||
assert "Cumulative infrastructure cost" in report
|
||||
assert "1155.20" in report
|
||||
assert "-86.32" in report
|
||||
Reference in New Issue
Block a user