## Summary - Rename `finance` → **`monetization`** Django app (keep `finance_*` tables via `label = "finance"`) - Add `services/stripe.py` + `services/revenuecat.py`; RevenueCat webhook upserts **subscription + Invoice/Payment** (billing history parity with Stripe) - Mount `/api/monetization/` + keep `/api/finance/` alias - Extend `Source`/`Provider` with `revenuecat`; product→plan mapping via `revenuecat_product_id` / `REVENUECAT_PRODUCT_PLAN_MAP` Closes #68. Companion to [chat_web_app#100](ai_ml_operations/chat_web_app#100). ## Test plan - [x] `manage.py test monetization.tests` (54 OK) - [x] Smoke `chat_backend.tests.test_views_documents` + `test_oauth` - [ ] Deploy: set `REVENUECAT_WEBHOOK_SECRET`; point RC webhook at `/api/finance/webhooks/revenuecat/` - [ ] Map store product IDs on `SubscriptionPlan.revenuecat_product_id` (or env JSON map) - [ ] Sandbox INITIAL_PURCHASE → subscription `source=revenuecat` + invoice in `/finance/invoices/`Reviewed-on: #69
56 lines
1.2 KiB
Python
56 lines
1.2 KiB
Python
from django.urls import path
|
|
|
|
from monetization.views import (
|
|
CreateBillingPortalSessionView,
|
|
CreateCheckoutSessionView,
|
|
InvoiceListView,
|
|
PaymentListView,
|
|
PlanListView,
|
|
RevenueCatWebhookView,
|
|
StripeWebhookView,
|
|
SubscriptionMeView,
|
|
)
|
|
|
|
urlpatterns = [
|
|
path(
|
|
"checkout/",
|
|
CreateCheckoutSessionView.as_view(),
|
|
name="finance_checkout",
|
|
),
|
|
path(
|
|
"portal/",
|
|
CreateBillingPortalSessionView.as_view(),
|
|
name="finance_portal",
|
|
),
|
|
path(
|
|
"invoices/",
|
|
InvoiceListView.as_view(),
|
|
name="finance_invoices",
|
|
),
|
|
path(
|
|
"payments/",
|
|
PaymentListView.as_view(),
|
|
name="finance_payments",
|
|
),
|
|
path(
|
|
"plans/",
|
|
PlanListView.as_view(),
|
|
name="finance_plans",
|
|
),
|
|
path(
|
|
"subscription/",
|
|
SubscriptionMeView.as_view(),
|
|
name="finance_subscription_me",
|
|
),
|
|
path(
|
|
"webhooks/stripe/",
|
|
StripeWebhookView.as_view(),
|
|
name="finance_stripe_webhook",
|
|
),
|
|
path(
|
|
"webhooks/revenuecat/",
|
|
RevenueCatWebhookView.as_view(),
|
|
name="finance_revenuecat_webhook",
|
|
),
|
|
]
|