Subversion Repositories SmartDukaan

Rev

Rev 4490 | Rev 4793 | 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,
32
    PRODUCT_PROCUREMENT = 14
3026 mandeep.dh 33
}
34
 
3106 mandeep.dh 35
enum ActivityType {
3269 mandeep.dh 36
    SEND_EMAIL_TO_CUSTOMER = 1,
3271 mandeep.dh 37
    RECEIVED_EMAIL_FROM_CUSTOMER = 2,
3269 mandeep.dh 38
    CALLED_CUSTOMER = 3,
3271 mandeep.dh 39
    RECEIVED_CALL_FROM_CUSTOMER = 4,
4020 mandeep.dh 40
    OTHER = 5,
41
    ESCALATE_TICKET = 6
3106 mandeep.dh 42
}
43
 
3390 mandeep.dh 44
struct Agent {
45
    1:i64 id,
46
    2:string name,
47
    3:string emailId,
48
    4:optional i64 managerId,
49
    5:string password
50
}
51
 
3026 mandeep.dh 52
struct Ticket {
53
    1:i64 id,
3390 mandeep.dh 54
    2:optional i64 customerId,
55
    3:i64 openDate,
56
    4:optional i64 closeDate,
57
    5:optional string description,
58
    6:TicketPriority priority,
59
    7:TicketCategory category,
60
    8:TicketStatus status,
61
    9:optional i64 assigneeId,
62
   10:i64 creatorId,
63
   11:optional i64 orderId,
64
   12:optional string airwayBillNo,
65
   13:optional string productName,
66
 
67
   // used for un-registered users
68
   14:optional string customerMobileNumber,
69
   15:optional string customerEmailId,
3546 mandeep.dh 70
   16:optional string customerName
3026 mandeep.dh 71
}
72
 
73
struct Activity {
74
    1:i64 id,
3168 mandeep.dh 75
    2:optional string description,
3106 mandeep.dh 76
    3:i64 creationTimestamp, // represents time at which this activity occurred
77
    4:ActivityType type,
3269 mandeep.dh 78
    5:optional i64 customerId, // used for registered users
3390 mandeep.dh 79
    6:i64 creatorId,
3026 mandeep.dh 80
 
3269 mandeep.dh 81
    // represents the numeric identifier for the emails sent to customers
82
    // These are archived in helper..useremailarchive or helper..useremail
3390 mandeep.dh 83
    7:optional i64 userEmailId,
3269 mandeep.dh 84
 
3106 mandeep.dh 85
    // ticket related fields to track changes on ticket fields
3390 mandeep.dh 86
    8:optional i64 ticketId,
87
    9:optional TicketPriority ticketPriority,
88
   10:optional i64 ticketAssigneeId,
89
   11:optional TicketStatus ticketStatus,
90
   12:optional TicketCategory ticketCategory,
91
   13:optional string ticketDescription,
92
 
93
   // Activities created as part of mails received from customers
94
   // have to be explicitly marked as read by agents in CRM.
95
   // This flag is set over such activities when any agent marks it as read!
3546 mandeep.dh 96
   14:optional bool isRead,
3390 mandeep.dh 97
 
98
   // used for un-registered users
99
   15:optional string customerMobileNumber,
100
   16:optional string customerEmailId,
101
   17:optional string customerName,
4241 anupam.sin 102
 
103
   // used for attachments name separated by semicolon
104
   18:optional string attachments
3026 mandeep.dh 105
}
106
 
3390 mandeep.dh 107
struct SearchFilter {
108
    1:optional i64 ticketId,
109
    2:optional i64 activityId,
110
    3:optional list<i64> ticketAssigneeIds,
111
    4:optional list<i64> activityCreatorIds,
112
    5:optional i64 agentId,
113
    6:optional i64 customerId,
114
    7:optional i64 startTimestamp,
115
    8:optional i64 endTimestamp,
116
    9:optional bool isActivityRead,
117
   10:optional string agentEmailId,
118
   11:optional string customerEmailId,
3499 mandeep.dh 119
   12:optional string customerMobileNumber,
3546 mandeep.dh 120
   13:optional list<TicketStatus> ticketStatuses,
3499 mandeep.dh 121
   14:optional TicketCategory ticketCategory,
3546 mandeep.dh 122
   15:optional TicketPriority ticketPriority,
123
   16:optional ActivityType activityType
3026 mandeep.dh 124
}
125
 
3374 rajveer 126
service CRMService extends GenericService.GenericService{
3026 mandeep.dh 127
    // Methods to read/write tickets from/in database
3390 mandeep.dh 128
    list<Ticket> getTickets(1:SearchFilter searchFilter);
3137 mandeep.dh 129
    list<Ticket> getUnassignedTickets();
3206 mandeep.dh 130
    void updateTicket(1:Ticket ticket, 2:Activity activity);
131
    i64 insertTicket(1:Ticket ticket, 2:Activity activity);
3026 mandeep.dh 132
 
133
    // Methods to read/write activities from/in database
3390 mandeep.dh 134
    list<Activity> getActivities(1:SearchFilter searchFilter);
3405 mandeep.dh 135
    i64 insertActivity(1:Activity activity);
3390 mandeep.dh 136
    void markAsRead(1:i64 activityId, 2:i64 agentId);
3026 mandeep.dh 137
 
138
    // Methods to read agent information
3390 mandeep.dh 139
    list<Agent> getAgents(1:SearchFilter searchFilter);
3087 mandeep.dh 140
    void updatePasswordForAgent(1:string agentEmailId, 2:string password);
141
 
142
    // Methods to read roles and permissions information
143
    list<string> getRoleNamesForAgent(1:string agentEmailId);
3106 mandeep.dh 144
    list<string> getPermissionsForRoleName(1:string roleName);
3339 mandeep.dh 145
 
146
    // Misc methods
147
    i64 getLastEmailProcessedTimestamp();
148
    void updateLastEmailProcessedTimestamp(1:i64 timestamp);
3026 mandeep.dh 149
}