Monetization app + RevenueCat webhooks (store IAP ledger) (#69)
## 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
This commit was merged in pull request #69.
This commit is contained in:
1 parent
2aeb95136a
commit
e1e086a474
44 files changed
+965
-102
No files matched your search
@@ -72,8 +72,8 @@ class CustomUserSerializer(serializers.ModelSerializer):
|
||||
extra_kwargs = {"password": {"write_only": True}}
|
||||
|
||||
def get_subscription(self, obj):
|
||||
from finance.services.plans import needs_checkout, plan_to_dict
|
||||
from finance.models import UserSubscription
|
||||
from monetization.services.plans import needs_checkout, plan_to_dict
|
||||
from monetization.models import UserSubscription
|
||||
|
||||
try:
|
||||
sub = obj.subscription
|
||||
@@ -122,7 +122,7 @@ class SelfServeRegistrationSerializer(serializers.Serializer):
|
||||
return email
|
||||
|
||||
def create(self, validated_data):
|
||||
from finance.services.plans import try_redeem_backer_email
|
||||
from monetization.services.plans import try_redeem_backer_email
|
||||
|
||||
email = validated_data["email"]
|
||||
password = validated_data["password"]
|
||||
|
||||
Reference in new issue
Block a user