| Line 43... |
Line 43... |
| 43 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
43 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| 44 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
44 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
| 45 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
45 |
import com.spice.profitmandi.dao.entity.transaction.UserWallet;
|
| 46 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
46 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
| 47 |
import com.spice.profitmandi.dao.enumuration.dtr.RechargeType;
|
47 |
import com.spice.profitmandi.dao.enumuration.dtr.RechargeType;
|
| - |
|
48 |
import com.spice.profitmandi.dao.model.UserCart;
|
| 48 |
import com.spice.profitmandi.dao.repository.GenericRepository;
|
49 |
import com.spice.profitmandi.dao.repository.GenericRepository;
|
| 49 |
import com.spice.profitmandi.dao.repository.dtr.RechargeCommissionRepository;
|
50 |
import com.spice.profitmandi.dao.repository.dtr.RechargeCommissionRepository;
|
| 50 |
import com.spice.profitmandi.dao.repository.dtr.RechargeOperatorRepository;
|
51 |
import com.spice.profitmandi.dao.repository.dtr.RechargeOperatorRepository;
|
| 51 |
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderRepository;
|
52 |
import com.spice.profitmandi.dao.repository.dtr.RechargeProviderRepository;
|
| 52 |
import com.spice.profitmandi.dao.repository.dtr.RechargeTransactionRepository;
|
53 |
import com.spice.profitmandi.dao.repository.dtr.RechargeTransactionRepository;
|
| Line 317... |
Line 318... |
| 317 |
|
318 |
|
| 318 |
public ResponseEntity<?> createRechargeDown(HttpServletRequest request,
|
319 |
public ResponseEntity<?> createRechargeDown(HttpServletRequest request,
|
| 319 |
@RequestBody CreateRechargeRequest createRechargeRequest) throws ProfitMandiBusinessException {
|
320 |
@RequestBody CreateRechargeRequest createRechargeRequest) throws ProfitMandiBusinessException {
|
| 320 |
|
321 |
|
| 321 |
int userId = (int) request.getAttribute(ProfitMandiConstants.USER_ID);
|
322 |
int userId = (int) request.getAttribute(ProfitMandiConstants.USER_ID);
|
| - |
|
323 |
int retailerId = userAccountRepository.selectRetailerIdByUserId(userId);
|
| 322 |
User user = null;
|
324 |
User saholicUser = null;
|
| 323 |
try {
|
325 |
try {
|
| 324 |
user = userRepository.selectById(userId);
|
326 |
saholicUser = userRepository.selectById(retailerId);
|
| 325 |
if (UNBLOCKED_RECHARGE_EMAILS.contains(user.getEmailId())) {
|
327 |
if (UNBLOCKED_RECHARGE_EMAILS.contains(saholicUser.getEmailId())) {
|
| 326 |
return createRecharge(request, createRechargeRequest);
|
328 |
return createRecharge(request, createRechargeRequest);
|
| 327 |
}
|
329 |
}
|
| 328 |
} catch (ProfitMandiBusinessException e) {
|
330 |
} catch (ProfitMandiBusinessException e) {
|
| 329 |
log.error("Unable to get user", e);
|
331 |
log.error("Unable to get user", e);
|
| 330 |
}
|
332 |
}
|
| Line 363... |
Line 365... |
| 363 |
crr.setReason("You don't have sufficient wallet balance.");
|
365 |
crr.setReason("You don't have sufficient wallet balance.");
|
| 364 |
crr.setResult(false);
|
366 |
crr.setResult(false);
|
| 365 |
return responseSender.badRequest(crr);
|
367 |
return responseSender.badRequest(crr);
|
| 366 |
}
|
368 |
}
|
| 367 |
|
369 |
|
| 368 |
User user = null;
|
370 |
User saholicUser = null;
|
| 369 |
try {
|
371 |
try {
|
| 370 |
user = userRepository.selectById(userId);
|
372 |
saholicUser = userRepository.selectById(retailerId);
|
| 371 |
} catch (ProfitMandiBusinessException e) {
|
373 |
} catch (ProfitMandiBusinessException e) {
|
| 372 |
log.error("Unable to get user", e);
|
374 |
log.error("Unable to get user", e);
|
| 373 |
crr.setReason("We are experiencing some problem right now.");
|
375 |
crr.setReason("We are experiencing some problem right now.");
|
| 374 |
crr.setResult(false);
|
376 |
crr.setResult(false);
|
| 375 |
return responseSender.internalServerError(e);
|
377 |
return responseSender.internalServerError(e);
|
| 376 |
}
|
378 |
}
|
| 377 |
|
379 |
|
| 378 |
RechargeRequest rechargeRequest = convertRechargeRequest(createRechargeRequest);
|
380 |
RechargeRequest rechargeRequest = convertRechargeRequest(createRechargeRequest);
|
| 379 |
if (!UNBLOCKED_RECHARGE_EMAILS.contains(user.getEmailId())) {
|
381 |
if (!UNBLOCKED_RECHARGE_EMAILS.contains(saholicUser.getEmailId())) {
|
| 380 |
throw new ProfitMandiBusinessException("Recharge Provider", createRechargeRequest.getOperatorId(),
|
382 |
throw new ProfitMandiBusinessException("Recharge Provider", createRechargeRequest.getOperatorId(),
|
| 381 |
"We are experiencing some problem right now.");
|
383 |
"We are experiencing some problem right now.");
|
| 382 |
}
|
384 |
}
|
| 383 |
RechargeResponse rechargeResponse = rechargeService.doRecharge(oxigenRechargeTransactionUrl,
|
385 |
RechargeResponse rechargeResponse = rechargeService.doRecharge(oxigenRechargeTransactionUrl,
|
| 384 |
oxigenRechargeAuthKey, oxigenRechargeValidationUrl, oxigenRechargeValidationAuthKey,
|
386 |
oxigenRechargeAuthKey, oxigenRechargeValidationUrl, oxigenRechargeValidationAuthKey,
|