| Line 92... |
Line 92... |
| 92 |
private ServletContext context;
|
92 |
private ServletContext context;
|
| 93 |
private String url;
|
93 |
private String url;
|
| 94 |
private File file;
|
94 |
private File file;
|
| 95 |
private String errMsg;
|
95 |
private String errMsg;
|
| 96 |
private String id;
|
96 |
private String id;
|
| - |
|
97 |
private long paymentId;
|
| 97 |
private static String transactionId;
|
98 |
private static String transactionId;
|
| 98 |
public String uploadorders(){
|
99 |
public String uploadorders(){
|
| 99 |
if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
|
100 |
if(!ReportsUtils.canAccessReport((Long)session.getAttribute(ReportsUtils.ROLE), request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0])) {
|
| 100 |
logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
|
101 |
logger.info(request.getRequestURI().substring(request.getContextPath().length()).split("/")[1].split("!")[0]);
|
| 101 |
return "authfail";
|
102 |
return "authfail";
|
| Line 516... |
Line 517... |
| 516 |
logger.info(orderId+" "+subOrderId + " Transaction Service Exception could not create transaction" +"\n");
|
517 |
logger.info(orderId+" "+subOrderId + " Transaction Service Exception could not create transaction" +"\n");
|
| 517 |
continue;
|
518 |
continue;
|
| 518 |
}
|
519 |
}
|
| 519 |
try{
|
520 |
try{
|
| 520 |
logger.info("Creating payment for suborder id " + subOrderId);
|
521 |
logger.info("Creating payment for suborder id " + subOrderId);
|
| 521 |
createPayment(user,subOrderId,total_price);
|
522 |
paymentId = createPayment(user,subOrderId,total_price);
|
| 522 |
}
|
523 |
}
|
| 523 |
catch (NumberFormatException e) {
|
524 |
catch (NumberFormatException e) {
|
| 524 |
logger.error("Could not create payment",e);
|
525 |
logger.error("Could not create payment",e);
|
| 525 |
sb.append(orderId+" "+subOrderId + " Could not create payment");
|
526 |
sb.append(orderId+" "+subOrderId + " Could not create payment");
|
| 526 |
e.printStackTrace();
|
527 |
e.printStackTrace();
|
| Line 574... |
Line 575... |
| 574 |
attribute.setValue(buyerName);
|
575 |
attribute.setValue(buyerName);
|
| 575 |
attributeList.add(attribute);
|
576 |
attributeList.add(attribute);
|
| 576 |
try {
|
577 |
try {
|
| 577 |
transaction_client.createFlipkartOrder(flipkartOrder);
|
578 |
transaction_client.createFlipkartOrder(flipkartOrder);
|
| 578 |
transaction_client.setOrderAttributes(flipkartOrder.getOrderId(),attributeList);
|
579 |
transaction_client.setOrderAttributes(flipkartOrder.getOrderId(),attributeList);
|
| - |
|
580 |
logger.info("transaction id : " + Long.valueOf(transactionId) + " Payment id : " + paymentId);
|
| - |
|
581 |
new PaymentClient().getClient().updatePaymentDetails(paymentId, null, null, null, null, null, null, subOrderId, null, PaymentStatus.SUCCESS, null, null);
|
| 579 |
orders_processed++;
|
582 |
orders_processed++;
|
| 580 |
} catch (TException e) {
|
583 |
} catch (TException e) {
|
| 581 |
logger.error("Could not create flipkart order");
|
584 |
logger.error("Could not create flipkart order");
|
| 582 |
sb.append(orderId+" "+subOrderId + " Could not create flipkart order"+"\n");
|
585 |
sb.append(orderId+" "+subOrderId + " Could not create flipkart order"+"\n");
|
| 583 |
continue;
|
586 |
continue;
|
| - |
|
587 |
}catch (PaymentException e) {
|
| - |
|
588 |
logger.error("Could not update flipkart order payment ",e);
|
| - |
|
589 |
sb.append(orderId+" "+subOrderId + " Could not update flipkart order payment"+"\n");
|
| - |
|
590 |
continue;
|
| 584 |
}
|
591 |
}
|
| 585 |
|
592 |
|
| 586 |
} catch (InventoryServiceException e1) {
|
593 |
} catch (InventoryServiceException e1) {
|
| 587 |
logger.error("Problem while reserving item in inventory service" + flipkartorder.getId());
|
594 |
logger.error("Problem while reserving item in inventory service" + flipkartorder.getId());
|
| 588 |
sb.append(orderId+" "+subOrderId + " Could not reserve inventory for sku "+ sku +"\n");
|
595 |
sb.append(orderId+" "+subOrderId + " Could not reserve inventory for sku "+ sku +"\n");
|
| Line 817... |
Line 824... |
| 817 |
counter++;
|
824 |
counter++;
|
| 818 |
} if (br != null)br.close();
|
825 |
} if (br != null)br.close();
|
| 819 |
if (fw != null)fw.close();
|
826 |
if (fw != null)fw.close();
|
| 820 |
}
|
827 |
}
|
| 821 |
|
828 |
|
| 822 |
public static void createPayment(User user, String subOrderId, double amount) throws PaymentException, TException {
|
829 |
public static long createPayment(User user, String subOrderId, double amount) throws PaymentException, TException {
|
| 823 |
in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
|
830 |
in.shop2020.payments.PaymentService.Client client = new PaymentClient().getClient();
|
| 824 |
logger.info("Creating payment for user id " + user.getUserId() + " Gateway id " + FLIPKART_GATEWAY_ID);
|
831 |
logger.info("Creating payment for user id " + user.getUserId() + " Gateway id " + FLIPKART_GATEWAY_ID);
|
| 825 |
logger.info("Long value of transaction id : " + Long.valueOf(transactionId));
|
832 |
logger.info("Long value of transaction id : " + Long.valueOf(transactionId));
|
| 826 |
long paymentId = client.createPayment(user.getUserId(), amount, FLIPKART_GATEWAY_ID, Long.valueOf(transactionId), false);
|
833 |
return client.createPayment(user.getUserId(), amount, FLIPKART_GATEWAY_ID, Long.valueOf(transactionId), false);
|
| 827 |
logger.info("transaction id : " + Long.valueOf(transactionId) + " Payment id : " + paymentId);
|
- |
|
| 828 |
client.updatePaymentDetails(paymentId, null, null, null, null, null, null, subOrderId, null, PaymentStatus.AUTHORIZED, null, null);
|
- |
|
| 829 |
}
|
834 |
}
|
| 830 |
|
835 |
|
| 831 |
|
836 |
|
| 832 |
}
|
837 |
}
|