| Line 1011... |
Line 1011... |
| 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 |
totalAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
| 1015 |
invoiceWalletAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
1015 |
invoiceWalletAmount += userWalletHistory.stream().collect(Collectors.summingInt(y->y.getAmount()));
|
| - |
|
1016 |
try {
|
| 1016 |
walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), totalAmount, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT,
|
1017 |
walletService.rollbackAmountFromWallet(fofoOrder.getFofoId(), totalAmount, fofoOrder.getId(), WalletReferenceType.SCHEME_OUT,
|
| 1017 |
"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());
|
1018 |
"Same order for Invoice-"+ invoiceNumber + "created twice, duplicate invoice rollback", fofoOrder.getCancelledTimestamp());
|
| - |
|
1019 |
} catch (Exception e) {
|
| - |
|
1020 |
LOGGER.info("Failed wallet update Reson [{}]", e.getMessage());
|
| - |
|
1021 |
}
|
| 1018 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
|
1022 |
List<SchemeInOut> schemeInOuts = schemeInOutRepository.selectByInventoryItemIds(new HashSet<>(Arrays.asList(inventoryItemId)));
|
| 1019 |
Set<Integer> schemeIds = new HashSet<>();
|
1023 |
Set<Integer> schemeIds = new HashSet<>();
|
| 1020 |
Set<Integer> schemeIdsRolledback = new HashSet<>();
|
1024 |
Set<Integer> schemeIdsRolledback = new HashSet<>();
|
| 1021 |
for(SchemeInOut sio : schemeInOuts) {
|
1025 |
for(SchemeInOut sio : schemeInOuts) {
|
| 1022 |
if(Math.abs(sio.getCreateTimestamp().getMinute() - fofoOrder.getCreateTimestamp().getMinute()) <= 1 && sio.getRolledBackTimestamp() == null) {
|
1026 |
if(Math.abs(sio.getCreateTimestamp().getMinute() - fofoOrder.getCreateTimestamp().getMinute()) <= 1 && sio.getRolledBackTimestamp() == null) {
|