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