Subversion Repositories SmartDukaan

Rev

Rev 12691 | Rev 12722 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
116 ashish 1
namespace java in.shop2020.utils
2
namespace py shop2020.thriftpy.utils
3
 
3374 rajveer 4
include "GenericService.thrift"
5
 
116 ashish 6
/**
7
Helper service
8
created by @ashish
9
**/
10
 
4693 mandeep.dh 11
struct Agent {
12
    1:i64 id,
13
    2:string name,
14
    3:string emailId,
15
    4:optional i64 managerId,
16
    5:string password,
17
    6:bool isActive
18
}
19
 
121 ashish 20
struct Mail{
21
	1:list<string> to,
22
	2:string subject,
23
	3:string data,
351 ashish 24
	4:string sender,
25
	5:list<string> attachments,
26
	6:string password
121 ashish 27
}
28
 
29
struct TextMessage{
30
	1:string number,
31
	2:string message,
32
	3:i64 dispatchTime,
33
	4:i64 deliveryTime
34
}
35
 
116 ashish 36
exception HelperServiceException{
37
	1:i64 id,
38
	2:string message
39
}
40
 
121 ashish 41
struct Message{
42
	1:i64 id,
43
	2:string message
44
}
45
 
2780 chandransh 46
enum Role{
47
	WAREHOUSE_EXECUTIVE = 0,
48
	ADMIN = 1,
8910 amar.kumar 49
	WAREHOUSE_MONITOR = 2,
50
	WAREHOUSE_OBSERVER = 3
2780 chandransh 51
}
52
 
12696 amit.gupta 53
struct Location {
54
	1:double lattitude,
55
	2:double longitude
56
}
57
 
58
enum DealerAuthRole{
59
	ADMIN = 1,
60
	AREA_MANAGER = 2,
61
	ONFEET_EXECUTIVE = 3
62
}
63
 
64
struct DealerAuth {
65
	1:string username,
66
	2:string password,
67
	3:DealerAuthRole role,
68
	4:i64 createdOn,
69
	5:i64 lastLoggedIn,
70
	6:Location lastLocation,
71
	7:bool isActive
72
}
73
 
74
 
495 rajveer 75
struct DashboardUser{
76
	1:string username,
77
	2:string password,
2442 chandransh 78
	3:i64 warehouseId,
8303 amar.kumar 79
	4:Role role,
80
	5:i64 source
495 rajveer 81
}
82
 
751 chandransh 83
struct LogisticsUser{
84
	1:string username,
85
	2:i64 providerId
86
}
87
 
1611 ankur.sing 88
struct StatisticsUser{
1891 ankur.sing 89
	1:string username
1611 ankur.sing 90
}
91
 
2023 ankur.sing 92
struct CatalogDashboardUser{
93
	1:string username,
2356 ankur.sing 94
	2:string password,
95
	3:i64 role
2023 ankur.sing 96
}
97
 
1397 varun.gupt 98
struct UserEmail{
1422 varun.gupt 99
	1:i64 id,
5864 rajveer 100
	2:list<string> emailTo,
1422 varun.gupt 101
	3:string emailFrom,
102
	4:string subject,
103
	5:string body,
104
	6:string source,
105
	7:string emailType,
106
	8:bool status,
5864 rajveer 107
	9:i64 timestamp,
108
	10:list<string> cc,
109
	11:list<string> bcc
1397 varun.gupt 110
}
111
 
1891 ankur.sing 112
struct ReportUser{
113
	1:string username,
12256 kshitij.so 114
	2:i64 role,
115
	3:string email
1891 ankur.sing 116
}
117
 
118
struct Report{
119
	1:i64 id,
120
	2:string description,
121
	3:string controller
122
}
123
 
4806 varun.gupt 124
struct QuickLink	{
4996 varun.gupt 125
	1:i64 id,
126
	2:string url,
127
	3:string text
4806 varun.gupt 128
}
129
 
7410 amar.kumar 130
struct AgentWarehouseMapping{
131
	1:i64 agentId,
132
	2:i64 warehouseId
133
}
134
 
12691 manish.sha 135
enum SmsType{
136
	TRANSACTIONAL,
137
	PROMOTIONAL,
138
	SERVICE_ALERT
139
}
140
 
