| Line 51... |
Line 51... |
| 51 |
TicketHandler ticketHandler = context.getBean(TicketHandler.class);
|
51 |
TicketHandler ticketHandler = context.getBean(TicketHandler.class);
|
| 52 |
ActivityHandler activityHandler = context.getBean(ActivityHandler.class);
|
52 |
ActivityHandler activityHandler = context.getBean(ActivityHandler.class);
|
| 53 |
AgentHandler agentHandler = context.getBean(AgentHandler.class);
|
53 |
AgentHandler agentHandler = context.getBean(AgentHandler.class);
|
| 54 |
|
54 |
|
| 55 |
private static final Log log = LogFactory.getLog(CRMServiceHandler.class);
|
55 |
private static final Log log = LogFactory.getLog(CRMServiceHandler.class);
|
| 56 |
private static final double TRUST_THRESHOLD_LEVEL = 0;
|
56 |
private static final double TRUST_THRESHOLD_LEVEL = 4.5;
|
| 57 |
|
57 |
|
| 58 |
public List<Ticket> getTickets(SearchFilter searchFilter) throws TException {
|
58 |
public List<Ticket> getTickets(SearchFilter searchFilter) throws TException {
|
| 59 |
List<Ticket> ttickets = new ArrayList<Ticket>();
|
59 |
List<Ticket> ttickets = new ArrayList<Ticket>();
|
| 60 |
for (in.shop2020.crm.domain.Ticket ticket : ticketHandler
|
60 |
for (in.shop2020.crm.domain.Ticket ticket : ticketHandler
|
| 61 |
.getTickets(in.shop2020.crm.domain.SearchFilter
|
61 |
.getTickets(in.shop2020.crm.domain.SearchFilter
|
| Line 204... |
Line 204... |
| 204 |
log.info("Logging tickets");
|
204 |
log.info("Logging tickets");
|
| 205 |
for (Order order : transaction.getOrders()) {
|
205 |
for (Order order : transaction.getOrders()) {
|
| 206 |
log.info("Processing order: " + order.getId());
|
206 |
log.info("Processing order: " + order.getId());
|
| 207 |
if (order.isCod()) {
|
207 |
if (order.isCod()) {
|
| 208 |
log.info("Processing COD order: " + order.getId());
|
208 |
log.info("Processing COD order: " + order.getId());
|
| - |
|
209 |
SearchFilter searchFilter = new SearchFilter();
|
| - |
|
210 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
| - |
|
211 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
| - |
|
212 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
| - |
|
213 |
searchFilter.setTicketCategory(TicketCategory.COD_VERIFICATION);
|
| - |
|
214 |
searchFilter.setCustomerId(transaction.getCustomer_id());
|
| - |
|
215 |
|
| - |
|
216 |
// No need to create a ticket if there exists one for the customer!
|
| - |
|
217 |
if (this.getTickets(searchFilter).isEmpty()) {
|
| 209 |
Ticket ticket = new Ticket();
|
218 |
Ticket ticket = new Ticket();
|
| 210 |
ticket.setCategory(TicketCategory.COD_VERIFICATION);
|
219 |
ticket.setCategory(TicketCategory.COD_VERIFICATION);
|
| 211 |
ticket.setCreatorId(ADMIN_AGENT_ID);
|
220 |
ticket.setCreatorId(ADMIN_AGENT_ID);
|
| 212 |
ticket.setCustomerId(transaction.getCustomer_id());
|
221 |
ticket.setCustomerId(transaction.getCustomer_id());
|
| 213 |
ticket.setDescription("Requires COD verification");
|
222 |
ticket.setDescription("Requires COD verification");
|
| 214 |
ticket.setPriority(TicketPriority.HIGH);
|
223 |
ticket.setPriority(TicketPriority.HIGH);
|
| 215 |
ticket.setStatus(TicketStatus.OPEN);
|
224 |
ticket.setStatus(TicketStatus.OPEN);
|
| 216 |
ticket.setOrderId(order.getId());
|
- |
|
| 217 |
|
225 |
|
| 218 |
Activity activity = new Activity();
|
226 |
Activity activity = new Activity();
|
| 219 |
activity.setCreatorId(ticket.getCreatorId());
|
227 |
activity.setCreatorId(ticket.getCreatorId());
|
| 220 |
activity.setCustomerId(ticket.getCustomerId());
|
228 |
activity.setCustomerId(ticket.getCustomerId());
|
| 221 |
activity.setDescription("Creating ticket");
|
229 |
activity.setDescription("Creating ticket");
|
| 222 |
activity.setTicketCategory(ticket.getCategory());
|
230 |
activity.setTicketCategory(ticket.getCategory());
|
| 223 |
activity.setTicketDescription(ticket.getDescription());
|
231 |
activity.setTicketDescription(ticket.getDescription());
|
| 224 |
activity.setTicketPriority(ticket.getPriority());
|
232 |
activity.setTicketPriority(ticket.getPriority());
|
| 225 |
activity.setTicketStatus(ticket.getStatus());
|
233 |
activity.setTicketStatus(ticket.getStatus());
|
| 226 |
activity.setType(ActivityType.OTHER);
|
234 |
activity.setType(ActivityType.OTHER);
|
| 227 |
|
235 |
|
| 228 |
this.insertTicket(ticket, activity);
|
236 |
this.insertTicket(ticket, activity);
|
| - |
|
237 |
break;
|
| - |
|
238 |
}
|
| 229 |
}
|
239 |
}
|
| 230 |
}
|
240 |
}
|
| 231 |
}
|
241 |
}
|
| 232 |
else {
|
242 |
else {
|
| 233 |
log.info("Autoverifying orders");
|
243 |
log.info("Autoverifying orders");
|
| 234 |
// Submit order for processing
|
244 |
// Submit order for processing
|