Subversion Repositories SmartDukaan

Rev

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

Rev 11519 Rev 11605
Line 147... Line 147...
147
	    cartPojo.setPickupStoreId(cart.getPickupStoreId());
147
	    cartPojo.setPickupStoreId(cart.getPickupStoreId());
148
	    cartPojo.setTotalPrice(cart.getTotalPrice());
148
	    cartPojo.setTotalPrice(cart.getTotalPrice());
149
	    cartPojo.setNeedInsuranceInfo(needInsuranceInfo);
149
	    cartPojo.setNeedInsuranceInfo(needInsuranceInfo);
150
	    
150
	    
151
	    List<CartLinePojo> linepojos = new ArrayList<CartLinePojo>();
151
	    List<CartLinePojo> linepojos = new ArrayList<CartLinePojo>();
152
	    CatalogService.Client catalogClient = new CatalogClient().getClient();
152
	    CatalogService.Client catalogClient;
153
	    for(Line line : cart.getLines()) {
153
	    for(Line line : cart.getLines()) {
154
	        CartLinePojo linepojo = new CartLinePojo();
154
	        CartLinePojo linepojo = new CartLinePojo();
-
 
155
	        catalogClient = new CatalogClient().getClient();
-
 
156
	        Item item = catalogClient.getItem(line.getItemId());
-
 
157
	        linepojo.setDataProtectionAvailable(catalogClient.getPrefferedInsurerForItem(line.getItemId(), InsurerType.DATA)>0);
-
 
158
	        linepojo.setTheftInsuranceAvailable(catalogClient.getPrefferedInsurerForItem(line.getItemId(), InsurerType.DEVICE)>0);
155
	        linepojo.setItemId(line.getItemId());
159
	        linepojo.setItemId(line.getItemId());
156
	        linepojo.setActualPrice(line.getActualPrice());
160
	        linepojo.setActualPrice(line.getActualPrice());
157
	        linepojo.setDataProtectionAmount(line.getDataProtectionAmount());
161
	        linepojo.setDataProtectionAmount(line.getDataProtectionAmount());
158
	        linepojo.setDataProtectionInsurer(line.getDataProtectionInsurer());
162
	        linepojo.setDataProtectionInsurer(line.getDataProtectionInsurer());
159
	        linepojo.setDataProtectionAvailable(catalogClient.getPrefferedInsurerForItem(line.getItemId(), InsurerType.DATA)>0);
-
 
160
	        linepojo.setDiscountedPrice(line.getDiscountedPrice());
163
	        linepojo.setDiscountedPrice(line.getDiscountedPrice());
161
	        linepojo.setInsuranceAmount(line.getInsuranceAmount());
164
	        linepojo.setInsuranceAmount(line.getInsuranceAmount());
162
	        linepojo.setInsurer(line.getInsurer());
165
	        linepojo.setInsurer(line.getInsurer());
163
	        linepojo.setTheftInsuranceAvailable(catalogClient.getPrefferedInsurerForItem(line.getItemId(), InsurerType.DEVICE)>0);
-
 
164
	        linepojo.setQuantity(line.getQuantity());
166
	        linepojo.setQuantity(line.getQuantity());
165
	        linepojo.setLogisticsInfo(in.shop2020.mobileapi.serving.services.LogisticsService.getLogisticsInfo(line.getItemId(), pincode));
167
	        linepojo.setLogisticsInfo(in.shop2020.mobileapi.serving.services.LogisticsService.getLogisticsInfo(line.getItemId(), pincode));
166
	        if(linepojo.getLogisticsInfo().getBusinessDays()==-1){
168
	        if(linepojo.getLogisticsInfo().getBusinessDays()==-1){
167
	        	cartPojo.setLocationServiceable(false);
169
	        	cartPojo.setLocationServiceable(false);
168
	        	cartPojo.setLocationServiceableMessage("Location not serviceable. Please specify a different address");
170
	        	cartPojo.setLocationServiceableMessage("Location not serviceable. Please specify a different address");
169
	        }
171
	        }
170
	        try {
-
 
171
	            Item item = catalogClient.getItem(line.getItemId());
-
 
172
	            linepojo.setName(item.getBrand() + " " + item.getModelName() + " " + item.getModelNumber());
172
            linepojo.setName(item.getBrand() + " " + item.getModelName() + " " + item.getModelNumber());
173
	            linepojo.setColor(item.getColor());
173
            linepojo.setColor(item.getColor());
174
	            linepojo.setImageUrl(PojoPopulator.getShortContent(item.getCatalogItemId()).getImageUrl());
174
            linepojo.setImageUrl(PojoPopulator.getShortContent(item.getCatalogItemId()).getImageUrl());
175
	            linepojos.add(linepojo);
175
            linepojos.add(linepojo);
176
	            
-
 
177
	        } catch(Exception e) {
-
 
178
	            log.error("Error in getting item with id : " + line.getItemId(), e);
-
 
179
	        }
-
 
180
	    }
176
	    }
181
	    cartPojo.setLines(linepojos);
177
	    cartPojo.setLines(linepojos);
182
        return cartPojo;
178
        return cartPojo;
183
	    
179
	    
184
	}
180
	}