Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
410 rajveer 1
package in.shop2020.serving.controllers;
2
 
2263 vikas 3
import in.shop2020.datalogger.EventType;
7839 rajveer 4
import in.shop2020.logistics.DeliveryType;
5945 mandeep.dh 5
import in.shop2020.model.v1.catalog.CatalogService.Client;
6903 anupam.sin 6
import in.shop2020.model.v1.catalog.Insurer;
1981 varun.gupt 7
import in.shop2020.model.v1.catalog.Item;
8
import in.shop2020.model.v1.user.Cart;
9
import in.shop2020.model.v1.user.Line;
555 chandransh 10
import in.shop2020.model.v1.user.ShoppingCartException;
572 chandransh 11
import in.shop2020.model.v1.user.UserContextService;
3599 rajveer 12
import in.shop2020.serving.services.ContentServingService;
2137 chandransh 13
import in.shop2020.serving.utils.FormattingUtils;
3599 rajveer 14
import in.shop2020.serving.utils.SnippetType;
3126 rajveer 15
import in.shop2020.thrift.clients.CatalogClient;
16
import in.shop2020.thrift.clients.UserClient;
2511 vikas 17
import in.shop2020.utils.DataLogger;
410 rajveer 18
 
2419 vikas 19
import java.util.ArrayList;
20
import java.util.HashMap;
21
import java.util.List;
22
import java.util.Map;
23
import java.util.StringTokenizer;
24
 
6736 amit.gupta 25
import org.apache.commons.lang.StringUtils;
832 rajveer 26
import org.apache.log4j.Logger;
1614 rajveer 27
import org.apache.struts2.convention.annotation.Action;
4046 varun.gupt 28
import org.apache.struts2.convention.annotation.Actions;
1614 rajveer 29
import org.apache.struts2.convention.annotation.InterceptorRef;
801 rajveer 30
import org.apache.struts2.convention.annotation.Result;
1614 rajveer 31
import org.apache.struts2.convention.annotation.Results;
410 rajveer 32
import org.apache.struts2.interceptor.ParameterAware;
33
import org.apache.thrift.TException;
34
 
1614 rajveer 35
 
36
@Results({
4046 varun.gupt 37
    @Result(name = "index", location = "cart-index.vm"),
38
	@Result(name="redirect", type="redirectAction", params = {"actionName" , "cart"}),
1614 rajveer 39
	@Result(name="failure", location="cart-failure.vm"),
40
	@Result(name="success", location="cart-success.vm")
41
})
42
 
