mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-19 06:49:22 +00:00
refactor: Replace magic numbers with named constants.
Co-authored-by: elisiariocouto <818914+elisiariocouto@users.noreply.github.com>
This commit is contained in:
committed by
Elisiário Couto
parent
1a2ec45f89
commit
d58894d07c
@@ -8,6 +8,11 @@ from leggen.services.database_service import DatabaseService
|
|||||||
from leggen.services.gocardless_service import GoCardlessService
|
from leggen.services.gocardless_service import GoCardlessService
|
||||||
from leggen.services.notification_service import NotificationService
|
from leggen.services.notification_service import NotificationService
|
||||||
|
|
||||||
|
# Constants for notification
|
||||||
|
EXPIRED_DAYS_LEFT = 0
|
||||||
|
ACCOUNT_SYNC_RETRY_COUNT = 1
|
||||||
|
ACCOUNT_SYNC_MAX_RETRIES = 1
|
||||||
|
|
||||||
|
|
||||||
class SyncService:
|
class SyncService:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -176,8 +181,8 @@ class SyncService:
|
|||||||
"account_id": account_id,
|
"account_id": account_id,
|
||||||
"error": error_msg,
|
"error": error_msg,
|
||||||
"type": "account_sync_failure",
|
"type": "account_sync_failure",
|
||||||
"retry_count": 1,
|
"retry_count": ACCOUNT_SYNC_RETRY_COUNT,
|
||||||
"max_retries": 1,
|
"max_retries": ACCOUNT_SYNC_MAX_RETRIES,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
except Exception as notif_error:
|
except Exception as notif_error:
|
||||||
@@ -289,7 +294,7 @@ class SyncService:
|
|||||||
"bank": institution_id,
|
"bank": institution_id,
|
||||||
"requisition_id": requisition_id,
|
"requisition_id": requisition_id,
|
||||||
"status": "expired",
|
"status": "expired",
|
||||||
"days_left": 0,
|
"days_left": EXPIRED_DAYS_LEFT,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user