| Line 13... |
Line 13... |
| 13 |
import in.shop2020.thrift.clients.UserClient;
|
13 |
import in.shop2020.thrift.clients.UserClient;
|
| 14 |
import in.shop2020.utils.DataLogger;
|
14 |
import in.shop2020.utils.DataLogger;
|
| 15 |
|
15 |
|
| 16 |
import java.util.ArrayList;
|
16 |
import java.util.ArrayList;
|
| 17 |
import java.util.Collection;
|
17 |
import java.util.Collection;
|
| - |
|
18 |
import java.util.HashMap;
|
| 18 |
import java.util.List;
|
19 |
import java.util.List;
|
| - |
|
20 |
import java.util.Map;
|
| 19 |
import java.util.ResourceBundle;
|
21 |
import java.util.ResourceBundle;
|
| 20 |
|
22 |
|
| 21 |
import org.apache.commons.lang.StringUtils;
|
23 |
import org.apache.commons.lang.StringUtils;
|
| 22 |
import org.apache.log4j.Logger;
|
24 |
import org.apache.log4j.Logger;
|
| 23 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
25 |
import org.apache.struts2.convention.annotation.InterceptorRef;
|
| Line 44... |
Line 46... |
| 44 |
private static Logger logger = Logger.getLogger(ProceedToPayController.class);
|
46 |
private static Logger logger = Logger.getLogger(ProceedToPayController.class);
|
| 45 |
private static final ResourceBundle resource = ResourceBundle.getBundle(ProceedToPayController.class.getName());
|
47 |
private static final ResourceBundle resource = ResourceBundle.getBundle(ProceedToPayController.class.getName());
|
| 46 |
private static final boolean SHOW_EBS_TEST_GATEWAY = Boolean.parseBoolean(resource.getString("show_ebs_test_gateway"));
|
48 |
private static final boolean SHOW_EBS_TEST_GATEWAY = Boolean.parseBoolean(resource.getString("show_ebs_test_gateway"));
|
| 47 |
|
49 |
|
| 48 |
private static List<EmiScheme> emiSchemes;
|
50 |
private static List<EmiScheme> emiSchemes;
|
| - |
|
51 |
private static String emiSchemesInJSON;
|
| 49 |
private boolean hasGiftVoucher = false;
|
52 |
private boolean hasGiftVoucher = false;
|
| 50 |
private long addressId = -1;
|
53 |
private long addressId = -1;
|
| 51 |
private String totalAmount = "";
|
54 |
private String totalAmount = "";
|
| 52 |
private double totalAmountD = 0l;
|
55 |
private double totalAmountD = 0l;
|
| 53 |
private boolean showCodOption = true;
|
56 |
private boolean showCodOption = true;
|
| Line 159... |
Line 162... |
| 159 |
}
|
162 |
}
|
| 160 |
|
163 |
|
| 161 |
return "index";
|
164 |
return "index";
|
| 162 |
}
|
165 |
}
|
| 163 |
|
166 |
|
| 164 |
private void populateEmiSchemes(){
|
167 |
public static void populateEmiSchemes(){
|
| 165 |
try {
|
168 |
try {
|
| 166 |
Client tClient = new TransactionClient().getClient();
|
169 |
Client tClient = new TransactionClient().getClient();
|
| 167 |
emiSchemes = tClient.getAvailableEmiSchemes();
|
170 |
emiSchemes = tClient.getAvailableEmiSchemes();
|
| 168 |
} catch (TTransportException e) {
|
171 |
} catch (TTransportException e) {
|
| 169 |
logger.error("Error while getting EMI schemes: ", e);
|
172 |
logger.error("Error while getting EMI schemes: ", e);
|
| Line 266... |
Line 269... |
| 266 |
logger.warn("Could not retrive emi based promotions for cart: " + userinfo.getCartId() + ".\n" + e);
|
269 |
logger.warn("Could not retrive emi based promotions for cart: " + userinfo.getCartId() + ".\n" + e);
|
| 267 |
return "{}";
|
270 |
return "{}";
|
| 268 |
}
|
271 |
}
|
| 269 |
}
|
272 |
}
|
| 270 |
|
273 |
|
| 271 |
public List<EmiScheme> getEmiSchemes(){
|
274 |
public static List<EmiScheme> getEmiSchemes(){
|
| 272 |
/*List<EmiScheme> schemes = new ArrayList<EmiScheme>();
|
275 |
if (emiSchemes != null) {
|
| 273 |
schemes.add(new EmiScheme(1,1,1,3,"HDFC Bank", 2000, "3 Months", EmiChargeType.FIXED, 500));
|
276 |
return emiSchemes;
|
| 274 |
schemes.add(new EmiScheme(2,1,1,6,"HDFC Bank", 4000, "6 Months", EmiChargeType.FIXED, 1000));
|
- |
|
| 275 |
schemes.add(new EmiScheme(3,1,1,9,"HDFC Bank", 6000, "9 Months", EmiChargeType.FIXED, 1500));
|
- |
|
| 276 |
schemes.add(new EmiScheme(4,1,1,12,"HDFC Bank", 6000, "12 Months", EmiChargeType.FIXED, 2000));
|
- |
|
| 277 |
schemes.add(new EmiScheme(5,1,2,6,"ICICI Bank", 7000, "6 Months", EmiChargeType.FIXED, 1000));
|
- |
|
| 278 |
schemes.add(new EmiScheme(6,1,2,9,"ICICI Bank", 7000,"9 Months", EmiChargeType.FIXED, 1500));
|
277 |
} else {
|
| 279 |
schemes.add(new EmiScheme(7,1,2,12,"ICICI Bank", 7000, "12 Months", EmiChargeType.FIXED, 2000));
|
- |
|
| 280 |
schemes.add(new EmiScheme(8,1,2,12,"ICICI Bank", 7000, "12 Months", EmiChargeType.PERCENTAGE, 3));
|
- |
|
| 281 |
emiSchemes = schemes;*/
|
278 |
populateEmiSchemes();
|
| 282 |
return emiSchemes;
|
279 |
return emiSchemes;
|
| - |
|
280 |
}
|
| 283 |
}
|
281 |
}
|
| 284 |
|
282 |
|
| 285 |
public static long getGatewayId(long emiSchemeId){
|
283 |
public static long getGatewayId(long emiSchemeId){
|
| 286 |
for(EmiScheme scheme: emiSchemes){
|
284 |
for(EmiScheme scheme: emiSchemes){
|
| 287 |
if(scheme.getId() == emiSchemeId){
|
285 |
if(scheme.getId() == emiSchemeId){
|
| Line 297... |
Line 295... |
| 297 |
return scheme.getChargeValue();
|
295 |
return scheme.getChargeValue();
|
| 298 |
}
|
296 |
}
|
| 299 |
}
|
297 |
}
|
| 300 |
return 0;
|
298 |
return 0;
|
| 301 |
}
|
299 |
}
|
| - |
|
300 |
|
| - |
|
301 |
public static String getEmiSchemesInJSON(){
|
| - |
|
302 |
if(emiSchemesInJSON==null){
|
| - |
|
303 |
List<Map<String, Object>> schemeList = new ArrayList<Map<String,Object>>();
|
| - |
|
304 |
for(EmiScheme scheme: getEmiSchemes()){
|
| - |
|
305 |
Map<String,Object> arrayMap = new HashMap<String, Object>();
|
| - |
|
306 |
arrayMap.put("bankId",scheme.getBankId());
|
| - |
|
307 |
arrayMap.put("bankName",scheme.getBankName());
|
| - |
|
308 |
arrayMap.put("chargeType",scheme.getChargeType());
|
| - |
|
309 |
arrayMap.put("chargeValue",scheme.getChargeValue());
|
| - |
|
310 |
arrayMap.put("gatewayId",scheme.getGatewayId());
|
| - |
|
311 |
arrayMap.put("minAmount",scheme.getMinAmount());
|
| - |
|
312 |
arrayMap.put("tenure",scheme.getTenure());
|
| - |
|
313 |
arrayMap.put("tenureDescription",scheme.getTenureDescription());
|
| - |
|
314 |
arrayMap.put("id",scheme.getId());
|
| - |
|
315 |
schemeList.add(arrayMap);
|
| - |
|
316 |
}
|
| - |
|
317 |
return new Gson().toJson(schemeList);
|
| - |
|
318 |
} else {
|
| - |
|
319 |
return emiSchemesInJSON;
|
| - |
|
320 |
}
|
| - |
|
321 |
}
|
| 302 |
}
|
322 |
}
|
| 303 |
|
323 |
|