Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
317 ashish 1
/**
2
 * 
3
 */
4
package in.shop2020.serving.controllers;
5
 
650 rajveer 6
 
2306 vikas 7
import in.shop2020.datalogger.EventType;
4934 amit.gupta 8
import in.shop2020.logistics.DeliveryType;
9840 amit.gupta 9
import in.shop2020.logistics.ItemText;
11672 anikendra 10
import in.shop2020.logistics.LogisticsInfo;
4934 amit.gupta 11
import in.shop2020.logistics.LogisticsService;
11672 anikendra 12
import in.shop2020.logistics.LogisticsServiceException;
12620 amit.gupta 13
import in.shop2020.model.v1.catalog.ExclusiveAffiliateItemInfo;
2306 vikas 14
import in.shop2020.model.v1.catalog.Item;
15
import in.shop2020.model.v1.user.UserContextService.Client;
3242 vikas 16
import in.shop2020.serving.cache.EhcacheWrapper;
3561 rajveer 17
import in.shop2020.serving.services.ContentServingService;
18
import in.shop2020.serving.utils.SnippetType;
12620 amit.gupta 19
import in.shop2020.serving.utils.Utils;
3126 rajveer 20
import in.shop2020.thrift.clients.CatalogClient;
4934 amit.gupta 21
import in.shop2020.thrift.clients.LogisticsClient;
3126 rajveer 22
import in.shop2020.thrift.clients.UserClient;
2511 vikas 23
import in.shop2020.utils.DataLogger;
375 ashish 24
 
317 ashish 25
import java.io.IOException;
11672 anikendra 26
import java.text.SimpleDateFormat;
9840 amit.gupta 27
import java.util.ArrayList;
11672 anikendra 28
import java.util.Calendar;
29
import java.util.GregorianCalendar;
3225 vikas 30
import java.util.HashMap;
4934 amit.gupta 31
import java.util.List;
375 ashish 32
import java.util.Map;
11970 amit.gupta 33
import java.util.Set;
317 ashish 34
 
3225 vikas 35
import net.sf.ehcache.CacheManager;
36
 
5026 varun.gupt 37
import org.apache.commons.lang.StringUtils;
832 rajveer 38
import org.apache.log4j.Logger;
507 rajveer 39
import org.apache.struts2.convention.annotation.Action;
40
import org.apache.struts2.convention.annotation.Actions;
974 vikas 41
import org.apache.struts2.convention.annotation.Result;
2306 vikas 42
import org.apache.struts2.convention.annotation.Results;
11672 anikendra 43
import org.apache.thrift.TException;
2306 vikas 44
import org.json.JSONException;
45
import org.json.JSONObject;
317 ashish 46
 
4934 amit.gupta 47
import com.google.gson.Gson;
48
 
317 ashish 49
/**
50
 * 
650 rajveer 51
 * @author rajveer
317 ashish 52
 *
53
 */
650 rajveer 54
 
