-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
65 lines (52 loc) · 1.94 KB
/
Copy pathmain.py
File metadata and controls
65 lines (52 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
It uses mock data for testing since the real API
doesn't exist yet.
To run with real API (when available):
- Update config.py with real API_BASE_URL
- Remove mock responses from client.py
- Ensure authentication is properly configured
"""
from services.v1.service import EmployeeService
from utils.logger import logger
def main() -> None:
logger.info("Starting Employee Service demonstration")
# Initialize the service
service = EmployeeService()
try:
# employee IDs from mock data
employee_ids = ["1", "2", "3"]
for employee_id in employee_ids:
print(f"\n--- Checking Employee {employee_id} ---")
# Check eligibility
try:
eligible, reasons = service.check_employee_eligibility(employee_id)
print(f"Eligible: {eligible}")
print("Reasons:")
for reason in reasons:
print(f" - {reason}")
except Exception as e:
print(f"Error checking eligibility: {e}")
# Get financial summary
try:
summary = service.get_employee_financial_summary(employee_id)
print("Financial Summary:")
for key, value in summary.items():
print(f" {key}: {value}")
except Exception as e:
print(f"Error getting financial summary: {e}")
# Example with non-existent employee
print(f"\n--- Checking Non-existent Employee ---")
try:
eligible, reasons = service.check_employee_eligibility("999")
print(f"Eligible: {eligible}")
print("Reasons:")
for reason in reasons:
print(f" - {reason}")
except Exception as e:
print(f"Error: {e}")
finally:
# Clean up
service.close()
logger.info("Employee Service demonstration completed")
if __name__ == "__main__":
main()