payemnt billing and credits refactoring
This commit is contained in:
@@ -336,6 +336,13 @@ class Invoice(AccountBaseModel):
|
||||
Invoice for subscription or credit purchases
|
||||
Tracks billing invoices with line items and payment status
|
||||
"""
|
||||
INVOICE_TYPE_CHOICES = [
|
||||
('subscription', 'Subscription'),
|
||||
('credit_package', 'Credit Package'),
|
||||
('addon', 'Add-on'),
|
||||
('custom', 'Custom'),
|
||||
]
|
||||
|
||||
STATUS_CHOICES = [
|
||||
('draft', 'Draft'),
|
||||
('pending', 'Pending'),
|
||||
@@ -345,6 +352,14 @@ class Invoice(AccountBaseModel):
|
||||
]
|
||||
|
||||
invoice_number = models.CharField(max_length=50, unique=True, db_index=True)
|
||||
|
||||
# Type
|
||||
invoice_type = models.CharField(
|
||||
max_length=30,
|
||||
choices=INVOICE_TYPE_CHOICES,
|
||||
default='custom',
|
||||
db_index=True
|
||||
)
|
||||
|
||||
# Subscription relationship
|
||||
subscription = models.ForeignKey(
|
||||
@@ -369,6 +384,10 @@ class Invoice(AccountBaseModel):
|
||||
invoice_date = models.DateField(db_index=True)
|
||||
due_date = models.DateField()
|
||||
paid_at = models.DateTimeField(null=True, blank=True)
|
||||
expires_at = models.DateTimeField(null=True, blank=True)
|
||||
|
||||
# Void metadata
|
||||
void_reason = models.TextField(blank=True)
|
||||
|
||||
# Line items
|
||||
line_items = models.JSONField(default=list, help_text="Invoice line items: [{description, amount, quantity}]")
|
||||
|
||||
Reference in New Issue
Block a user