fx-shared-models 0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- fx_shared_models-0.1/PKG-INFO +26 -0
- fx_shared_models-0.1/fx_shared_models.egg-info/PKG-INFO +26 -0
- fx_shared_models-0.1/fx_shared_models.egg-info/SOURCES.txt +8 -0
- fx_shared_models-0.1/fx_shared_models.egg-info/dependency_links.txt +1 -0
- fx_shared_models-0.1/fx_shared_models.egg-info/requires.txt +2 -0
- fx_shared_models-0.1/fx_shared_models.egg-info/top_level.txt +1 -0
- fx_shared_models-0.1/setup.cfg +4 -0
- fx_shared_models-0.1/setup.py +25 -0
- fx_shared_models-0.1/shared_models/__init__.py +6 -0
- fx_shared_models-0.1/shared_models/constants.py +414 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: fx_shared_models
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Shared models for FX Backend
|
|
5
|
+
Home-page: https://github.com/fxbackend/fx_shared_models
|
|
6
|
+
Author: FX Backend
|
|
7
|
+
Author-email: fxbackend@gmail.com
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Requires-Dist: Django>=3.0
|
|
16
|
+
Requires-Dist: django-environ>=0.10.0
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: classifier
|
|
20
|
+
Dynamic: description
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
Shared models package containing Customer and System Settings models for FX Backend
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: fx_shared_models
|
|
3
|
+
Version: 0.1
|
|
4
|
+
Summary: Shared models for FX Backend
|
|
5
|
+
Home-page: https://github.com/fxbackend/fx_shared_models
|
|
6
|
+
Author: FX Backend
|
|
7
|
+
Author-email: fxbackend@gmail.com
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
13
|
+
Classifier: Framework :: Django
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Requires-Dist: Django>=3.0
|
|
16
|
+
Requires-Dist: django-environ>=0.10.0
|
|
17
|
+
Dynamic: author
|
|
18
|
+
Dynamic: author-email
|
|
19
|
+
Dynamic: classifier
|
|
20
|
+
Dynamic: description
|
|
21
|
+
Dynamic: home-page
|
|
22
|
+
Dynamic: requires-dist
|
|
23
|
+
Dynamic: requires-python
|
|
24
|
+
Dynamic: summary
|
|
25
|
+
|
|
26
|
+
Shared models package containing Customer and System Settings models for FX Backend
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
setup.py
|
|
2
|
+
fx_shared_models.egg-info/PKG-INFO
|
|
3
|
+
fx_shared_models.egg-info/SOURCES.txt
|
|
4
|
+
fx_shared_models.egg-info/dependency_links.txt
|
|
5
|
+
fx_shared_models.egg-info/requires.txt
|
|
6
|
+
fx_shared_models.egg-info/top_level.txt
|
|
7
|
+
shared_models/__init__.py
|
|
8
|
+
shared_models/constants.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
shared_models
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='fx_shared_models',
|
|
5
|
+
version='0.1',
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
install_requires=[
|
|
8
|
+
'Django>=3.0',
|
|
9
|
+
'django-environ>=0.10.0',
|
|
10
|
+
],
|
|
11
|
+
python_requires='>=3.8',
|
|
12
|
+
author='FX Backend',
|
|
13
|
+
author_email='fxbackend@gmail.com',
|
|
14
|
+
description='Shared models for FX Backend',
|
|
15
|
+
long_description='Shared models package containing Customer and System Settings models for FX Backend',
|
|
16
|
+
url='https://github.com/fxbackend/fx_shared_models',
|
|
17
|
+
classifiers=[
|
|
18
|
+
'Development Status :: 3 - Alpha',
|
|
19
|
+
'Intended Audience :: Developers',
|
|
20
|
+
'License :: OSI Approved :: MIT License',
|
|
21
|
+
'Programming Language :: Python :: 3',
|
|
22
|
+
'Programming Language :: Python :: 3.8',
|
|
23
|
+
'Framework :: Django',
|
|
24
|
+
],
|
|
25
|
+
)
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
class EmailProvider(str, Enum):
|
|
4
|
+
SMTP = 'smtp'
|
|
5
|
+
SENDGRID = 'sendgrid'
|
|
6
|
+
|
|
7
|
+
class SettingType(str, Enum):
|
|
8
|
+
EMAIL = 'email'
|
|
9
|
+
SECURITY = 'security'
|
|
10
|
+
KYC = 'kyc'
|
|
11
|
+
COMMISSION = 'commission'
|
|
12
|
+
|
|
13
|
+
class SettingStatus(str, Enum):
|
|
14
|
+
ACTIVE = 'active'
|
|
15
|
+
INACTIVE = 'inactive'
|
|
16
|
+
PENDING = 'pending'
|
|
17
|
+
|
|
18
|
+
class ContentType(str, Enum):
|
|
19
|
+
TEXT = 'text'
|
|
20
|
+
HTML = 'html'
|
|
21
|
+
|
|
22
|
+
class BaseEmailVariables:
|
|
23
|
+
"""Base variables available for all system emails"""
|
|
24
|
+
NAME = "name"
|
|
25
|
+
EMAIL = "email"
|
|
26
|
+
PHONE = "phone"
|
|
27
|
+
ID = "id"
|
|
28
|
+
FIRST_NAME = "first_name"
|
|
29
|
+
LAST_NAME = "last_name"
|
|
30
|
+
LOCATION = "location"
|
|
31
|
+
CP_URL = "cp_url"
|
|
32
|
+
CRM_URL = "crm_url"
|
|
33
|
+
|
|
34
|
+
CP_LOGIN_LINK = "cp_login_link"
|
|
35
|
+
CRM_LOGIN_LINK = "crm_login_link"
|
|
36
|
+
|
|
37
|
+
# Customer related
|
|
38
|
+
CUSTOMER_NAME = "customer_name"
|
|
39
|
+
CUSTOMER_EMAIL = "customer_email"
|
|
40
|
+
CUSTOMER_PHONE = "customer_phone"
|
|
41
|
+
CUSTOMER_ADDRESS = "customer_address"
|
|
42
|
+
CUSTOMER_CITY = "customer_city"
|
|
43
|
+
CUSTOMER_STATE = "customer_state"
|
|
44
|
+
CUSTOMER_ZIP = "customer_zip"
|
|
45
|
+
CUSTOMER_COUNTRY = "customer_country"
|
|
46
|
+
CUSTOMER_ID = "customer_id"
|
|
47
|
+
CUSTOMER_FIRST_NAME = "customer_first_name"
|
|
48
|
+
CUSTOMER_LAST_NAME = "customer_last_name"
|
|
49
|
+
CUSTOMER_CRM_LINK = "customer_crm_link"
|
|
50
|
+
# User related
|
|
51
|
+
USER_NAME = "user_name" # Full name of the user
|
|
52
|
+
USER_EMAIL = "user_email" # Email address of the user
|
|
53
|
+
USER_FIRST_NAME = "user_first_name" # First name of the user
|
|
54
|
+
USER_LAST_NAME = "user_last_name" # Last name of the user
|
|
55
|
+
# Company related
|
|
56
|
+
COMPANY_NAME = "company_name" # Name of the company
|
|
57
|
+
COMPANY_ADDRESS = "company_address" # Company address
|
|
58
|
+
COMPANY_PHONE = "company_phone" # Company phone number
|
|
59
|
+
COMPANY_EMAIL = "company_email" # Company email address
|
|
60
|
+
COMPANY_WEBSITE = "company_website" # Company website URL
|
|
61
|
+
APP_NAME = "app_name" # Name of the application
|
|
62
|
+
APP_URL = "app_url" # Base URL of the application
|
|
63
|
+
CURRENT_DATE = "current_date" # Current date
|
|
64
|
+
CURRENT_TIME = "current_time" # Current time
|
|
65
|
+
SUPPORT_EMAIL = "support_email" # Support email address
|
|
66
|
+
LOGO_URL = "logo_url" # URL to company logo
|
|
67
|
+
|
|
68
|
+
# Common
|
|
69
|
+
TICKET_NUMBER = "ticket_number" # Ticket number
|
|
70
|
+
TICKET_URL = "ticket_url" # Ticket URL
|
|
71
|
+
FEEDBACK_LINK = "feedback_link" # Feedback link
|
|
72
|
+
VERIFICATION_LINK = "verification_link" # Verification link
|
|
73
|
+
EXPIRY_TIME = "expiry_time" # Expiry time
|
|
74
|
+
CODE = "code" # Code
|
|
75
|
+
REASON = "reason" # Reason
|
|
76
|
+
STATUS = "status" # Status
|
|
77
|
+
SEVERITY = "severity" # Severity
|
|
78
|
+
ACTION_REQUIRED = "action_required" # Action required
|
|
79
|
+
ACTION_URL = "action_url" # Action URL
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def get_all_variables(cls) -> list:
|
|
83
|
+
"""Get all base variables as a list"""
|
|
84
|
+
return [
|
|
85
|
+
getattr(cls, attr) for attr in dir(cls)
|
|
86
|
+
if not attr.startswith('_') and isinstance(getattr(cls, attr), str)
|
|
87
|
+
]
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def get_variable_descriptions(cls) -> dict:
|
|
91
|
+
"""Get descriptions for all base variables"""
|
|
92
|
+
return {
|
|
93
|
+
cls.CP_URL: "URL to the CP",
|
|
94
|
+
cls.CRM_URL: "URL to the CRM",
|
|
95
|
+
cls.CRM_LOGIN_LINK: "Login link for the CRM",
|
|
96
|
+
cls.CP_LOGIN_LINK: "Login link for the CP",
|
|
97
|
+
cls.NAME: "Full name of the receiver (customer or user, can be used when both details are not required)",
|
|
98
|
+
cls.EMAIL: "Email address of the receiver (customer or user, can be used when both details are not required)",
|
|
99
|
+
cls.PHONE: "Phone number of the receiver (customer or user, can be used when both details are not required)",
|
|
100
|
+
cls.ID: "ID of the receiver (customer or user, can be used when both details are not required)",
|
|
101
|
+
cls.FIRST_NAME: "First name of the receiver (customer or user, can be used when both details are not required)",
|
|
102
|
+
cls.LAST_NAME: "Last name of the receiver (customer or user, can be used when both details are not required)",
|
|
103
|
+
cls.LOCATION: "Location of the receiver (customer or user, can be used when both details are not required)",
|
|
104
|
+
cls.CUSTOMER_NAME: "Full name of the customer",
|
|
105
|
+
cls.CUSTOMER_ID: "ID of the customer",
|
|
106
|
+
cls.CUSTOMER_EMAIL: "Email address of the customer",
|
|
107
|
+
cls.CUSTOMER_PHONE: "Phone number of the customer",
|
|
108
|
+
cls.CUSTOMER_ADDRESS: "Address of the customer",
|
|
109
|
+
cls.CUSTOMER_CITY: "City of the customer",
|
|
110
|
+
cls.CUSTOMER_STATE: "State of the customer",
|
|
111
|
+
cls.CUSTOMER_ZIP: "Zip code of the customer",
|
|
112
|
+
cls.CUSTOMER_COUNTRY: "Country of the customer",
|
|
113
|
+
cls.CUSTOMER_FIRST_NAME: "First name of the customer",
|
|
114
|
+
cls.CUSTOMER_LAST_NAME: "Last name of the customer",
|
|
115
|
+
cls.USER_NAME: "Full name of the user",
|
|
116
|
+
cls.USER_EMAIL: "Email address of the user",
|
|
117
|
+
cls.USER_FIRST_NAME: "First name of the user",
|
|
118
|
+
cls.USER_LAST_NAME: "Last name of the user",
|
|
119
|
+
cls.COMPANY_NAME: "Name of the company",
|
|
120
|
+
cls.COMPANY_ADDRESS: "Company address",
|
|
121
|
+
cls.COMPANY_PHONE: "Company phone number",
|
|
122
|
+
cls.COMPANY_EMAIL: "Company email address",
|
|
123
|
+
cls.COMPANY_WEBSITE: "Company website URL",
|
|
124
|
+
cls.APP_NAME: "Name of the application",
|
|
125
|
+
cls.APP_URL: "Base URL of the application",
|
|
126
|
+
cls.CURRENT_DATE: "Current date",
|
|
127
|
+
cls.CURRENT_TIME: "Current time",
|
|
128
|
+
cls.SUPPORT_EMAIL: "Support email address",
|
|
129
|
+
cls.LOGO_URL: "URL to company logo",
|
|
130
|
+
cls.TICKET_NUMBER: "Ticket number",
|
|
131
|
+
cls.TICKET_URL: "Ticket URL",
|
|
132
|
+
cls.FEEDBACK_LINK: "Feedback link",
|
|
133
|
+
cls.VERIFICATION_LINK: "Verification link",
|
|
134
|
+
cls.EXPIRY_TIME: "Expiry time",
|
|
135
|
+
cls.CODE: "Code",
|
|
136
|
+
cls.REASON: "Reason",
|
|
137
|
+
cls.STATUS: "Status",
|
|
138
|
+
cls.SEVERITY: "Severity",
|
|
139
|
+
cls.ACTION_REQUIRED: "Action required",
|
|
140
|
+
cls.ACTION_URL: "Action URL"
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
class SystemEmailTrigger:
|
|
144
|
+
"""System email trigger events and their descriptions"""
|
|
145
|
+
|
|
146
|
+
# Authentication related
|
|
147
|
+
LOGIN_NOTIFICATION = "login_notification"
|
|
148
|
+
LOGIN_FAILED_NOTIFICATION = "login_failed_notification"
|
|
149
|
+
PASSWORD_RESET = "password_reset"
|
|
150
|
+
EMAIL_VERIFICATION = "email_verification"
|
|
151
|
+
TWO_FACTOR_CODE = "two_factor_code"
|
|
152
|
+
ACCESS_CHANGED = "access_changed"
|
|
153
|
+
TWO_FACTOR_STATUS_CHANGED = "two_factor_status_changed"
|
|
154
|
+
SECURITY_KEY_STATUS_CHANGED = "security_key_status_changed"
|
|
155
|
+
|
|
156
|
+
# Customer related
|
|
157
|
+
CUSTOMER_WELCOME_LIVE_EMAIL = "customer_welcome_live_email"
|
|
158
|
+
CUSTOMER_WELCOME_DEMO_EMAIL = "customer_welcome_demo_email"
|
|
159
|
+
CUSTOMER_WELCOME_IB_EMAIL = "customer_welcome_ib_email"
|
|
160
|
+
CUSTOMER_AGENT_ASSIGNED = "customer_agent_assigned"
|
|
161
|
+
CUSTOMER_AGENT_UNASSIGNED = "customer_agent_unassigned"
|
|
162
|
+
CUSTOMER_FEEDBACK = "customer_feedback"
|
|
163
|
+
CUSTOMER_SUPPORT = "customer_support"
|
|
164
|
+
ACCOUNT_UPDATED = "account_updated"
|
|
165
|
+
|
|
166
|
+
# User related
|
|
167
|
+
USER_WELCOME_EMAIL = "user_welcome_email"
|
|
168
|
+
USER_CUSTOMER_ASSIGNED = "user_customer_assigned"
|
|
169
|
+
USER_CUSTOMER_UNASSIGNED = "user_customer_unassigned"
|
|
170
|
+
USER_CUSTOMER_ADDED = "user_customer_added"
|
|
171
|
+
|
|
172
|
+
# System related
|
|
173
|
+
SYSTEM_ALERT = "system_alert"
|
|
174
|
+
MAINTENANCE_NOTIFICATION = "maintenance_notification"
|
|
175
|
+
SECURITY_ALERT = "security_alert"
|
|
176
|
+
|
|
177
|
+
@classmethod
|
|
178
|
+
def get_all_triggers(cls) -> list:
|
|
179
|
+
"""Get all trigger events as a list"""
|
|
180
|
+
return [
|
|
181
|
+
getattr(cls, attr) for attr in dir(cls)
|
|
182
|
+
if not attr.startswith('_') and isinstance(getattr(cls, attr), str)
|
|
183
|
+
]
|
|
184
|
+
|
|
185
|
+
@classmethod
|
|
186
|
+
def get_trigger_descriptions(cls) -> dict:
|
|
187
|
+
"""Get descriptions for all trigger events"""
|
|
188
|
+
return {
|
|
189
|
+
cls.LOGIN_NOTIFICATION: "Sent when a user/customer logs in",
|
|
190
|
+
cls.LOGIN_FAILED_NOTIFICATION: "Sent when a user's/customer's login attempt fails",
|
|
191
|
+
cls.PASSWORD_RESET: "Sent when a user/customer requests a password reset",
|
|
192
|
+
cls.EMAIL_VERIFICATION: "Sent to verify a user's/customer's email address",
|
|
193
|
+
cls.TWO_FACTOR_CODE: "Sent with two-factor authentication code",
|
|
194
|
+
cls.ACCESS_CHANGED: "Sent when a user's/customer's access level is changed",
|
|
195
|
+
cls.TWO_FACTOR_STATUS_CHANGED: "Sent when two-factor authentication status is changed",
|
|
196
|
+
cls.SECURITY_KEY_STATUS_CHANGED: "Sent when security key status is changed",
|
|
197
|
+
|
|
198
|
+
cls.CUSTOMER_WELCOME_LIVE_EMAIL: "Sent when a customer registers via /live or added as a client in the crm",
|
|
199
|
+
cls.CUSTOMER_WELCOME_DEMO_EMAIL: "Sent when a customer registers via /demo or added as a lead in the crm",
|
|
200
|
+
cls.CUSTOMER_WELCOME_IB_EMAIL: "Sent when a customer registers via /ib or added as a ib in the crm",
|
|
201
|
+
cls.CUSTOMER_AGENT_ASSIGNED: "Sent when a customer is assigned to an agent",
|
|
202
|
+
cls.CUSTOMER_AGENT_UNASSIGNED: "Sent when a customer is unassigned from an agent",
|
|
203
|
+
cls.CUSTOMER_FEEDBACK: "Sent to request customer feedback",
|
|
204
|
+
cls.CUSTOMER_SUPPORT: "Sent in response to customer support requests",
|
|
205
|
+
cls.ACCOUNT_UPDATED: "Sent when account details are updated",
|
|
206
|
+
|
|
207
|
+
cls.USER_WELCOME_EMAIL: "Sent when a new user registers/added to the system",
|
|
208
|
+
cls.USER_CUSTOMER_ASSIGNED: "Sent when a user is assigned to a customer",
|
|
209
|
+
cls.USER_CUSTOMER_UNASSIGNED: "Sent when a user is unassigned from a customer",
|
|
210
|
+
cls.USER_CUSTOMER_ADDED: "Sent when a user is assigned to a customer",
|
|
211
|
+
|
|
212
|
+
cls.SYSTEM_ALERT: "Sent for important system alerts",
|
|
213
|
+
cls.MAINTENANCE_NOTIFICATION: "Sent for scheduled maintenance notifications",
|
|
214
|
+
cls.SECURITY_ALERT: "Sent for security-related alerts"
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@classmethod
|
|
218
|
+
def get_trigger_variables(cls) -> dict:
|
|
219
|
+
"""Get required variables for each trigger event"""
|
|
220
|
+
return {
|
|
221
|
+
cls.LOGIN_NOTIFICATION: ["name", "ip", "location"],
|
|
222
|
+
cls.LOGIN_FAILED_NOTIFICATION: ["name", "ip", "location"],
|
|
223
|
+
cls.PASSWORD_RESET: ["name", "verification_link", "expiry_time"],
|
|
224
|
+
cls.EMAIL_VERIFICATION: ["name", "code", "expiry_time"],
|
|
225
|
+
cls.TWO_FACTOR_CODE: ["name", "code", "expiry_time"],
|
|
226
|
+
cls.ACCESS_CHANGED: ["name", "reason", "support_contact", "status"],
|
|
227
|
+
cls.TWO_FACTOR_STATUS_CHANGED: ["name", "status"],
|
|
228
|
+
cls.SECURITY_KEY_STATUS_CHANGED: ["name", "status"],
|
|
229
|
+
|
|
230
|
+
cls.CUSTOMER_WELCOME_LIVE_EMAIL: ["name", "cp_login_link"],
|
|
231
|
+
cls.CUSTOMER_WELCOME_DEMO_EMAIL: ["name", "cp_login_link"],
|
|
232
|
+
cls.CUSTOMER_WELCOME_IB_EMAIL: ["name", "cp_login_link"],
|
|
233
|
+
cls.CUSTOMER_AGENT_ASSIGNED: ["customer_name", "user_name", "cp_login_link"],
|
|
234
|
+
cls.CUSTOMER_AGENT_UNASSIGNED: ["customer_name", "user_name", "cp_login_link"],
|
|
235
|
+
cls.CUSTOMER_FEEDBACK: ["user_name", "feedback_link"],
|
|
236
|
+
cls.CUSTOMER_SUPPORT: ["ticket_number", "support_message"],
|
|
237
|
+
cls.ACCOUNT_UPDATED: ["user_name", "updated_fields"],
|
|
238
|
+
|
|
239
|
+
cls.USER_WELCOME_EMAIL: ["name", "crm_login_link"],
|
|
240
|
+
cls.USER_CUSTOMER_ASSIGNED: ["customer_name", "user_name", "crm_login_link", "customer_crm_link"],
|
|
241
|
+
cls.USER_CUSTOMER_UNASSIGNED: ["customer_name", "user_name", "crm_login_link", "customer_crm_link"],
|
|
242
|
+
cls.USER_CUSTOMER_ADDED: ["customer_name", "user_name", "crm_login_link", "customer_crm_link"],
|
|
243
|
+
|
|
244
|
+
cls.SYSTEM_ALERT: ["alert_message", "severity", "action_required"],
|
|
245
|
+
cls.MAINTENANCE_NOTIFICATION: ["start_time", "end_time", "affected_services"],
|
|
246
|
+
cls.SECURITY_ALERT: ["alert_type", "alert_message", "recommended_action"]
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
# Variable classes for different types of emails
|
|
250
|
+
class AuthenticationEmailVariables:
|
|
251
|
+
"""Variables specific to authentication-related emails"""
|
|
252
|
+
IP_ADDRESS = "ip_address"
|
|
253
|
+
BROWSER = "browser"
|
|
254
|
+
DEVICE = "device"
|
|
255
|
+
LOCATION = "location"
|
|
256
|
+
VERIFICATION_CODE = "verification_code"
|
|
257
|
+
VERIFICATION_LINK = "verification_link"
|
|
258
|
+
EXPIRY_TIME = "expiry_time"
|
|
259
|
+
ACCESS_LEVEL = "access_level"
|
|
260
|
+
PREVIOUS_ACCESS = "previous_access"
|
|
261
|
+
NEW_ACCESS = "new_access"
|
|
262
|
+
SECURITY_STATUS = "security_status"
|
|
263
|
+
|
|
264
|
+
@classmethod
|
|
265
|
+
def get_all_variables(cls) -> list:
|
|
266
|
+
return [
|
|
267
|
+
getattr(cls, attr) for attr in dir(cls)
|
|
268
|
+
if not attr.startswith('_') and isinstance(getattr(cls, attr), str)
|
|
269
|
+
]
|
|
270
|
+
|
|
271
|
+
@classmethod
|
|
272
|
+
def get_variable_descriptions(cls) -> dict:
|
|
273
|
+
return {
|
|
274
|
+
cls.IP_ADDRESS: "IP address of the login attempt",
|
|
275
|
+
cls.BROWSER: "Browser used for the login attempt",
|
|
276
|
+
cls.DEVICE: "Device used for the login attempt",
|
|
277
|
+
cls.LOCATION: "Location of the login attempt",
|
|
278
|
+
cls.VERIFICATION_CODE: "Code for email verification or 2FA",
|
|
279
|
+
cls.VERIFICATION_LINK: "Link for email verification or password reset",
|
|
280
|
+
cls.EXPIRY_TIME: "Expiry time for verification code/link",
|
|
281
|
+
cls.ACCESS_LEVEL: "User's access level",
|
|
282
|
+
cls.PREVIOUS_ACCESS: "Previous access level",
|
|
283
|
+
cls.NEW_ACCESS: "New access level",
|
|
284
|
+
cls.SECURITY_STATUS: "Status of security feature"
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
class CustomerEmailVariables:
|
|
288
|
+
"""Variables specific to customer-related emails"""
|
|
289
|
+
ACCOUNT_TYPE = "account_type"
|
|
290
|
+
ACCOUNT_NUMBER = "account_number"
|
|
291
|
+
ACCOUNT_STATUS = "account_status"
|
|
292
|
+
ASSIGNED_AGENT = "assigned_agent"
|
|
293
|
+
PREVIOUS_AGENT = "previous_agent"
|
|
294
|
+
FEEDBACK_LINK = "feedback_link"
|
|
295
|
+
TICKET_NUMBER = "ticket_number"
|
|
296
|
+
TICKET_STATUS = "ticket_status"
|
|
297
|
+
TICKET_PRIORITY = "ticket_priority"
|
|
298
|
+
SUPPORT_MESSAGE = "support_message"
|
|
299
|
+
UPDATED_FIELDS = "updated_fields"
|
|
300
|
+
|
|
301
|
+
@classmethod
|
|
302
|
+
def get_all_variables(cls) -> list:
|
|
303
|
+
return [
|
|
304
|
+
getattr(cls, attr) for attr in dir(cls)
|
|
305
|
+
if not attr.startswith('_') and isinstance(getattr(cls, attr), str)
|
|
306
|
+
]
|
|
307
|
+
|
|
308
|
+
@classmethod
|
|
309
|
+
def get_variable_descriptions(cls) -> dict:
|
|
310
|
+
return {
|
|
311
|
+
cls.ACCOUNT_TYPE: "Type of customer account (live/demo/ib)",
|
|
312
|
+
cls.ACCOUNT_NUMBER: "Customer's account number",
|
|
313
|
+
cls.ACCOUNT_STATUS: "Status of customer's account",
|
|
314
|
+
cls.ASSIGNED_AGENT: "Name of assigned agent",
|
|
315
|
+
cls.PREVIOUS_AGENT: "Name of previously assigned agent",
|
|
316
|
+
cls.FEEDBACK_LINK: "Link to provide feedback",
|
|
317
|
+
cls.TICKET_NUMBER: "Support ticket number",
|
|
318
|
+
cls.TICKET_STATUS: "Status of support ticket",
|
|
319
|
+
cls.TICKET_PRIORITY: "Priority of support ticket",
|
|
320
|
+
cls.SUPPORT_MESSAGE: "Support message or response",
|
|
321
|
+
cls.UPDATED_FIELDS: "List of updated account fields"
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
class SystemEmailVariables:
|
|
325
|
+
"""Variables specific to system-related emails"""
|
|
326
|
+
ALERT_TYPE = "alert_type"
|
|
327
|
+
ALERT_MESSAGE = "alert_message"
|
|
328
|
+
SEVERITY = "severity"
|
|
329
|
+
ACTION_REQUIRED = "action_required"
|
|
330
|
+
MAINTENANCE_START = "maintenance_start"
|
|
331
|
+
MAINTENANCE_END = "maintenance_end"
|
|
332
|
+
AFFECTED_SERVICES = "affected_services"
|
|
333
|
+
SYSTEM_STATUS = "system_status"
|
|
334
|
+
ERROR_DETAILS = "error_details"
|
|
335
|
+
RESOLUTION_STEPS = "resolution_steps"
|
|
336
|
+
|
|
337
|
+
@classmethod
|
|
338
|
+
def get_all_variables(cls) -> list:
|
|
339
|
+
return [
|
|
340
|
+
getattr(cls, attr) for attr in dir(cls)
|
|
341
|
+
if not attr.startswith('_') and isinstance(getattr(cls, attr), str)
|
|
342
|
+
]
|
|
343
|
+
|
|
344
|
+
@classmethod
|
|
345
|
+
def get_variable_descriptions(cls) -> dict:
|
|
346
|
+
return {
|
|
347
|
+
cls.ALERT_TYPE: "Type of system alert",
|
|
348
|
+
cls.ALERT_MESSAGE: "Alert message details",
|
|
349
|
+
cls.SEVERITY: "Severity level of the alert",
|
|
350
|
+
cls.ACTION_REQUIRED: "Required action to be taken",
|
|
351
|
+
cls.MAINTENANCE_START: "Start time of maintenance",
|
|
352
|
+
cls.MAINTENANCE_END: "End time of maintenance",
|
|
353
|
+
cls.AFFECTED_SERVICES: "Services affected by maintenance/issue",
|
|
354
|
+
cls.SYSTEM_STATUS: "Current system status",
|
|
355
|
+
cls.ERROR_DETAILS: "Detailed error information",
|
|
356
|
+
cls.RESOLUTION_STEPS: "Steps to resolve the issue"
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
class TriggerVariableMapping:
|
|
360
|
+
"""Maps trigger events to their specific variable classes"""
|
|
361
|
+
MAPPINGS = {
|
|
362
|
+
# Authentication triggers
|
|
363
|
+
"login_notification": AuthenticationEmailVariables,
|
|
364
|
+
"login_failed_notification": AuthenticationEmailVariables,
|
|
365
|
+
"password_reset": AuthenticationEmailVariables,
|
|
366
|
+
"email_verification": AuthenticationEmailVariables,
|
|
367
|
+
"two_factor_code": AuthenticationEmailVariables,
|
|
368
|
+
"access_changed": AuthenticationEmailVariables,
|
|
369
|
+
"two_factor_status_changed": AuthenticationEmailVariables,
|
|
370
|
+
"security_key_status_changed": AuthenticationEmailVariables,
|
|
371
|
+
|
|
372
|
+
# Customer triggers
|
|
373
|
+
"customer_welcome_live_email": CustomerEmailVariables,
|
|
374
|
+
"customer_welcome_demo_email": CustomerEmailVariables,
|
|
375
|
+
"customer_welcome_ib_email": CustomerEmailVariables,
|
|
376
|
+
"customer_agent_assigned": CustomerEmailVariables,
|
|
377
|
+
"customer_agent_unassigned": CustomerEmailVariables,
|
|
378
|
+
"customer_feedback": CustomerEmailVariables,
|
|
379
|
+
"customer_support": CustomerEmailVariables,
|
|
380
|
+
"account_updated": CustomerEmailVariables,
|
|
381
|
+
|
|
382
|
+
# System triggers
|
|
383
|
+
"system_alert": SystemEmailVariables,
|
|
384
|
+
"maintenance_notification": SystemEmailVariables,
|
|
385
|
+
"security_alert": SystemEmailVariables
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
@classmethod
|
|
389
|
+
def get_variables_for_trigger(cls, trigger_event: str) -> tuple:
|
|
390
|
+
"""Get all available variables for a trigger event"""
|
|
391
|
+
# Always include base variables
|
|
392
|
+
variables = BaseEmailVariables.get_all_variables()
|
|
393
|
+
descriptions = BaseEmailVariables.get_variable_descriptions()
|
|
394
|
+
|
|
395
|
+
# Add trigger-specific variables
|
|
396
|
+
if trigger_event in cls.MAPPINGS:
|
|
397
|
+
variable_class = cls.MAPPINGS[trigger_event]
|
|
398
|
+
variables.extend(variable_class.get_all_variables())
|
|
399
|
+
descriptions.update(variable_class.get_variable_descriptions())
|
|
400
|
+
|
|
401
|
+
return variables, descriptions
|
|
402
|
+
|
|
403
|
+
class AccountType(str, Enum):
|
|
404
|
+
LIVE = 'LIVE'
|
|
405
|
+
DEMO = 'DEMO'
|
|
406
|
+
IB = 'IB'
|
|
407
|
+
|
|
408
|
+
@classmethod
|
|
409
|
+
def get_all_types(cls) -> list:
|
|
410
|
+
return [
|
|
411
|
+
getattr(cls, attr) for attr in dir(cls)
|
|
412
|
+
if not attr.startswith('_') and isinstance(getattr(cls, attr), str)
|
|
413
|
+
]
|
|
414
|
+
|