| Line 1015... |
Line 1015... |
| 1015 |
invoiceWalletAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
1015 |
invoiceWalletAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
| 1016 |
walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), totalAmount, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT,
|
1016 |
walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), totalAmount, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT,
|
| 1017 |
"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());
|
1017 |
"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());
|
| 1018 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
|
1018 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
|
| 1019 |
Set<Integer> schemeIds = new HashSet<>();
|
1019 |
Set<Integer> schemeIds = new HashSet<>();
|
| - |
|
1020 |
Set<Integer> schemeIdsRolledback = new HashSet<>();
|
| 1020 |
for(SchemeInOut sio : schemeInOuts) {
|
1021 |
for(SchemeInOut sio : schemeInOuts) {
|
| 1021 |
if(Math.abs(sio.getCreateTimestamp().getMinute() - fofoOrder.getCreateTimestamp().getMinute()) <= 1 && sio.getRolledBackTimestamp() == null) {
|
1022 |
if(Math.abs(sio.getCreateTimestamp().getMinute() - fofoOrder.getCreateTimestamp().getMinute()) <= 1 && sio.getRolledBackTimestamp() == null) {
|
| 1022 |
LOGGER.info(sio);
|
1023 |
LOGGER.info(sio);
|
| 1023 |
if(!schemeIds.contains(sio.getSchemeId())) {
|
1024 |
if(!schemeIds.contains(sio.getSchemeId())) {
|
| 1024 |
schemeIds.add(sio.getSchemeId());
|
1025 |
schemeIds.add(sio.getSchemeId());
|
| - |
|
1026 |
} else if (!schemeIdsRolledback.contains(sio.getSchemeId())) {
|
| 1025 |
} else {
|
1027 |
schemeIdsRolledback.add(sio.getSchemeId());
|
| 1026 |
sio.setRolledBackTimestamp(LocalDateTime.now());
|
1028 |
sio.setRolledBackTimestamp(LocalDateTime.now());
|
| 1027 |
schemeReverseAmount += sio.getAmount();
|
1029 |
schemeReverseAmount += sio.getAmount();
|
| 1028 |
invoiceSchemeReversalAmount += sio.getAmount();
|
1030 |
invoiceSchemeReversalAmount += sio.getAmount();
|
| 1029 |
}
|
1031 |
}
|
| 1030 |
}
|
1032 |
}
|
| Line 1032... |
Line 1034... |
| 1032 |
LOGGER.info("invoiceWalletAmount - {}, invoiceSchemeReversalAmount {}", invoiceWalletAmount, invoiceSchemeReversalAmount);
|
1034 |
LOGGER.info("invoiceWalletAmount - {}, invoiceSchemeReversalAmount {}", invoiceWalletAmount, invoiceSchemeReversalAmount);
|
| 1033 |
}
|
1035 |
}
|
| 1034 |
}
|
1036 |
}
|
| 1035 |
}
|
1037 |
}
|
| 1036 |
LOGGER.info("Total Sale Amount Reversal - {}, Total Wallet Amount Reversal {}, Total Scheme Reversal Amount - {}", saleAmount, totalAmount, schemeReverseAmount);
|
1038 |
LOGGER.info("Total Sale Amount Reversal - {}, Total Wallet Amount Reversal {}, Total Scheme Reversal Amount - {}", saleAmount, totalAmount, schemeReverseAmount);
|
| - |
|
1039 |
throw new Exception();
|
| 1037 |
}
|
1040 |
}
|
| 1038 |
}
|
1041 |
}
|
| 1039 |
|
1042 |
|
| 1040 |
//7015845171
|
1043 |
//7015845171
|
| 1041 |
|
1044 |
|