mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-03-06 14:03:07 +00:00
fix: abs() for transaction amounts in admin notifications and subscription events
- send_subscription_purchase_notification: abs(transaction.amount_kopeks) when no explicit amount_kopeks passed - send_subscription_renewal_notification: abs(transaction.amount_kopeks) for SubscriptionEvent storage - Prevents negative amounts in admin Telegram messages and SubscriptionEvent records
This commit is contained in:
@@ -403,7 +403,7 @@ class AdminNotificationService:
|
||||
) -> bool:
|
||||
try:
|
||||
total_amount = (
|
||||
amount_kopeks if amount_kopeks is not None else (transaction.amount_kopeks if transaction else 0)
|
||||
amount_kopeks if amount_kopeks is not None else (abs(transaction.amount_kopeks) if transaction else 0)
|
||||
)
|
||||
|
||||
await self._record_subscription_event(
|
||||
@@ -846,7 +846,7 @@ class AdminNotificationService:
|
||||
user=user,
|
||||
subscription=subscription,
|
||||
transaction=transaction,
|
||||
amount_kopeks=transaction.amount_kopeks,
|
||||
amount_kopeks=abs(transaction.amount_kopeks),
|
||||
message='Subscription renewed',
|
||||
occurred_at=transaction.completed_at or transaction.created_at,
|
||||
extra={
|
||||
|
||||
Reference in New Issue
Block a user