Subversion Repositories SmartDukaan

Rev

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

Rev 26089 Rev 26254
Line 223... Line 223...
223
	public void refundToWallet(Integer retailerId, Float amountToRefund, Integer transactionId,
223
	public void refundToWallet(Integer retailerId, Float amountToRefund, Integer transactionId,
224
			WalletReferenceType walletReferenceType, String description) throws ProfitMandiBusinessException {
224
			WalletReferenceType walletReferenceType, String description) throws ProfitMandiBusinessException {
225
 
225
 
226
		List<UserWalletHistory> all_entries = userWalletHistoryRepository
226
		List<UserWalletHistory> all_entries = userWalletHistoryRepository
227
				.selectAllByreferenceIdandreferenceType(transactionId, walletReferenceType);
227
				.selectAllByreferenceIdandreferenceType(transactionId, walletReferenceType);
-
 
228
 
228
		UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
229
		UserWallet userWallet = userWalletRepository.selectByRetailerId(retailerId);
229
		int walletAmount = walletService.getWalletAmount(retailerId);
230
		int walletAmount = walletService.getWalletAmount(retailerId);
230
		LOGGER.info("userWallet" + userWallet);
231
		LOGGER.info("userWallet" + userWallet);
231
		int max_eligible_credit_amount = 0;
232
		int max_eligible_credit_amount = 0;
232
 
233
 
-
 
234
		LOGGER.info("all_entries {}",all_entries);
233
		for (UserWalletHistory history : all_entries) {
235
		for (UserWalletHistory history : all_entries) {
234
			max_eligible_credit_amount -= history.getAmount();
236
			max_eligible_credit_amount -= history.getAmount();
235
		}
237
		}
236
		if (max_eligible_credit_amount < amountToRefund) {
238
		if (max_eligible_credit_amount < amountToRefund) {
237
 
239
 
Line 250... Line 252...
250
		userWalletHistory.setReferenceType(walletReferenceType);
252
		userWalletHistory.setReferenceType(walletReferenceType);
251
		userWalletHistory.setWalletId(userWallet.getId());
253
		userWalletHistory.setWalletId(userWallet.getId());
252
		userWalletHistory.setTimestamp(LocalDateTime.now());
254
		userWalletHistory.setTimestamp(LocalDateTime.now());
253
		userWalletHistory.setDescription(description);
255
		userWalletHistory.setDescription(description);
254
 
256
 
255
		LOGGER.info("all_entries" + userWalletHistory);
-
 
256
		userWalletHistoryRepository.persist(userWalletHistory);
257
		userWalletHistoryRepository.persist(userWalletHistory);
257
 
258
 
258
	}
259
	}
259
 
260
 
260
	@Override
261
	@Override