Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
3137 mandeep.dh 1
/**
2
 * 
3
 */
4
package in.shop2020.serving.controllers;
5
 
3339 mandeep.dh 6
import in.shop2020.crm.Activity;
7
import in.shop2020.crm.ActivityType;
3137 mandeep.dh 8
import in.shop2020.crm.Agent;
3390 mandeep.dh 9
import in.shop2020.crm.SearchFilter;
3137 mandeep.dh 10
import in.shop2020.crm.Ticket;
3339 mandeep.dh 11
import in.shop2020.crm.TicketCategory;
12
import in.shop2020.crm.TicketPriority;
3137 mandeep.dh 13
import in.shop2020.crm.TicketStatus;
3546 mandeep.dh 14
import in.shop2020.model.v1.order.LineItem;
15
import in.shop2020.model.v1.order.Order;
16
import in.shop2020.model.v1.order.OrderStatus;
4267 anupam.sin 17
import in.shop2020.model.v1.order.Transaction;
3546 mandeep.dh 18
import in.shop2020.model.v1.order.TransactionServiceException;
4267 anupam.sin 19
import in.shop2020.model.v1.order.TransactionStatus;
3137 mandeep.dh 20
import in.shop2020.model.v1.user.User;
21
import in.shop2020.model.v1.user.UserContextException;
3578 mandeep.dh 22
import in.shop2020.payments.Payment;
23
import in.shop2020.payments.PaymentException;
24
import in.shop2020.payments.PaymentStatus;
3390 mandeep.dh 25
import in.shop2020.serving.auth.CRMAuthorizingRealm;
26
import in.shop2020.thrift.clients.CRMClient;
3405 mandeep.dh 27
import in.shop2020.thrift.clients.HelperClient;
3578 mandeep.dh 28
import in.shop2020.thrift.clients.PaymentClient;
3546 mandeep.dh 29
import in.shop2020.thrift.clients.TransactionClient;
3390 mandeep.dh 30
import in.shop2020.thrift.clients.UserClient;
3405 mandeep.dh 31
import in.shop2020.util.CRMConstants;
4020 mandeep.dh 32
import in.shop2020.util.CRMConstants.EscalationMatrix;
4241 anupam.sin 33
import in.shop2020.util.CRMConstants.CODCancelMatrix;
3405 mandeep.dh 34
import in.shop2020.utils.HelperService.Client;
35
import in.shop2020.utils.HelperServiceException;
3546 mandeep.dh 36
import in.shop2020.utils.ModelUtils;
3137 mandeep.dh 37
 
3397 mandeep.dh 38
import java.text.ParseException;
3137 mandeep.dh 39
import java.util.ArrayList;
3578 mandeep.dh 40
import java.util.Calendar;
3390 mandeep.dh 41
import java.util.Collections;
3405 mandeep.dh 42
import java.util.Date;
4490 anupam.sin 43
import java.util.HashMap;
3137 mandeep.dh 44
import java.util.List;
45
 
4256 mandeep.dh 46
import net.htmlparser.jericho.Source;
47
 
3405 mandeep.dh 48
import org.apache.shiro.SecurityUtils;
3137 mandeep.dh 49
import org.apache.thrift.TException;
3546 mandeep.dh 50
import org.apache.thrift.transport.TTransportException;
3137 mandeep.dh 51
 
52
/**
53
 * @author mandeep
54
 * 
55
 */
56
public class TicketsController extends BaseController {
57
 
58
    /**
59
     * 
60
     */
61
    private static final long serialVersionUID = 1L;
62
 
63
    List<Ticket>              tickets          = new ArrayList<Ticket>();
3405 mandeep.dh 64
    private String            customerEmailId;
3339 mandeep.dh 65
    private String            description;
66
    private String            assigneeEmailId;
67
    private String            priority;
68
    private String            category;
69
    private String            orderId;
3397 mandeep.dh 70
    private String[]          agentIds;
71
    private String            startTimestamp;
72
    private String            endTimestamp;
3137 mandeep.dh 73
 
3405 mandeep.dh 74
    private String            userId;
75
    private String            id;
76
    private String            activityDescription;
77
    private String            status;
78
    private String            activityType;
79
    private Ticket            ticket;
80
    private List<Activity>    activities;
81
    private String            subject;
82
    private String            body;
83
    private String            customerName;
84
    private String            customerMobileNumber;
3546 mandeep.dh 85
    private User              user;
86
    private String            orderStatus;
87
    private List<Order>       orders;
4267 anupam.sin 88
    private List<Payment>     payments;
4020 mandeep.dh 89
    private String            escalate;
4241 anupam.sin 90
    private String            cancelReason;
4267 anupam.sin 91
    private String            transactionId;
3405 mandeep.dh 92
 
4438 anupam.sin 93
    private String paymentId;
94
 
4490 anupam.sin 95
    private HashMap<String, String> allAttachmentsForTicket;
96
 
3405 mandeep.dh 97
    public String index() {
98
        try {
99
            if (id != null && !id.isEmpty()) {
100
                SearchFilter searchFilter = new SearchFilter();
101
                crmServiceClient = new CRMClient().getClient();
102
                searchFilter.setTicketId(Long.parseLong(id));
103
                tickets = crmServiceClient.getTickets(searchFilter);
104
            }
105
        } catch (TException e) {
106
            log.error("Error while getting tickets", e);
107
            return EXCEPTION;
108
        }
109
 
110
        return INDEX;
111
    }
112
 
113
    public String edit() {
114
        try {
115
            long ticketId = Long.parseLong(id);
116
            SearchFilter searchFilter = new SearchFilter();
117
            searchFilter.setTicketId(ticketId);
118
            crmServiceClient = new CRMClient().getClient();
119
            ticket = crmServiceClient.getTickets(searchFilter).get(0);
120
            activities = crmServiceClient.getActivities(searchFilter);
4490 anupam.sin 121
            populateAttachments();
3405 mandeep.dh 122
            subject = createSubjectString(ticket);
123
 
124
            if (ticket.isSetCustomerId()) {
125
                userId = String.valueOf(ticket.getCustomerId());
3546 mandeep.dh 126
                userContextServiceClient = new UserClient().getClient();
127
 
128
                try {
129
                    user = userContextServiceClient.getUserById(ticket
130
                            .getCustomerId());
131
                } catch (UserContextException e) {
132
                    log.error("Could not fetch user details", e);
133
                }
3405 mandeep.dh 134
            }
135
 
136
            customerEmailId = ticket.getCustomerEmailId();
4277 anupam.sin 137
 
138
            if (TicketCategory.ORDER_CANCELLATION.equals(ticket.getCategory())) {
139
                log.info("Fetching orders for " + ticket.getCustomerId());
140
                orders = new ArrayList<Order>();
141
                transactionServiceClient = new TransactionClient().getClient();
142
                Order order = transactionServiceClient.getOrder(ticket.getOrderId());
143
                log.info("Processing Order: " + order);
4287 anupam.sin 144
                if(OrderStatus.CANCEL_REQUEST_RECEIVED.equals(order.getStatus())) {
145
                    orders.add(order);
146
                }
4277 anupam.sin 147
            }
3546 mandeep.dh 148
 
149
            if (TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())) {
150
                log.info("Fetching orders for " + ticket.getCustomerId());
151
                orders = new ArrayList<Order>();
152
                transactionServiceClient = new TransactionClient().getClient();
153
                for (Order order : transactionServiceClient
154
                        .getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
4663 rajveer 155
                                Collections.singletonList(OrderStatus.COD_VERIFICATION_PENDING))) {
3546 mandeep.dh 156
                    log.info("Processing Order: " + order);
157
                    if (order.isCod()) {
158
                        orders.add(order);
159
                    }
160
                }
161
            }
4490 anupam.sin 162
 
163
            if (TicketCategory.DOA_RECEIVED.equals(ticket.getCategory())) {
164
                log.info("Fetching orders for " + ticket.getCustomerId());
165
                orders = new ArrayList<Order>();
166
                transactionServiceClient = new TransactionClient().getClient();
167
                for (Order order : transactionServiceClient
168
                        .getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
169
                                Collections.singletonList(OrderStatus.DOA_REQUEST_RECEIVED))) {
170
                    log.info("Processing Order: " + order);
171
                    if (order != null) {
172
                        orders.add(order);
173
                    }
174
                }
175
            }
