| 7226 |
anupam.sin |
1 |
package in.shop2020.serving.controllers;
|
|
|
2 |
|
|
|
3 |
import in.shop2020.model.v1.order.HotspotStore;
|
|
|
4 |
import in.shop2020.model.v1.order.RechargeDenomination;
|
|
|
5 |
import in.shop2020.model.v1.order.RechargePlan;
|
| 7386 |
anupam.sin |
6 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 7226 |
anupam.sin |
7 |
|
|
|
8 |
import java.util.HashMap;
|
|
|
9 |
import java.util.List;
|
|
|
10 |
import java.util.Map;
|
|
|
11 |
|
|
|
12 |
import org.apache.log4j.Logger;
|
|
|
13 |
import org.apache.struts2.convention.annotation.Result;
|
|
|
14 |
import org.apache.struts2.convention.annotation.Results;
|
|
|
15 |
|
|
|
16 |
@Results({
|
|
|
17 |
@Result(name = "redirect", location = "${redirectUrl}", type = "redirect")
|
|
|
18 |
})
|
|
|
19 |
|
|
|
20 |
public class HomeController extends BaseController {
|
|
|
21 |
|
|
|
22 |
/**
|
|
|
23 |
*
|
|
|
24 |
*/
|
|
|
25 |
private String deviceType = null; //Default is Mobile , 2 is for DTH
|
|
|
26 |
private String deviceNumber = "";
|
|
|
27 |
private String form = "";
|
|
|
28 |
private String error = "";
|
|
|
29 |
private String operatorId;
|
|
|
30 |
private String operatorName;
|
|
|
31 |
private String serviceName;
|
|
|
32 |
private String denominationType;
|
|
|
33 |
private String circlecode;
|
|
|
34 |
private List<RechargeDenomination> rechargeDenominations = null;
|
|
|
35 |
private static final long serialVersionUID = 2079308723099307749L;
|
|
|
36 |
|
|
|
37 |
private Long storeId;
|
|
|
38 |
private static Logger log = Logger.getLogger(Class.class);
|
|
|
39 |
private static Map<Long, String> mobileProvidersMap;
|
|
|
40 |
private static Map<Long, String> dthProvidersMap;
|
|
|
41 |
private String errorMsg = "";
|
|
|
42 |
private String redirectUrl;
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
public String index() {
|
| 7386 |
anupam.sin |
46 |
String loginStatus = (String) request.getSession().getAttribute("LOGGED_IN");
|
|
|
47 |
if(loginStatus != null && loginStatus.equals("TRUE")){
|
|
|
48 |
storeId = Long.parseLong((String) request.getSession().getAttribute("STORE_ID"));
|
|
|
49 |
if(!hotspotStores.containsKey(storeId)){
|
|
|
50 |
try{
|
|
|
51 |
HotspotStore hotSpotStore = (new TransactionClient()).getClient().getHotspotStore(storeId, "");
|
|
|
52 |
hotspotStores.put(storeId, hotSpotStore);
|
|
|
53 |
} catch (Exception e) {
|
|
|
54 |
log.error("Unable to get store", e);
|
|
|
55 |
}
|
|
|
56 |
}
|
|
|
57 |
return "index";
|
|
|
58 |
}
|
|
|
59 |
return "authfail";
|
| 7226 |
anupam.sin |
60 |
}
|
|
|
61 |
|
|
|
62 |
public void setDeviceType(String incomingdeviceType) {
|
|
|
63 |
deviceType = incomingdeviceType;
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
public void setDeviceNumber(String deviceNumber){
|
|
|
67 |
this.deviceNumber = deviceNumber;
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
public String getDeviceType() {
|
|
|
71 |
return deviceType;
|
|
|
72 |
}
|
|
|
73 |
|
|
|
74 |
public String getForm() {
|
|
|
75 |
return form;
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
public void setForm(String form) {
|
|
|
79 |
this.form = form;
|
|
|
80 |
}
|
|
|
81 |
|
|
|
82 |
public String getError() {
|
|
|
83 |
return error;
|
|
|
84 |
}
|
|
|
85 |
|
|
|
86 |
public void setError(String error) {
|
|
|
87 |
this.error = error;
|
|
|
88 |
}
|
|
|
89 |
|
|
|
90 |
public String getPageName() {
|
|
|
91 |
return operatorName + " online recharge";
|
|
|
92 |
}
|
|
|
93 |
|
|
|
94 |
public String getPageTitle() {
|
|
|
95 |
return operatorName + " online recharge";
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
public String getPageMetaDesc() {
|
|
|
99 |
return "Recharge your " + this.operatorName + " " + this.serviceName + " online for all cities using Credit/Debit card & net banking. Fast, Secure and Hassle Free Recharge";
|
|
|
100 |
}
|
|
|
101 |
|
|
|
102 |
public String getPageMetaKeywords() {
|
|
|
103 |
return "mobile, recharge";
|
|
|
104 |
}
|
|
|
105 |
|
|
|
106 |
public long getOperatorId(){
|
|
|
107 |
return Long.parseLong(this.operatorId);
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
public String getDenominationType() {
|
|
|
111 |
return denominationType;
|
|
|
112 |
}
|
|
|
113 |
|
|
|
114 |
public void setDenominationType(String denominationType) {
|
|
|
115 |
this.denominationType = denominationType;
|
|
|
116 |
}
|
|
|
117 |
|
|
|
118 |
public String getCirclecode() {
|
|
|
119 |
return circlecode;
|
|
|
120 |
}
|
|
|
121 |
|
|
|
122 |
public void setCircleCode(String circlecode) {
|
|
|
123 |
this.circlecode = circlecode;
|
|
|
124 |
}
|
|
|
125 |
|
|
|
126 |
public List<RechargeDenomination> getRechargeDenominations() {
|
|
|
127 |
return rechargeDenominations;
|
|
|
128 |
}
|
|
|
129 |
|
|
|
130 |
public void setRechargeDenominations(
|
|
|
131 |
List<RechargeDenomination> rechargeDenominations) {
|
|
|
132 |
this.rechargeDenominations = rechargeDenominations;
|
|
|
133 |
}
|
|
|
134 |
|
|
|
135 |
public void setOperatorId(String operatorId) {
|
|
|
136 |
this.operatorId = operatorId;
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
public void setErrorMsg(String errorMsg) {
|
|
|
140 |
this.errorMsg = errorMsg;
|
|
|
141 |
}
|
|
|
142 |
|
|
|
143 |
public String getErrorMsg() {
|
|
|
144 |
return errorMsg;
|
|
|
145 |
}
|
|
|
146 |
|
|
|
147 |
public static void setDthProvidersMap(Map<Long, String> dthProvidersMap) {
|
|
|
148 |
HomeController.dthProvidersMap = dthProvidersMap;
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
public static Map<Long, String> getDthProvidersMap() {
|
|
|
152 |
return dthProvidersMap;
|
|
|
153 |
}
|
|
|
154 |
|
|
|
155 |
public static void setMobileProvidersMap(Map<Long, String> mobileProvidersMap) {
|
|
|
156 |
HomeController.mobileProvidersMap = mobileProvidersMap;
|
|
|
157 |
}
|
|
|
158 |
|
|
|
159 |
public static Map<Long, String> getMobileProvidersMap() {
|
|
|
160 |
return mobileProvidersMap;
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
public Long getStoreId() {
|
|
|
164 |
return storeId;
|
|
|
165 |
}
|
|
|
166 |
|
|
|
167 |
public void setStoreId(Long storeId) {
|
|
|
168 |
this.storeId = storeId;
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
public String getStoreCircleCode() {
|
|
|
172 |
return (String)(request.getSession().getAttribute("STORE_CIRCLE_CODE"));
|
|
|
173 |
}
|
|
|
174 |
|
|
|
175 |
public String getRedirectUrl() {
|
|
|
176 |
return redirectUrl;
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
public void setRedirectUrl(String redirectUrl) {
|
|
|
180 |
this.redirectUrl = redirectUrl;
|
|
|
181 |
}
|
|
|
182 |
|
|
|
183 |
public String getStoreCode(){
|
|
|
184 |
return hotspotStores.get(storeId).getHotspotId();
|
|
|
185 |
}
|
|
|
186 |
|
|
|
187 |
public String getCollectedAmount(){
|
|
|
188 |
return hotspotStores.get(storeId).getCollectedAmount()+"";
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
}
|