Subversion Repositories SmartDukaan

Rev

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

Rev 8196 Rev 8241
Line 184... Line 184...
184
            
184
            
185
            row.getCell(EBAY_LISTINGID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
185
            row.getCell(EBAY_LISTINGID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
186
            String ebayListingId = row.getCell(EBAY_LISTINGID_INDEX).getStringCellValue();
186
            String ebayListingId = row.getCell(EBAY_LISTINGID_INDEX).getStringCellValue();
187
    		CatalogService.Client catalogClient = new CatalogClient().getClient();
187
    		CatalogService.Client catalogClient = new CatalogClient().getClient();
188
    		EbayItem ebayItem = catalogClient.getEbayItem(ebayListingId);
188
    		EbayItem ebayItem = catalogClient.getEbayItem(ebayListingId);
-
 
189
    		double listingPrice = 0;
-
 
190
    		double overriddenPrice = 0;
-
 
191
    		double totalPrice = 0;
-
 
192
    		Cell overriddenPriceCell = row.getCell(LISTING_PRICE_INDEX);
-
 
193
        	if(overriddenPriceCell  != null && overriddenPriceCell .getCellType() != Cell.CELL_TYPE_BLANK) {
-
 
194
        		overriddenPrice = row.getCell(LISTING_PRICE_INDEX).getNumericCellValue();
-
 
195
        	}
-
 
196
    		
189
    		long quantity = new Double(row.getCell(QUANTITY_INDEX).getNumericCellValue()).longValue();
197
    		long quantity = new Double(row.getCell(QUANTITY_INDEX).getNumericCellValue()).longValue();
190
    		String totalPriceString = row.getCell(AMOUNT_INDEX).getStringCellValue();
198
    		String totalPriceString = row.getCell(AMOUNT_INDEX).getStringCellValue();
-
 
199
    		if(overriddenPrice>=1) {
-
 
200
    			totalPrice = overriddenPrice*quantity;
-
 
201
    			listingPrice = (Double.parseDouble(totalPriceString.substring(3).replace(",","")))/quantity;
-
 
202
    		} else {
191
    		double totalPrice = Double.parseDouble(totalPriceString.substring(3).replace(",","")); 
203
    			totalPrice = Double.parseDouble(totalPriceString.substring(3).replace(",",""));
-
 
204
    			listingPrice = totalPrice/quantity;
-
 
205
    		}
192
    		
206
    		
193
        	LineItem lineItem = null;
207
        	LineItem lineItem = null;
194
        	try {
208
        	try {
195
        		lineItem = createLineItem(ebayItem.getItemId(), quantity, totalPrice);
209
        		lineItem = createLineItem(ebayItem.getItemId(), quantity, totalPrice);
196
        	} catch (Exception tex) {
210
        	} catch (Exception tex) {
Line 313... Line 327...
313
                }
327
                }
314
                ebayOrder.setOrderId(order.getId());
328
                ebayOrder.setOrderId(order.getId());
315
                ebayOrder.setPaisaPayId(paisaPayId);
329
                ebayOrder.setPaisaPayId(paisaPayId);
316
                ebayOrder.setListingName(ebayItem.getListingName());
330
                ebayOrder.setListingName(ebayItem.getListingName());
317
                ebayOrder.setSubsidyAmount(ebayItem.getSubsidy()*quantity);
331
                ebayOrder.setSubsidyAmount(ebayItem.getSubsidy()*quantity);
-
 
332
                ebayOrder.setListingPrice(listingPrice);
318
                transaction_client.createEbayOrder(ebayOrder);
333
                transaction_client.createEbayOrder(ebayOrder);
319
            } catch (Exception e) {
334
            } catch (Exception e) {
320
                logger.error("Unable to create order for rowId " + (rowId + 1), e);
335
                logger.error("Unable to create order for rowId " + (rowId + 1), e);
321
                addActionError("Unable to create order for rowId " + (rowId + 1));
336
                addActionError("Unable to create order for rowId " + (rowId + 1));
322
                return "authsuccess";
337
                return "authsuccess";
Line 337... Line 352...
337
        lineItem.setModel_number(item.getModelNumber());
352
        lineItem.setModel_number(item.getModelNumber());
338
        lineItem.setModel_name(item.getModelName());
353
        lineItem.setModel_name(item.getModelName());
339
        lineItem.setExtra_info(item.getFeatureDescription());
354
        lineItem.setExtra_info(item.getFeatureDescription());
340
        lineItem.setQuantity(quantity);
355
        lineItem.setQuantity(quantity);
341
        lineItem.setItem_id(item.getId());
356
        lineItem.setItem_id(item.getId());
342
        lineItem.setTotal_weight(item.getWeight());
357
        lineItem.setUnit_weight(item.getWeight());
-
 
358
        lineItem.setTotal_weight(item.getWeight()*quantity);
343
        lineItem.setUnit_price(amount/quantity);
359
        lineItem.setUnit_price(amount/quantity);
344
        lineItem.setTotal_price(amount);
360
        lineItem.setTotal_price(amount);
345
 
361
 
346
        if (item.getColor() == null || "NA".equals(item.getColor())) {
362
        if (item.getColor() == null || "NA".equals(item.getColor())) {
347
            lineItem.setColor("");
363
            lineItem.setColor("");