payemnt billing and credits refactoring
This commit is contained in:
@@ -550,7 +550,9 @@ CELERY_REDIS_BACKEND_USE_SSL = os.getenv('REDIS_SSL_ENABLED', 'false').lower() =
|
||||
|
||||
# Publish/Sync Logging Configuration
|
||||
PUBLISH_SYNC_LOG_DIR = os.path.join(BASE_DIR, 'logs', 'publish-sync-logs')
|
||||
BILLING_LOG_DIR = os.path.join(BASE_DIR, 'logs', 'billing-logs')
|
||||
os.makedirs(PUBLISH_SYNC_LOG_DIR, exist_ok=True)
|
||||
os.makedirs(BILLING_LOG_DIR, exist_ok=True)
|
||||
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
@@ -566,6 +568,11 @@ LOGGING = {
|
||||
'style': '{',
|
||||
'datefmt': '%Y-%m-%d %H:%M:%S',
|
||||
},
|
||||
'billing': {
|
||||
'format': '[{asctime}] [{levelname}] [{name}] {message}',
|
||||
'style': '{',
|
||||
'datefmt': '%Y-%m-%d %H:%M:%S',
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'console': {
|
||||
@@ -593,6 +600,20 @@ LOGGING = {
|
||||
'backupCount': 10,
|
||||
'formatter': 'publish_sync',
|
||||
},
|
||||
'billing_file': {
|
||||
'class': 'logging.handlers.RotatingFileHandler',
|
||||
'filename': os.path.join(BILLING_LOG_DIR, 'billing.log'),
|
||||
'maxBytes': 10 * 1024 * 1024, # 10 MB
|
||||
'backupCount': 20,
|
||||
'formatter': 'billing',
|
||||
},
|
||||
'payment_file': {
|
||||
'class': 'logging.handlers.RotatingFileHandler',
|
||||
'filename': os.path.join(BILLING_LOG_DIR, 'payments.log'),
|
||||
'maxBytes': 10 * 1024 * 1024, # 10 MB
|
||||
'backupCount': 20,
|
||||
'formatter': 'billing',
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'publish_sync': {
|
||||
@@ -610,6 +631,16 @@ LOGGING = {
|
||||
'level': 'INFO',
|
||||
'propagate': False,
|
||||
},
|
||||
'billing': {
|
||||
'handlers': ['console', 'billing_file'],
|
||||
'level': 'INFO',
|
||||
'propagate': False,
|
||||
},
|
||||
'payments': {
|
||||
'handlers': ['console', 'payment_file'],
|
||||
'level': 'INFO',
|
||||
'propagate': False,
|
||||
},
|
||||
'auth.middleware': {
|
||||
'handlers': ['console'],
|
||||
'level': 'INFO',
|
||||
@@ -626,6 +657,7 @@ LOGGING = {
|
||||
# Celery Results Backend
|
||||
CELERY_RESULT_BACKEND = 'django-db'
|
||||
CELERY_CACHE_BACKEND = 'django-cache'
|
||||
CELERY_RESULT_EXTENDED = True # Store task name, args, kwargs in results
|
||||
|
||||
# Import/Export Settings
|
||||
IMPORT_EXPORT_USE_TRANSACTIONS = True
|
||||
@@ -704,6 +736,7 @@ UNFOLD = {
|
||||
{"title": "Credit Packages", "icon": "card_giftcard", "link": lambda request: "/admin/billing/creditpackage/"},
|
||||
{"title": "Payment Methods (Global)", "icon": "credit_card", "link": lambda request: "/admin/billing/paymentmethodconfig/"},
|
||||
{"title": "Account Payment Methods", "icon": "account_balance_wallet", "link": lambda request: "/admin/billing/accountpaymentmethod/"},
|
||||
{"title": "Payment Logs", "icon": "receipt", "link": lambda request: "/admin/billing/webhookevent/"},
|
||||
],
|
||||
},
|
||||
# Credits & AI Usage (CONSOLIDATED)
|
||||
|
||||
Reference in New Issue
Block a user