| Line 131... |
Line 131... |
| 131 |
private File orderDataFile;
|
131 |
private File orderDataFile;
|
| 132 |
private String orderDataFileName;
|
132 |
private String orderDataFileName;
|
| 133 |
private String transactionId;
|
133 |
private String transactionId;
|
| 134 |
private String errorMsg = "";
|
134 |
private String errorMsg = "";
|
| 135 |
private Long rowId = 0L;
|
135 |
private Long rowId = 0L;
|
| - |
|
136 |
|
| - |
|
137 |
private long paymentId;
|
| 136 |
|
138 |
|
| 137 |
public String create() throws TException {
|
139 |
public String create() throws TException {
|
| 138 |
File fileToCreate = null;
|
140 |
File fileToCreate = null;
|
| 139 |
orderDataFileName = "OrderSheet_Snapdeal_"+(new Date().toString());
|
141 |
orderDataFileName = "OrderSheet_Snapdeal_"+(new Date().toString());
|
| 140 |
try {
|
142 |
try {
|
| Line 399... |
Line 401... |
| 399 |
logger.error("Duplicate order for subOrderId " + subOrderId + " for row number " + rowId);
|
401 |
logger.error("Duplicate order for subOrderId " + subOrderId + " for row number " + rowId);
|
| 400 |
continue;
|
402 |
continue;
|
| 401 |
}
|
403 |
}
|
| 402 |
|
404 |
|
| 403 |
transactionId = String.valueOf(transaction_client.createTransaction(txn));
|
405 |
transactionId = String.valueOf(transaction_client.createTransaction(txn));
|
| 404 |
createPayment(user, (new Long(subOrderId)).toString(), totalPrice);
|
406 |
paymentId = createPayment(user, (new Long(subOrderId)).toString(), totalPrice);
|
| 405 |
|
407 |
|
| 406 |
logger.info("Successfully created transaction: " + transactionId + " for amount: " + totalPrice);
|
408 |
logger.info("Successfully created transaction: " + transactionId + " for amount: " + totalPrice);
|
| 407 |
|
409 |
|
| 408 |
Transaction transaction = transaction_client.getTransaction(Long.parseLong(transactionId));
|
410 |
Transaction transaction = transaction_client.getTransaction(Long.parseLong(transactionId));
|
| 409 |
Order order = transaction.getOrders().get(0);
|
411 |
Order order = transaction.getOrders().get(0);
|
| Line 418... |
Line 420... |
| 418 |
snapdealOrder.setReferenceCode(referenceCode);
|
420 |
snapdealOrder.setReferenceCode(referenceCode);
|
| 419 |
snapdealOrder.setProductName(productName);
|
421 |
snapdealOrder.setProductName(productName);
|
| 420 |
snapdealOrder.setSnapdealTxnDate(snapdealTxnDate.getTime());
|
422 |
snapdealOrder.setSnapdealTxnDate(snapdealTxnDate.getTime());
|
| 421 |
snapdealOrder.setListingPrice(listingPrice);
|
423 |
snapdealOrder.setListingPrice(listingPrice);
|
| 422 |
transaction_client.createSnapdealOrder(snapdealOrder);
|
424 |
transaction_client.createSnapdealOrder(snapdealOrder);
|
| 423 |
|
- |
|
| - |
|
425 |
new PaymentClient().getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, Long.toString(subOrderId), null, PaymentStatus.SUCCESS, null, null);
|
| 424 |
|
426 |
|
| 425 |
} catch (Exception e) {
|
427 |
} catch (Exception e) {
|
| 426 |
logger.error("Error while creating order for rowId " + rowId, e);
|
428 |
logger.error("Error while creating order for rowId " + rowId, e);
|
| 427 |
addActionError("Error while creating order for rowId " + rowId);
|
429 |
addActionError("Error while creating order for rowId " + rowId);
|
| 428 |
setErrorMsg(getErrorMsg() + "<br>Error while creating order for row number " + rowId);
|
430 |
setErrorMsg(getErrorMsg() + "<br>Error while creating order for row number " + rowId);
|
| Line 469... |
Line 471... |
| 469 |
lineItem.setColor(item.getColor());
|
471 |
lineItem.setColor(item.getColor());
|
| 470 |
}
|
472 |
}
|
| 471 |
return lineItem;
|
473 |
return lineItem;
|
| 472 |
}
|
474 |
}
|
| 473 |
|
475 |
|
| 474 |
private void createPayment(User user, String subOrderId, double amount) throws NumberFormatException, PaymentException, TException {
|
476 |
private long createPayment(User user, String subOrderId, double amount) throws NumberFormatException, PaymentException, TException {
|
| 475 |
in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
|
477 |
in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
|
| 476 |
long paymentId = client.createPayment(user.getUserId(), amount, SNAPDEAL_GATEWAY_ID, Long.valueOf(transactionId), false);
|
478 |
return client.createPayment(user.getUserId(), amount, SNAPDEAL_GATEWAY_ID, Long.valueOf(transactionId), false);
|
| 477 |
client.updatePaymentDetails(paymentId, null, null, null, null, null, null, subOrderId, null, PaymentStatus.AUTHORIZED, null, null);
|
- |
|
| 478 |
}
|
479 |
}
|
| 479 |
|
480 |
|
| 480 |
public String index() {
|
481 |
public String index() {
|
| 481 |
if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), "/ebay-dashboard"))
|
482 |
if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), "/ebay-dashboard"))
|
| 482 |
return "authfail";
|
483 |
return "authfail";
|