507 rajveer 43
public class CartController extends BaseController implements ParameterAware{
410 rajveer 44
 
45
	private static final long serialVersionUID = 1L;
1957 vikas 46
	private static Logger log = Logger.getLogger(Class.class);
507 rajveer 47
	Map<String, String[]> reqparams = null;
4217 varun.gupt 48
 
4046 varun.gupt 49
	private int variationId = 0;
2137 chandransh 50
    private String totalamount;
410 rajveer 51
 
572 chandransh 52
	private String errorMsg = "";
3970 varun.gupt 53
	private String cartMsg = "";
410 rajveer 54
 
1981 varun.gupt 55
	private String pincode = "110001";
56
 
57
	private String couponCode = null;
58
 
2137 chandransh 59
	private String discountedAmount;
1981 varun.gupt 60
 
2810 rajveer 61
	private long itemId;
6903 anupam.sin 62
    private String insuranceResult;
63
 
64
    private boolean toInsure;
65
    private long productId;
2810 rajveer 66
 
410 rajveer 67
	public CartController(){
507 rajveer 68
		super();
69
	}
70
 
71
	 // GET /cart
4046 varun.gupt 72
	@Actions({
73
		@Action(value="cart", interceptorRefs={@InterceptorRef("myDefault")}),
4453 varun.gupt 74
		@Action(value="cart1", interceptorRefs={@InterceptorRef("myDefault")})
4046 varun.gupt 75
	})
4344 anupam.sin 76
	public String index()  {
4046 varun.gupt 77
		this.setVariationId(request.getRequestURI());
78
		log.info(this.getVariationId());
1614 rajveer 79
 
4046 varun.gupt 80
		long cartId = userinfo.getCartId();
81
 
82
	    if(cartId != -1){
83
        	try {
84
    			UserContextService.Client userClient = (new UserClient()).getClient();
6736 amit.gupta 85
    			List<String> cartResponse  = userClient.validateCart(cartId, sourceId);
86
    			errorMsg = cartResponse.get(0);
87
    			if(StringUtils.isNotEmpty(cartResponse.get(1))) {
88
    				addActionMessage(cartResponse.get(1));
89
    			}
90
    			log.info("Cart Change/EMI Message rcvd from the service is:" + errorMsg);
4046 varun.gupt 91
 
92
    			// As per ticket #119 in trac
93
    			Cart cart = userClient.getCart(cartId);
94
    			int totalItems = cart.getLinesSize();
95
    			double totalAmount = cart.getTotalPrice();
96
				userinfo.setTotalItems(totalItems);
97
				userinfo.setTotalAmount(totalAmount);
98
    		} catch (Exception e) {
99
    			// This exception can be ignored for showing the cart. Not so
100
    			// innocent when this occurs at the time of checkout or when the
101
    			// user is proceeding to pay.
102
    		    log.warn("Unable to validate the cart: ", e);
103
    		}
104
	    }
3970 varun.gupt 105
		return "index";
106
	}
4046 varun.gupt 107
 
572 chandransh 108
	// POST /entity
1614 rajveer 109
 
110
	@Action(value="addtocart",interceptorRefs={@InterceptorRef("createuser"),@InterceptorRef("myDefault")})
572 chandransh 111
	public String create() {
112
		log.info("CartController.create");
555 chandransh 113
 
572 chandransh 114
		printParams();
115
 
116
		long userId = userinfo.getUserId();
117
		long cartId = userinfo.getCartId();
118
 
1614 rajveer 119
		log.info("user id is " + userId);
120
		log.info("cart id is " + cartId);
121
 
572 chandransh 122
		log.info("item id is " + this.reqparams.get("productid"));
1614 rajveer 123
 
637 rajveer 124
		String itemIds = "";
572 chandransh 125
		if (this.reqparams.get("productid") != null) {
126
			itemIds = this.reqparams.get("productid")[0];
637 rajveer 127
		}else{
128
			return "failure";
572 chandransh 129
		}
637 rajveer 130
 
572 chandransh 131
		StringTokenizer tokenizer = new StringTokenizer(itemIds, "_");
132
		while (tokenizer.hasMoreTokens()) {
2810 rajveer 133
			itemId = Long.parseLong(tokenizer.nextToken());
572 chandransh 134
 
135
			try {
3126 rajveer 136
				UserClient userServiceClient = new UserClient();
572 chandransh 137
				UserContextService.Client userClient = userServiceClient.getClient();
762 rajveer 138
				if (cartId == 0){
5342 rajveer 139
					cartId = userClient.getUserById(userId).getActiveCartId();
762 rajveer 140
				}
3561 rajveer 141
				// If we add multiple items to cart and get some message from service, 
142
				// first message to be preserved and presented to the user.
2099 rajveer 143
				if(cartMsg.equals("")){
3561 rajveer 144
				    cartMsg = userClient.addItemToCart(cartId, itemId, 1, sourceId);
2036 rajveer 145
			    }else{
3561 rajveer 146
			        userClient.addItemToCart(cartId, itemId, 1, sourceId);
2036 rajveer 147
			    }
762 rajveer 148
				userinfo.setCartId(cartId);
149
				int totalItems = userClient.getCart(cartId).getLinesSize();
150
				userinfo.setTotalItems(totalItems);
572 chandransh 151
			} catch (TException e) {
2944 chandransh 152
			    log.error("Unable to create or add to cart because of: ", e);
572 chandransh 153
			} catch (Exception e) {
2944 chandransh 154
			    log.error("Unable to create or add to cart because of: ", e);
507 rajveer 155
			}
156
 
572 chandransh 157
		}
3185 vikas 158
        DataLogger.logData(EventType.ADD_TO_CART, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),
2157 vikas 159
                Long.toString(cartId), itemIds);
572 chandransh 160
		return "success";
161
	}		
162
 
1614 rajveer 163
 
4217 varun.gupt 164
	// DELETE /entity