176
 
177
            if (TicketCategory.RETURN_FORM.equals(ticket.getCategory())) {
178
                log.info("Fetching orders for " + ticket.getCustomerId());
179
                orders = new ArrayList<Order>();
180
                transactionServiceClient = new TransactionClient().getClient();
181
                for (Order order : transactionServiceClient
182
                        .getOrdersForCustomer(ticket.getCustomerId(), 0, 0,
183
                                Collections.singletonList(OrderStatus.RET_REQUEST_RECEIVED))) {
184
                    log.info("Processing Order: " + order);
185
                    if (order != null) {
186
                        orders.add(order);
187
                    }
188
                }
189
            }
3578 mandeep.dh 190
 
4267 anupam.sin 191
            if (TicketCategory.PAYMENT_FLAGGED.equals(ticket.getCategory())) {
192
                log.info("Fetching orders for " + ticket.getCustomerId());
193
                payments = new ArrayList<Payment>();
194
                in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
195
                transactionServiceClient = new TransactionClient().getClient();
196
                for (Transaction transaction : transactionServiceClient
197
                        .getTransactionsForCustomer(ticket.getCustomerId(), 0, 0, TransactionStatus.FLAGGED)) {
198
                    log.info("Processing Transaction: " + transaction);
199
                    for ( Payment payment : paymentClient.getPaymentForTxnId(transaction.getId())) {
200
                        if( payment.getStatus().equals(PaymentStatus.AUTHORIZED)) {
201
                            payments.add(payment);
202
                        }
203
                    }
204
                }
205
            }
206
 
3578 mandeep.dh 207
            if (TicketCategory.FAILED_PAYMENTS.equals(ticket.getCategory())) {
208
                log.info("Fetching orders for " + ticket.getCustomerId());
209
                orders = new ArrayList<Order>();
210
                in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
211
 
212
                long failedTransactionId = -1;
213
                long lastfailedTransactionTimestamp = -1;
214
                for (Payment payment : paymentClient.getPaymentsForUser(ticket.getCustomerId(), 0, getTomorrow().getTime(), PaymentStatus.FAILED, 0)) {
215
                    if (payment.getErrorTimestamp() > lastfailedTransactionTimestamp) {
216
                        failedTransactionId = payment.getMerchantTxnId();
217
                    }
218
                }
219
 
220
                transactionServiceClient = new TransactionClient().getClient();
221
                orders.addAll(transactionServiceClient.getOrdersForTransaction(failedTransactionId, ticket.getCustomerId()));
222
            }
4008 mandeep.dh 223
 
224
            if (TicketCategory.DELAYED_DELIVERY.equals(ticket.getCategory())) {
225
                log.info("Fetching orders for " + ticket.getCustomerId());
226
                orders = new ArrayList<Order>();
227
                transactionServiceClient = new TransactionClient().getClient();
228
 
229
                for (Order order : transactionServiceClient.getOrdersForCustomer(ticket.getCustomerId(), 0, 0, null)) {
230
                    if (order.getExpected_delivery_time() > order.getPromised_delivery_time() && order.getExpected_delivery_time() > new Date().getTime()) {
231
                        orders.add(order);
232
                    }
233
                }
234
            }
3405 mandeep.dh 235
        } catch (TException e) {
3546 mandeep.dh 236
            log.error("Error loading edit page", e);
237
        } catch (NumberFormatException e) {
238
            log.error("Error parsing orderId", e);
239
        } catch (TransactionServiceException e) {
240
            log.error("Error fetching orders for " + ticket.getCustomerId(), e);
3578 mandeep.dh 241
        } catch (PaymentException e) {
242
            log.error("Error fetching payments for " + ticket.getCustomerId(), e);
3405 mandeep.dh 243
        }
244
 
245
        return EDIT;
246
    }
247
 
4490 anupam.sin 248
    private void populateAttachments() {
249
        allAttachmentsForTicket = new HashMap<String, String>();
250
        for (Activity activity : activities) {
251
            log.info("" + activity.getId());
252
            String attachment = activity.getAttachments();
253
            if (attachment != null && !attachment.isEmpty()) {
254
                log.info("" + attachment);
255
                String [] attachmentList = attachment.split(";");
256
                for (String attachmentName : attachmentList) {
257
                    if (attachmentName != null && !attachmentName.isEmpty()) {
258
                        log.info("" + attachmentName);
259
                        allAttachmentsForTicket.put(activity.getId() + "-" + attachmentName, attachmentName);
260
                    }
261
                }
262
            }
263
        }
264
    }
265
 
266
    public static void main(String[] args) {
267
        TicketsController tc = new TicketsController();
268
        Integer i = new Integer(14215);
269
        tc.id = i.toString();
270
        tc.populateAttachments();
271
    }
272
 
3405 mandeep.dh 273
    private String createSubjectString(Ticket ticket) {
274
        return CRMConstants.CRM_SUBJECT_PREFIX_FOR_TICKET_ID + ticket.getId()
275
                + " " + ticket.getCategory().name();
276
    }
277
 
3578 mandeep.dh 278
    private Date getTomorrow() {
279
        Calendar calendar = Calendar.getInstance();
280
        calendar.setTime(new Date());
281
        calendar.add(Calendar.DAY_OF_MONTH, 1);
282
        return calendar.getTime();
283
    }
284
 
