Subversion Repositories SmartDukaan

Rev

Rev 3546 | Rev 3853 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3546 Rev 3578
Line 251... Line 251...
251
            log.error("Could not fetch transaction details", e);
251
            log.error("Could not fetch transaction details", e);
252
        } catch (UserContextException e) {
252
        } catch (UserContextException e) {
253
            e.printStackTrace();
253
            e.printStackTrace();
254
        }
254
        }
255
    }
255
    }
-
 
256
 
-
 
257
    public void processPaymentFailure(long customerId) throws TException {
-
 
258
        log.info("Processing Payment failure for customerId: " + customerId);
-
 
259
        SearchFilter searchFilter = new SearchFilter();
-
 
260
        searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
-
 
261
        searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
-
 
262
        searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
-
 
263
        searchFilter.setTicketCategory(TicketCategory.FAILED_PAYMENTS);
-
 
264
        searchFilter.setCustomerId(customerId);
-
 
265
 
-
 
266
        // No need to create a ticket if there exists one for the customer!
-
 
267
        if (this.getTickets(searchFilter).isEmpty()) {
-
 
268
            Ticket ticket = new Ticket();
-
 
269
            ticket.setCategory(TicketCategory.FAILED_PAYMENTS);
-
 
270
            ticket.setCreatorId(ADMIN_AGENT_ID);
-
 
271
            ticket.setCustomerId(customerId);
-
 
272
            ticket.setDescription("Requires payment failures' follow-up!");
-
 
273
            ticket.setPriority(TicketPriority.HIGH);
-
 
274
            ticket.setStatus(TicketStatus.OPEN);
-
 
275
 
-
 
276
            Activity activity = new Activity();
-
 
277
            activity.setCreatorId(ticket.getCreatorId());
-
 
278
            activity.setCustomerId(ticket.getCustomerId());
-
 
279
            activity.setDescription("Creating ticket");
-
 
280
            activity.setTicketCategory(ticket.getCategory());
-
 
281
            activity.setTicketDescription(ticket.getDescription());
-
 
282
            activity.setTicketPriority(ticket.getPriority());
-
 
283
            activity.setTicketStatus(ticket.getStatus());
-
 
284
            activity.setType(ActivityType.OTHER);
-
 
285
 
-
 
286
            this.insertTicket(ticket, activity);
-
 
287
        }
-
 
288
    }
256
}
289
}