141
enum SmsStatus{
142
	IN_PROCESS,
143
	DELIVERED,
144
	UNDELIVERED,
145
	SERVICE_ERROR,
146
	USER_ABSENT,
147
	MEMORY_FULL,
148
	NDLC_FAIL,
149
	INVALID_NUMBER
150
}
151
 
152
enum SmsDeliveryStatus{
153
	NOT_SENT,
154
	SENT_TO_OPERATOR,
155
	SUBMITTED_TO_SMSC,
156
	GOT_STATUS_CODE
157
}
158
 
159
struct UserSms{
160
	1:i64 id,
161
	2:i64 user_id,
162
	3:string mobileNumber,
163
	4:string smsText,
164
	5:SmsType type,
165
	6:SmsStatus status,
166
	7:i64 attempts,
167
	8:i64 createdTimestamp,
168
	9:string responseId,
169
	10:string responseText
170
	11:SmsDeliveryStatus deliveryStatus,  
171
}
172
 
173
struct UserSmsInfo{
174
	1:i64 userId,
175
	2:string mobileNo,
176
	3:i32 dailyCount,
177
	4:i32 weeklyCount,
178
	5:bool dndStatus,
179
	6:bool smsSubscribed,
180
	7:i64 createdTimestamp,
181
	8:i64 updateTimestamp
182
}
183
 
3374 rajveer 184
service HelperService extends GenericService.GenericService{
763 rajveer 185
	/**
3206 mandeep.dh 186
	* Save email details, to be sent later; Also returns its identifier.
2455 varun.gupt 187
	*/
8020 rajveer 188
	i64 saveUserEmailForSending(1:list<string> emailTo, 2:string emailFrom, 3:string subject, 4:string body, 5:string source, 6:string emailType, 7:list<string> cc, 8:list<string> bcc, 9:i64 sourceId) throws (1:HelperServiceException se),
2455 varun.gupt 189
 
190
	/**
191
	* Retreives all the emails pending for dispatch
192
	*/
3086 rajveer 193
	list<UserEmail> getEmailsToBeSent() throws (1:HelperServiceException se),
2455 varun.gupt 194
 
195
	/**
196
	* Marks email as sent after successful dispatch
197
	*/
1422 varun.gupt 198
	void markEmailAsSent(1:i64 emailId) throws (1:HelperServiceException se),
1397 varun.gupt 199
 
121 ashish 200
	void sendMail(1:Mail mail) throws (1:HelperServiceException se),
201
	void sendText(1:TextMessage message) throws (1:HelperServiceException se),
202
 
351 ashish 203
	void addMessage(1:Message message) throws (1:HelperServiceException se),
121 ashish 204
	void updateMessage(1:i64 id, 2:string message) throws (1:HelperServiceException se),
351 ashish 205
	Message getMessage(1:i64 id) throws (1:HelperServiceException se),
495 rajveer 206
	Message getSubstitutedMessage(1:i64 id, 2:map<string,string> params) throws (1:HelperServiceException se),
207
 
208
	//authenticate dashboard users
209
	bool addUser(1:string username, 2:string password, 3:i64 warehouseId) throws (1:HelperServiceException se),
210
	bool deleteUser(1:string username) throws (1:HelperServiceException se),
2442 chandransh 211
 
751 chandransh 212
	/**
2442 chandransh 213
	 Returns the dashboard user if the supplied username and password match. Raises an exception otherwise.
214
	 The loggedOn timestamp for the dashboard user is updated .
751 chandransh 215
	*/
2442 chandransh 216
	DashboardUser authenticateDashboardUser(1:string username, 2:string password) throws (1:HelperServiceException se),
217
 
218
	/**
219
	Update the password of the dashboard user. Currently, there is no place where this method is called.
220
	*/
751 chandransh 221
	bool updatePassword(1:string username, 2:string oldPassword, 3:string newPassword) throws (1:HelperServiceException se),
222
 
223
	/**
224
	 Returns the LogisticsUser struct associated with the given username and password if they match.
225
	 Throws an exception otherwise.
226
	*/
227
	LogisticsUser authenticateLogisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse)
1611 ankur.sing 228
 
229
	/**
230
	 Returns the StatisticsUser struct associated with the given username and password if they match.
231
	 Throws an exception otherwise.
232
	*/
1891 ankur.sing 233
	StatisticsUser authenticateStatisticsUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