3339 mandeep.dh 285
    public String create() {
286
        try {
3546 mandeep.dh 287
            long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId)
288
                    .getId();
3339 mandeep.dh 289
            Ticket ticket = new Ticket();
290
            ticket.setDescription(description);
291
            ticket.setCreatorId(creatorId);
292
            ticket.setStatus(TicketStatus.OPEN);
293
            ticket.setPriority(TicketPriority.valueOf(priority));
294
            ticket.setCategory(TicketCategory.valueOf(category));
295
 
296
            Activity activity = new Activity();
297
            activity.setDescription("Creating Ticket");
298
            activity.setType(ActivityType.OTHER);
299
            activity.setTicketPriority(TicketPriority.valueOf(priority));
300
            activity.setTicketStatus(TicketStatus.OPEN);
301
            activity.setCreatorId(creatorId);
302
            activity.setTicketCategory(TicketCategory.valueOf(category));
303
            activity.setTicketDescription(description);
304
 
305
            if (orderId != null && !orderId.isEmpty()) {
306
                ticket.setOrderId(Long.parseLong(orderId));
307
            }
4490 anupam.sin 308
 
309
            if (TicketCategory.valueOf(category) == TicketCategory.DOA_RECEIVED) {
310
                transactionServiceClient = new TransactionClient().getClient();
311
                if (!transactionServiceClient.markOrderDoaRequestReceived(Long.parseLong(orderId))) {
312
                    throw new Exception("Order cannot be marked as DOA Received");
313
                }
314
                log.info("" + userId);
315
 
316
                Order order = transactionServiceClient.getOrder(Long.parseLong(orderId));
317
                log.info("In order table id is : " + order.getCustomer_id());
318
                if (userId == null || userId.isEmpty() || order.getCustomer_id() != Long.parseLong(userId)) {
319
                    throw new Exception("This order is not associated with this user Id");
320
                }
321
            }
322
 
323
            if (TicketCategory.valueOf(category) == TicketCategory.RETURN_FORM) {
324
                transactionServiceClient = new TransactionClient().getClient();
325
                if (!transactionServiceClient.markOrderReturnRequestReceived(Long.parseLong(orderId))) {
326
                    throw new Exception("Order cannot be marked as Return Requested");
327
                }
328
                log.info("" + userId);
329
 
330
                Order order = transactionServiceClient.getOrder(Long.parseLong(orderId));
331
                log.info("In order table id is : " + order.getCustomer_id());
332
                if (userId == null || userId.isEmpty() || order.getCustomer_id() != Long.parseLong(userId)) {
333
                    throw new Exception("This order is not associated with this user Id");
334
                }
335
            }
336
 
3405 mandeep.dh 337
            if (userId != null && !userId.isEmpty()) {
338
                ticket.setCustomerId(Long.parseLong(userId));
339
                activity.setCustomerId(Long.parseLong(userId));
3546 mandeep.dh 340
            } else {
3390 mandeep.dh 341
                User user = null;
342
                userContextServiceClient = new UserClient().getClient();
343
                try {
3405 mandeep.dh 344
                    if (customerName != null && !customerName.isEmpty()) {
345
                        ticket.setCustomerName(customerName);
346
                        activity.setCustomerName(customerName);
347
                    }
348
 
349
                    if (customerEmailId != null && !customerEmailId.isEmpty()) {
350
                        ticket.setCustomerEmailId(customerEmailId);
351
                        activity.setCustomerEmailId(customerEmailId);
3546 mandeep.dh 352
                        user = userContextServiceClient
353
                                .getUserByEmail(customerEmailId);
3405 mandeep.dh 354
                    }
355
 
3546 mandeep.dh 356
                    if ((user == null || user.getUserId() == -1)
357
                            && customerMobileNumber != null
358
                            && !customerMobileNumber.isEmpty()) {
3405 mandeep.dh 359
                        ticket.setCustomerMobileNumber(customerMobileNumber);
360
                        activity.setCustomerMobileNumber(customerMobileNumber);
3546 mandeep.dh 361
                        user = userContextServiceClient
362
                                .getUserByMobileNumber(Long
363
                                        .parseLong(customerMobileNumber));
3405 mandeep.dh 364
                    }
3390 mandeep.dh 365
                } catch (UserContextException e) {
3546 mandeep.dh 366
                    log.error("Could not fetch user for: " + customerEmailId
367
                            + " " + customerMobileNumber + " " + customerName,
368
                            e);
3390 mandeep.dh 369
                }
3546 mandeep.dh 370
 
3390 mandeep.dh 371
                if (user != null && user.getUserId() != -1) {
372
                    ticket.setCustomerId(user.getUserId());
373
                    activity.setCustomerId(user.getUserId());
374
                }
3339 mandeep.dh 375
            }
376
 
377
            // handling null values appropriately
378
            if (assigneeEmailId != null && !assigneeEmailId.isEmpty()) {
3546 mandeep.dh 379
                long assigneeId = CRMAuthorizingRealm.getAgent(assigneeEmailId)
380
                        .getId();
3339 mandeep.dh 381
                ticket.setAssigneeId(assigneeId);
382
                activity.setTicketAssigneeId(assigneeId);
383
            }
384
 
3546 mandeep.dh 385
            crmServiceClient = new CRMClient().getClient();
386
            id = String
387
                    .valueOf(crmServiceClient.insertTicket(ticket, activity));
3339 mandeep.dh 388
        } catch (TException e) {
389
            log.error("Error while creating ticket", e);
390
            return EXCEPTION;
4490 anupam.sin 391
        } catch (NumberFormatException e) {
392
            log.error("Error while parsing Order Id", e);
393
            return EXCEPTION;
394
        } catch (TransactionServiceException e) {
395
            log.error("Error while updating order status", e);
396
            return EXCEPTION;
397
        } catch (Exception e) {
398
            log.error(e.getMessage());
399
            return EXCEPTION;
3339 mandeep.dh 400
        }
401
 
3405 mandeep.dh 402
        return index();
3339 mandeep.dh 403
    }
404
 
3405 mandeep.dh 405
    public boolean isAssigneeEditable() {
406
        return SecurityUtils.getSubject().hasRole("TeamLead");
407
    }
408
 
