| Line 12... |
Line 12... |
| 12 |
import java.util.Date;
|
12 |
import java.util.Date;
|
| 13 |
import java.util.HashMap;
|
13 |
import java.util.HashMap;
|
| 14 |
import java.util.List;
|
14 |
import java.util.List;
|
| 15 |
import java.util.Map;
|
15 |
import java.util.Map;
|
| 16 |
|
16 |
|
| - |
|
17 |
import in.shop2020.datalogger.event.OrderCreation;
|
| 17 |
import in.shop2020.logistics.LogisticsServiceException;
|
18 |
import in.shop2020.logistics.LogisticsServiceException;
|
| 18 |
import in.shop2020.logistics.Provider;
|
19 |
import in.shop2020.logistics.Provider;
|
| 19 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
20 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
| 20 |
import in.shop2020.model.v1.catalog.Vendor;
|
21 |
import in.shop2020.model.v1.catalog.Vendor;
|
| 21 |
import in.shop2020.model.v1.order.LineItem;
|
22 |
import in.shop2020.model.v1.order.LineItem;
|
| Line 30... |
Line 31... |
| 30 |
import in.shop2020.thrift.clients.CatalogClient;
|
31 |
import in.shop2020.thrift.clients.CatalogClient;
|
| 31 |
import in.shop2020.thrift.clients.LogisticsClient;
|
32 |
import in.shop2020.thrift.clients.LogisticsClient;
|
| 32 |
import in.shop2020.thrift.clients.PaymentClient;
|
33 |
import in.shop2020.thrift.clients.PaymentClient;
|
| 33 |
import in.shop2020.thrift.clients.TransactionClient;
|
34 |
import in.shop2020.thrift.clients.TransactionClient;
|
| 34 |
|
35 |
|
| - |
|
36 |
import javassist.expr.NewArray;
|
| - |
|
37 |
|
| 35 |
import javax.servlet.ServletContext;
|
38 |
import javax.servlet.ServletContext;
|
| 36 |
import javax.servlet.ServletOutputStream;
|
39 |
import javax.servlet.ServletOutputStream;
|
| 37 |
import javax.servlet.http.HttpServletRequest;
|
40 |
import javax.servlet.http.HttpServletRequest;
|
| 38 |
import javax.servlet.http.HttpServletResponse;
|
41 |
import javax.servlet.http.HttpServletResponse;
|
| 39 |
import javax.servlet.http.HttpSession;
|
42 |
import javax.servlet.http.HttpSession;
|
| Line 66... |
Line 69... |
| 66 |
/**
|
69 |
/**
|
| 67 |
* @author Varun Gupta
|
70 |
* @author Varun Gupta
|
| 68 |
* @description: This class handles web requests to generate vendor specific reconciliation reports
|
71 |
* @description: This class handles web requests to generate vendor specific reconciliation reports
|
| 69 |
* for given vendor for a given date range
|
72 |
* for given vendor for a given date range
|
| 70 |
*/
|
73 |
*/
|
| 71 |
|
74 |
//
|
| 72 |
//@InterceptorRefs({
|
75 |
//@InterceptorRefs({
|
| 73 |
// @InterceptorRef("defaultStack"),
|
76 |
// @InterceptorRef("defaultStack"),
|
| 74 |
// @InterceptorRef("login")
|
77 |
// @InterceptorRef("login")
|
| 75 |
//})
|
78 |
//})
|
| 76 |
//@Results({
|
79 |
//@Results({
|
| Line 86... |
Line 89... |
| 86 |
BILLING_NUMBER(2),
|
89 |
BILLING_NUMBER(2),
|
| 87 |
BILLING_DATE(3),
|
90 |
BILLING_DATE(3),
|
| 88 |
DELIVERY_DATE(4),
|
91 |
DELIVERY_DATE(4),
|
| 89 |
SETTLEMENT_DATE(5),
|
92 |
SETTLEMENT_DATE(5),
|
| 90 |
CURRENT_STATUS(6),
|
93 |
CURRENT_STATUS(6),
|
| - |
|
94 |
PAYMENT_STATUS(7),
|
| 91 |
BRAND(7),
|
95 |
BRAND(7),
|
| 92 |
MODEL_NAME(8),
|
96 |
MODEL_NAME(8),
|
| 93 |
MODEL_NUMBER(9),
|
97 |
MODEL_NUMBER(9),
|
| 94 |
COLOR(10),
|
98 |
COLOR(10),
|
| 95 |
QUANTITY(11),
|
99 |
QUANTITY(11),
|
| Line 157... |
Line 161... |
| 157 |
private Map<Long, Map<String, Double>> misMatches = new HashMap<Long, Map<String, Double>>();
|
161 |
private Map<Long, Map<String, Double>> misMatches = new HashMap<Long, Map<String, Double>>();
|
| 158 |
private Map<Long, String> ebsSettlementSummaries;
|
162 |
private Map<Long, String> ebsSettlementSummaries;
|
| 159 |
|
163 |
|
| 160 |
private List<OrderStatus> refundOrderStatuses = new ArrayList<OrderStatus>();
|
164 |
private List<OrderStatus> refundOrderStatuses = new ArrayList<OrderStatus>();
|
| 161 |
|
165 |
|
| - |
|
166 |
private List<Order> refundedOrdersBilledinDateRange = new ArrayList<Order>();
|
| - |
|
167 |
private List<Order> reshippedOrders = new ArrayList<Order>();
|
| - |
|
168 |
|
| 162 |
private final DateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy");
|
169 |
private final DateFormat DATE_FORMAT = new SimpleDateFormat("dd/MM/yyyy");
|
| 163 |
|
170 |
|
| 164 |
public VendorReconciliationController() {
|
171 |
public VendorReconciliationController() {
|
| 165 |
try {
|
172 |
try {
|
| 166 |
CatalogClient csc = new CatalogClient();
|
173 |
CatalogClient csc = new CatalogClient();
|
| Line 237... |
Line 244... |
| 237 |
Date endDate = dateFormat.parse(request.getParameter("end"));
|
244 |
Date endDate = dateFormat.parse(request.getParameter("end"));
|
| 238 |
long vendorId = Long.parseLong(request.getParameter("vendor"));
|
245 |
long vendorId = Long.parseLong(request.getParameter("vendor"));
|
| 239 |
|
246 |
|
| 240 |
logger.info(startDate + " " + endDate + " " + vendorId);
|
247 |
logger.info(startDate + " " + endDate + " " + vendorId);
|
| 241 |
|
248 |
|
| 242 |
TransactionClient tsc = new TransactionClient();
|
249 |
String vendorName = getVendorName(vendorId);
|
| 243 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
- |
|
| 244 |
|
- |
|
| 245 |
List<Order> orders = transactionClient.getBilledOrdersForVendor(vendorId, startDate.getTime(), endDate.getTime());
|
- |
|
| 246 |
logger.info("Order count: " + orders.size());
|
- |
|
| 247 |
DateFormat dateFormatForFile = new SimpleDateFormat("dd.MM.yyyy");
|
250 |
DateFormat dateFormatForFile = new SimpleDateFormat("dd.MM.yyyy");
|
| 248 |
String vendorName = getVendorName(vendorId);
|
- |
|
| 249 |
|
251 |
|
| 250 |
response.setContentType("application/vnd.ms-excel");
|
252 |
response.setContentType("application/vnd.ms-excel");
|
| 251 |
response.setHeader("Content-disposition", "inline; filename=" + vendorName + "-reconciliation-from-" + dateFormatForFile.format(startDate) + "-" + dateFormatForFile.format(endDate) + ".xls");
|
253 |
response.setHeader("Content-disposition", "inline; filename=" + vendorName + "-reconciliation-from-" + dateFormatForFile.format(startDate) + "-" + dateFormatForFile.format(endDate) + ".xls");
|
| 252 |
|
254 |
|
| 253 |
ServletOutputStream sos;
|
255 |
ServletOutputStream sos;
|
| 254 |
try {
|
256 |
try {
|
| 255 |
ByteArrayOutputStream baos = getReconciliationReport(orders, startDate, endDate);
|
257 |
ByteArrayOutputStream baos = getReconciliationReport(vendorId, startDate, endDate);
|
| 256 |
sos = response.getOutputStream();
|
258 |
sos = response.getOutputStream();
|
| 257 |
baos.writeTo(sos);
|
259 |
baos.writeTo(sos);
|
| 258 |
sos.flush();
|
260 |
sos.flush();
|
| 259 |
} catch (IOException e) {
|
261 |
} catch (IOException e) {
|
| 260 |
logger.error("Error while streaming the hotspot reconciliation report", e);
|
262 |
logger.error("Error while streaming the hotspot reconciliation report", e);
|
| 261 |
}
|
263 |
}
|
| 262 |
} catch (ParseException e) {
|
264 |
} catch (ParseException e) {
|
| 263 |
logger.error("Unable to parse the start or end date", e);
|
265 |
logger.error("Unable to parse the start or end date", e);
|
| 264 |
} catch (TransactionServiceException e) {
|
- |
|
| 265 |
logger.error("Error while getting order information from the transaction service", e);
|
- |
|
| 266 |
} catch (TException e) {
|
- |
|
| 267 |
logger.error("Unable to get the orders or the warehouses", e);
|
- |
|
| 268 |
} catch (NullPointerException e) {
|
266 |
} catch (NullPointerException e) {
|
| 269 |
logger.error("NullPointerException", e);
|
267 |
logger.error("NullPointerException", e);
|
| 270 |
} catch (Exception e) {
|
- |
|
| 271 |
logger.error("Unexpected exception", e);
|
- |
|
| 272 |
}
|
268 |
}
|
| 273 |
return new DefaultHttpHeaders("report");
|
269 |
return new DefaultHttpHeaders("report");
|
| 274 |
}
|
270 |
}
|
| 275 |
|
271 |
|
| 276 |
public void uploadEBSSettlementSummary() {
|
272 |
public void uploadEBSSettlementSummary() {
|
| 277 |
|
273 |
|
| Line 687... |
Line 683... |
| 687 |
}
|
683 |
}
|
| 688 |
addActionMessage("Successfully added Aramex settlement details for " + countSuccessfulSaves + " orders");
|
684 |
addActionMessage("Successfully added Aramex settlement details for " + countSuccessfulSaves + " orders");
|
| 689 |
}
|
685 |
}
|
| 690 |
|
686 |
|
| 691 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
687 |
// Prepares the XLS worksheet object and fills in the data with proper formatting
|
| 692 |
private ByteArrayOutputStream getReconciliationReport(List<Order> orders, Date startDate, Date endDate) {
|
688 |
private ByteArrayOutputStream getReconciliationReport(long vendorId, Date startDate, Date endDate) {
|
| 693 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
- |
|
| 694 |
|
689 |
|
| - |
|
690 |
List<Order> billedOrders = null;
|
| - |
|
691 |
try {
|
| 695 |
Workbook wb = new HSSFWorkbook();
|
692 |
TransactionClient tsc = new TransactionClient();
|
| - |
|
693 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| 696 |
|
694 |
|
| - |
|
695 |
PaymentClient psc = new PaymentClient();
|
| - |
|
696 |
in.shop2020.payments.PaymentService.Client paymentClient = psc.getClient();
|
| - |
|
697 |
|
| - |
|
698 |
billedOrders = transactionClient.getBilledOrdersForVendor(vendorId, startDate.getTime(), endDate.getTime());
|
| - |
|
699 |
logger.info("Billed Orders count: " + billedOrders.size());
|
| - |
|
700 |
|
| - |
|
701 |
List<PaymentSettlement> paymentSettlements = transactionClient.getSettlementsByDate(startDate.getTime(), endDate.getTime(), false);
|
| - |
|
702 |
logger.info("Settlement Count: " + paymentSettlements.size());
|
| - |
|
703 |
|
| - |
|
704 |
List<Order> settledOrders = new ArrayList<Order>();
|
| - |
|
705 |
|
| - |
|
706 |
for (PaymentSettlement paymentSettlement: paymentSettlements) {
|
| - |
|
707 |
Payment payment = paymentClient.getPayment(paymentSettlement.getPaymentId());
|
| - |
|
708 |
Transaction txn = transactionClient.getTransaction(payment.getMerchantTxnId());
|
| - |
|
709 |
settledOrders.addAll(txn.getOrders());
|
| - |
|
710 |
}
|
| - |
|
711 |
logger.info("Settled Orders count: " + settledOrders.size());
|
| - |
|
712 |
|
| - |
|
713 |
} catch (TransactionServiceException e) {
|
| - |
|
714 |
String errMsg = "Transaction Service Exception occured";
|
| - |
|
715 |
logger.error(errMsg, e);
|
| - |
|
716 |
addActionError(errMsg);
|
| - |
|
717 |
} catch (TTransportException e) {
|
| - |
|
718 |
String errMsg = "Transaction Service Exception occured";
|
| - |
|
719 |
logger.error(errMsg, e);
|
| - |
|
720 |
addActionError(errMsg);
|
| - |
|
721 |
} catch (TException e) {
|
| - |
|
722 |
// TODO Auto-generated
|
| - |
|
723 |
String errMsg = "Transaction Service Exception occured";
|
| - |
|
724 |
logger.error(errMsg, e);
|
| - |
|
725 |
addActionError(errMsg);
|
| - |
|
726 |
|
| - |
|
727 |
} catch (PaymentException e) {
|
| - |
|
728 |
String errMsg = "Transaction Service Exception occured";
|
| - |
|
729 |
logger.error(errMsg, e);
|
| - |
|
730 |
addActionError(errMsg);
|
| - |
|
731 |
}
|
| - |
|
732 |
|
| - |
|
733 |
ByteArrayOutputStream baosXLS = new ByteArrayOutputStream();
|
| - |
|
734 |
// return baosXLS;
|
| - |
|
735 |
|
| - |
|
736 |
Workbook wb = new HSSFWorkbook();
|
| - |
|
737 |
|
| 697 |
//Create the style for the title row
|
738 |
//Create the style for the title row
|
| 698 |
Font font = wb.createFont();
|
739 |
Font font = wb.createFont();
|
| 699 |
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
740 |
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
|
| 700 |
CellStyle boldStyle = wb.createCellStyle();
|
741 |
CellStyle boldStyle = wb.createCellStyle();
|
| 701 |
boldStyle.setFont(font);
|
742 |
boldStyle.setFont(font);
|
| Line 704... |
Line 745... |
| 704 |
rightAlignStyle.setAlignment(CellStyle.ALIGN_RIGHT);
|
745 |
rightAlignStyle.setAlignment(CellStyle.ALIGN_RIGHT);
|
| 705 |
|
746 |
|
| 706 |
Sheet orderSheet = wb.createSheet("Orders");
|
747 |
Sheet orderSheet = wb.createSheet("Orders");
|
| 707 |
Sheet mismatchSheet = wb.createSheet("Mismatches");
|
748 |
Sheet mismatchSheet = wb.createSheet("Mismatches");
|
| 708 |
|
749 |
|
| 709 |
populateOrderSheet(orders, startDate, endDate, orderSheet, boldStyle, rightAlignStyle);
|
750 |
populateOrderSheet(billedOrders, startDate, endDate, orderSheet, boldStyle, rightAlignStyle);
|
| 710 |
populateMismatchSheet(mismatchSheet);
|
751 |
populateMismatchSheet(mismatchSheet);
|
| 711 |
|
752 |
|
| 712 |
// Write the workbook to the output stream
|
753 |
// Write the workbook to the output stream
|
| 713 |
try {
|
754 |
try {
|
| 714 |
wb.write(baosXLS);
|
755 |
wb.write(baosXLS);
|
| Line 771... |
Line 812... |
| 771 |
headerRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue("Total Transfer Price");
|
812 |
headerRow.createCell(OrderReportColumn.TOTAL_TRANSFER_PRICE.getValue()).setCellValue("Total Transfer Price");
|
| 772 |
headerRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue("Total Selling Price");
|
813 |
headerRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue("Total Selling Price");
|
| 773 |
headerRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue("Current Status");
|
814 |
headerRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue("Current Status");
|
| 774 |
headerRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue("Gateway Transaction Id");
|
815 |
headerRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue("Gateway Transaction Id");
|
| 775 |
headerRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("Payment Type");
|
816 |
headerRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("Payment Type");
|
| - |
|
817 |
headerRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue("Payment Status");
|
| 776 |
headerRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue("Payment Id");
|
818 |
headerRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue("Payment Id");
|
| 777 |
headerRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue("Coupon Code");
|
819 |
headerRow.createCell(OrderReportColumn.COUPON_CODE.getValue()).setCellValue("Coupon Code");
|
| 778 |
// headerRow.createCell(OrderReportColumn.COUPON_CATEGORY.getValue()).setCellValue("Coupon Category");
|
820 |
// headerRow.createCell(OrderReportColumn.COUPON_CATEGORY.getValue()).setCellValue("Coupon Category");
|
| 779 |
// headerRow.createCell(OrderReportColumn.DISCOUNT.getValue()).setCellValue("Discount");
|
821 |
// headerRow.createCell(OrderReportColumn.DISCOUNT.getValue()).setCellValue("Discount");
|
| 780 |
headerRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue("Service Tax");
|
822 |
headerRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue("Service Tax");
|
| Line 787... |
Line 829... |
| 787 |
sheet.createRow(serialNo ++);
|
829 |
sheet.createRow(serialNo ++);
|
| 788 |
|
830 |
|
| 789 |
TransactionClient tsc;
|
831 |
TransactionClient tsc;
|
| 790 |
PaymentClient psc;
|
832 |
PaymentClient psc;
|
| 791 |
LogisticsClient lsc;
|
833 |
LogisticsClient lsc;
|
| 792 |
|
834 |
|
| 793 |
try {
|
835 |
try {
|
| 794 |
tsc = new TransactionClient();
|
836 |
tsc = new TransactionClient();
|
| 795 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
837 |
in.shop2020.model.v1.order.TransactionService.Client transactionClient = tsc.getClient();
|
| 796 |
|
838 |
|
| 797 |
psc = new PaymentClient();
|
839 |
psc = new PaymentClient();
|
| Line 823... |
Line 865... |
| 823 |
refunds.put(settlement.getPaymentId(), settlement);
|
865 |
refunds.put(settlement.getPaymentId(), settlement);
|
| 824 |
}
|
866 |
}
|
| 825 |
|
867 |
|
| 826 |
List <Long> orderIds = new ArrayList<Long>();
|
868 |
List <Long> orderIds = new ArrayList<Long>();
|
| 827 |
Map<Long, List<Order>> orderMap = new HashMap<Long, List<Order>>();
|
869 |
Map<Long, List<Order>> orderMap = new HashMap<Long, List<Order>>();
|
| - |
|
870 |
|
| - |
|
871 |
int countMultipleOrderTxns = 0;
|
| 828 |
|
872 |
|
| 829 |
for(Order order : orders) {
|
873 |
for(Order order : orders) {
|
| 830 |
orderIds.add(order.getId());
|
874 |
orderIds.add(order.getId());
|
| 831 |
|
875 |
|
| 832 |
if (orderMap.containsKey(order.getTransactionId())) {
|
876 |
if (orderMap.containsKey(order.getTransactionId())) {
|
| 833 |
orderMap.get(order.getTransactionId()).add(order);
|
877 |
orderMap.get(order.getTransactionId()).add(order);
|
| - |
|
878 |
countMultipleOrderTxns += 1;
|
| 834 |
|
879 |
|
| 835 |
} else {
|
880 |
} else {
|
| 836 |
List<Order> o = new ArrayList<Order>();
|
881 |
List<Order> o = new ArrayList<Order>();
|
| 837 |
o.add(order);
|
882 |
o.add(order);
|
| 838 |
orderMap.put(order.getTransactionId(), o);
|
883 |
orderMap.put(order.getTransactionId(), o);
|
| 839 |
}
|
884 |
}
|
| 840 |
}
|
885 |
}
|
| 841 |
|
886 |
|
| 842 |
List<Long> reshippedOrderIds = null;
|
887 |
// Getting list of order ids belonging to reshipped orders
|
| 843 |
|
- |
|
| 844 |
reshippedOrderIds = transactionClient.getReshippedOrderIds(orderIds);
|
888 |
List<Long> reshippedOrderIds = transactionClient.getReshippedOrderIds(orderIds);
|
| 845 |
|
889 |
|
| 846 |
for(long txnId: orderMap.keySet()) {
|
890 |
for(long txnId: orderMap.keySet()) {
|
| 847 |
List<Order> orderList = orderMap.get(txnId);
|
891 |
List<Order> orderList = orderMap.get(txnId);
|
| 848 |
|
892 |
|
| 849 |
for (Order order: orderList) {
|
893 |
for (Order order: orderList) {
|
| 850 |
logger.info("For order: " + order.getId());
|
894 |
logger.info("For order: " + order.getId());
|
| - |
|
895 |
|
| - |
|
896 |
boolean isReshippedOrder = reshippedOrderIds.contains(order.getId());
|
| - |
|
897 |
|
| - |
|
898 |
if (isReshippedOrder) {
|
| - |
|
899 |
reshippedOrders.add(order);
|
| - |
|
900 |
// orderList.remove(order);
|
| - |
|
901 |
// orderMap.get(txnId).remove(order);
|
| - |
|
902 |
continue;
|
| - |
|
903 |
}
|
| 851 |
|
904 |
|
| 852 |
LineItem lineItem = order.getLineitems().get(0);
|
905 |
LineItem lineItem = order.getLineitems().get(0);
|
| 853 |
double transferPrice = lineItem.getTransfer_price();
|
906 |
double transferPrice = lineItem.getTransfer_price();
|
| 854 |
Payment payment = null;
|
907 |
Payment payment = null;
|
| 855 |
|
908 |
|
| 856 |
try {
|
909 |
try {
|
| - |
|
910 |
if(order.isCod()) {
|
| - |
|
911 |
payment = paymentClient.getPaymentForTxnId(order.getTransactionId()).get(0);
|
| - |
|
912 |
} else {
|
| 857 |
payment = paymentClient.getSuccessfulPaymentForTxnId(order.getTransactionId());
|
913 |
payment = paymentClient.getSuccessfulPaymentForTxnId(order.getTransactionId());
|
| - |
|
914 |
}
|
| 858 |
logger.info("getSuccessfulPaymentForTxnId: " + payment);
|
915 |
logger.info("getSuccessfulPaymentForTxnId, " + order.getTransactionId() + ": " + payment);
|
| 859 |
|
916 |
|
| 860 |
} catch (TApplicationException e) {
|
917 |
} catch (TApplicationException e) {
|
| 861 |
orderIdsWithoutSuccess.add(order.getId());
|
918 |
orderIdsWithoutSuccess.add(order.getId());
|
| 862 |
|
- |
|
| 863 |
logger.error("Exception while getting successfull payment for transaction Id, " + order.getTransactionId(), e);
|
919 |
String errMsg = "Exception while getting successfull payment for transaction Id, " + order.getTransactionId();
|
| - |
|
920 |
logger.error(errMsg, e);
|
| 864 |
addActionError("Exception while getting payment for transaction Id, " + order.getTransactionId());
|
921 |
addActionError(errMsg);
|
| 865 |
}
|
922 |
}
|
| 866 |
|
923 |
|
| 867 |
Transaction txn = transactionClient.getTransaction(order.getTransactionId());
|
924 |
Transaction txn = transactionClient.getTransaction(order.getTransactionId());
|
| 868 |
PaymentSettlement paymentSettlement = null;
|
925 |
PaymentSettlement paymentSettlement = null;
|
| 869 |
String paymentType = null;
|
926 |
String paymentType = null;
|
| Line 914... |
Line 971... |
| 914 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(totalSellingPrice);
|
971 |
contentRow.createCell(OrderReportColumn.TOTAL_SELLING_PRICE.getValue()).setCellValue(totalSellingPrice);
|
| 915 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatusDescription());
|
972 |
contentRow.createCell(OrderReportColumn.CURRENT_STATUS.getValue()).setCellValue(order.getStatusDescription());
|
| 916 |
|
973 |
|
| 917 |
double refund = 0.0;
|
974 |
double refund = 0.0;
|
| 918 |
|
975 |
|
| - |
|
976 |
if(order.isCod()) {
|
| - |
|
977 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue("COD - " + codProviders.get(order.getLogistics_provider_id()));
|
| - |
|
978 |
} else {
|
| - |
|
979 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue(paymentType);
|
| - |
|
980 |
}
|
| - |
|
981 |
|
| 919 |
if (payment != null) {
|
982 |
if (payment != null) {
|
| 920 |
contentRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(paymentSettlement.getSettlementDate())));
|
983 |
contentRow.createCell(OrderReportColumn.SETTLEMENT_DATE.getValue()).setCellValue(DATE_FORMAT.format(new Date(paymentSettlement.getSettlementDate())));
|
| 921 |
contentRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue(payment.getGatewayTxnId());
|
984 |
contentRow.createCell(OrderReportColumn.GATEWAY_TRANSACTION_ID.getValue()).setCellValue(payment.getGatewayTxnId());
|
| 922 |
contentRow.createCell(OrderReportColumn.PAYMENT_TYPE.getValue()).setCellValue(paymentType);
|
985 |
contentRow.createCell(OrderReportColumn.PAYMENT_STATUS.getValue()).setCellValue(payment.getStatus().name());
|
| 923 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(payment.getPaymentId());
|
986 |
contentRow.createCell(OrderReportColumn.PAYMENT_ID.getValue()).setCellValue(payment.getPaymentId());
|
| 924 |
|
987 |
|
| 925 |
if(refunds.containsKey(payment.getPaymentId())) {
|
988 |
if(refunds.containsKey(payment.getPaymentId())) {
|
| 926 |
refund = refunds.get(payment.getPaymentId()).getNetCollection();
|
989 |
refund = refunds.get(payment.getPaymentId()).getNetCollection();
|
| 927 |
refunds.remove(payment.getPaymentId());
|
990 |
refunds.remove(payment.getPaymentId());
|
| Line 932... |
Line 995... |
| 932 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue(serviceTax);
|
995 |
contentRow.createCell(OrderReportColumn.SERVICE_TAX.getValue()).setCellValue(serviceTax);
|
| 933 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue(otherCollectionCharges);
|
996 |
contentRow.createCell(OrderReportColumn.OTHER_CHARGES.getValue()).setCellValue(otherCollectionCharges);
|
| 934 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue(netCollection);
|
997 |
contentRow.createCell(OrderReportColumn.NET_COLLECTION.getValue()).setCellValue(netCollection);
|
| 935 |
contentRow.createCell(OrderReportColumn.FINAL_AMOUNT.getValue()).setCellValue(netCollection - refund);
|
998 |
contentRow.createCell(OrderReportColumn.FINAL_AMOUNT.getValue()).setCellValue(netCollection - refund);
|
| 936 |
|
999 |
|
| 937 |
boolean isReshippedOrder = reshippedOrderIds.contains(order.getId());
|
- |
|
| 938 |
contentRow.createCell(OrderReportColumn.IS_RESHIPED_ORDER.getValue()).setCellValue(isReshippedOrder ? 1 : 0);
|
1000 |
contentRow.createCell(OrderReportColumn.IS_RESHIPED_ORDER.getValue()).setCellValue(isReshippedOrder ? 1 : 0);
|
| 939 |
}
|
1001 |
}
|
| 940 |
}
|
1002 |
}
|
| 941 |
|
1003 |
|
| - |
|
1004 |
logger.info("Reshipped Orders ", reshippedOrders);
|
| - |
|
1005 |
|
| 942 |
logger.info("Order Ids where no successful payment was found: " + orderIdsWithoutSuccess.size());
|
1006 |
logger.info("Order Ids where no successful payment was found: " + orderIdsWithoutSuccess.size());
|
| 943 |
logger.info(orderIdsWithoutSuccess.toString());
|
1007 |
logger.info(orderIdsWithoutSuccess.toString());
|
| 944 |
logger.info("Pending Refunds: " + refunds);
|
1008 |
logger.info("Pending Refunds: " + refunds);
|
| 945 |
logger.info("Reshipped Order Ids" + reshippedOrderIds);
|
1009 |
logger.info("Reshipped Order Ids" + reshippedOrderIds);
|
| - |
|
1010 |
logger.info("countMultipleOrderTxns: " + countMultipleOrderTxns);
|
| 946 |
|
1011 |
|
| 947 |
sheet.createRow(serialNo++);
|
1012 |
sheet.createRow(serialNo++);
|
| 948 |
|
1013 |
|
| 949 |
// Refunds belonging to orders billed before the start date of supplied billing date range
|
1014 |
// Refunds belonging to orders billed before the start date of supplied billing date range
|
| 950 |
for (long paymentId: refunds.keySet()) {
|
1015 |
for (long paymentId: refunds.keySet()) {
|