Subversion Repositories SmartDukaan

Rev

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

Rev 24876 Rev 24905
Line 29... Line 29...
29
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
29
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
30
import com.spice.profitmandi.common.model.CustomRetailer;
30
import com.spice.profitmandi.common.model.CustomRetailer;
31
import com.spice.profitmandi.common.model.ProfitMandiConstants;
31
import com.spice.profitmandi.common.model.ProfitMandiConstants;
32
import com.spice.profitmandi.common.model.UnsettledPaymentModel;
32
import com.spice.profitmandi.common.model.UnsettledPaymentModel;
33
import com.spice.profitmandi.common.util.StringUtils;
33
import com.spice.profitmandi.common.util.StringUtils;
34
import com.spice.profitmandi.dao.entity.dtr.Retailer;
-
 
35
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
34
import com.spice.profitmandi.dao.entity.transaction.AddWalletRequest;
36
import com.spice.profitmandi.dao.entity.transaction.ManualPaymentType;
35
import com.spice.profitmandi.dao.entity.transaction.ManualPaymentType;
37
import com.spice.profitmandi.dao.entity.transaction.UnsettledPayment;
36
import com.spice.profitmandi.dao.entity.transaction.UnsettledPayment;
38
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
37
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
39
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
38
import com.spice.profitmandi.dao.entity.transaction.UserWalletHistory;
Line 584... Line 583...
584
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
583
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
585
		return "wallet-history";
584
		return "wallet-history";
586
 
585
 
587
	}
586
	}
588
 
587
 
-
 
588
	@RequestMapping(value = "/getWalletHistoryByPartner", method = RequestMethod.GET)
-
 
589
	public String getWalletHistoryByPartner(HttpServletRequest request,
-
 
590
			int fofoId,
-
 
591
			@RequestParam(name="referenceType",required=false) WalletReferenceType referenceType, 
-
 
592
			@RequestParam(name="offset", required=false, defaultValue="0")int offset, 
-
 
593
			@RequestParam(name="limit", required=false, defaultValue="30")int limit, 
-
 
594
			Model model) throws Exception {
-
 
595
		
-
 
596
		UserWallet userWallet = userWalletRepository.selectByRetailerId(fofoId);
-
 
597
		List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository
-
 
598
				.selectPaginatedByWalletIdReferenceType(userWallet.getId(), referenceType, offset, limit);
-
 
599
		
-
 
600
		model.addAttribute("wallethistory", userWalletHistory);
-
 
601
		
-
 
602
		model.addAttribute("response", mvcResponseSender.createResponseString(true));
-
 
603
		return "wallet-history";
-
 
604
		
-
 
605
	}
-
 
606
 
589
	@RequestMapping(value = "/getPartnerName", method = RequestMethod.GET)
607
	@RequestMapping(value = "/getPartnerName", method = RequestMethod.GET)
590
	public String getPartnerName(HttpServletRequest request,
608
	public String getPartnerName(HttpServletRequest request,
591
			@RequestParam(name = "reference", defaultValue = "0") int reference,
609
			@RequestParam(name = "reference", defaultValue = "0") int reference,
592
			@RequestParam WalletReferenceType referenceType, Model model) throws Exception {
610
			@RequestParam WalletReferenceType referenceType, Model model) throws Exception {
593
 
611
 
594
		List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository
612
		List<UserWalletHistory> userWalletHistory = userWalletHistoryRepository
595
				.selectAllByreferenceIdandreferenceType(reference, referenceType);
613
				.selectAllByreferenceIdandreferenceType(reference, referenceType);
596
		if(userWalletHistory.isEmpty()){
614
		if (userWalletHistory.isEmpty()) {
597
			throw new ProfitMandiBusinessException("RefrenceId", reference, "Reference Id not found");
615
			throw new ProfitMandiBusinessException("RefrenceId", reference, "Reference Id not found");
598
		}
616
		}
599
		UserWallet userWallet = userWalletRepository.selectById(userWalletHistory.get(0).getWalletId());
617
		UserWallet userWallet = userWalletRepository.selectById(userWalletHistory.get(0).getWalletId());
600
		
618
 
601
		CustomRetailer retailer = retailerService.getFofoRetailer(userWallet.getUserId());
619
		CustomRetailer retailer = retailerService.getFofoRetailer(userWallet.getUserId());
602
   
620
 
603
		model.addAttribute("response", mvcResponseSender.createResponseString(retailer));
621
		model.addAttribute("response", mvcResponseSender.createResponseString(retailer));
604
		
622
 
605
		return "response";
623
		return "response";
606
 
624
 
607
	}
625
	}
608
 
626
 
609
	@RequestMapping(value = "/walletUpdate", method = RequestMethod.POST)
627
	@RequestMapping(value = "/walletUpdate", method = RequestMethod.POST)