3397 mandeep.dh 409
    public String searchTickets() throws ParseException {
3137 mandeep.dh 410
        try {
3397 mandeep.dh 411
            SearchFilter searchFilter = new SearchFilter();
3405 mandeep.dh 412
            if (userId != null && !userId.isEmpty()) {
413
                searchFilter.setCustomerId(Long.parseLong(userId));
414
            }
415
 
3397 mandeep.dh 416
            if (agentIds != null && agentIds.length != 0) {
417
                searchFilter.setTicketAssigneeIds(new ArrayList<Long>());
418
                for (String agentId : agentIds) {
3546 mandeep.dh 419
                    searchFilter.getTicketAssigneeIds().add(
420
                            CRMAuthorizingRealm.getAgent(agentId).getId());
3397 mandeep.dh 421
                }
422
            }
3137 mandeep.dh 423
 
3397 mandeep.dh 424
            if (startTimestamp != null && !startTimestamp.isEmpty()) {
3546 mandeep.dh 425
                searchFilter.setStartTimestamp(SDF.parse(startTimestamp)
426
                        .getTime());
3397 mandeep.dh 427
            }
428
 
429
            if (endTimestamp != null && !endTimestamp.isEmpty()) {
430
                searchFilter.setEndTimestamp(SDF.parse(endTimestamp).getTime());
431
            }
432
 
3422 mandeep.dh 433
            if (id != null && !id.isEmpty()) {
434
                searchFilter.setTicketId(Long.parseLong(id));
435
            }
436
 
3499 mandeep.dh 437
            if (status != null && !status.isEmpty()) {
3972 mandeep.dh 438
                searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
439
                searchFilter.getTicketStatuses().add(TicketStatus.valueOf(status));
440
                if (TicketStatus.OPEN.name().equals(status)) {
441
                    searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
442
                }
3499 mandeep.dh 443
            }
444
 
445
            if (category != null && !category.isEmpty()) {
3546 mandeep.dh 446
                searchFilter
447
                        .setTicketCategory(TicketCategory.valueOf(category));
3499 mandeep.dh 448
            }
449
 
3546 mandeep.dh 450
            crmServiceClient = new CRMClient().getClient();
3405 mandeep.dh 451
            tickets = crmServiceClient.getTickets(searchFilter);
3137 mandeep.dh 452
        } catch (TException e) {
453
            String errorString = "Error getting tickets for "
454
                    + currentAgentEmailId;
455
            log.error(errorString, e);
456
            addActionError(errorString);
457
        }
458
 
3405 mandeep.dh 459
        return index();
3137 mandeep.dh 460
    }
461
 
462
    public String getUnassignedTickets() {
463
        try {
3546 mandeep.dh 464
            crmServiceClient = new CRMClient().getClient();
3137 mandeep.dh 465
            tickets = crmServiceClient.getUnassignedTickets();
466
        } catch (TException e) {
3339 mandeep.dh 467
            String errorString = "Error getting tickets for "
468
                    + currentAgentEmailId;
3137 mandeep.dh 469
            log.error(errorString, e);
470
            addActionError(errorString);
471
        }
472
 
3405 mandeep.dh 473
        return index();
3137 mandeep.dh 474
    }
475
 
3405 mandeep.dh 476
    public String update() {
477
        try {
478
            long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId)
479
                    .getId();
480
 
3546 mandeep.dh 481
            SearchFilter searchFilter = new SearchFilter();
482
            searchFilter.setTicketId(Long.parseLong(id));
483
            crmServiceClient = new CRMClient().getClient();
484
            Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
3405 mandeep.dh 485
            ticket.setDescription(description);
486
            ticket.setPriority(TicketPriority.valueOf(priority));
487
 
488
            // Update when a ticket is closed!
3578 mandeep.dh 489
            if (TicketStatus.CLOSED.name().equals(status) || TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())) {
3546 mandeep.dh 490
                if (TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())
491
                        && pendingCODOrders(ticket.getCustomerId())) {
492
                    addActionMessage("Cod orders pending for verification. Ticket can not be closed and its category cannot be changed.");
493
                } else {
494
                    ticket.setCategory(TicketCategory.valueOf(category));
495
                    ticket.setStatus(TicketStatus.valueOf(status));
496
                    ticket.setCloseDate(new Date().getTime());
497
                }
3405 mandeep.dh 498
            }
3546 mandeep.dh 499
            else {
500
                ticket.setCategory(TicketCategory.valueOf(category));
3578 mandeep.dh 501
                ticket.setStatus(TicketStatus.valueOf(status));
3546 mandeep.dh 502
            }
3405 mandeep.dh 503
 
504
            if (activityDescription == null || activityDescription.isEmpty()) {
4241 anupam.sin 505
                activityDescription = "Ticket fields updated";
3405 mandeep.dh 506
            }
507
 
508
            Activity activity = new Activity();
509
            activity.setDescription(activityDescription);
510
            activity.setType(ActivityType.valueOf(activityType));
3546 mandeep.dh 511
            activity.setTicketPriority(ticket.getPriority());
512
            activity.setTicketStatus(ticket.getStatus());
3405 mandeep.dh 513
            activity.setCreatorId(creatorId);
3546 mandeep.dh 514
            activity.setTicketCategory(ticket.getCategory());
515
            activity.setTicketDescription(ticket.getDescription());
3405 mandeep.dh 516
 
517
            if (userId != null && !userId.isEmpty()) {
518
                activity.setCustomerId(Long.parseLong(userId));
519
            }
520
 
4035 mandeep.dh 521
            // Handling null values appropriately
522
            if (assigneeEmailId != null && !assigneeEmailId.isEmpty()) {
523
                long assigneeId = CRMAuthorizingRealm.getAgent(assigneeEmailId)
524
                        .getId();
525
                ticket.setAssigneeId(assigneeId);
526
                activity.setTicketAssigneeId(assigneeId);
527
            }
528
 
3405 mandeep.dh 529
            if (ActivityType.SEND_EMAIL_TO_CUSTOMER.equals(activity.getType())) {
530
                log.info("Sending mail");
531
                Client helperClient = new HelperClient().getClient();
532
                activity.setUserEmailId(helperClient.saveUserEmailForSending(
3546 mandeep.dh 533
                        customerEmailId, CRMConstants.CRM_EMAIL_SENDOR,
534
                        subject, body, null, CRMConstants.CRM_EMAIL_TYPE));
3405 mandeep.dh 535
 
4256 mandeep.dh 536
                String plainTextbody = new Source(body).getTextExtractor().toString();
537
 
3405 mandeep.dh 538
                // We change activityType to OTHER when pop up box for email
539
                // closes
540
                activity.setDescription("Subject: " + subject + "\n\n"
4256 mandeep.dh 541
                        + "Body: " + plainTextbody);
4206 mandeep.dh 542
 
543
                String activityDesc = activity.getDescription();
544
                if (activityDesc.length() > CRMConstants.DESCRIPTION_MAX_WIDTH) {
545
                    activityDesc = activityDesc.substring(0, CRMConstants.DESCRIPTION_MAX_WIDTH);
546
                    activityDesc += "\n\nTHIS TEXT IS TRUNCATED. PLEASE VISIT INBOX TO SEE COMPLETE DETAILS.";
547
                }
548
 
549
                activity.setDescription(activityDesc);
3405 mandeep.dh 550
            }
551
 
