Subversion Repositories SmartDukaan

Rev

Rev 7913 | Rev 11898 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7913 Rev 9301
Line 62... Line 62...
62
	
62
	
63
	private String dob;
63
	private String dob;
64
    private String guardianName;
64
    private String guardianName;
65
 
65
 
66
    private boolean isAnyItemInsured = false;
66
    private boolean isAnyItemInsured = false;
67
	
-
 
-
 
67
    private boolean isAnyItemDataProtected = false;
68
	private static List<PickupStore> storeAddresses = new ArrayList<PickupStore>();
68
	private static List<PickupStore> storeAddresses = new ArrayList<PickupStore>();
69
	private static final List<String> allZones = new ArrayList<String>();
69
	private static final List<String> allZones = new ArrayList<String>();
70
	    
70
	    
71
    static {
71
    static {
72
        try {
72
        try {
Line 99... Line 99...
99
			itemIdString = Utils.getItemIdStringInCart(cart);
99
			itemIdString = Utils.getItemIdStringInCart(cart);
100
			for(Line line : cart.getLines()) {
100
			for(Line line : cart.getLines()) {
101
			    if(line.getInsurer() > 0) {
101
			    if(line.getInsurer() > 0) {
102
			        setAnyItemInsured(true);
102
			        setAnyItemInsured(true);
103
			    }
103
			    }
-
 
104
			    if(line.getDataProtectionInsurer() > 0) {
-
 
105
			    	setAnyItemDataProtected(true);
-
 
106
			    }
104
			}
107
			}
105
			long defaultAddressId = cart.getAddressId();
108
			long defaultAddressId = cart.getAddressId();
106
			if (defaultAddressId == 0) {
109
			if (defaultAddressId == 0) {
107
			    defaultAddressId = userClient.getDefaultAddressId(userId);
110
			    defaultAddressId = userClient.getDefaultAddressId(userId);
108
			}
111
			}
Line 270... Line 273...
270
		List<Address> addresses = null;
273
		List<Address> addresses = null;
271
		long defaultAddressId = 0;
274
		long defaultAddressId = 0;
272
		long defaultStoreAddressId = 0;
275
		long defaultStoreAddressId = 0;
273
		String phoneNumber = "";
276
		String phoneNumber = "";
274
        double totalInsurance = 0.0;
277
        double totalInsurance = 0.0;
-
 
278
        double oneAssistAmount = 0.0;
275
        boolean isAnyItemInsured = false;
279
        boolean isAnyItemInsured = false;
-
 
280
        boolean isAnyItemDataProtected = false;
276
 
281
        
277
		CatalogClient catalogServiceClient  = null;
282
		CatalogClient catalogServiceClient  = null;
278
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = null;
283
		in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = null;
279
		UserClient userContextServiceClient = null;
284
		UserClient userContextServiceClient = null;
280
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
285
		in.shop2020.model.v1.user.UserContextService.Client userClient = null;
281
		
286
		
Line 287... Line 292...
287
			userContextServiceClient = new UserClient();
292
			userContextServiceClient = new UserClient();
288
			userClient = userContextServiceClient.getClient();
293
			userClient = userContextServiceClient.getClient();
289
			
294
			
290
			Cart cart = userClient.getCart(cartId);
295
			Cart cart = userClient.getCart(cartId);
291
			List<Line> lineItems = cart.getLines();
296
			List<Line> lineItems = cart.getLines();
292
			
-
 
293
			if( ! lineItems.isEmpty())	{
297
			if( ! lineItems.isEmpty())	{
294
				items = new ArrayList<Map<String,String>>();
298
				items = new ArrayList<Map<String,String>>();
295
				for (Line line : lineItems) {
299
				for (Line line : lineItems) {
296
					Map<String, String> itemdetail = new HashMap<String, String>();
300
					Map<String, String> itemdetail = new HashMap<String, String>();
297
					Item item = catalogClient.getItemForSource(line.getItemId(), sourceId);
301
					Item item = catalogClient.getItemForSource(line.getItemId(), sourceId);
Line 313... Line 317...
313
					itemdetail.put("TOTAL_PRICE", formattingUtils.formatPrice((item.getSellingPrice()*line.getQuantity())));
317
					itemdetail.put("TOTAL_PRICE", formattingUtils.formatPrice((item.getSellingPrice()*line.getQuantity())));
314
					itemdetail.put("SHIPPING_TIME", (line.getEstimate() == -1) ? "-1" : EstimateController.getDeliveryDateString(line.getEstimate(), DeliveryType.PREPAID));
318
					itemdetail.put("SHIPPING_TIME", (line.getEstimate() == -1) ? "-1" : EstimateController.getDeliveryDateString(line.getEstimate(), DeliveryType.PREPAID));
315
					itemdetail.put("BEST_DEAL_TEXT", item.getBestDealText());
319
					itemdetail.put("BEST_DEAL_TEXT", item.getBestDealText());
316
					itemdetail.put("INSURANCE_AMOUNT", line.getInsuranceAmount() + "");
320
					itemdetail.put("INSURANCE_AMOUNT", line.getInsuranceAmount() + "");
317
					itemdetail.put("INSURER", line.getInsurer() + "");
321
					itemdetail.put("INSURER", line.getInsurer() + "");
-
 
322
					itemdetail.put("IS_DATA_PROTECTED", (line.getDataProtectionInsurer() == 0 ? false : true) + "");
-
 
323
					itemdetail.put("ONE_ASSIST_AMOUNT", line.getDataProtectionAmount() + "");
318
					items.add(itemdetail);
324
					items.add(itemdetail);
319
					totalInsurance += line.getInsuranceAmount();
325
					totalInsurance += line.getInsuranceAmount();
-
 
326
					oneAssistAmount +=line.getDataProtectionAmount();
-
 
327
					
320
					if(line.getInsurer() > 0) {
328
					if(line.getInsurer() > 0) {
321
					    isAnyItemInsured = true;
329
					    isAnyItemInsured = true;
322
					}
330
					}
-
 
331
					if (line.getDataProtectionInsurer() > 0){
-
 
332
						isAnyItemDataProtected = true;
-
 
333
					}
323
				}
334
				}
324
			}
335
			}
325
			totalamount = cart.getTotalPrice();
336
			totalamount = cart.getTotalPrice();
326
			addresses = userClient.getAllAddressesForUser(userId);
337
			addresses = userClient.getAllAddressesForUser(userId);
327
			User user = userClient.getUserById(userId);
338
			User user = userClient.getUserById(userId);
Line 381... Line 392...
381
		context.put("errorMsg", errorMsg);
392
		context.put("errorMsg", errorMsg);
382
		context.put("selectedTab", selectedTab);
393
		context.put("selectedTab", selectedTab);
383
		context.put("storeAddresses", storeAddresses);
394
		context.put("storeAddresses", storeAddresses);
384
		context.put("allZones", allZones);
395
		context.put("allZones", allZones);
385
		context.put("isAnyItemInsured", isAnyItemInsured + "");
396
		context.put("isAnyItemInsured", isAnyItemInsured + "");
-
 
397
		context.put("isAnyItemDataProtected", isAnyItemDataProtected + "");
-
 
398
		context.put("oneAssistAmount", formattingUtils.formatPrice(oneAssistAmount) + "");
386
		htmlString = pageLoader.getHtmlFromVelocity(templateFile, context);
399
		htmlString = pageLoader.getHtmlFromVelocity(templateFile, context);
387
		return htmlString;
400
		return htmlString;
388
	}
401
	}
389
	
402
	
390
	public long getAddressId(){
403
	public long getAddressId(){
Line 500... Line 513...
500
    }
513
    }
501
 
514
 
502
    public void setAddressId(long addressId) {
515
    public void setAddressId(long addressId) {
503
        this.addressId = addressId;
516
        this.addressId = addressId;
504
    }
517
    }
-
 
518
 
-
 
519
	public void setAnyItemDataProtected(boolean isAnyItemDataProtected) {
-
 
520
		this.isAnyItemDataProtected = isAnyItemDataProtected;
-
 
521
	}
-
 
522
 
-
 
523
	public boolean isAnyItemDataProtected() {
-
 
524
		return isAnyItemDataProtected;
-
 
525
	}
-
 
526
 
505
}
527
}
506
528