| Line 1009... |
Line 1009... |
| 1009 |
//Rollback entry with reversal reason
|
1009 |
//Rollback entry with reversal reason
|
| 1010 |
if(fofoOrder.getCreateTimestamp().isAfter(LocalDate.of(2020, 4, 1).atStartOfDay())) {
|
1010 |
if(fofoOrder.getCreateTimestamp().isAfter(LocalDate.of(2020, 4, 1).atStartOfDay())) {
|
| 1011 |
float invoiceWalletAmount = 0;
|
1011 |
float invoiceWalletAmount = 0;
|
| 1012 |
float invoiceSchemeReversalAmount = 0;
|
1012 |
float invoiceSchemeReversalAmount = 0;
|
| 1013 |
List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(fofoOrder.getId(), WalletReferenceType.SCHEME_OUT);
|
1013 |
List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository.selectAllByreferenceIdandreferenceType(fofoOrder.getId(), WalletReferenceType.SCHEME_OUT);
|
| 1014 |
totalAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
1014 |
float amountToRollback = userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
| - |
|
1015 |
totalAmount += amountToRollback;
|
| 1015 |
invoiceWalletAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
1016 |
invoiceWalletAmount += amountToRollback;
|
| 1016 |
try {
|
1017 |
try {
|
| 1017 |
walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), totalAmount, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT,
|
1018 |
walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), amountToRollback, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT,
|
| 1018 |
"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());
|
1019 |
"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());
|
| 1019 |
} catch (Exception e) {
|
1020 |
} catch (Exception e) {
|
| 1020 |
LOGGER.info("Failed wallet update Reson [{}]", e.getMessage());
|
1021 |
LOGGER.info("Failed wallet update Reson [{}]", e.getMessage());
|
| 1021 |
}
|
1022 |
}
|
| 1022 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
|
1023 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
|