Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
3026 mandeep.dh 1
namespace java in.shop2020.crm
2
namespace py shop2020.thriftpy.crm
3
 
3374 rajveer 4
include "GenericService.thrift"
5
 
3026 mandeep.dh 6
enum TicketPriority {
7
    LOW = 0,
8
    HIGH = 1,
9
    MEDIUM = 2
10
}
11
 
12
enum TicketStatus {
13
    OPEN = 0,
14
    CLOSED = 1,
15
    REOPEN = 2
16
}
17
 
18
enum TicketCategory {
19
    RETURN_FORM = 1,
20
    ORDER_CANCELLATION = 2,
21
    DELIVERY_PROBLEM = 3,
22
    PAYMENT_STATUS = 4,
23
    ORDER_STATUS = 5,
24
    PRODUCT_REQUEST = 6,
25
    PRODUCT_QUESTION = 7,
3499 mandeep.dh 26
    OTHER = 8,
3578 mandeep.dh 27
    COD_VERIFICATION = 9,
4008 mandeep.dh 28
    FAILED_PAYMENTS = 10,
4267 anupam.sin 29
    DELAYED_DELIVERY = 11,
4490 anupam.sin 30
    PAYMENT_FLAGGED = 12,
4681 amar.kumar 31
    DOA_RECEIVED = 13,
4948 phani.kuma 32
    PRODUCT_PROCUREMENT = 14,
5407 amar.kumar 33
    UNDELIVERED = 15,
5791 anupam.sin 34
    CATEGORY = 16,
6104 rajveer 35
    STORE_PICKUP = 17,
36
    RECHARGE_UNKNOWN = 18
3026 mandeep.dh 37
}
38
 
3106 mandeep.dh 39
enum ActivityType {
3269 mandeep.dh 40
    SEND_EMAIL_TO_CUSTOMER = 1,
3271 mandeep.dh 41
    RECEIVED_EMAIL_FROM_CUSTOMER = 2,
3269 mandeep.dh 42
    CALLED_CUSTOMER = 3,
3271 mandeep.dh 43
    RECEIVED_CALL_FROM_CUSTOMER = 4,
4020 mandeep.dh 44
    OTHER = 5,
45
    ESCALATE_TICKET = 6
3106 mandeep.dh 46
}
47
 
3390 mandeep.dh 48
struct Agent {
49
    1:i64 id,
50
    2:string name,
51
    3:string emailId,
52
    4:optional i64 managerId,
4793 amar.kumar 53
    5:string password,
54
    6:bool is_active;
3390 mandeep.dh 55
}
56
 
3026 mandeep.dh 57
struct Ticket {
58
    1:i64 id,
3390 mandeep.dh 59
    2:optional i64 customerId,
60
    3:i64 openDate,
61
    4:optional i64 closeDate,
62
    5:optional string description,
63
    6:TicketPriority priority,
64
    7:TicketCategory category,
65
    8:TicketStatus status,
66
    9:optional i64 assigneeId,
67
   10:i64 creatorId,
68
   11:optional i64 orderId,
69
   12:optional string airwayBillNo,
70
   13:optional string productName,
71
 
72
   // used for un-registered users
73
   14:optional string customerMobileNumber,
74
   15:optional string customerEmailId,
3546 mandeep.dh 75
   16:optional string customerName
3026 mandeep.dh 76
}
77
 
78
struct Activity {
79
    1:i64 id,
3168 mandeep.dh 80
    2:optional string description,
3106 mandeep.dh 81
    3:i64 creationTimestamp, // represents time at which this activity occurred
82
    4:ActivityType type,
3269 mandeep.dh 83
    5:optional i64 customerId, // used for registered users
3390 mandeep.dh 84
    6:i64 creatorId,
3026 mandeep.dh 85
 
3269 mandeep.dh 86
    // represents the numeric identifier for the emails sent to customers
87
    // These are archived in helper..useremailarchive or helper..useremail
3390 mandeep.dh 88
    7:optional i64 userEmailId,
3269 mandeep.dh 89
 
3106 mandeep.dh 90
    // ticket related fields to track changes on ticket fields
3390 mandeep.dh 91
    8:optional i64 ticketId,
92
    9:optional TicketPriority ticketPriority,
93
   10:optional i64 ticketAssigneeId,
94
   11:optional TicketStatus ticketStatus,
95
   12:optional TicketCategory ticketCategory,
96
   13:optional string ticketDescription,
97
 
98
   // Activities created as part of mails received from customers
99
   // have to be explicitly marked as read by agents in CRM.
100
   // This flag is set over such activities when any agent marks it as read!
3546 mandeep.dh 101
   14:optional bool isRead,
3390 mandeep.dh 102
 
103
   // used for un-registered users
104
   15:optional string customerMobileNumber,
105
   16:optional string customerEmailId,
106
   17:optional string customerName,
4241 anupam.sin 107
 
108
   // used for attachments name separated by semicolon
109
   18:optional string attachments
3026 mandeep.dh 110
}
111
 