4020 mandeep.dh 552
            if (ActivityType.ESCALATE_TICKET.equals(activity.getType())) {
553
                log.info("Sending escalation mail");
554
                EscalationMatrix escalation = CRMConstants.EscalationMatrix.valueOf(escalate);
555
                List<Integer> escalationReceipients = escalation.getAgentIds();
556
 
557
                String toMailIds = "";
558
                for (Integer agentId : escalationReceipients) {
559
                    toMailIds += CRMAuthorizingRealm.getAgent(agentId).getEmailId() + ";";
4034 mandeep.dh 560
 
561
                    // Setting last agent as assignee
562
                    ticket.setAssigneeId(agentId);
563
                    activity.setTicketAssigneeId(agentId);
4020 mandeep.dh 564
                }
565
 
566
                Client helperClient = new HelperClient().getClient();
567
                String escalationMailSubject = createEscalationMailSubject(ticket, escalation);
568
                String escalationMailBody = createEscalationMailBody(ticket, escalation);
569
 
570
                activity.setUserEmailId(helperClient.saveUserEmailForSending(
571
                        toMailIds, CRMConstants.CRM_EMAIL_SENDOR,
572
                        escalationMailSubject, escalationMailBody,
573
                        null, CRMConstants.CRM_EMAIL_TYPE));
574
 
575
                // We change activityType to OTHER when pop up box for email
576
                // closes
577
                activity.setDescription("To: " + toMailIds + "\n\nSubject: " + escalationMailSubject + "\n\n"
578
                        + "Body: " + escalationMailBody);
579
            }
580
 
3405 mandeep.dh 581
            User user = null;
582
            userContextServiceClient = new UserClient().getClient();
583
            try {
584
                if (customerName != null && !customerName.isEmpty()) {
585
                    ticket.setCustomerName(customerName);
586
                    activity.setCustomerName(customerName);
587
                }
588
 
589
                if (customerEmailId != null && !customerEmailId.isEmpty()) {
590
                    ticket.setCustomerEmailId(customerEmailId);
591
                    activity.setCustomerEmailId(customerEmailId);
3546 mandeep.dh 592
                    user = userContextServiceClient
593
                            .getUserByEmail(customerEmailId);
3405 mandeep.dh 594
                }
595
 
3546 mandeep.dh 596
                if ((user == null || user.getUserId() == -1)
597
                        && customerMobileNumber != null
598
                        && !customerMobileNumber.isEmpty()) {
3405 mandeep.dh 599
                    ticket.setCustomerMobileNumber(customerMobileNumber);
600
                    activity.setCustomerMobileNumber(customerMobileNumber);
3546 mandeep.dh 601
                    user = userContextServiceClient.getUserByMobileNumber(Long
602
                            .parseLong(customerMobileNumber));
3405 mandeep.dh 603
                }
604
            } catch (UserContextException e) {
605
                log.error("Could not fetch user for: " + customerEmailId + " "
606
                        + customerMobileNumber + " " + customerName, e);
607
            }
3546 mandeep.dh 608
 
3405 mandeep.dh 609
            if (user != null && user.getUserId() != -1) {
610
                ticket.setCustomerId(user.getUserId());
611
                activity.setCustomerId(user.getUserId());
612
            }
613
 
614
            crmServiceClient = new CRMClient().getClient();
615
            crmServiceClient.updateTicket(ticket, activity);
616
        } catch (TException e) {
617
            log.error("Error while updating ticket", e);
618
            return EXCEPTION;
619
        } catch (HelperServiceException hse) {
620
            log.error("Error while sending mail", hse);
621
            return EXCEPTION;
622
        }
623
 
624
        return index();
625
    }
626
 
4020 mandeep.dh 627
    private String createEscalationMailBody(Ticket ticket,
628
            EscalationMatrix escalation)
629
    {
630
        return body + "<br />Please visit following URL to check ticket details.<br />" + 
631
            "http://cs.shop2020.in:8080/crm?ticketId=" + ticket.getId();
632
    }
633
 
634
    private String createEscalationMailSubject(Ticket ticket,
635
            EscalationMatrix escalation)
636
    {
637
        return CRMConstants.CRM_SUBJECT_PREFIX_FOR_TICKET_ID + ticket.getId() + " - ESCALATION FROM CRM - Type: " + escalation.name();
638
    }
639
 
3546 mandeep.dh 640
    private boolean pendingCODOrders(long customerId) {
641
        try {
642
            log.info("Trying to fetch orders for " + customerId);
643
            transactionServiceClient = new TransactionClient().getClient();
644
            for (Order order : transactionServiceClient.getOrdersForCustomer(
645
                    customerId, 0, 0,
4663 rajveer 646
                    Collections.singletonList(OrderStatus.COD_VERIFICATION_PENDING))) {
3546 mandeep.dh 647
                log.info("Processing order: " + order.getId() + " with COD: " + order.isCod());
648
                if (order.isCod()) {
649
                    log.info("Returning true from pendingCODOrders() for " + customerId);
650
                    return true;
651
                }
652
            }
653
        } catch (TTransportException e) {
654
            log.error("Error while creating thrift client", e);
655
        } catch (TransactionServiceException e) {
656
            log.error("Error fetching orders", e);
657
        } catch (TException e) {
658
            log.error("Error fetching orders", e);
659
        }
660
 
661
        log.info("Returning false from pendingCODOrders() for " + customerId);
662
        return false;
663
    }
664
 
4277 anupam.sin 665
    public String updateOrderStatus() {
666
        long creatorId;
667
        OrderStatus orderStatusEnum = null;
668
        try {
669
            creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
670
 
671
            if(orderStatus.equals("DENY_CANCEL_REQUEST")) {
672
                transactionServiceClient = new TransactionClient().getClient();
673
                transactionServiceClient.markOrderCancellationRequestDenied(Long.parseLong(orderId));
674
            } 
3546 mandeep.dh 675
 
4277 anupam.sin 676
            else {
3546 mandeep.dh 677
 
4277 anupam.sin 678
                orderStatusEnum = OrderStatus.valueOf(orderStatus);
679
                transactionServiceClient = new TransactionClient().getClient();
3578 mandeep.dh 680
 
4277 anupam.sin 681
                if (OrderStatus.SUBMITTED_FOR_PROCESSING.equals(orderStatusEnum)) {
682
                    transactionServiceClient.verifyOrder(Long.parseLong(orderId));
683
                }
684
                else if (OrderStatus.CANCELED.equals(orderStatusEnum)) {
685
                    transactionServiceClient.refundOrder(Long.parseLong(orderId), currentAgentEmailId, cancelReason);
686
                }
687
                else if (OrderStatus.CANCEL_REQUEST_CONFIRMED.equals(orderStatusEnum)) {
688
                    transactionServiceClient.markOrderCancellationRequestConfirmed(Long.parseLong(orderId));
689
                }
690
                else {
691
                    throw new UnsupportedOperationException("Cannot update status of orderId: " + orderId + " to: " + orderStatus);
692
                }
693
            }
694
 
695
            SearchFilter searchFilter = new SearchFilter();
696
            searchFilter.setTicketId(Long.parseLong(id));
697
            crmServiceClient = new CRMClient().getClient();
698
            Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
3546 mandeep.dh 699
 
4277 anupam.sin 700
            // Inserting activity
701
            Activity activity = new Activity();
702
            activity.setDescription("Status updated for Order Id: " + orderId
703
                    + " to " + orderStatus + ", Reason: " + cancelReason + body);
704
            activity.setType(ActivityType.OTHER);
705
            activity.setTicketPriority(ticket.getPriority());
706
            activity.setTicketStatus(ticket.getStatus());
707
            activity.setCreatorId(creatorId);
708
            activity.setTicketCategory(ticket.getCategory());
709
            activity.setTicketDescription(ticket.getDescription());
710
            activity.setCustomerId(ticket.getCustomerId());
711
            activity.setTicketAssigneeId(ticket.getAssigneeId());
3546 mandeep.dh 712
 
4277 anupam.sin 713
            crmServiceClient = new CRMClient().getClient();
714
            crmServiceClient.updateTicket(ticket, activity);
3546 mandeep.dh 715
 
4277 anupam.sin 716
        } catch (TException e) {
717
            log.info("Thrift exception", e);
718
        } catch (NumberFormatException e) {
719
            log.info("Could not convert to long", e);
720
        } catch (TransactionServiceException e) {
721
            log.info("Transaction client exception", e);
722
        }
723
 
3546 mandeep.dh 724
        return edit();
725
    }
