Subversion Repositories SmartDukaan

Rev

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

Rev 22609 Rev 22931
Line 27... Line 27...
27
public class WalletController {
27
public class WalletController {
28
 
28
 
29
	private static final Logger log=LoggerFactory.getLogger(WalletController.class);
29
	private static final Logger log=LoggerFactory.getLogger(WalletController.class);
30
 
30
 
31
	@Autowired
31
	@Autowired
32
	UserWalletRepository userWalletRepository;
32
	private WalletService walletService;
33
	
33
	
34
	@Autowired
34
	@Autowired
35
	WalletService walletService;
-
 
36
	
-
 
37
	@Autowired
-
 
38
	ResponseSender<?> responseSender;
35
	private ResponseSender<?> responseSender;
39
	
36
	
40
	@RequestMapping(value = ProfitMandiConstants.URL_MY_WALLET, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
37
	@RequestMapping(value = ProfitMandiConstants.URL_MY_WALLET, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
41
	@ApiImplicitParams({
38
	@ApiImplicitParams({
42
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", 
39
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", 
43
				required = true, dataType = "string", paramType = "header")
40
				required = true, dataType = "string", paramType = "header")
44
	})
41
	})
45
	@ApiOperation(value = "")
42
	@ApiOperation(value = "")
46
	public ResponseEntity<?> getMyWallet(HttpServletRequest request){
43
	public ResponseEntity<?> getMyWallet(HttpServletRequest request) throws ProfitMandiBusinessException{
47
		int userId = (int)request.getAttribute("userId");
44
		int userId = (int)request.getAttribute("userId");
48
		try{
-
 
49
			return responseSender.ok(walletService.getUserWalletByUserId(userId));
45
		return responseSender.ok(walletService.getUserWalletByUserId(userId));
50
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
-
 
51
			return responseSender.badRequest(profitMandiBusinessException);
-
 
52
		}
-
 
53
	}
46
	}
54
 
47
 
55
	@RequestMapping(value = ProfitMandiConstants.URL_MY_WALLET_HISTORY, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
48
	@RequestMapping(value = ProfitMandiConstants.URL_MY_WALLET_HISTORY, method=RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
56
	@ApiImplicitParams({
49
	@ApiImplicitParams({
57
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", 
50
		@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", 
58
				required = true, dataType = "string", paramType = "header")
51
				required = true, dataType = "string", paramType = "header")
59
	})
52
	})
60
	public ResponseEntity<?> getMyWalletHistory(HttpServletRequest request){
53
	public ResponseEntity<?> getMyWalletHistory(HttpServletRequest request) throws ProfitMandiBusinessException{
61
		int userId = (int)request.getAttribute("userId");
54
		int userId = (int)request.getAttribute("userId");
62
		try{
-
 
63
			return responseSender.ok(walletService.getUserWalletHistoryByUserId(userId));
55
		return responseSender.ok(walletService.getUserWalletHistoryByUserId(userId));
64
		}catch(ProfitMandiBusinessException profitMandiBusinessException){
-
 
65
			return responseSender.badRequest(profitMandiBusinessException);
-
 
66
		}
-
 
67
	}
56
	}
68
 
57
 
69
}
58
}
70
59