| Line 189... |
Line 189... |
| 189 |
public void closeSession() throws TException {
|
189 |
public void closeSession() throws TException {
|
| 190 |
// TODO Auto-generated method stub
|
190 |
// TODO Auto-generated method stub
|
| 191 |
|
191 |
|
| 192 |
}
|
192 |
}
|
| 193 |
|
193 |
|
| - |
|
194 |
/**
|
| - |
|
195 |
* Async method that creates a ticket if necessary for COD verification
|
| - |
|
196 |
*/
|
| 194 |
public void processCODTxn(long transactionId) throws TException {
|
197 |
public void processCODTxn(long transactionId) {
|
| 195 |
try {
|
198 |
try {
|
| 196 |
log.info("Processing txn id: " + transactionId);
|
199 |
log.info("Processing txn id: " + transactionId);
|
| 197 |
Client client = new TransactionClient().getClient();
|
200 |
Client client = new TransactionClient().getClient();
|
| 198 |
Transaction transaction = client.getTransaction(transactionId);
|
201 |
Transaction transaction = client.getTransaction(transactionId);
|
| 199 |
in.shop2020.model.v1.user.UserContextService.Client userClient = new UserClient().getClient();
|
202 |
in.shop2020.model.v1.user.UserContextService.Client userClient = new UserClient().getClient();
|
| 200 |
User user = userClient.getUserById(transaction.getCustomer_id());
|
203 |
User user = userClient.getUserById(transaction.getCustomer_id());
|
| 201 |
log.info(TRUST_THRESHOLD_LEVEL);
|
- |
|
| 202 |
log.info(user.getTrustLevel());
|
- |
|
| 203 |
if (user.getTrustLevel() - TRUST_THRESHOLD_LEVEL < 1e-4) {
|
204 |
if (user.getTrustLevel() - TRUST_THRESHOLD_LEVEL < 1e-4) {
|
| 204 |
for (Order order : transaction.getOrders()) {
|
205 |
for (Order order : transaction.getOrders()) {
|
| 205 |
log.info("Processing order: " + order.getId());
|
206 |
log.info("Processing order: " + order.getId());
|
| 206 |
if (order.isCod() && OrderStatus.INIT.equals(order.getStatus())) {
|
207 |
if (order.isCod() && OrderStatus.INIT.equals(order.getStatus())) {
|
| 207 |
log.info("Processing COD order: " + order.getId());
|
208 |
log.info("Processing COD order: " + order.getId());
|
| Line 236... |
Line 237... |
| 236 |
activity.setType(ActivityType.OTHER);
|
237 |
activity.setType(ActivityType.OTHER);
|
| 237 |
|
238 |
|
| 238 |
this.insertTicket(ticket, activity);
|
239 |
this.insertTicket(ticket, activity);
|
| 239 |
break;
|
240 |
break;
|
| 240 |
}
|
241 |
}
|
| 241 |
}
|
242 |
}
|
| 242 |
}
|
243 |
}
|
| 243 |
}
|
244 |
}
|
| 244 |
else {
|
245 |
else {
|
| 245 |
log.info("Autoverifying orders");
|
246 |
log.info("Autoverifying orders");
|
| 246 |
// Submit order for processing
|
247 |
// Submit order for processing
|
| Line 251... |
Line 252... |
| 251 |
}
|
252 |
}
|
| 252 |
} catch (TransactionServiceException e) {
|
253 |
} catch (TransactionServiceException e) {
|
| 253 |
log.error("Could not fetch transaction details", e);
|
254 |
log.error("Could not fetch transaction details", e);
|
| 254 |
} catch (UserContextException e) {
|
255 |
} catch (UserContextException e) {
|
| 255 |
log.error("Could not fetch user details", e);
|
256 |
log.error("Could not fetch user details", e);
|
| - |
|
257 |
} catch (TException e) {
|
| - |
|
258 |
log.info("Error processing txn id: " + transactionId);
|
| - |
|
259 |
} catch (Exception e) {
|
| - |
|
260 |
log.info("Exception processing txn id: " + transactionId);
|
| 256 |
}
|
261 |
}
|
| 257 |
}
|
262 |
}
|
| 258 |
|
263 |
|
| - |
|
264 |
/**
|
| - |
|
265 |
* Async method to create tickets for failed payments.
|
| - |
|
266 |
*/
|
| 259 |
public void processPaymentFailure(long customerId) throws TException {
|
267 |
public void processPaymentFailure(long customerId) {
|
| - |
|
268 |
try {
|
| 260 |
log.info("Processing Payment failure for customerId: " + customerId);
|
269 |
log.info("Processing Payment failure for customerId: " + customerId);
|
| 261 |
SearchFilter searchFilter = new SearchFilter();
|
270 |
SearchFilter searchFilter = new SearchFilter();
|
| 262 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
271 |
searchFilter.setTicketStatuses(new ArrayList<TicketStatus>());
|
| 263 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
272 |
searchFilter.getTicketStatuses().add(TicketStatus.OPEN);
|
| 264 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
273 |
searchFilter.getTicketStatuses().add(TicketStatus.REOPEN);
|
| 265 |
searchFilter.setTicketCategory(TicketCategory.FAILED_PAYMENTS);
|
274 |
searchFilter.setTicketCategory(TicketCategory.FAILED_PAYMENTS);
|
| 266 |
searchFilter.setCustomerId(customerId);
|
275 |
searchFilter.setCustomerId(customerId);
|
| 267 |
|
276 |
|
| 268 |
// No need to create a ticket if there exists one for the customer!
|
277 |
// No need to create a ticket if there exists one for the customer!
|
| 269 |
if (this.getTickets(searchFilter).isEmpty()) {
|
278 |
if (this.getTickets(searchFilter).isEmpty()) {
|
| 270 |
Ticket ticket = new Ticket();
|
279 |
Ticket ticket = new Ticket();
|
| 271 |
ticket.setCategory(TicketCategory.FAILED_PAYMENTS);
|
280 |
ticket.setCategory(TicketCategory.FAILED_PAYMENTS);
|
| 272 |
ticket.setCreatorId(ADMIN_AGENT_ID);
|
281 |
ticket.setCreatorId(ADMIN_AGENT_ID);
|
| 273 |
ticket.setCustomerId(customerId);
|
282 |
ticket.setCustomerId(customerId);
|
| 274 |
ticket.setDescription("Requires payment failures' follow-up!");
|
283 |
ticket.setDescription("Requires payment failures' follow-up!");
|
| 275 |
ticket.setPriority(TicketPriority.HIGH);
|
284 |
ticket.setPriority(TicketPriority.HIGH);
|
| 276 |
ticket.setStatus(TicketStatus.OPEN);
|
285 |
ticket.setStatus(TicketStatus.OPEN);
|
| 277 |
ticket.setAssigneeId(ADMIN_AGENT_ID);
|
286 |
ticket.setAssigneeId(ADMIN_AGENT_ID);
|
| 278 |
|
287 |
|
| 279 |
Activity activity = new Activity();
|
288 |
Activity activity = new Activity();
|
| 280 |
activity.setCreatorId(ticket.getCreatorId());
|
289 |
activity.setCreatorId(ticket.getCreatorId());
|
| 281 |
activity.setCustomerId(ticket.getCustomerId());
|
290 |
activity.setCustomerId(ticket.getCustomerId());
|
| 282 |
activity.setDescription("Creating ticket");
|
291 |
activity.setDescription("Creating ticket");
|
| 283 |
activity.setTicketCategory(ticket.getCategory());
|
292 |
activity.setTicketCategory(ticket.getCategory());
|
| 284 |
activity.setTicketDescription(ticket.getDescription());
|
293 |
activity.setTicketDescription(ticket.getDescription());
|
| 285 |
activity.setTicketPriority(ticket.getPriority());
|
294 |
activity.setTicketPriority(ticket.getPriority());
|
| 286 |
activity.setTicketStatus(ticket.getStatus());
|
295 |
activity.setTicketStatus(ticket.getStatus());
|
| 287 |
activity.setType(ActivityType.OTHER);
|
296 |
activity.setType(ActivityType.OTHER);
|
| 288 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
297 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| 289 |
|
298 |
|
| 290 |
this.insertTicket(ticket, activity);
|
299 |
this.insertTicket(ticket, activity);
|
| - |
|
300 |
}
|
| - |
|
301 |
} catch (TException e) {
|
| - |
|
302 |
log.error("Error fetching/inserting tickets for customer Id: " + customerId, e);
|
| - |
|
303 |
} catch (Exception e) {
|
| - |
|
304 |
log.error("Exception processing payment failrue for customer Id: " + customerId, e);
|
| 291 |
}
|
305 |
}
|
| 292 |
}
|
306 |
}
|
| 293 |
}
|
307 |
}
|