Version 1.9.0
This commit is contained in:
@@ -129,6 +129,8 @@
|
||||
└───────────────┘ └────────────────────┘
|
||||
```
|
||||
|
||||
> **Note:** The two-pool logic is internal to `CreditService.deduct_credits()`. All AI functions and other credit consumers are unaffected - they call the same credit check/deduct methods as before.
|
||||
|
||||
### Credit Operations
|
||||
|
||||
| Operation | Method | Affects | Description |
|
||||
@@ -481,7 +483,7 @@ Invoice Created ──▶ 48 hours ──▶ Reminder Sent ──▶ 48 hours
|
||||
│ │
|
||||
│ SCENARIO 3: No Payment After 24 Hours │
|
||||
│ ───────────────────────────────────── │
|
||||
│ • plan credits → reset to 0 (task: reset_unpaid_renewal_credits) │
|
||||
│ • plan credits → reset to 0 (task: send_day_after_reminders) │
|
||||
│ • bonus_credits → UNCHANGED (user can still use these) │
|
||||
│ • Warning email sent │
|
||||
│ │
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
# Billing Module
|
||||
|
||||
**Last Verified:** January 10, 2026
|
||||
**Status:** ✅ Active (Image Generation Credit System Complete January 2026)
|
||||
**Last Verified:** January 20, 2026
|
||||
**Status:** ✅ Active (Two-Pool Credit System v2.0 January 2026)
|
||||
**Backend Path:** `backend/igny8_core/modules/billing/` + `backend/igny8_core/business/billing/`
|
||||
**Frontend Path:** `frontend/src/pages/Billing/` + `frontend/src/pages/Account/`
|
||||
|
||||
> **Payment System Reference:** For comprehensive payment gateway documentation (Stripe, PayPal, Bank Transfer), see [PAYMENT-SYSTEM.md](../90-REFERENCE/PAYMENT-SYSTEM.md)
|
||||
> **Complete Billing Reference:** For comprehensive billing & payment documentation, see [BILLING-PAYMENTS-COMPLETE.md](BILLING-PAYMENTS-COMPLETE.md)
|
||||
> **Payment System Reference:** For payment gateway documentation (Stripe, PayPal, Bank Transfer), see [PAYMENT-SYSTEM.md](../90-REFERENCE/PAYMENT-SYSTEM.md)
|
||||
|
||||
---
|
||||
|
||||
## Two-Pool Credit System (v2.0)
|
||||
|
||||
| Pool | Field | Source | Behavior |
|
||||
|------|-------|--------|----------|
|
||||
| **Plan Credits** | `account.credits` | Subscription plan | Reset on renewal, reset to 0 if unpaid after 24h |
|
||||
| **Bonus Credits** | `account.bonus_credits` | Credit packages | **NEVER expire**, **NEVER reset** |
|
||||
|
||||
### Credit Usage Priority
|
||||
1. **Plan credits** used FIRST
|
||||
2. **Bonus credits** only used when plan credits = 0
|
||||
|
||||
### What Happens on Renewal
|
||||
| Event | Plan Credits | Bonus Credits |
|
||||
|-------|--------------|---------------|
|
||||
| Payment success | Reset to plan amount | No change |
|
||||
| No payment (24h) | Reset to 0 | No change |
|
||||
| Late payment | Reset to plan amount | No change |
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ SeedKeywords (Global) → Keywords (Site/Sector) → Clusters → ContentIdeas
|
||||
|
||||
**Trigger:** User clicks "Auto Cluster" button
|
||||
**AI Function:** `AutoClusterFunction`
|
||||
**Credit Cost:** Per batch (configurable)
|
||||
**Credit Cost:** Based on AI tokens used (see AIModelConfig)
|
||||
|
||||
**Flow:**
|
||||
1. User selects keywords (or all unclustered)
|
||||
@@ -144,7 +144,7 @@ SeedKeywords (Global) → Keywords (Site/Sector) → Clusters → ContentIdeas
|
||||
|
||||
**Trigger:** User clicks "Generate Ideas" on cluster(s)
|
||||
**AI Function:** `GenerateIdeasFunction`
|
||||
**Credit Cost:** Per idea generated
|
||||
**Credit Cost:** Based on AI tokens used (see AIModelConfig)
|
||||
|
||||
**Flow:**
|
||||
1. User selects clusters
|
||||
|
||||
@@ -147,7 +147,7 @@ ContentIdeas → Tasks → Content → Images → Review → Publish
|
||||
|
||||
**Trigger:** User clicks "Generate" on task
|
||||
**AI Function:** `GenerateContentFunction`
|
||||
**Credit Cost:** Per 100 words generated
|
||||
**Credit Cost:** Based on AI tokens used (see AIModelConfig)
|
||||
|
||||
**Flow:**
|
||||
1. User has task with title, keywords, word count target
|
||||
@@ -165,7 +165,7 @@ ContentIdeas → Tasks → Content → Images → Review → Publish
|
||||
|
||||
**Trigger:** Part of content generation or explicit
|
||||
**AI Function:** `GenerateImagePromptsFunction`
|
||||
**Credit Cost:** Per prompt
|
||||
**Credit Cost:** Based on AI tokens used (see AIModelConfig)
|
||||
|
||||
**Flow:**
|
||||
1. Content exists with body
|
||||
@@ -179,7 +179,7 @@ ContentIdeas → Tasks → Content → Images → Review → Publish
|
||||
|
||||
**Trigger:** User clicks "Generate Images" or automation
|
||||
**AI Function:** `GenerateImagesFunction`
|
||||
**Credit Cost:** Per image
|
||||
**Credit Cost:** Deducted per image (see AIModelConfig.credits_per_image)
|
||||
|
||||
**Flow:**
|
||||
1. Image record exists with prompt, status=pending
|
||||
|
||||
Reference in New Issue
Block a user