4277 anupam.sin 726
 
3137 mandeep.dh 727
    public User getUser(Long userId) {
728
        User user = null;
729
 
730
        try {
3390 mandeep.dh 731
            userContextServiceClient = new UserClient().getClient();
3137 mandeep.dh 732
            user = userContextServiceClient.getUserById(userId);
733
        } catch (UserContextException e) {
734
            String errorString = "Could not fetch user for " + userId;
735
            log.error(errorString, e);
736
            addActionError(errorString);
737
        } catch (TException e) {
738
            String errorString = "Could not create client";
739
            log.error(errorString, e);
740
            addActionError(errorString);
741
        }
742
 
743
        return user;
744
    }
4267 anupam.sin 745
 
4438 anupam.sin 746
    public String allowPayment() {
747
        try {
748
            log.info("Allowing payment for paymentId = " + paymentId);
749
            transactionServiceClient = new TransactionClient().getClient();
750
            transactionServiceClient.markTransactionAsPaymentFlagRemoved(Long.parseLong(transactionId));
751
            if (id != null && !id.isEmpty()) {
752
                SearchFilter searchFilter = new SearchFilter();
753
                crmServiceClient = new CRMClient().getClient();
754
                searchFilter.setTicketId(Long.parseLong(id));
755
                Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
756
                // Inserting activity
757
                if(ticket != null) {
758
                    Activity activity = new Activity();
759
                    activity.setDescription("Flagged Payment allowed");
760
                    activity.setType(ActivityType.OTHER);
761
                    activity.setTicketPriority(ticket.getPriority());
762
                    activity.setTicketStatus(ticket.getStatus());
763
                    activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
764
                    activity.setTicketCategory(ticket.getCategory());
765
                    activity.setTicketDescription(ticket.getDescription());
766
                    activity.setCustomerId(ticket.getCustomerId());
767
                    activity.setTicketAssigneeId(ticket.getAssigneeId());
768
 
769
                    crmServiceClient = new CRMClient().getClient();
770
                    crmServiceClient.updateTicket(ticket, activity);
771
                }
772
            }
773
 
774
        } catch (TException e) {
775
            log.error("Error while getting tickets", e);
776
            return EXCEPTION;
777
        } catch (NumberFormatException e) {
778
            log.error("Invalid ticket Id", e);
779
            return EXCEPTION;
780
        } catch (TransactionServiceException e) {
781
            log.error("Error while marking transactions as Flag removed", e);
782
            return EXCEPTION;
783
        }
4267 anupam.sin 784
        return edit();
785
    }
786
 
4490 anupam.sin 787
    public String blockPayment() {
4438 anupam.sin 788
        try {
789
            log.info("Blocking payment for paymentId = " + paymentId);
790
            transactionServiceClient = new TransactionClient().getClient();
791
            transactionServiceClient.refundTransaction(Long.parseLong(transactionId), currentAgentEmailId, "FLAGGED_PAYMENT_CANCELLED");
792
            if (id != null && !id.isEmpty()) {
793
                SearchFilter searchFilter = new SearchFilter();
794
                crmServiceClient = new CRMClient().getClient();
795
                searchFilter.setTicketId(Long.parseLong(id));
796
                Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
797
                // Inserting activity
798
                if(ticket != null) {
799
                    Activity activity = new Activity();
800
                    activity.setDescription("Flagged Payment allowed");
801
                    activity.setType(ActivityType.OTHER);
802
                    activity.setTicketPriority(ticket.getPriority());
803
                    activity.setTicketStatus(ticket.getStatus());
804
                    activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
805
                    activity.setTicketCategory(ticket.getCategory());
806
                    activity.setTicketDescription(ticket.getDescription());
807
                    activity.setCustomerId(ticket.getCustomerId());
808
                    activity.setTicketAssigneeId(ticket.getAssigneeId());
809
 
810
                    crmServiceClient = new CRMClient().getClient();
811
                    crmServiceClient.updateTicket(ticket, activity);
812
                }
813
            }
814
 
815
        } catch (TException e) {
816
            log.error("Error while getting tickets", e);
817
            return EXCEPTION;
818
        } catch (NumberFormatException e) {
819
            log.error("Invalid ticket Id", e);
820
            return EXCEPTION;
821
        } catch (TransactionServiceException e) {
822
            log.error("Error while allowing flagged payment", e);
823
            return EXCEPTION;
824
        }
4267 anupam.sin 825
        return edit();
826
    }
4490 anupam.sin 827
 
828
    public String authorizeReturn() {
829
        try {
830
            log.info("Authorizing OrderId =" + orderId);
831
            transactionServiceClient = new TransactionClient().getClient();
832
            transactionServiceClient.markOrderReturnRequestAuthorized(Long.parseLong(orderId), true);
833
            if (id != null && !id.isEmpty()) {
834
                SearchFilter searchFilter = new SearchFilter();
835
                crmServiceClient = new CRMClient().getClient();
836
                searchFilter.setTicketId(Long.parseLong(id));
837
                Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
838
                // Inserting activity
839
                if(ticket != null) {
840
                    Activity activity = new Activity();
841
                    activity.setDescription("Return Authorized");
842
                    activity.setType(ActivityType.OTHER);
843
                    activity.setTicketPriority(ticket.getPriority());
844
                    activity.setTicketStatus(ticket.getStatus());
845
                    activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
846
                    activity.setTicketCategory(ticket.getCategory());
847
                    activity.setTicketDescription(ticket.getDescription());
848
                    activity.setCustomerId(ticket.getCustomerId());
849
                    activity.setTicketAssigneeId(ticket.getAssigneeId());
3137 mandeep.dh 850
 
4490 anupam.sin 851
                    crmServiceClient = new CRMClient().getClient();
852
                    crmServiceClient.updateTicket(ticket, activity);
853
                }
854
            }
855
 
856
        } catch (TException e) {
857
            log.error("Error while getting tickets", e);
858
            return EXCEPTION;
859
        } catch (NumberFormatException e) {
860
            log.error("Invalid ticket Id", e);
861
            return EXCEPTION;
862
        } catch (TransactionServiceException e) {
863
            log.error("Error while authorizing Return", e);
864
            return EXCEPTION;
865
        }
866
        return edit();
867
    }
