| Line 17... |
Line 17... |
| 17 |
import in.shop2020.model.v1.order.Transaction;
|
17 |
import in.shop2020.model.v1.order.Transaction;
|
| 18 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
18 |
import in.shop2020.model.v1.order.TransactionServiceException;
|
| 19 |
import in.shop2020.model.v1.order.TransactionStatus;
|
19 |
import in.shop2020.model.v1.order.TransactionStatus;
|
| 20 |
import in.shop2020.model.v1.user.User;
|
20 |
import in.shop2020.model.v1.user.User;
|
| 21 |
import in.shop2020.model.v1.user.UserContextException;
|
21 |
import in.shop2020.model.v1.user.UserContextException;
|
| 22 |
import in.shop2020.payments.Attribute;
|
- |
|
| 23 |
import in.shop2020.payments.Payment;
|
22 |
import in.shop2020.payments.Payment;
|
| 24 |
import in.shop2020.payments.PaymentException;
|
23 |
import in.shop2020.payments.PaymentException;
|
| 25 |
import in.shop2020.payments.PaymentStatus;
|
24 |
import in.shop2020.payments.PaymentStatus;
|
| 26 |
import in.shop2020.serving.auth.CRMAuthorizingRealm;
|
25 |
import in.shop2020.serving.auth.CRMAuthorizingRealm;
|
| 27 |
import in.shop2020.thrift.clients.CRMClient;
|
26 |
import in.shop2020.thrift.clients.CRMClient;
|
| Line 88... |
Line 87... |
| 88 |
private List<Payment> payments;
|
87 |
private List<Payment> payments;
|
| 89 |
private String escalate;
|
88 |
private String escalate;
|
| 90 |
private String cancelReason;
|
89 |
private String cancelReason;
|
| 91 |
private String transactionId;
|
90 |
private String transactionId;
|
| 92 |
|
91 |
|
| - |
|
92 |
private String paymentId;
|
| - |
|
93 |
|
| 93 |
public String index() {
|
94 |
public String index() {
|
| 94 |
try {
|
95 |
try {
|
| 95 |
if (id != null && !id.isEmpty()) {
|
96 |
if (id != null && !id.isEmpty()) {
|
| 96 |
SearchFilter searchFilter = new SearchFilter();
|
97 |
SearchFilter searchFilter = new SearchFilter();
|
| 97 |
crmServiceClient = new CRMClient().getClient();
|
98 |
crmServiceClient = new CRMClient().getClient();
|
| Line 646... |
Line 647... |
| 646 |
}
|
647 |
}
|
| 647 |
|
648 |
|
| 648 |
return user;
|
649 |
return user;
|
| 649 |
}
|
650 |
}
|
| 650 |
|
651 |
|
| - |
|
652 |
public String allowPayment() {
|
| - |
|
653 |
try {
|
| 651 |
public String allowPayment() throws NumberFormatException, TransactionServiceException, TException {
|
654 |
log.info("Allowing payment for paymentId = " + paymentId);
|
| 652 |
transactionServiceClient = new TransactionClient().getClient();
|
655 |
transactionServiceClient = new TransactionClient().getClient();
|
| 653 |
transactionServiceClient.markTransactionAsPaymentFlagRemoved(Long.parseLong(transactionId));
|
656 |
transactionServiceClient.markTransactionAsPaymentFlagRemoved(Long.parseLong(transactionId));
|
| - |
|
657 |
if (id != null && !id.isEmpty()) {
|
| - |
|
658 |
SearchFilter searchFilter = new SearchFilter();
|
| - |
|
659 |
crmServiceClient = new CRMClient().getClient();
|
| - |
|
660 |
searchFilter.setTicketId(Long.parseLong(id));
|
| - |
|
661 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
| - |
|
662 |
// Inserting activity
|
| - |
|
663 |
if(ticket != null) {
|
| - |
|
664 |
Activity activity = new Activity();
|
| - |
|
665 |
activity.setDescription("Flagged Payment allowed");
|
| - |
|
666 |
activity.setType(ActivityType.OTHER);
|
| - |
|
667 |
activity.setTicketPriority(ticket.getPriority());
|
| - |
|
668 |
activity.setTicketStatus(ticket.getStatus());
|
| - |
|
669 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
| - |
|
670 |
activity.setTicketCategory(ticket.getCategory());
|
| - |
|
671 |
activity.setTicketDescription(ticket.getDescription());
|
| - |
|
672 |
activity.setCustomerId(ticket.getCustomerId());
|
| - |
|
673 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| - |
|
674 |
|
| - |
|
675 |
crmServiceClient = new CRMClient().getClient();
|
| - |
|
676 |
crmServiceClient.updateTicket(ticket, activity);
|
| - |
|
677 |
}
|
| - |
|
678 |
}
|
| - |
|
679 |
|
| - |
|
680 |
} catch (TException e) {
|
| - |
|
681 |
log.error("Error while getting tickets", e);
|
| - |
|
682 |
return EXCEPTION;
|
| - |
|
683 |
} catch (NumberFormatException e) {
|
| - |
|
684 |
log.error("Invalid ticket Id", e);
|
| - |
|
685 |
return EXCEPTION;
|
| - |
|
686 |
} catch (TransactionServiceException e) {
|
| - |
|
687 |
log.error("Error while marking transactions as Flag removed", e);
|
| - |
|
688 |
return EXCEPTION;
|
| - |
|
689 |
}
|
| 654 |
return edit();
|
690 |
return edit();
|
| 655 |
}
|
691 |
}
|
| 656 |
|
692 |
|
| 657 |
public String blockPayment() throws NumberFormatException, TransactionServiceException, TException {
|
693 |
public String blockPayment() throws NumberFormatException, TransactionServiceException, TException {
|
| - |
|
694 |
try {
|
| - |
|
695 |
log.info("Blocking payment for paymentId = " + paymentId);
|
| 658 |
transactionServiceClient = new TransactionClient().getClient();
|
696 |
transactionServiceClient = new TransactionClient().getClient();
|
| - |
|
697 |
transactionServiceClient.refundTransaction(Long.parseLong(transactionId), currentAgentEmailId, "FLAGGED_PAYMENT_CANCELLED");
|
| 659 |
log.info("*" + transactionId + "*");
|
698 |
if (id != null && !id.isEmpty()) {
|
| - |
|
699 |
SearchFilter searchFilter = new SearchFilter();
|
| - |
|
700 |
crmServiceClient = new CRMClient().getClient();
|
| - |
|
701 |
searchFilter.setTicketId(Long.parseLong(id));
|
| - |
|
702 |
Ticket ticket = crmServiceClient.getTickets(searchFilter).get(0);
|
| - |
|
703 |
// Inserting activity
|
| - |
|
704 |
if(ticket != null) {
|
| - |
|
705 |
Activity activity = new Activity();
|
| - |
|
706 |
activity.setDescription("Flagged Payment allowed");
|
| - |
|
707 |
activity.setType(ActivityType.OTHER);
|
| - |
|
708 |
activity.setTicketPriority(ticket.getPriority());
|
| - |
|
709 |
activity.setTicketStatus(ticket.getStatus());
|
| 660 |
transactionServiceClient.refundTransaction(Long.parseLong(transactionId), currentAgentEmailId, "FLAGGED_PAYMENT_CANCELLED");
|
710 |
activity.setCreatorId(CRMAuthorizingRealm.getAgent(currentAgentEmailId).getId());
|
| - |
|
711 |
activity.setTicketCategory(ticket.getCategory());
|
| - |
|
712 |
activity.setTicketDescription(ticket.getDescription());
|
| - |
|
713 |
activity.setCustomerId(ticket.getCustomerId());
|
| - |
|
714 |
activity.setTicketAssigneeId(ticket.getAssigneeId());
|
| - |
|
715 |
|
| - |
|
716 |
crmServiceClient = new CRMClient().getClient();
|
| - |
|
717 |
crmServiceClient.updateTicket(ticket, activity);
|
| - |
|
718 |
}
|
| - |
|
719 |
}
|
| - |
|
720 |
|
| - |
|
721 |
} catch (TException e) {
|
| - |
|
722 |
log.error("Error while getting tickets", e);
|
| - |
|
723 |
return EXCEPTION;
|
| - |
|
724 |
} catch (NumberFormatException e) {
|
| - |
|
725 |
log.error("Invalid ticket Id", e);
|
| - |
|
726 |
return EXCEPTION;
|
| - |
|
727 |
} catch (TransactionServiceException e) {
|
| - |
|
728 |
log.error("Error while allowing flagged payment", e);
|
| - |
|
729 |
return EXCEPTION;
|
| - |
|
730 |
}
|
| 661 |
return edit();
|
731 |
return edit();
|
| 662 |
}
|
732 |
}
|
| 663 |
|
733 |
|
| 664 |
public EscalationMatrix[] getEscalationMatrix () {
|
734 |
public EscalationMatrix[] getEscalationMatrix () {
|
| 665 |
return CRMConstants.EscalationMatrix.values();
|
735 |
return CRMConstants.EscalationMatrix.values();
|
| Line 922... |
Line 992... |
| 922 |
}
|
992 |
}
|
| 923 |
|
993 |
|
| 924 |
public void setTransactionId(String transactionId) {
|
994 |
public void setTransactionId(String transactionId) {
|
| 925 |
this.transactionId = transactionId;
|
995 |
this.transactionId = transactionId;
|
| 926 |
}
|
996 |
}
|
| - |
|
997 |
|
| - |
|
998 |
public String getPaymentId() {
|
| - |
|
999 |
return paymentId;
|
| - |
|
1000 |
}
|
| - |
|
1001 |
|
| - |
|
1002 |
public void setPaymentId(String paymentId) {
|
| - |
|
1003 |
this.paymentId = paymentId;
|
| - |
|
1004 |
}
|
| 927 |
}
|
1005 |
}
|