165
	public String destroy()	{
166
		log.info("CartController.destroy");
167
		printParams();
168
		log.info("item id is " + this.request.getParameter("productid"));
169
 
170
		String itemIdString = this.request.getParameter("productid");
171
		itemId = Long.parseLong(itemIdString);
172
 
173
		if(userinfo.getCartId() == -1)	{
174
			log.info("Cart does not exist. Nothing to delete.");
175
		} else	{
176
			if(deleteItemFromCart(userinfo.getCartId(), itemId, userinfo.getUserId(), userinfo.isSessionId()))	{
177
				updateUserSessionInfo(userinfo.getCartId());
178
				DataLogger.logData(EventType.DELETE_FROM_CART, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),
2157 vikas 179
                        Long.toString(userinfo.getCartId()), itemIdString);
4217 varun.gupt 180
				return "redirect";
507 rajveer 181
			}
182
		}
4217 varun.gupt 183
		return "redirect";
184
	}
185
 
186
	// DELETE /entity
187
	public String update() {
188
		log.info("CartController.update");
189
		printParams();
190
		log.info("item id is " + this.request.getParameter("productid"));
191
		log.info("item quantity is " + this.request.getParameter("quantity"));
192
		String itemIdString = this.request.getParameter("productid");
193
		String quantityString = this.request.getParameter("quantity");
194
		long itemId = Long.parseLong(itemIdString);
195
		long quantity = Long.parseLong(quantityString);
196
 
197
		if(quantity <= 0)	{
198
			log.info("Not valid item quantity. Unable to change item quantity.");
199
		} else	{
200
			if(updateItemQuantityInCart(userinfo.getCartId(), itemId, quantity))	{
201
				DataLogger.logData(EventType.UPDATE_CART_QUANTITY, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),
202
                        Long.toString(userinfo.getCartId()), Long.toString(itemId), Long.toString(quantity));
203
				return "redirect";
507 rajveer 204
			}
4217 varun.gupt 205
		}
206
		DataLogger.logData(EventType.UPDATE_CART_QUANTITY_FAILED, getSessionId(), userinfo.getUserId(), userinfo.getEmail(),
2157 vikas 207
                    Long.toString(userinfo.getCartId()), Long.toString(itemId), Long.toString(quantity));
4217 varun.gupt 208
		addActionError("Unable to update the quantity");
209
		return "redirect";
210
	}
3970 varun.gupt 211
 
507 rajveer 212
    public void printParams(){
213
    	for(String param : reqparams.keySet()) {
214
    		log.info("param name is " + param);
215
    		log.info("param first is " + reqparams.get(param)[0]);
216
    	}
217
    	log.info(this.reqparams);
218
    }
219
 
762 rajveer 220
	private boolean updateItemQuantityInCart(long cartId, long itemId, long quantity){
221
		try {
3126 rajveer 222
			UserClient userContextServiceClient = new UserClient();
762 rajveer 223
			in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
224
 
3562 rajveer 225
			userClient.addItemToCart(cartId, itemId, quantity, sourceId);
762 rajveer 226
			return true;
227
		} catch (ShoppingCartException e) {
2944 chandransh 228
		    log.error("Unable to update the item quantity in the cart: ", e);
762 rajveer 229
		} catch (TException e) {
2944 chandransh 230
		    log.error("Unable to update the item quantity in the cart: ", e);
762 rajveer 231
		} catch (Exception e) {
2944 chandransh 232
		    log.error("Unable to update the item quantity in the cart: ", e);
762 rajveer 233
		}
234
		return false;
235
	}
236
 
237
	private boolean deleteItemFromCart(long cartId, long catalogItemId, long userId, boolean isSessionId){
238
		try {
3126 rajveer 239
			UserClient userContextServiceClient = new UserClient();
762 rajveer 240
			in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
4217 varun.gupt 241
 
762 rajveer 242
			userClient.deleteItemFromCart(cartId, catalogItemId);
4217 varun.gupt 243
			return true;
762 rajveer 244
		} catch (ShoppingCartException e) {
2944 chandransh 245
		    log.error("Unable to delete item from cart: ", e);
762 rajveer 246
		} catch (TException e) {
2944 chandransh 247
		    log.error("Unable to delete item from cart: ", e);
762 rajveer 248
		} catch (Exception e) {
2944 chandransh 249
		    log.error("Unable to delete item from cart: ", e);
762 rajveer 250
		}
251
 
252
		return false;
253
	}
