Subversion Repositories SmartDukaan

Rev

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