Subversion Repositories SmartDukaan

Rev

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