254
 
3830 chandransh 255
	private void updateUserSessionInfo(long cartId) {
3126 rajveer 256
		UserClient userContextServiceClient = null;
762 rajveer 257
		try {
3126 rajveer 258
			userContextServiceClient = new UserClient();
762 rajveer 259
			in.shop2020.model.v1.user.UserContextService.Client userClient = userContextServiceClient.getClient();
3830 chandransh 260
			Cart cart = userClient.getCart(cartId);
261
			userinfo.setTotalItems(cart.getLinesSize());
262
			userinfo.setTotalAmount(cart.getTotalPrice());
762 rajveer 263
		} catch (ShoppingCartException e) {
2944 chandransh 264
		    log.error("Unable to get the cart from service: ", e);
762 rajveer 265
		} catch (TException e) {
2944 chandransh 266
		    log.error("Unable to get the cart from service: ", e);
762 rajveer 267
		} catch (Exception e) {
2944 chandransh 268
		    log.error("Unable to get the cart from service: ", e);
762 rajveer 269
		}
270
	}
1981 varun.gupt 271
 
272
	public List<Map<String,String>> getCartItems() {
273
	    List<Map<String,String>> items = null;
762 rajveer 274
 
3126 rajveer 275
        UserClient userServiceClient = null;
1981 varun.gupt 276
        in.shop2020.model.v1.user.UserContextService.Client userClient = null;
3126 rajveer 277
        CatalogClient catalogServiceClient  = null;
5945 mandeep.dh 278
        in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = null;
762 rajveer 279
 
2137 chandransh 280
        FormattingUtils formattingUtils = new FormattingUtils();
281
 
1981 varun.gupt 282
        try    {
3126 rajveer 283
            catalogServiceClient = new CatalogClient();
1981 varun.gupt 284
            catalogClient = catalogServiceClient.getClient();
3126 rajveer 285
            userServiceClient = new UserClient();
1981 varun.gupt 286
            userClient = userServiceClient.getClient();
287
 
288
            pincode = userClient.getDefaultPincode(userinfo.getUserId());
289
            Cart cart = userClient.getCart(userinfo.getCartId());
290
            List<Line> lineItems = cart.getLines();
6903 anupam.sin 291
            double totalInsuranceAmount = 0.0;
292
            boolean isAnyItemInsured = false;
1981 varun.gupt 293
            if(lineItems.size() != 0)  {
294
                items = new ArrayList<Map<String,String>>();
295
 
296
                for (Line line : lineItems)    {
297
                    Map<String, String> itemdetail = new HashMap<String, String>();
3561 rajveer 298
 
6903 anupam.sin 299
                    double insuranceAmount = 0;
3561 rajveer 300
                    Item item = catalogClient.getItemForSource(line.getItemId(), sourceId);
6903 anupam.sin 301
                    Insurer insurer = null;
3561 rajveer 302
 
6903 anupam.sin 303
                    if(line.getInsurer() != 0) {
6921 anupam.sin 304
                        insuranceAmount = catalogClient.getInsuranceAmount(item.getId(), 
305
                                (line.getDiscountedPrice() == 0 ? line.getActualPrice() : line.getDiscountedPrice()),
306
                                item.getPreferredInsurer(), 
307
                                (long)line.getQuantity());
6903 anupam.sin 308
                        isAnyItemInsured = true;
309
                    } else if (item.getPreferredInsurer() != 0) {
6921 anupam.sin 310
                        insuranceAmount = catalogClient.getInsuranceAmount(item.getId(), 
311
                                (line.getDiscountedPrice() == 0 ? line.getActualPrice() : line.getDiscountedPrice()),
312
                                item.getPreferredInsurer(), 
313
                                (long)line.getQuantity());
6903 anupam.sin 314
                        //Insurer insurer = catalogClient.getInsurer(item.getPreferredInsurer());
315
                    } else {
316
                        insuranceAmount = 0;
317
                    }
318
 
1981 varun.gupt 319
                    String itemName = ((item.getBrand() != null) ? item.getBrand() + " " : "")
320
                                            + ((item.getModelName() != null) ? item.getModelName() + " " : "") 
3830 chandransh 321
                                            + (( item.getModelNumber() != null ) ? item.getModelNumber() + " " : "" );
1981 varun.gupt 322
 
3830 chandransh 323
                    String itemColor = "";
324
                    if(item.getColor() != null && !item.getColor().trim().equals("NA"))
325
                        itemColor = "Color - " + item.getColor();
326
 
1981 varun.gupt 327
                    itemdetail.put("ITEM_NAME", itemName);
3830 chandransh 328
                    itemdetail.put("ITEM_COLOR", itemColor);
1981 varun.gupt 329
                    itemdetail.put("ITEM_ID", line.getItemId() + "");
330
                    itemdetail.put("CATALOG_ID", item.getCatalogItemId() + "");
331
                    itemdetail.put("ITEM_QUANTITY", ((int)line.getQuantity()) + "");
2137 chandransh 332
                    itemdetail.put("MRP", formattingUtils.formatPrice(item.getMrp()));
333
                    itemdetail.put("SELLING_PRICE", formattingUtils.formatPrice(item.getSellingPrice()));
334
                    itemdetail.put("TOTAL_PRICE", formattingUtils.formatPrice(((item.getSellingPrice() * line.getQuantity()))));
7839 rajveer 335
                    itemdetail.put("SHIPPING_TIME", EstimateController.getDeliveryDateString(line.getEstimate(), DeliveryType.PREPAID));
7845 rajveer 336
                    itemdetail.put("COD_SHIPPING_TIME", EstimateController.getDeliveryDateString(line.getEstimate(), DeliveryType.COD));
4217 varun.gupt 337
					itemdetail.put("BEST_DEAL_TEXT", item.getBestDealText());
6903 anupam.sin 338
					itemdetail.put("IS_INSURABLE", item.getPreferredInsurer() + "");
339
					itemdetail.put("IS_INSURED", (line.getInsurer() == 0 ? false : true) + "");
340
					itemdetail.put("INSURANCE_AMOUNT", insuranceAmount + "");
1981 varun.gupt 341
 
6903 anupam.sin 342
					totalInsuranceAmount += insuranceAmount;
1981 varun.gupt 343
                    items.add(itemdetail);
344
                }
345
            }
2137 chandransh 346
 
6903 anupam.sin 347
//            if(isAnyItemInsured == false) {
348
//                totalamount = formattingUtils.formatPrice(cart.getTotalPrice() + totalInsuranceAmount);
349
//                discountedAmount = formattingUtils.formatPrice(cart.getDiscountedPrice() + totalInsuranceAmount);
350
//            } else {
351
                totalamount = formattingUtils.formatPrice(cart.getTotalPrice());
352
                discountedAmount = formattingUtils.formatPrice(cart.getDiscountedPrice());
353
//            }
354
 
1981 varun.gupt 355
            couponCode = cart.getCouponCode() == null ? "" : cart.getCouponCode();
6903 anupam.sin 356
        } catch (Exception e){
2944 chandransh 357
            log.error("Unable to get the cart details becasue of: ", e);
1981 varun.gupt 358
        }
359
        return items;
507 rajveer 360
	}