868
 
869
    public String denyReturn() {
870
        try {
871
            log.info("Denying OrderId =" + orderId);
872
            transactionServiceClient = new TransactionClient().getClient();
873
            transactionServiceClient.markOrderReturnRequestAuthorized(Long.parseLong(orderId), false);
874
            if (id != null && !id.isEmpty()) {
875
                SearchFilter searchFilter = new SearchFilter();
876
                crmServiceClient = new CRMClient().getClient();
877
                searchFilter.setTicketId(Long.parseLong(id));
878
                Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
879
                // Inserting activity
880
                if(ticket != null) {
881
                    Activity activity = new Activity();
882
                    activity.setDescription("Return Denied");
883
                    activity.setType(ActivityType.OTHER);
884
                    activity.setTicketPriority(ticket.getPriority());
885
                    activity.setTicketStatus(ticket.getStatus());
886
                    activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
887
                    activity.setTicketCategory(ticket.getCategory());
888
                    activity.setTicketDescription(ticket.getDescription());
889
                    activity.setCustomerId(ticket.getCustomerId());
890
                    activity.setTicketAssigneeId(ticket.getAssigneeId());
891
 
892
                    crmServiceClient = new CRMClient().getClient();
893
                    crmServiceClient.updateTicket(ticket, activity);
894
                }
895
            }
896
 
897
        } catch (TException e) {
898
            log.error("Error while getting tickets", e);
899
            return EXCEPTION;
900
        } catch (NumberFormatException e) {
901
            log.error("Invalid ticket Id", e);
902
            return EXCEPTION;
903
        } catch (TransactionServiceException e) {
904
            log.error("Error while denying Return", e);
905
            return EXCEPTION;
906
        }
907
        return edit();
908
    }
909
 
910
    public String authorizeDOA() {
911
        try {
912
            log.info("Authorizing OrderId =" + orderId);
913
            transactionServiceClient = new TransactionClient().getClient();
914
            transactionServiceClient.markOrderDoaRequestAuthorized(Long.parseLong(orderId), true);
915
            if (id != null && !id.isEmpty()) {
916
                SearchFilter searchFilter = new SearchFilter();
917
                crmServiceClient = new CRMClient().getClient();
918
                searchFilter.setTicketId(Long.parseLong(id));
919
                Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
920
                // Inserting activity
921
                if(ticket != null) {
922
                    Activity activity = new Activity();
923
                    activity.setDescription("DOA Authorized");
924
                    activity.setType(ActivityType.OTHER);
925
                    activity.setTicketPriority(ticket.getPriority());
926
                    activity.setTicketStatus(ticket.getStatus());
927
                    activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
928
                    activity.setTicketCategory(ticket.getCategory());
929
                    activity.setTicketDescription(ticket.getDescription());
930
                    activity.setCustomerId(ticket.getCustomerId());
931
                    activity.setTicketAssigneeId(ticket.getAssigneeId());
932
 
933
                    crmServiceClient = new CRMClient().getClient();
934
                    crmServiceClient.updateTicket(ticket, activity);
935
                }
936
            }
937
 
938
        } catch (TException e) {
939
            log.error("Error while getting tickets", e);
940
            return EXCEPTION;
941
        } catch (NumberFormatException e) {
942
            log.error("Invalid ticket Id", e);
943
            return EXCEPTION;
944
        } catch (TransactionServiceException e) {
945
            log.error("Error while authorizing DOA", e);
946
            return EXCEPTION;
947
        }
948
        return edit();
949
    }
950
 
951
    public String denyDOA() {
952
        try {
953
            log.info("Denying OrderId =" + orderId);
954
            transactionServiceClient = new TransactionClient().getClient();
955
            transactionServiceClient.markOrderDoaRequestAuthorized(Long.parseLong(orderId), false);
956
            if (id != null && !id.isEmpty()) {
957
                SearchFilter searchFilter = new SearchFilter();
958
                crmServiceClient = new CRMClient().getClient();
959
                searchFilter.setTicketId(Long.parseLong(id));
960
                Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
961
                // Inserting activity
962
                if(ticket != null) {
963
                    Activity activity = new Activity();
964
                    activity.setDescription("DOA Denied");
965
                    activity.setType(ActivityType.OTHER);
966
                    activity.setTicketPriority(ticket.getPriority());
967
                    activity.setTicketStatus(ticket.getStatus());
968
                    activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
969
                    activity.setTicketCategory(ticket.getCategory());
970
                    activity.setTicketDescription(ticket.getDescription());
971
                    activity.setCustomerId(ticket.getCustomerId());
972
                    activity.setTicketAssigneeId(ticket.getAssigneeId());
973
 
974
                    crmServiceClient = new CRMClient().getClient();
975
                    crmServiceClient.updateTicket(ticket, activity);
976
                }
977
            }
978
 
979
        } catch (TException e) {
980
            log.error("Error while getting tickets", e);
981
            return EXCEPTION;
982
        } catch (NumberFormatException e) {
983
            log.error("Invalid ticket Id", e);
984
            return EXCEPTION;
985
        } catch (TransactionServiceException e) {
986
            log.error("Error while denying DOA", e);
987
            return EXCEPTION;
988
        }
989
        return edit();
990
    }
991
 
4020 mandeep.dh 992
    public EscalationMatrix[] getEscalationMatrix () {
993
        return CRMConstants.EscalationMatrix.values();
994
    }
995
 
4241 anupam.sin 996
    public CODCancelMatrix[] getCODCancelMatrix () {
997
        return CRMConstants.CODCancelMatrix.values();
998
    }
999
 
3546 mandeep.dh 1000
    public String getAddress(Order order) {
1001
        return ModelUtils.extractAddressFromOrder(order);
1002
    }
1003
 
1004
    public String getProductName(LineItem lineItem) {
4008 mandeep.dh 1005
        return ModelUtils.extractProductNameFromLineItem(lineItem) + " " + lineItem.getColor();
3546 mandeep.dh 1006
    }
1007
 
3405 mandeep.dh 1008
    public ActivityType[] getActivityTypes() {
1009
        return ActivityType.values();
1010
    }
1011
 
1012
    public TicketStatus[] getTicketStatuses() {
1013
        return TicketStatus.values();
1014
    }
1015
 
3390 mandeep.dh 1016
    public Agent getAgent(long agentId) throws TException {
1017
        return CRMAuthorizingRealm.getAgent(agentId);
3137 mandeep.dh 1018
    }
1019
 
3339 mandeep.dh 1020
    public List<Agent> getAllAgents() {
3390 mandeep.dh 1021
        return CRMAuthorizingRealm.getAgents();
3339 mandeep.dh 1022
    }
1023
 
1024
    public TicketCategory[] getTicketCategories() {
1025
        return TicketCategory.values();
1026
    }