2306 vikas 55
@Results({
56
    @Result(name = "show", location = "entity-show.vm"),
5266 rajveer 57
    @Result(name = "redirect", location = "${redirectUrl}", type = "redirect", params={"statusCode", "301"})
2306 vikas 58
})
650 rajveer 59
public class EntityController extends BaseController {
60
 
61
	private static final long serialVersionUID = 1L;
1957 vikas 62
	private static Logger log = Logger.getLogger(Class.class);
11672 anikendra 63
	private Long firstItem =  0l;
3225 vikas 64
	private static final String PRODUCT_PROERTIES_SNIPPET_KEY = "PRODUCT_PROPERTIES";
65
	private static final String PRODUCT_SUMMARY_SNIPPET_KEY = "PRODUCT_SUMMARY";
66
	private static final String PRODUCT_SLIDEGUIDE_KEY = "SLIDEGUIDE";
11964 amit.gupta 67
	private static final String ENTITY_DETAIL_KEY = "ENTITY_DETAIL";
11672 anikendra 68
    private String entityLogisticsEstimation = "[]";
5037 rajveer 69
	private static final String DEFAULT_PINCODE = "110001";
317 ashish 70
	private String id;
2306 vikas 71
	private String redirectUrl;
620 rajveer 72
	private long productId;
2867 rajveer 73
	private boolean isMobile = false;
12620 amit.gupta 74
	private List<ExclusiveAffiliateItemInfo> entityItemsExclusiveInfo = new ArrayList<ExclusiveAffiliateItemInfo>();
2867 rajveer 75
 
12620 amit.gupta 76
	public List<ExclusiveAffiliateItemInfo> getEntityItemsExclusiveInfo() {
77
		return entityItemsExclusiveInfo;
78
	}
79
 
80
	public String getEntityItemsExclusiveInfoJson(){
81
		return new Gson().toJson(entityItemsExclusiveInfo);
82
	}
83
 
6084 rajveer 84
	private Map<String, Double> discounts = new HashMap<String, Double>();
3225 vikas 85
	private Map<String, String> snippets;
5094 phani.kuma 86
	private static Map<Long, String> label = new HashMap<Long, String>();
11672 anikendra 87
 
88
	public static Map<Integer, String> businessDayToActualDateMap = new HashMap<Integer, String>();
89
	private Map<String, String> deliveryEstimate = new HashMap<String, String>();
90
 
5094 phani.kuma 91
	static{
92
		setRetargettingLabel();
93
	}
3225 vikas 94
 
375 ashish 95
	public EntityController(){
96
		super();
97
	}
507 rajveer 98
 
974 vikas 99
	// GET /*/1000001
507 rajveer 100
	@Actions({
974 vikas 101
		@Action("/mobile-phones"),
5873 amit.gupta 102
		@Action("/cameras"),
1005 vikas 103
		@Action("/mobile-accessories"),
2460 rajveer 104
		@Action("/tablets"),
3715 rajveer 105
		@Action("/laptops"),
5182 varun.gupt 106
		@Action("/laptop-accessories"),
6593 amit.gupta 107
		@Action("/entity"),
8315 amit.gupta 108
		@Action("/music-players"),
12525 amit.gupta 109
		@Action("/smart-watches"),
12527 amit.gupta 110
		@Action("/projectors")
507 rajveer 111
	})
2306 vikas 112
    public String show() throws SecurityException, IOException, JSONException {
317 ashish 113
    	log.info("id=" + id);
637 rajveer 114
 
2306 vikas 115
    	String entityUrl = "";
116
    	String metaDescription = "";
117
    	String pageTitle = "";
2434 rajveer 118
    	String productName = "";
3830 chandransh 119
    	String categoryName = "";
120
    	String categoryUrl = "";
2652 rajveer 121
    	String displayAccessories = "FALSE";
3830 chandransh 122
    	String breadCrumb = "";
5347 amit.gupta 123
    	String parentCategory = "";
5930 amit.gupta 124
    	String compareCategory = "";
10190 amit.gupta 125
    	String isComparable = "false";
2306 vikas 126
    	try {
3225 vikas 127
    	    setSnippets();
128
            htmlSnippets.put("PRODUCT_PROPERTIES", snippets.get(PRODUCT_PROERTIES_SNIPPET_KEY));
129
    	    JSONObject productPropertiesInJson = new JSONObject(htmlSnippets.get("PRODUCT_PROPERTIES"));
2306 vikas 130
    	    entityUrl = productPropertiesInJson.getString("entityUrl");
131
    	    metaDescription = productPropertiesInJson.getString("metaDescription");
132
    	    pageTitle = productPropertiesInJson.getString("title");
2434 rajveer 133
    	    productName = productPropertiesInJson.getString("name");
3830 chandransh 134
    	    categoryName = productPropertiesInJson.getString("categoryName");
135
    	    categoryUrl = productPropertiesInJson.getString("categoryUrl");
2652 rajveer 136
    	    displayAccessories = productPropertiesInJson.getString("displayAccessories");
3830 chandransh 137
    	    breadCrumb = productPropertiesInJson.getString("breadCrumb");
5347 amit.gupta 138
    	    parentCategory = productPropertiesInJson.getString("parentCategory");
5930 amit.gupta 139
    	    compareCategory = productPropertiesInJson.getString("compareCategory");
10190 amit.gupta 140
    	    isComparable = productPropertiesInJson.getString("isComparable");
2306 vikas 141
    	}
142
    	catch (JSONException e) {
4965 rajveer 143
            log.warn("Unable to parse product properties JSON", e);
2306 vikas 144
            try {
3126 rajveer 145
                CatalogClient catalogClientService = new CatalogClient();
5945 mandeep.dh 146
                in.shop2020.model.v1.catalog.CatalogService.Client client = catalogClientService.getClient();
2306 vikas 147
 
148
                Item item = client.getItemsByCatalogId(productId).get(0);
2307 vikas 149
                redirectUrl = "/" + item.getBrand().toLowerCase().replace(" ", "-");
2306 vikas 150
            } catch (Exception e1) {
4965 rajveer 151
                log.warn("Unable to get items by catalog id", e1);
2306 vikas 152
                redirectUrl = "/";
153
            }
154
            log.info(redirectUrl);
155
            return "redirect";
156
       }
157
    	String currentUrl = request.getRequestURL().toString();
1197 varun.gupt 158
 
2306 vikas 159
    	if (!currentUrl.contains(entityUrl)) {
160
    	    redirectUrl = entityUrl;
161
    	    return "redirect";
162
    	}
163
 
2434 rajveer 164
    	//Extracting base url
1689 rajveer 165
    	String rootUrl = currentUrl.split("/")[2];
2194 varun.gupt 166
 
3225 vikas 167
    	htmlSnippets.put("PRODUCT_SUMMARY", snippets.get(PRODUCT_SUMMARY_SNIPPET_KEY));
1258 varun.gupt 168
    	htmlSnippets.put("PRODUCT_ID", productId + "");
169
    	htmlSnippets.put("PRODUCT_NAME", productName);
3830 chandransh 170
    	htmlSnippets.put("CATEGORY_NAME", categoryName);
171
    	htmlSnippets.put("CATEGORY_URL", categoryUrl);
1689 rajveer 172
    	htmlSnippets.put("PRODUCT_URL", currentUrl);
2194 varun.gupt 173
    	htmlSnippets.put("ROOT_URL", "http://" + rootUrl);
3225 vikas 174
		htmlSnippets.put("SLIDE_GUIDE", snippets.get(PRODUCT_SLIDEGUIDE_KEY));
1269 varun.gupt 175
		htmlSnippets.put("PAGE_TITLE", pageTitle.trim());
2306 vikas 176
		htmlSnippets.put("PAGE_METADESC", metaDescription);
3830 chandransh 177
		htmlSnippets.put("BREADCRUMB", breadCrumb);
5347 amit.gupta 178
		htmlSnippets.put("PARENT_CATEGORY", parentCategory);
5930 amit.gupta 179
		htmlSnippets.put("COMPARE_CATEGORY", compareCategory);
10190 amit.gupta 180
		htmlSnippets.put("IS_COMPARABLE", isComparable);
3830 chandransh 181
 
2652 rajveer 182
		if(displayAccessories.equals("TRUE")){
2867 rajveer 183
			setMobile(true);
2652 rajveer 184
		}
185
 
650 rajveer 186
		try {
5188 rajveer 187
			if(userinfo.getUserId() != -1){
188
				long itemId = Long.parseLong(id);
189
				UserClient userServiceClient = new UserClient();
190
				Client client = userServiceClient.getClient();
191
				client.updateBrowseHistory(userinfo.getUserId(), itemId);
1511 rajveer 192
			}
650 rajveer 193
 
449 rajveer 194
		} catch (Exception e) {
2949 chandransh 195
			log.warn("Unable to update the browsing history because of: ", e);
449 rajveer 196
		}
4494 varun.gupt 197
 
12616 anikendra 198
//		DataLogger.logData(EventType.PRODUCT_VIEW, getSessionId(), userinfo.getUserId(), userinfo.getEmail(), userinfo.getPincode(), 
199
//                productName, Long.toString(productId), StringUtils.substring(request.getHeader("referer"), 0, 500));			       
11672 anikendra 200
 
201
        try {
11676 amit.gupta 202
            setEntityLogisticsEstimation();
12620 amit.gupta 203
            getDeliveryEstimate(firstItem, userinfo.getPincode());
11672 anikendra 204
        } catch (Exception e1) {
205
            log.warn("Unable to get delivery estimates for "+ id);
206
        }
2149 vikas 207
		return "show";
317 ashish 208
    }
11672 anikendra 209
 
210
	/**
211
	 * 
212
	 * @return
213
	 */
214
	public void getDeliveryEstimate(Long itemId, String pincode){
215
		LogisticsClient logisticsServiceClient = null;
216
		String days = "-1";
217
		long businessDays = -1;
218
		boolean isCODAvailable=false;
219
		boolean isOTGAvailable=false;
220
		String codDays = "-1";
221
    	try {
222
			logisticsServiceClient = new LogisticsClient();
223
			LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
224
			LogisticsInfo logistincInfo = logisticsClient.getLogisticsEstimation(itemId, pincode, DeliveryType.PREPAID);
225
 
226
			if(logistincInfo.getDeliveryTime()!=-1L){
227
				days = getDeliveryDateString((int)logistincInfo.getDeliveryTime(), DeliveryType.PREPAID);
228
				if(logistincInfo.isCodAllowed()){
229
					codDays = getDeliveryDateString((int)(logistincInfo.getDeliveryTime()), DeliveryType.COD);
230
				}
231
			}
232
			businessDays = logistincInfo.getDeliveryTime();
233
			isCODAvailable = logistincInfo.isCodAllowed();
234
			isOTGAvailable = logistincInfo.isOtgAvailable();
235
 
236
			log.info("busines days = " + businessDays + "is COD avaialbale " + isCODAvailable + "is OTG available " + isOTGAvailable + " days "+days+" cod days "+codDays);
237
    	} catch (LogisticsServiceException e)	{
238
    		log.error("Unable to get estimate/COD availability for " + itemId, e);
239
		} catch(TException e)	{
240
 
241
		} catch (Exception e)	{
242
 
243
		}
244
		deliveryEstimate.put("delivery_estimate", days);
245
		deliveryEstimate.put("cod_delivery_estimate", codDays);
246
		deliveryEstimate.put("is_cod_available_for_location", Boolean.toString(isCODAvailable));
247
		deliveryEstimate.put("on_time_guarantee", Boolean.toString(isOTGAvailable));
248
		deliveryEstimate.put("business_days", businessDays + "");        	
249
	}
250
 
251
	private  static String getDeliveryDateString(int days, DeliveryType type) throws TException {
252
    	Calendar now = new GregorianCalendar();
253
    	int hour = now.get(Calendar.HOUR_OF_DAY);
254
    	if(type == DeliveryType.COD && hour < 15){
255
			days = days + 1;
256
		}
257
    	if(businessDayToActualDateMap.containsKey(days)){
258
    		if(hour != 0){	
259
    			return businessDayToActualDateMap.get(days);
260
    		}
261
    		businessDayToActualDateMap.clear();
262
		}
263
 
264
    	now.set(now.get(Calendar.YEAR), now.get(Calendar.MONTH), now.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
265
 
266
    	LogisticsClient logisticsServiceClient = null;
267
		logisticsServiceClient = new LogisticsClient();
268
		LogisticsService.Client logisticsClient = logisticsServiceClient.getClient();
269
 
270
    	int newdays = (int) logisticsClient.adjustDeliveryDays(now.getTimeInMillis(), days);
271
    	now.add(Calendar.DAY_OF_MONTH, newdays);
272
 
273
    	SimpleDateFormat dateformat = new SimpleDateFormat("EEE dd-MMM-yy");
274
    	if(newdays == 1){
275
    		businessDayToActualDateMap.put(days, "Tomorrow, " + dateformat.format(now.getTime()));
276
    	}else{
277
    		businessDayToActualDateMap.put(days, dateformat.format(now.getTime()));
278
    	}
279
    	return businessDayToActualDateMap.get(days);
280
	}
3225 vikas 281
 
317 ashish 282
    /**
283
     * 
284
     * @param id
285
     */
286
    public void setId(String id) {
4831 varun.gupt 287
    	String[] tokens = id.split("-");
288
    	this.id = tokens[tokens.length - 1];
974 vikas 289
    	this.productId = Long.parseLong(this.id);
317 ashish 290
    }
291
 
387 rajveer 292
	public Map<String,String> getHtmlSnippets(){
388 rajveer 293
		System.out.println(" getHtmlSnippets  is called");
387 rajveer 294
		return htmlSnippets;
375 ashish 295
	}
388 rajveer 296
 
449 rajveer 297
	public String getSlideGuideSnippet(){
388 rajveer 298
		return htmlSnippets.get("SLIDE_GUIDE");
299
	}
300
 
2306 vikas 301
	public String getRedirectUrl(){
5493 rajveer 302
		String query = request.getQueryString();
303
		if(query!=null){
304
			return redirectUrl + "?" + query;
305
		}
306
		return redirectUrl;
2306 vikas 307
    }
308
 
449 rajveer 309
	public String getProductSummarySnippet(){
310
		return htmlSnippets.get("PRODUCT_SUMMARY");
311
	}
312
 
974 vikas 313
	public String getPageTitleSnippet(){
314
		return htmlSnippets.get("PAGE_TITLE");
315
	}
316
 
317
	public String getPageMetaDescSnippet(){
318
		return htmlSnippets.get("PAGE_METADESC");
319
	}
320
 
321
 
1197 varun.gupt 322
	public String getProductName()	{
323
		return htmlSnippets.get("PRODUCT_NAME");
324
	}
5347 amit.gupta 325
 
5930 amit.gupta 326
	public String getCompareCategory(){
327
		return htmlSnippets.get("COMPARE_CATEGORY");
5347 amit.gupta 328
	}
329
 
5930 amit.gupta 330
	public String getCompareCategoryLowerCase(){
331
		String compareCategory = htmlSnippets.get("COMPARE_CATEGORY");
332
		return compareCategory.toLowerCase();
5347 amit.gupta 333
	}
1258 varun.gupt 334
 
3830 chandransh 335
	public String getCategoryName()	{
336
		return htmlSnippets.get("CATEGORY_NAME");
337
	}
338
 
339
	public String getCategoryUrl()	{
340
		return htmlSnippets.get("CATEGORY_URL");
341
	}
342
 
1258 varun.gupt 343
	public String getProductId()	{
344
		return htmlSnippets.get("PRODUCT_ID");
345
	}
346
 
347
	public String getProductUrl()	{
348
		return htmlSnippets.get("PRODUCT_URL");
349
	}
1364 varun.gupt 350
 
351
	public String getRootUrl()	{
352
		return htmlSnippets.get("ROOT_URL");
353
	}
2867 rajveer 354
 
3830 chandransh 355
	public String getBreadCrumb(){
356
		return htmlSnippets.get("BREADCRUMB");
357
	}
10190 amit.gupta 358
 
359
	public String isComparable(){
360
		return htmlSnippets.get("IS_COMPARABLE");
361
	}
3830 chandransh 362
 
2867 rajveer 363
	/**
364
	 * @param isMobile the isMobile to set
365
	 */
366
	public void setMobile(boolean isMobile) {
367
		this.isMobile = isMobile;
2652 rajveer 368
	}
2867 rajveer 369
 
370
	/**
371
	 * @return the isMobile
372
	 */
373
	public boolean isMobile() {
374
		return isMobile;
375
	}
3225 vikas 376
 
377
    private void setSnippets() {
378
        EhcacheWrapper<Long, Map<String, String>> productSnippetsCache = new EhcacheWrapper<Long, Map<String, String>>(
379
                EhcacheWrapper.PRODUCT_PAGE_SNIPPET_CACHE_NAME, CacheManager.create());
3561 rajveer 380
        if(sourceId == -1){
381
        	snippets = productSnippetsCache.get(productId);
382
        }
3225 vikas 383
        if (snippets == null) {
384
            log.info("Getting product snippet for :" + productId);
385
            snippets = new HashMap<String, String>();
3561 rajveer 386
            snippets.put(PRODUCT_PROERTIES_SNIPPET_KEY, ContentServingService.getSnippet(SnippetType.PRODUCT_PROPERTIES_SNIPPET, productId+"", sourceId));
387
            snippets.put(PRODUCT_SUMMARY_SNIPPET_KEY, ContentServingService.getSnippet(SnippetType.PRODUCT_DETAIL_SNIPPET, productId+"", sourceId));
388
            snippets.put(PRODUCT_SLIDEGUIDE_KEY, ContentServingService.getSnippet(SnippetType.SLIDE_GUIDE_SNIPPET, productId+"", sourceId));
11964 amit.gupta 389
        	snippets.put(ENTITY_DETAIL_KEY, ContentServingService.getJSON(productId + ""));
3561 rajveer 390
            if(sourceId == -1){
391
            	productSnippetsCache.put(productId, snippets);
392
            }
3225 vikas 393
            return;
394
        }
395
        log.info("Loaded from cache product snippet for :" + productId);
396
    }
4494 varun.gupt 397
 
398
    public Map<String, Double> getDiscounts()	{
399
    	return discounts;
400
    }
4934 amit.gupta 401
 
11672 anikendra 402
    public void setEntityLogisticsEstimation(){
9840 amit.gupta 403
    	List<ItemText> itemTexts = null; 
4934 amit.gupta 404
    	try {
405
    		LogisticsClient cl = new LogisticsClient();
406
            LogisticsService.Client client = cl.getClient();
9840 amit.gupta 407
            itemTexts = client.getEntityLogisticsEstimation(productId, DEFAULT_PINCODE, DeliveryType.PREPAID );
10195 amit.gupta 408
            if(itemTexts!=null){
409
            	List<Long> items = new ArrayList<Long>();
410
            	for(ItemText itemText : itemTexts) {
411
            		items.add(itemText.getItemId());
12633 amit.gupta 412
            		ExclusiveAffiliateItemInfo ea =  Utils.getExclusiveAffiliateItems().get(itemText.getItemId());
413
            		if(ea!=null){
414
            			entityItemsExclusiveInfo.add(ea);
415
            		}
10195 amit.gupta 416
            	}
12089 amit.gupta 417
            	log.info("Items before: " + itemTexts);
11970 amit.gupta 418
            	if(userinfo.isPrivateDealUser()){
11973 amit.gupta 419
            		log.info("Private Deal user identified");
11970 amit.gupta 420
            		try {
421
            			CatalogClient catalogClientService = new CatalogClient();
422
            			in.shop2020.model.v1.catalog.CatalogService.Client client1 = catalogClientService.getClient();
423
            			Set<Long> deals = client1.getAllActivePrivateDeals(items, 0).keySet();
424
            			int lastIndex = 0;
425
            			for(int i=0;i<itemTexts.size();i++) {
426
            				ItemText it = itemTexts.get(i);
427
            				if(it.getDisplayText().equals("NOTIFY ME")) {
428
            					break;
429
            				}
12087 amit.gupta 430
                    		if(deals.contains(it.getItemId()) && lastIndex > 0) {
431
                    			itemTexts.add(i-lastIndex,itemTexts.remove(i));
12088 amit.gupta 432
                    		}else if(!deals.contains(it.getItemId())){
11970 amit.gupta 433
                    			lastIndex++;
434
                    		}
435
                    	}
436
            		} catch (Exception e1) {
437
            			log.warn("Unable to get items by catalog id", e1);
438
            			redirectUrl = "/";
439
            		}
11972 amit.gupta 440
            		items = new ArrayList<Long>();
441
            		for(ItemText itemText : itemTexts) {
442
                		items.add(itemText.getItemId());
443
                	}
12089 amit.gupta 444
            		log.info("Items after: " + itemTexts);
11970 amit.gupta 445
            	}
11672 anikendra 446
            	firstItem = items.get(0);
447
            	entityLogisticsEstimation = new Gson().toJson(items);
448
            	return;
10195 amit.gupta 449
            }
4934 amit.gupta 450
        } catch (Exception e1) {
10190 amit.gupta 451
            log.error("Unable to get items for productId: "+  productId, e1);
4934 amit.gupta 452
        }
11672 anikendra 453
        entityLogisticsEstimation = "[]";
10195 amit.gupta 454
 
4934 amit.gupta 455
    }
5094 phani.kuma 456
 
11672 anikendra 457
    public String getEntityLogisticsEstimation() {
458
    	return entityLogisticsEstimation;
459
    }
460
 
5094 phani.kuma 461
    private static void setRetargettingLabel() {
462
    	label.put((long) 1002160, "6EIBCKjf1wMQ6Pua0wM"); //Samsung Galaxy Y S5360
463
    	label.put((long) 1002106, "JFGVCKCt8gMQ6Pua0wM"); //Sony Ericsson Xperia Neo V MT11i
464
    	label.put((long) 1003230, "ArAYCJiu8gMQ6Pua0wM"); //Micromax Funbook Tab P300
465
    	label.put((long) 1002151, "j0c_CJCv8gMQ6Pua0wM"); //HTC Explorer (Pico) A310e
466
    	label.put((long) 1000607, "7H3QCKDh8wMQ6Pua0wM"); //SanDisk MicroSD 8GB
467
    	label.put((long) 1003213, "QtGQCJji8wMQ6Pua0wM"); //Micromax SUPERFONE Gossip A78
468
    	label.put((long) 1002530, "0YNbCJDj8wMQ6Pua0wM"); //Samsung Champ Deluxe Duos C3312
469
    	label.put((long) 1003039, "pQUaCIjk8wMQ6Pua0wM"); //Samsung Star 3 Duos S5222
470
    	label.put((long) 1002575, "zcYTCIDl8wMQ6Pua0wM"); //Samsung Galaxy Y Duos S6102
471
    }
472
 
473
    public String getRetargettingLabel() {
474
    	return label.get(this.productId);
475
    }
7853 amit.gupta 476
 
477
 
478
    public String getEmiObject(){
479
    	return ProceedToPayController.getEmiSchemesInJSON();
480
    }
5491 rajveer 481
 
11672 anikendra 482
    public String getDeliveryEstimate() {
483
    	return new Gson().toJson(this.deliveryEstimate);
484
    }
11964 amit.gupta 485
 
486
    public String getProductJSON(){
487
    	if(userinfo.isPrivateDealUser()){
488
			return snippets.get(ENTITY_DETAIL_KEY);
489
		} else {
490
			return null;
491
		}
492
    }
1197 varun.gupt 493
}