Subversion Repositories SmartDukaan

Rev

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

Rev 4256 Rev 4267
Line 12... Line 12...
12
import in.shop2020.crm.TicketPriority;
12
import in.shop2020.crm.TicketPriority;
13
import in.shop2020.crm.TicketStatus;
13
import in.shop2020.crm.TicketStatus;
14
import in.shop2020.model.v1.order.LineItem;
14
import in.shop2020.model.v1.order.LineItem;
15
import in.shop2020.model.v1.order.Order;
15
import in.shop2020.model.v1.order.Order;
16
import in.shop2020.model.v1.order.OrderStatus;
16
import in.shop2020.model.v1.order.OrderStatus;
-
 
17
import in.shop2020.model.v1.order.Transaction;
17
import in.shop2020.model.v1.order.TransactionServiceException;
18
import in.shop2020.model.v1.order.TransactionServiceException;
-
 
19
import in.shop2020.model.v1.order.TransactionStatus;
18
import in.shop2020.model.v1.user.User;
20
import in.shop2020.model.v1.user.User;
19
import in.shop2020.model.v1.user.UserContextException;
21
import in.shop2020.model.v1.user.UserContextException;
-
 
22
import in.shop2020.payments.Attribute;
20
import in.shop2020.payments.Payment;
23
import in.shop2020.payments.Payment;
21
import in.shop2020.payments.PaymentException;
24
import in.shop2020.payments.PaymentException;
22
import in.shop2020.payments.PaymentStatus;
25
import in.shop2020.payments.PaymentStatus;
23
import in.shop2020.serving.auth.CRMAuthorizingRealm;
26
import in.shop2020.serving.auth.CRMAuthorizingRealm;
24
import in.shop2020.thrift.clients.CRMClient;
27
import in.shop2020.thrift.clients.CRMClient;
Line 80... Line 83...
80
    private String            customerName;
83
    private String            customerName;
81
    private String            customerMobileNumber;
84
    private String            customerMobileNumber;
82
    private User              user;
85
    private User              user;
83
    private String            orderStatus;
86
    private String            orderStatus;
84
    private List<Order>       orders;
87
    private List<Order>       orders;
-
 
88
    private List<Payment>     payments;
85
    private String            escalate;
89
    private String            escalate;
86
    private String            cancelReason;
90
    private String            cancelReason;
-
 
91
    private String            transactionId;
87
 
92
 
88
    public String index() {
93
    public String index() {
89
        try {
94
        try {
90
            if (id != null && !id.isEmpty()) {
95
            if (id != null && !id.isEmpty()) {
91
                SearchFilter searchFilter = new SearchFilter();
96
                SearchFilter searchFilter = new SearchFilter();
Line 137... Line 142...
137
                        orders.add(order);
142
                        orders.add(order);
138
                    }
143
                    }
139
                }
144
                }
140
            }
145
            }
141
 
146
 
-
 
147
            if (TicketCategory.PAYMENT_FLAGGED.equals(ticket.getCategory())) {
-
 
148
                log.info("Fetching orders for " + ticket.getCustomerId());
-
 
149
                payments = new ArrayList<Payment>();
-
 
150
                in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
-
 
151
                transactionServiceClient = new TransactionClient().getClient();
-
 
152
                for (Transaction transaction : transactionServiceClient
-
 
153
                        .getTransactionsForCustomer(ticket.getCustomerId(), 0, 0, TransactionStatus.FLAGGED)) {
-
 
154
                    log.info("Processing Transaction: " + transaction);
-
 
155
                    for ( Payment payment : paymentClient.getPaymentForTxnId(transaction.getId())) {
-
 
156
                        if( payment.getStatus().equals(PaymentStatus.AUTHORIZED)) {
-
 
157
                            payments.add(payment);
-
 
158
                        }
-
 
159
                    }
-
 
160
                }
-
 
161
            }
-
 
162
 
142
            if (TicketCategory.FAILED_PAYMENTS.equals(ticket.getCategory())) {
163
            if (TicketCategory.FAILED_PAYMENTS.equals(ticket.getCategory())) {
143
                log.info("Fetching orders for " + ticket.getCustomerId());
164
                log.info("Fetching orders for " + ticket.getCustomerId());
144
                orders = new ArrayList<Order>();
165
                orders = new ArrayList<Order>();
145
                in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
166
                in.shop2020.payments.PaymentService.Client paymentClient = new PaymentClient().getClient();
146
 
167
 
Line 593... Line 614...
593
            addActionError(errorString);
614
            addActionError(errorString);
594
        }
615
        }
595
 
616
 
596
        return user;
617
        return user;
597
    }
618
    }
-
 
619
    
-
 
620
    public String allowPayment() throws NumberFormatException, TransactionServiceException, TException {
-
 
621
        transactionServiceClient = new TransactionClient().getClient();
-
 
622
        transactionServiceClient.markTransactionAsPaymentFlagRemoved(Long.parseLong(transactionId));
-
 
623
        return edit();
-
 
624
    }
-
 
625
    
-
 
626
    public String blockPayment() throws NumberFormatException, TransactionServiceException, TException {
-
 
627
        transactionServiceClient = new TransactionClient().getClient();
-
 
628
        log.info("*" + transactionId + "*");
-
 
629
        transactionServiceClient.refundTransaction(Long.parseLong(transactionId), currentAgentEmailId, "FLAGGED_PAYMENT_CANCELLED");
-
 
630
        return edit();
-
 
631
    }
598
 
632
 
599
    public EscalationMatrix[] getEscalationMatrix () {
633
    public EscalationMatrix[] getEscalationMatrix () {
600
        return CRMConstants.EscalationMatrix.values();
634
        return CRMConstants.EscalationMatrix.values();
601
    }
635
    }
602
 
636
 
Line 841... Line 875...
841
    }
875
    }
842
 
876
 
843
    public void setCancelReason(String cancelReason) {
877
    public void setCancelReason(String cancelReason) {
844
        this.cancelReason = cancelReason;
878
        this.cancelReason = cancelReason;
845
    }
879
    }
-
 
880
 
-
 
881
    public List<Payment> getPayments() {
-
 
882
        return payments;
-
 
883
    }
-
 
884
 
-
 
885
    public void setPayments(List<Payment> payments) {
-
 
886
        this.payments = payments;
-
 
887
    }
-
 
888
 
-
 
889
    public String getTransactionId() {
-
 
890
        return transactionId;
-
 
891
    }
-
 
892
 
-
 
893
    public void setTransactionId(String transactionId) {
-
 
894
        this.transactionId = transactionId;
-
 
895
    }
846
}
896
}