Subversion Repositories SmartDukaan

Rev

Rev 6111 | Rev 6462 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6111 anupam.sin 1
package in.shop2020.serving.controllers;
2
 
3
import in.shop2020.model.v1.order.OrderStatus;
4
import in.shop2020.model.v1.order.RechargeOrder;
5
import in.shop2020.model.v1.order.TransactionServiceException;
6
import in.shop2020.model.v1.user.UserContextException;
7
import in.shop2020.payments.Payment;
8
import in.shop2020.payments.PaymentException;
9
import in.shop2020.serving.model.ShipmentUpdate;
10
import in.shop2020.thrift.clients.PaymentClient;
11
import in.shop2020.thrift.clients.TransactionClient;
12
import in.shop2020.thrift.clients.UserClient;
13
 
14
import java.util.ArrayList;
15
import java.util.Collections;
16
import java.util.List;
17
import java.util.concurrent.Callable;
18
import java.util.concurrent.Executors;
19
import java.util.concurrent.TimeUnit;
20
 
21
import org.apache.log4j.Logger;
22
import org.apache.thrift.TException;
23
import org.apache.thrift.transport.TTransportException;
24
 
25
public class RechargeOrderInfoController extends BaseController {
26
 
27
    /**
28
     * 
29
     */
30
    private static final long serialVersionUID = 1L;
31
 
32
    private static Logger log = Logger.getLogger(Class.class);
33
    private String rechargeOrderId = "";
34
    private RechargeOrder rechargeOrder = null;
35
    private List<Payment> payments = null;
36
 
37
    public String index() {
38
        try {
39
            PaymentClient paymentServiceClient = new PaymentClient();
40
            TransactionClient transactionServiceClient = new TransactionClient();
41
 
42
            rechargeOrder = transactionServiceClient.getClient().getRechargeOrder(Long.parseLong(rechargeOrderId));
43
 
44
            payments = paymentServiceClient.getClient()
45
            .getPaymentForTxnId(rechargeOrder.getTransactionId());
46
 
47
        } catch (TTransportException e) {
48
            log.error("Unable to create thrift Client", e);
49
        } catch (TransactionServiceException e) {
50
            addActionError("Invalid order id or no order selected.");
51
        } catch (TException e) {
52
            log.error("Unable to get thrift Client", e);
53
        } catch (PaymentException e) {
54
            log.error("Unable to get payments for transctionId : " + rechargeOrder.getTransactionId(), e);
55
        }
56
        return INDEX;
57
    }
58
 
59
    public String getRechargeOrderId() {
60
        return rechargeOrderId;
61
    }
62
 
63
    public void setRechargeOrderId(String rechargeOrderId) {
64
        this.rechargeOrderId = rechargeOrderId;
65
    }
6153 anupam.sin 66
 
67
    public String getProviderName(Long operatorId) {
68
        return providersMap.get(operatorId);
69
    }
6111 anupam.sin 70
 
71
    public RechargeOrder getRechargeOrder() {
72
        return rechargeOrder;
73
    }
74
 
75
    public void setRechargeOrder(RechargeOrder rechargeOrder) {
76
        this.rechargeOrder = rechargeOrder;
77
    }
78
 
79
    public List<Payment> getPayments() {
80
        return payments;
81
    }
82
 
83
    public void setPayments(List<Payment> payments) {
84
        this.payments = payments;
85
    }
86
 
87
}