Subversion Repositories SmartDukaan

Rev

Rev 23761 | Rev 23929 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23761 Rev 23762
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);