6903 anupam.sin 361
 
362
	public String insureItem() {
363
	    //TODO : Call a method in userservice that insures the item.
364
	    insuranceResult = "";
365
	    try {
366
	        UserContextService.Client usc = new UserClient().getClient();
367
            if(usc.insureItem(productId, userinfo.getCartId(), toInsure)) {
368
                setInsuranceResult("SUCCESS");
369
            } else {
370
                setInsuranceResult("FAILURE");
371
            }
372
        } catch (Exception e) {
373
            log.error("Unable to insure item : " + productId + " for cart : " + userinfo.getCartId(), e);
374
            setInsuranceResult("FAILURE");
375
        }
376
	    return "insurance-result";
377
	}
1981 varun.gupt 378
 
3080 rajveer 379
	public long getItemId(){
380
		return this.itemId;
381
	}
382
 
2137 chandransh 383
	public String getTotalAmount() {
1981 varun.gupt 384
	    return totalamount;
385
	}
507 rajveer 386
 
1981 varun.gupt 387
	public String getPinCode() {
388
	    return pincode;
507 rajveer 389
	}
390
 
1981 varun.gupt 391
	public String getCouponCode()  {
392
	    return couponCode;
393
	}
394
 
395
	public String getDiscountedAmount()   {
2137 chandransh 396
	    return discountedAmount;
1981 varun.gupt 397
	}