1027
 
1028
    public TicketPriority[] getTicketPriorities() {
1029
        return TicketPriority.values();
1030
    }
1031
 
3137 mandeep.dh 1032
    public List<Ticket> getTickets() {
1033
        return tickets;
1034
    }
1035
 
1036
    public void setTickets(List<Ticket> tickets) {
1037
        this.tickets = tickets;
1038
    }
3339 mandeep.dh 1039
 
3405 mandeep.dh 1040
    public String getCustomerEmailId() {
1041
        return customerEmailId;
3339 mandeep.dh 1042
    }
1043
 
3405 mandeep.dh 1044
    public void setCustomerEmailId(String customerEmailId) {
1045
        this.customerEmailId = customerEmailId;
3339 mandeep.dh 1046
    }
1047
 
1048
    public String getDescription() {
1049
        return description;
1050
    }
1051
 
1052
    public void setDescription(String description) {
1053
        this.description = description;
1054
    }
1055
 
1056
    public String getAssigneeEmailId() {
1057
        return assigneeEmailId;
1058
    }
1059
 
1060
    public void setAssigneeEmailId(String assigneeEmailId) {
1061
        this.assigneeEmailId = assigneeEmailId;
1062
    }
1063
 
1064
    public String getPriority() {
1065
        return priority;
1066
    }
1067
 
1068
    public void setPriority(String priority) {
1069
        this.priority = priority;
1070
    }
1071
 
1072
    public String getCategory() {
1073
        return category;
1074
    }
1075
 
1076
    public void setCategory(String category) {
1077
        this.category = category;
1078
    }
1079
 
1080
    public String getOrderId() {
1081
        return orderId;
1082
    }
1083
 
1084
    public void setOrderId(String orderId) {
1085
        this.orderId = orderId;
1086
    }
3397 mandeep.dh 1087
 
1088
    public String[] getAgentIds() {
1089
        return agentIds;
1090
    }
1091
 
1092
    public void setAgentIds(String[] agentIds) {
1093
        this.agentIds = agentIds;
1094
    }
1095
 
1096
    public String getStartTimestamp() {
1097
        return startTimestamp;
1098
    }
1099
 
1100
    public void setStartTimestamp(String startTimestamp) {
1101
        this.startTimestamp = startTimestamp;
1102
    }
1103
 
1104
    public String getEndTimestamp() {
1105
        return endTimestamp;
1106
    }
1107
 
1108
    public void setEndTimestamp(String endTimestamp) {
1109
        this.endTimestamp = endTimestamp;
1110
    }
3405 mandeep.dh 1111
 
1112
    public String getUserId() {
1113
        return userId;
1114
    }
1115
 
1116
    public void setUserId(String userId) {
1117
        this.userId = userId;
1118
    }
1119
 
1120
    public String getId() {
1121
        return id;
1122
    }
1123
 
1124
    public void setId(String id) {
1125
        this.id = id;
1126
    }
1127
 
1128
    public String getActivityDescription() {
1129
        return activityDescription;
1130
    }
1131
 
1132
    public void setActivityDescription(String activityDescription) {
1133
        this.activityDescription = activityDescription;
1134
    }
1135
 
1136
    public String getStatus() {
1137
        return status;
1138
    }
1139
 
1140
    public void setStatus(String status) {
1141
        this.status = status;
1142
    }
1143
 
1144
    public String getActivityType() {
1145
        return activityType;
1146
    }
1147
 
1148
    public void setActivityType(String activityType) {
1149
        this.activityType = activityType;
1150
    }
1151
 
1152
    public Ticket getTicket() {
1153
        return ticket;
1154
    }
1155
 
1156
    public void setTicket(Ticket ticket) {
1157
        this.ticket = ticket;
1158
    }
1159
 
1160
    public List<Activity> getActivities() {
1161
        return activities;
1162
    }
1163
 
1164
    public void setActivities(List<Activity> activities) {
1165
        this.activities = activities;
1166
    }
1167
 
1168
    public String getSubject() {
1169
        return subject;
1170
    }
1171
 
1172
    public void setSubject(String subject) {
1173
        this.subject = subject;
1174
    }
1175
 
1176
    public String getBody() {
1177
        return body;
1178
    }
1179
 
1180
    public void setBody(String body) {
1181
        this.body = body;
1182
    }
1183
 
1184
    public String getCustomerName() {
1185
        return customerName;
1186
    }
1187
 
1188
    public void setCustomerName(String customerName) {
1189
        this.customerName = customerName;
1190
    }
1191
 
1192
    public String getCustomerMobileNumber() {
1193
        return customerMobileNumber;
1194
    }
1195
 
1196
    public void setCustomerMobileNumber(String customerMobileNumber) {
1197
        this.customerMobileNumber = customerMobileNumber;
1198
    }
3546 mandeep.dh 1199
 
1200
    public User getUser() {
1201
        return user;
1202
    }
1203
 
1204
    public void setUser(User user) {
1205
        this.user = user;
1206
    }
1207
 
1208
    public String getOrderStatus() {
1209
        return orderStatus;
1210
    }
1211
 
1212
    public void setOrderStatus(String orderStatus) {
1213
        this.orderStatus = orderStatus;
1214
    }
1215
 
1216
    public List<Order> getOrders() {
1217
        return orders;
1218
    }
1219
 
1220
    public void setOrders(List<Order> orders) {
1221
        this.orders = orders;
1222
    }
4020 mandeep.dh 1223
 
1224
    public String getEscalate() {
1225
        return escalate;
1226
    }
1227
 
1228
    public void setEscalate(String escalate) {
1229
        this.escalate = escalate;
1230
    }
4241 anupam.sin 1231
 
1232
    public String getCancelReason() {
1233
        return cancelReason;
1234
    }
1235
 
1236
    public void setCancelReason(String cancelReason) {
1237
        this.cancelReason = cancelReason;
1238
    }
4267 anupam.sin 1239
 
1240
    public List<Payment> getPayments() {
1241
        return payments;
1242
    }
1243
 
1244
    public void setPayments(List<Payment> payments) {
1245
        this.payments = payments;
1246
    }
1247
 
1248
    public String getTransactionId() {
1249
        return transactionId;
1250
    }
1251
 
1252
    public void setTransactionId(String transactionId) {
1253
        this.transactionId = transactionId;
1254
    }
4438 anupam.sin 1255
 
1256
    public String getPaymentId() {
1257
        return paymentId;
1258
    }
1259
 
1260
    public void setPaymentId(String paymentId) {
1261
        this.paymentId = paymentId;
1262
    }
4490 anupam.sin 1263
 
1264
    public HashMap<String, String> getAllAttachmentsForTicket() {
1265
        return allAttachmentsForTicket;
1266
    }
1267
 
1268
    public void setAllAttachmentsForTicket(HashMap<String, String> allAttachmentsForTicket) {
1269
        this.allAttachmentsForTicket = allAttachmentsForTicket;
1270
    }
3137 mandeep.dh 1271
}