Subversion Repositories SmartDukaan

Rev

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