398
 
399
	public String getErrorMsg()    {
400
	    return errorMsg;
401
	}
402
 
507 rajveer 403
	public long getNumberOfItems(){
404
		return userinfo.getTotalItems();
405
	}
650 rajveer 406
 
2036 rajveer 407
	public String getCartMsg(){
2099 rajveer 408
	    if(cartMsg.equals("")){
409
	        return null;
410
	    }
411
	    return cartMsg;
2036 rajveer 412
	}
413
 
2810 rajveer 414
	public String getSnippets(){
415
    	String snippets = "";
3126 rajveer 416
		CatalogClient csc;
2810 rajveer 417
		try {
3126 rajveer 418
			csc = new CatalogClient();
2810 rajveer 419
			List<Long> similarItems = csc.getClient().getSimilarItemsCatalogIds(0, 4, itemId);
420
			for(Long catalogId: similarItems){
3599 rajveer 421
				snippets = snippets + ContentServingService.getSnippet(SnippetType.WIDGET_SNIPPET, catalogId+"", sourceId);
2810 rajveer 422
			}
423
		} catch (Exception e) {
424
			log.error("Unable to initialise Catalogservice Client");
425
		}	    
426
	    return snippets;
427
    }
428
 
650 rajveer 429
	@Override
430
	public void setParameters(Map<String, String[]> parameters) {
431
		this.reqparams = parameters;	
432
	}
3903 varun.gupt 433
 
434
	@Override
435
	public String getHeaderSnippet() {
436
		String url = request.getQueryString();
437
		if (url == null) {
438
			url = "";
439
		} else {
440
			url = "?" + url;
441
		}
442
		url = request.getRequestURI() + url;
6152 amit.gupta 443
		return pageLoader.getHeaderHtml(userinfo.isLoggedIn(), userinfo.getEmail(), userinfo.getTotalItems(), url , 0, false);
3903 varun.gupt 444
	}
3970 varun.gupt 445
 
4222 varun.gupt 446
	public boolean isUserLoggedIn()	{
447
		return userinfo.isLoggedIn();
448
	}
449
 
4046 varun.gupt 450
	public void setVariationId(String uri)	{
451
		if (uri.equals("/cart1"))	{
452
			this.variationId = 1;
453
		}
3970 varun.gupt 454
	}
455
 
4046 varun.gupt 456
	public int getVariationId()	{
457
		return this.variationId;
3970 varun.gupt 458
	}
5228 amit.gupta 459
 
460
	public String getActionMessage(){
461
		if(cartMsg.contains("out of stock")){
462
			return "Notify me when this product is in stock.";
463
		}else {
464
			return "Notify me when this product is available.";
465
		}
466
	}
467
 
468
	public String getOfferNote(){
469
		String note = null;
470
		if(cartMsg.contains("out of stock")){
471
			return note;
472
		}
473
		else {
474
			try {
475
	            CatalogClient catalogServiceClient = new CatalogClient();
476
	            Client catalogClient = catalogServiceClient.getClient();
477
	            Item it = catalogClient.getItem(itemId);
478
	            note = it.getBestDealText();
479
			} catch (Exception e)  {
480
				log.error("Unable to get the offertext because of: ", e);
481
			}
482
		}
483
		return note;
484
	}
6903 anupam.sin 485
 
486
    public String getInsuranceResult() {
487
        return insuranceResult;
488
    }
489
 
490
    public void setInsuranceResult(String insuranceResult) {
491
        this.insuranceResult = insuranceResult;
492
    }
493
 
494
    public void setToInsure(boolean toInsure) {
495
        this.toInsure = toInsure;
496
    }
497
 
498
    public boolean getToInsure() {
499
        return toInsure;
500
    }
501
 
502
    public long getProductId() {
503
        return productId;
504
    }
505
 
506
    public void setProductId(long productId) {
507
        this.productId = productId;
508
    }
5228 amit.gupta 509
}