| Line 127... |
Line 127... |
| 127 |
log.error("Could not fetch user details", e);
|
127 |
log.error("Could not fetch user details", e);
|
| 128 |
}
|
128 |
}
|
| 129 |
}
|
129 |
}
|
| 130 |
|
130 |
|
| 131 |
customerEmailId = ticket.getCustomerEmailId();
|
131 |
customerEmailId = ticket.getCustomerEmailId();
|
| - |
|
132 |
|
| - |
|
133 |
if (TicketCategory.ORDER_CANCELLATION.equals(ticket.getCategory())) {
|
| - |
|
134 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
| - |
|
135 |
orders = new ArrayList<Order>();
|
| - |
|
136 |
transactionServiceClient = new TransactionClient().getClient();
|
| - |
|
137 |
Order order = transactionServiceClient.getOrder(ticket.getOrderId());
|
| - |
|
138 |
log.info("Processing Order: " + order);
|
| - |
|
139 |
orders.add(order);
|
| - |
|
140 |
}
|
| 132 |
|
141 |
|
| 133 |
if (TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())) {
|
142 |
if (TicketCategory.COD_VERIFICATION.equals(ticket.getCategory())) {
|
| 134 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
143 |
log.info("Fetching orders for " + ticket.getCustomerId());
|
| 135 |
orders = new ArrayList<Order>();
|
144 |
orders = new ArrayList<Order>();
|
| 136 |
transactionServiceClient = new TransactionClient().getClient();
|
145 |
transactionServiceClient = new TransactionClient().getClient();
|
| Line 554... |
Line 563... |
| 554 |
|
563 |
|
| 555 |
log.info("Returning false from pendingCODOrders() for " + customerId);
|
564 |
log.info("Returning false from pendingCODOrders() for " + customerId);
|
| 556 |
return false;
|
565 |
return false;
|
| 557 |
}
|
566 |
}
|
| 558 |
|
567 |
|
| 559 |
public String updateOrderStatus() throws NumberFormatException,
|
568 |
public String updateOrderStatus() {
|
| - |
|
569 |
long creatorId;
|
| 560 |
TransactionServiceException, TException {
|
570 |
OrderStatus orderStatusEnum = null;
|
| - |
|
571 |
try {
|
| 561 |
long creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId)
|
572 |
creatorId = CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId();
|
| - |
|
573 |
|
| - |
|
574 |
if(orderStatus.equals("DENY_CANCEL_REQUEST")) {
|
| - |
|
575 |
transactionServiceClient = new TransactionClient().getClient();
|
| - |
|
576 |
transactionServiceClient.markOrderCancellationRequestDenied(Long.parseLong(orderId));
|
| 562 |
.getId();
|
577 |
}
|
| 563 |
|
578 |
|
| 564 |
OrderStatus orderStatusEnum = OrderStatus.valueOf(orderStatus);
|
- |
|
| 565 |
transactionServiceClient = new TransactionClient().getClient();
|
579 |
else {
|
| 566 |
|
580 |
|
| - |
|
581 |
orderStatusEnum = OrderStatus.valueOf(orderStatus);
|
| - |
|
582 |
transactionServiceClient = new TransactionClient().getClient();
|
| - |
|
583 |
|
| 567 |
if (OrderStatus.SUBMITTED_FOR_PROCESSING.equals(orderStatusEnum)) {
|
584 |
if (OrderStatus.SUBMITTED_FOR_PROCESSING.equals(orderStatusEnum)) {
|
| 568 |
transactionServiceClient.verifyOrder(Long.parseLong(orderId));
|
585 |
transactionServiceClient.verifyOrder(Long.parseLong(orderId));
|
| 569 |
}
|
586 |
}
|
| 570 |
else if (OrderStatus.CANCELED.equals(orderStatusEnum)) {
|
587 |
else if (OrderStatus.CANCELED.equals(orderStatusEnum)) {
|
| 571 |
transactionServiceClient.refundOrder(Long.parseLong(orderId), currentAgentEmailId, cancelReason);
|
588 |
transactionServiceClient.refundOrder(Long.parseLong(orderId), currentAgentEmailId, cancelReason);
|
| - |
|
589 |
}
|
| - |
|
590 |
else if (OrderStatus.CANCEL_REQUEST_CONFIRMED.equals(orderStatusEnum)) {
|
| - |
|
591 |
transactionServiceClient.markOrderCancellationRequestConfirmed(Long.parseLong(orderId));
|
| 572 |
}
|
592 |
}
|
| 573 |
else {
|
593 |
else {
|
| 574 |
throw new UnsupportedOperationException("Cannot update status of orderId: " + orderId + " to: " + orderStatus);
|
594 |
throw new UnsupportedOperationException("Cannot update status of orderId: " + orderId + " to: " + orderStatus);
|
| - |
|
595 |
}
|
| 575 |
}
|
596 |
}
|
| - |
|
597 |
|
| - |
|
598 |
SearchFilter searchFilter = new SearchFilter();
|
| - |
|
599 |
searchFilter.setTicketId(Long.parseLong(id));
|
| - |
|
600 |
crmServiceClient = new CRMClient().getClient();
|
| - |
|
601 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
| - |
|
602 |
|
| - |
|
603 |
// Inserting activity
|
| - |
|
604 |
Activity activity = new Activity();
|
| - |
|
605 |
activity.setDescription("Status updated for Order Id: " + orderId
|
| - |
|
606 |
+ " to " + orderStatus + ", Reason: " + cancelReason + body);
|
| - |
|
607 |
activity.setType(ActivityType.OTHER);
|
| - |
|
608 |
activity.setTicketPriority(ticket.getPriority());
|
| - |
|
609 |
activity.setTicketStatus(ticket.getStatus());
|
| - |
|
610 |
activity.setCreatorId(creatorId);
|
| - |
|
611 |
activity.setTicketCategory(ticket.getCategory());
|
| - |
|
612 |
activity.setTicketDescription(ticket.getDescription());
|
| - |
|
613 |
activity.setCustomerId(ticket.getCustomerId());
|
| - |
|
614 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| 576 |
|
615 |
|
| 577 |
SearchFilter searchFilter = new SearchFilter();
|
- |
|
| 578 |
searchFilter.setTicketId(Long.parseLong(id));
|
- |
|
| 579 |
crmServiceClient = new CRMClient().getClient();
|
616 |
crmServiceClient = new CRMClient().getClient();
|
| 580 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
617 |
crmServiceClient.updateTicket(ticket, activity);
|
| 581 |
|
- |
|
| 582 |
// Inserting activity
|
- |
|
| 583 |
Activity activity = new Activity();
|
- |
|
| 584 |
activity.setDescription("Status updated for Order Id: " + orderId
|
- |
|
| 585 |
+ " to " + orderStatus + ", Reason: " + cancelReason + body);
|
- |
|
| 586 |
activity.setType(ActivityType.OTHER);
|
- |
|
| 587 |
activity.setTicketPriority(ticket.getPriority());
|
- |
|
| 588 |
activity.setTicketStatus(ticket.getStatus());
|
- |
|
| 589 |
activity.setCreatorId(creatorId);
|
- |
|
| 590 |
activity.setTicketCategory(ticket.getCategory());
|
- |
|
| 591 |
activity.setTicketDescription(ticket.getDescription());
|
- |
|
| 592 |
activity.setCustomerId(ticket.getCustomerId());
|
- |
|
| 593 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
- |
|
| 594 |
|
618 |
|
| - |
|
619 |
} catch (TException e) {
|
| - |
|
620 |
log.info("Thrift exception", e);
|
| - |
|
621 |
} catch (NumberFormatException e) {
|
| 595 |
crmServiceClient = new CRMClient().getClient();
|
622 |
log.info("Could not convert to long", e);
|
| 596 |
crmServiceClient.updateTicket(ticket, activity);
|
623 |
} catch (TransactionServiceException e) {
|
| - |
|
624 |
log.info("Transaction client exception", e);
|
| - |
|
625 |
}
|
| 597 |
|
626 |
|
| 598 |
return edit();
|
627 |
return edit();
|
| 599 |
}
|
628 |
}
|
| 600 |
|
629 |
|
| 601 |
public User getUser(Long userId) {
|
630 |
public User getUser(Long userId) {
|
| 602 |
User user = null;
|
631 |
User user = null;
|
| 603 |
|
632 |
|
| 604 |
try {
|
633 |
try {
|
| 605 |
userContextServiceClient = new UserClient().getClient();
|
634 |
userContextServiceClient = new UserClient().getClient();
|