Subversion Repositories SmartDukaan

Rev

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