| Line 196... |
Line 196... |
| 196 |
txn.setTransactionStatus(TransactionStatus.INIT);
|
196 |
txn.setTransactionStatus(TransactionStatus.INIT);
|
| 197 |
txn.setStatusDescription("Order for Ebay ");
|
197 |
txn.setStatusDescription("Order for Ebay ");
|
| 198 |
|
198 |
|
| 199 |
List<Order> orders = new ArrayList<Order>();
|
199 |
List<Order> orders = new ArrayList<Order>();
|
| 200 |
|
200 |
|
| - |
|
201 |
double listingPrice = 0;
|
| - |
|
202 |
double overriddenPrice = 0;
|
| - |
|
203 |
double totalPrice = 0;
|
| - |
|
204 |
|
| 201 |
row.getCell(EBAY_LISTINGID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
|
205 |
row.getCell(EBAY_LISTINGID_INDEX).setCellType(Cell.CELL_TYPE_STRING);
|
| 202 |
String ebayListingId = row.getCell(EBAY_LISTINGID_INDEX).getStringCellValue();
|
206 |
String ebayListingId = row.getCell(EBAY_LISTINGID_INDEX).getStringCellValue();
|
| 203 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|
207 |
CatalogService.Client catalogClient = new CatalogClient().getClient();
|
| 204 |
EbayItem ebayItem = catalogClient.getEbayItem(ebayListingId);
|
208 |
EbayItem ebayItem = catalogClient.getEbayItem(ebayListingId);
|
| 205 |
long quantity = new Double(row.getCell(QUANTITY_INDEX).getNumericCellValue()).longValue();
|
209 |
long quantity = new Double(row.getCell(QUANTITY_INDEX).getNumericCellValue()).longValue();
|
| - |
|
210 |
Cell overriddenPriceCell = row.getCell(LISTING_PRICE_INDEX);
|
| - |
|
211 |
if(overriddenPriceCell != null && overriddenPriceCell .getCellType() != Cell.CELL_TYPE_BLANK) {
|
| - |
|
212 |
overriddenPrice = row.getCell(LISTING_PRICE_INDEX).getNumericCellValue();
|
| - |
|
213 |
}
|
| 206 |
String totalPriceString = row.getCell(AMOUNT_INDEX).getStringCellValue();
|
214 |
String totalPriceString = row.getCell(AMOUNT_INDEX).getStringCellValue();
|
| - |
|
215 |
if(overriddenPrice>=1) {
|
| - |
|
216 |
totalPrice = overriddenPrice*quantity;
|
| - |
|
217 |
listingPrice = (Double.parseDouble(totalPriceString.substring(3).replace(",","")))/quantity;
|
| - |
|
218 |
} else {
|
| 207 |
double totalPrice = Double.parseDouble(totalPriceString.substring(3).replace(",",""));
|
219 |
totalPrice = Double.parseDouble(totalPriceString.substring(3).replace(",",""));
|
| - |
|
220 |
listingPrice = totalPrice/quantity;
|
| - |
|
221 |
}
|
| 208 |
LineItem lineItem = null;
|
222 |
LineItem lineItem = null;
|
| 209 |
try {
|
223 |
try {
|
| 210 |
lineItem = createLineItem(ebayItem.getItemId(), quantity, totalPrice);
|
224 |
lineItem = createLineItem(ebayItem.getItemId(), quantity, totalPrice);
|
| 211 |
} catch (Exception tex) {
|
225 |
} catch (Exception tex) {
|
| 212 |
logger.error("Unable to establish connection to the Catalog service", tex);
|
226 |
logger.error("Unable to establish connection to the Catalog service", tex);
|
| Line 325... |
Line 339... |
| 325 |
}
|
339 |
}
|
| 326 |
ebayOrder.setOrderId(transaction.getOrders().get(0).getId());
|
340 |
ebayOrder.setOrderId(transaction.getOrders().get(0).getId());
|
| 327 |
ebayOrder.setPaisaPayId(paisaPayId);
|
341 |
ebayOrder.setPaisaPayId(paisaPayId);
|
| 328 |
ebayOrder.setSubsidyAmount(ebayItem.getSubsidy()*quantity);
|
342 |
ebayOrder.setSubsidyAmount(ebayItem.getSubsidy()*quantity);
|
| 329 |
ebayOrder.setListingName(ebayItem.getListingName());
|
343 |
ebayOrder.setListingName(ebayItem.getListingName());
|
| - |
|
344 |
ebayOrder.setListingPrice(listingPrice);
|
| 330 |
transaction_client.createEbayOrder(ebayOrder);
|
345 |
transaction_client.createEbayOrder(ebayOrder);
|
| 331 |
} catch (Exception e) {
|
346 |
} catch (Exception e) {
|
| 332 |
logger.error("Unable to establish connection to the transaction service", e);
|
347 |
logger.error("Unable to establish connection to the transaction service", e);
|
| 333 |
addActionError("Unable to establish connection to the transaction service");
|
348 |
addActionError("Unable to establish connection to the transaction service");
|
| 334 |
return "authsuccess";
|
349 |
return "authsuccess";
|
| Line 350... |
Line 365... |
| 350 |
lineItem.setModel_name(item.getModelName());
|
365 |
lineItem.setModel_name(item.getModelName());
|
| 351 |
lineItem.setExtra_info(item.getFeatureDescription());
|
366 |
lineItem.setExtra_info(item.getFeatureDescription());
|
| 352 |
lineItem.setQuantity(quantity);
|
367 |
lineItem.setQuantity(quantity);
|
| 353 |
lineItem.setItem_id(item.getId());
|
368 |
lineItem.setItem_id(item.getId());
|
| 354 |
lineItem.setUnit_weight(item.getWeight());
|
369 |
lineItem.setUnit_weight(item.getWeight());
|
| 355 |
lineItem.setTotal_weight(item.getWeight());
|
370 |
lineItem.setTotal_weight(item.getWeight()*quantity);
|
| 356 |
lineItem.setUnit_price(amount/quantity);
|
371 |
lineItem.setUnit_price(amount/quantity);
|
| 357 |
lineItem.setTotal_price(amount);
|
372 |
lineItem.setTotal_price(amount);
|
| 358 |
|
373 |
|
| 359 |
if (item.getColor() == null || "NA".equals(item.getColor())) {
|
374 |
if (item.getColor() == null || "NA".equals(item.getColor())) {
|
| 360 |
lineItem.setColor("");
|
375 |
lineItem.setColor("");
|