| Line 78... |
Line 78... |
| 78 |
|
78 |
|
| 79 |
/**
|
79 |
/**
|
| 80 |
* Method to create tickets for failed payments.
|
80 |
* Method to create tickets for failed payments.
|
| 81 |
*/
|
81 |
*/
|
| 82 |
public void processPaymentFailure(long customerId) {
|
82 |
public void processPaymentFailure(long customerId) {
|
| 83 |
try {
|
- |
|
| 84 |
log.info("Processing Payment failure for customerId: " + customerId);
|
83 |
log.info("Processing Payment failure for customerId: " + customerId);
|
| 85 |
SearchFilter searchFilter = new SearchFilter();
|
84 |
SearchFilter searchFilter = new SearchFilter();
|
| 86 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
85 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
| 87 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
86 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
| 88 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
87 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
| 89 |
searchFilter.setTicketCategory(TicketCategory.FAILED_PAYMENTS);
|
88 |
searchFilter.setTicketCategory(TicketCategory.FAILED_PAYMENTS);
|
| 90 |
searchFilter.setCustomerId(customerId);
|
89 |
searchFilter.setCustomerId(customerId);
|
| 91 |
|
90 |
|
| 92 |
// No need to create a ticket if there exists one for the customer!
|
91 |
// No need to create a ticket if there exists one for the customer!
|
| 93 |
if (ticketHandler.getTickets(searchFilter).isEmpty()) {
|
92 |
if (ticketHandler.getTickets(searchFilter).isEmpty()) {
|
| 94 |
Ticket ticket = new Ticket();
|
93 |
Ticket ticket = new Ticket();
|
| 95 |
ticket.setCategory(TicketCategory.FAILED_PAYMENTS);
|
94 |
ticket.setCategory(TicketCategory.FAILED_PAYMENTS);
|
| 96 |
ticket.setCreatorId(ADMIN_AGENT_ID);
|
95 |
ticket.setCreatorId(ADMIN_AGENT_ID);
|
| 97 |
ticket.setCustomerId(customerId);
|
96 |
ticket.setCustomerId(customerId);
|
| 98 |
ticket.setDescription("Requires payment failures' follow-up!");
|
97 |
ticket.setDescription("Requires payment failures' follow-up!");
|
| 99 |
ticket.setPriority(TicketPriority.HIGH);
|
98 |
ticket.setPriority(TicketPriority.HIGH);
|
| 100 |
ticket.setStatus(TicketStatus.OPEN);
|
99 |
ticket.setStatus(TicketStatus.OPEN);
|
| 101 |
ticket.setAssigneeId(OUTBOUND_DEFAULT_ASSIGNEE_ID);
|
100 |
ticket.setAssigneeId(OUTBOUND_DEFAULT_ASSIGNEE_ID);
|
| 102 |
|
101 |
|
| 103 |
Activity activity = new Activity();
|
102 |
Activity activity = new Activity();
|
| 104 |
activity.setCreatorId(ticket.getCreatorId());
|
103 |
activity.setCreatorId(ticket.getCreatorId());
|
| 105 |
activity.setCustomerId(ticket.getCustomerId());
|
104 |
activity.setCustomerId(ticket.getCustomerId());
|
| 106 |
activity.setDescription("Creating ticket");
|
105 |
activity.setDescription("Creating ticket");
|
| 107 |
activity.setTicketCategory(ticket.getCategory());
|
106 |
activity.setTicketCategory(ticket.getCategory());
|
| 108 |
activity.setTicketDescription(ticket.getDescription());
|
107 |
activity.setTicketDescription(ticket.getDescription());
|
| 109 |
activity.setTicketPriority(ticket.getPriority());
|
108 |
activity.setTicketPriority(ticket.getPriority());
|
| 110 |
activity.setTicketStatus(ticket.getStatus());
|
109 |
activity.setTicketStatus(ticket.getStatus());
|
| 111 |
activity.setType(ActivityType.OTHER);
|
110 |
activity.setType(ActivityType.OTHER);
|
| 112 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
111 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| 113 |
|
112 |
|
| 114 |
createTicket(ticket, activity);
|
113 |
createTicket(ticket, activity);
|
| 115 |
}
|
- |
|
| 116 |
} catch (Exception e) {
|
- |
|
| 117 |
log.error("Exception processing payment failure for customer Id: "
|
- |
|
| 118 |
+ customerId, e);
|
- |
|
| 119 |
}
|
114 |
}
|
| 120 |
}
|
115 |
}
|
| 121 |
|
116 |
|
| 122 |
@Transactional
|
117 |
@Transactional
|
| 123 |
private void createTicket(Ticket ticket, Activity activity) {
|
118 |
private void createTicket(Ticket ticket, Activity activity) {
|