Subversion Repositories SmartDukaan

Rev

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

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