Files
sarlink-portal-api/billing/utils.py
i701 e3c2d4450f
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m51s
feat(billing): add calculate_total_new_price utility for dynamic payment calculation
2025-07-27 15:17:47 +05:00

34 lines
864 B
Python

def calculate_total_new_price(number_of_devices, number_of_months):
monthly_price_map = {
1: 100,
2: 175,
3: 250,
4: 325,
5: 400,
6: 475,
7: 550,
8: 625,
9: 700,
10: 775,
11: 850,
12: 925,
13: 1000,
14: 1075,
15: 1150,
16: 1225,
17: 1300,
}
if number_of_devices < 1 or number_of_devices > 17:
raise ValueError("Number of devices must be between 1 and 17.")
monthly_price = monthly_price_map[number_of_devices]
total_price = monthly_price * number_of_months
print(f"Monthly price for {number_of_devices} devices: {monthly_price}")
print(f"Total price for {number_of_months} months: {total_price}")
return total_price
calculate_total_new_price(number_of_devices=2, number_of_months=3)