3390 mandeep.dh 112
struct SearchFilter {
113
    1:optional i64 ticketId,
114
    2:optional i64 activityId,
115
    3:optional list<i64> ticketAssigneeIds,
116
    4:optional list<i64> activityCreatorIds,
117
    5:optional i64 agentId,
118
    6:optional i64 customerId,
119
    7:optional i64 startTimestamp,
120
    8:optional i64 endTimestamp,
121
    9:optional bool isActivityRead,
122
   10:optional string agentEmailId,
123
   11:optional string customerEmailId,
3499 mandeep.dh 124
   12:optional string customerMobileNumber,
3546 mandeep.dh 125
   13:optional list<TicketStatus> ticketStatuses,
3499 mandeep.dh 126
   14:optional TicketCategory ticketCategory,
3546 mandeep.dh 127
   15:optional TicketPriority ticketPriority,
128
   16:optional ActivityType activityType
3026 mandeep.dh 129
}
130
 
3374 rajveer 131
service CRMService extends GenericService.GenericService{
3026 mandeep.dh 132
    // Methods to read/write tickets from/in database
3390 mandeep.dh 133
    list<Ticket> getTickets(1:SearchFilter searchFilter);
3137 mandeep.dh 134
    list<Ticket> getUnassignedTickets();
3206 mandeep.dh 135
    void updateTicket(1:Ticket ticket, 2:Activity activity);
136
    i64 insertTicket(1:Ticket ticket, 2:Activity activity);
4793 amar.kumar 137
    void unassignAgentTickets(1:i32 assigneeId);
3026 mandeep.dh 138
 
139
    // Methods to read/write activities from/in database
3390 mandeep.dh 140
    list<Activity> getActivities(1:SearchFilter searchFilter);
3405 mandeep.dh 141
    i64 insertActivity(1:Activity activity);
3390 mandeep.dh 142
    void markAsRead(1:i64 activityId, 2:i64 agentId);
3026 mandeep.dh 143
 
144
    // Methods to read agent information
3390 mandeep.dh 145
    list<Agent> getAgents(1:SearchFilter searchFilter);
5287 amar.kumar 146
    list<Agent> getInactiveAgents(1:SearchFilter searchFilter);
3087 mandeep.dh 147
    void updatePasswordForAgent(1:string agentEmailId, 2:string password);
148
 
149
    // Methods to read roles and permissions information
150
    list<string> getRoleNamesForAgent(1:string agentEmailId);
3106 mandeep.dh 151
    list<string> getPermissionsForRoleName(1:string roleName);
3339 mandeep.dh 152
 
153
    // Misc methods
154
    i64 getLastEmailProcessedTimestamp();
155
    void updateLastEmailProcessedTimestamp(1:i64 timestamp);
4793 amar.kumar 156
 
157
    // Method to change active/inactive status of Agent
158
    void changeAgentStatus(1:bool status, 2:string emailId);
159
 
160
    //Method to add a new CRM Agent 
161
    void insertAgent(1:Agent agent, 2:list<string> role);
5169 amar.kumar 162
 
163
    //Method to change CRM agent role
164
    void changeAgentRole(1:i64 id, 2:list<string> role);
165
 
166
    //Method to get openTicketCount for any agent
167
    i32 getOpenTicketCountForAgent(1:i64 agentId);
5909 amar.kumar 168
 
169
    //Method to get all open tickets grouped by categories
170
    map<string,i64> getOpenTicketsMap();
3026 mandeep.dh 171
}