| Line 252... |
Line 252... |
| 252 |
List<RechargeTransaction> pendingTransactions = rechargeTransactionRepository.getPendingCashBackRehargeTransactions();
|
252 |
List<RechargeTransaction> pendingTransactions = rechargeTransactionRepository.getPendingCashBackRehargeTransactions();
|
| 253 |
Map<Object, Double> totalRetailerCashbacks = pendingTransactions.stream().collect(Collectors.groupingBy(x->x.getRetailerId(), Collectors.summingDouble(x->x.getCommission())));
|
253 |
Map<Object, Double> totalRetailerCashbacks = pendingTransactions.stream().collect(Collectors.groupingBy(x->x.getRetailerId(), Collectors.summingDouble(x->x.getCommission())));
|
| 254 |
for (Map.Entry<Object, Double>totalRetailerCashback : totalRetailerCashbacks.entrySet()) {
|
254 |
for (Map.Entry<Object, Double>totalRetailerCashback : totalRetailerCashbacks.entrySet()) {
|
| 255 |
int retailerId = (Integer)totalRetailerCashback.getKey();
|
255 |
int retailerId = (Integer)totalRetailerCashback.getKey();
|
| 256 |
float amount = totalRetailerCashback.getValue().floatValue();
|
256 |
float amount = totalRetailerCashback.getValue().floatValue();
|
| - |
|
257 |
if(Math.round(amount) > 0) {
|
| 257 |
walletService.addAmountToWallet(retailerId, referenceId, WalletReferenceType.CASHBACK, "Recharge Cashback", Math.round(amount));
|
258 |
walletService.addAmountToWallet(retailerId, referenceId, WalletReferenceType.CASHBACK, "Recharge Cashback", Math.round(amount));
|
| - |
|
259 |
}
|
| 258 |
}
|
260 |
}
|
| 259 |
for(RechargeTransaction rt : pendingTransactions) {
|
261 |
for(RechargeTransaction rt : pendingTransactions) {
|
| 260 |
rt.setCashbackTimestamp(cashbackTime);
|
262 |
rt.setCashbackTimestamp(cashbackTime);
|
| 261 |
rt.setCashbackReference(referenceId);
|
263 |
rt.setCashbackReference(referenceId);
|
| 262 |
rechargeTransactionRepository.persist(rt);
|
264 |
rechargeTransactionRepository.persist(rt);
|