| Line 27... |
Line 27... |
| 27 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
27 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 28 |
import com.spice.profitmandi.dao.entity.dtr.UserAccounts;
|
28 |
import com.spice.profitmandi.dao.entity.dtr.UserAccounts;
|
| 29 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
29 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
| 30 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
30 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| 31 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
31 |
import com.spice.profitmandi.dao.repository.dtr.UserRepository;
|
| - |
|
32 |
import com.spice.profitmandi.dao.repository.transaction.PendingRechargeCommissionRepository;
|
| 32 |
import com.spice.profitmandi.thrift.clients.PaymentClient;
|
33 |
import com.spice.profitmandi.thrift.clients.PaymentClient;
|
| 33 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
34 |
import com.spice.profitmandi.thrift.clients.TransactionClient;
|
| 34 |
import com.spice.profitmandi.web.req.CreateRechargeRequest;
|
35 |
import com.spice.profitmandi.web.req.CreateRechargeRequest;
|
| 35 |
import com.spice.profitmandi.web.res.ConfirmRechargeResponse;
|
36 |
import com.spice.profitmandi.web.res.ConfirmRechargeResponse;
|
| 36 |
import com.spice.profitmandi.web.res.CreateRechargeResponse;
|
37 |
import com.spice.profitmandi.web.res.CreateRechargeResponse;
|
| Line 66... |
Line 67... |
| 66 |
|
67 |
|
| 67 |
@Autowired
|
68 |
@Autowired
|
| 68 |
private UserRepository userRepository;
|
69 |
private UserRepository userRepository;
|
| 69 |
|
70 |
|
| 70 |
@Autowired
|
71 |
@Autowired
|
| - |
|
72 |
private PendingRechargeCommissionRepository pendingRechargeCommissionRepository;
|
| - |
|
73 |
|
| - |
|
74 |
@Autowired
|
| 71 |
private ResponseSender<?> responseSender;
|
75 |
private ResponseSender<?> responseSender;
|
| 72 |
|
76 |
|
| 73 |
@RequestMapping(value = ProfitMandiConstants.URL_GET_SERVICE_PROVIDER, method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
77 |
@RequestMapping(value = ProfitMandiConstants.URL_GET_SERVICE_PROVIDER, method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
| 74 |
@ApiImplicitParams({
|
78 |
@ApiImplicitParams({
|
| 75 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",
|
79 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",
|
| Line 134... |
Line 138... |
| 134 |
required = true, dataType = "string", paramType = "header")
|
138 |
required = true, dataType = "string", paramType = "header")
|
| 135 |
})
|
139 |
})
|
| 136 |
@ApiOperation(value = "")
|
140 |
@ApiOperation(value = "")
|
| 137 |
public ResponseEntity<?> confirmRecharge(HttpServletRequest request, @RequestParam(value="rechargeAmount") long rechargeAmount)
|
141 |
public ResponseEntity<?> confirmRecharge(HttpServletRequest request, @RequestParam(value="rechargeAmount") long rechargeAmount)
|
| 138 |
throws ProfitMandiBusinessException{
|
142 |
throws ProfitMandiBusinessException{
|
| 139 |
int userId = (int)request.getAttribute("userId");
|
143 |
int userId = (int)request.getAttribute(ProfitMandiConstants.USER_ID);
|
| 140 |
UserAccounts userAccount = null;
|
144 |
UserAccounts userAccount = null;
|
| 141 |
UserWallet wallet = null;
|
145 |
UserWallet wallet = null;
|
| 142 |
if (rechargeAmount <=0){
|
146 |
if (rechargeAmount <=0){
|
| 143 |
return responseSender.badRequest(null);
|
147 |
return responseSender.badRequest(null);
|
| 144 |
}
|
148 |
}
|
| Line 160... |
Line 164... |
| 160 |
crr.setCanProceed(false);
|
164 |
crr.setCanProceed(false);
|
| 161 |
crr.setReason("You don't have sufficient wallet balance");
|
165 |
crr.setReason("You don't have sufficient wallet balance");
|
| 162 |
}
|
166 |
}
|
| 163 |
return responseSender.ok(crr);
|
167 |
return responseSender.ok(crr);
|
| 164 |
}
|
168 |
}
|
| - |
|
169 |
|
| - |
|
170 |
@RequestMapping(value = ProfitMandiConstants.URL_RECHARGE_PENDING_COMMISSION, method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
171 |
@ApiImplicitParams({
|
| - |
|
172 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",
|
| - |
|
173 |
required = true, dataType = "string", paramType = "header")
|
| - |
|
174 |
})
|
| - |
|
175 |
@ApiOperation(value = "")
|
| - |
|
176 |
public ResponseEntity<?> getPendingRechargeCommission(HttpServletRequest request)
|
| - |
|
177 |
throws ProfitMandiBusinessException{
|
| - |
|
178 |
int userId = (int)request.getAttribute(ProfitMandiConstants.USER_ID);
|
| - |
|
179 |
int retailerId = userAccountRepository.selectRetailerIdByUserId(userId);
|
| - |
|
180 |
return responseSender.ok(pendingRechargeCommissionRepository.selectByRetailerId(retailerId));
|
| - |
|
181 |
}
|
| 165 |
|
182 |
|
| 166 |
@RequestMapping(value = ProfitMandiConstants.URL_CREATE_RECHARGE , method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
183 |
@RequestMapping(value = ProfitMandiConstants.URL_CREATE_RECHARGE , method=RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
|
| 167 |
@ApiImplicitParams({
|
184 |
@ApiImplicitParams({
|
| 168 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",
|
185 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token",
|
| 169 |
required = true, dataType = "string", paramType = "header")
|
186 |
required = true, dataType = "string", paramType = "header")
|