234
 
235
	/**
236
	 Returns the ReportUser struct associated with the given username and password if they match.
237
	 Throws an exception otherwise.
238
	*/
239
	ReportUser authenticateReportUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
240
 
241
	/**
242
	Returns list of reports which are configured for the given role. 
243
	*/
2023 ankur.sing 244
	list<Report> getReports(1:i64 role),
245
 
246
	/**
2356 ankur.sing 247
	 Returns the CatalogDashboardUser struct associated with the given username, password and role if they match.
2023 ankur.sing 248
	 Throws an exception otherwise.
249
	*/
6788 rajveer 250
	CatalogDashboardUser authenticateCatalogUser(1:string username, 2:string password) throws(1:HelperServiceException hse),
4544 varun.gupt 251
 
252
	/**
253
	Saves the list of entity Ids to be shared with an email address 
254
	*/
4693 mandeep.dh 255
	void shareEntities(1:list<i64> entityIds, 2:string email) throws(1:HelperServiceException hse),
256
 
257
    // Methods to read agent information
4806 varun.gupt 258
    list<Agent> getAgents(),
259
    bool validateLogIn(1:string emailId, 2:string password),
260
    void updatePasswordForAgent(1:string agentEmailId, 2:string password),
4693 mandeep.dh 261
 
262
    // Methods to read roles and permissions information
4806 varun.gupt 263
    list<string> getRoleNamesForAgent(1:string agentEmailId),
4996 varun.gupt 264
    list<string> getPermissionsForRoleName(1:string roleName),
4806 varun.gupt 265
 
266
    //Methods to save and read QuickLinks
267
    void saveQuickLink(1:string url, 2:string text) throws(1:HelperServiceException hse),
4996 varun.gupt 268
    list<QuickLink> getQuickLinks() throws(1:HelperServiceException hse),
5055 varun.gupt 269
    void updateQuickLink(1:i64 id, 2:string url, 3:string text) throws(1:HelperServiceException hse),
270
 
271
	/**
272
	Returns a list of emails to which product notifications have been sent in a given date range
273
	*/
6322 amar.kumar 274
	list<string> getEmailsForNotificationsSent(1:i64 startDatetime, 2:i64 endDatetime) throws(1:HelperServiceException hse),
275
 
276
	//Returns body of mail sent for order confirmation
7410 amar.kumar 277
	string getOrderConfirmationMail(1:i64 orderId),
7221 kshitij.so 278
 
279
	//Returns body of mail sent for delivery success
7410 amar.kumar 280
	string getOrderDeliveryMail(1:i64 orderId),
281
 
282
	list<i64> getWarehouseIdsForAgent(1:string agentEmailId),
283
 
12691 manish.sha 284
	i64 saveUserSmsForSending(1:i64 userId, 2:string mobileNo, 3:string text, 4:SmsType type) throws (1:HelperServiceException se),
285
 
286
	list<UserSms> getSmsToBeSent() throws (1:HelperServiceException se),
287
 
288
	void addUserSmsInfo(1:UserSmsInfo userSmsInfo) throws (1:HelperServiceException se),
289
 
290
	bool updateUserSmsInfo(1:UserSmsInfo userSmsInfo) throws (1:HelperServiceException se),
291
 
292
	UserSmsInfo getUserSmsInfo(1:i64 userId) throws (1:HelperServiceException se),
293
 
294
	list<UserSmsInfo> getAllUsersSmsInfo(1:bool dndStatus, 2:bool smsSubscribed) throws (1:HelperServiceException se),
295
 
296
	list<UserSms> listSmsToGetDeliveryInfo() throws (1:HelperServiceException se),
297
 
12696 amit.gupta 298
	bool markMessagesAsSentToOperator(list<UserSms> userSmsList),
12691 manish.sha 299
 
12696 amit.gupta 300
	bool markMessagesAsSubmittedToSmsc(list<UserSms> userSmsList),
12691 manish.sha 301
 
12696 amit.gupta 302
	bool markMessagesAsSent(list<UserSms> userSmsList),
12691 manish.sha 303
 
12696 amit.gupta 304
	bool markMessagesAsRetry(list<UserSms> userSmsList),
305
 
306
	DealerAuth authoriseDealer(1:DealerAuth dealer)
116 ashish 307
}