| Line 1... |
Line 1... |
| 1 |
package com.spice.profitmandi.web.controller;
|
1 |
package com.spice.profitmandi.web.controller;
|
| 2 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
2 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 3 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
3 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 4 |
import com.spice.profitmandi.dao.entity.fofo.TrialForm;
|
4 |
import com.spice.profitmandi.dao.entity.fofo.TrialForm;
|
| 5 |
import com.spice.profitmandi.dao.repository.trialOnboarding.TrialFormRepository;
|
5 |
import com.spice.profitmandi.dao.repository.trialOnboarding.TrialFormRepository;
|
| - |
|
6 |
import com.spice.profitmandi.dao.repository.user.PrivateDealUserRepository;
|
| 6 |
import com.spice.profitmandi.dao.service.TrialService;
|
7 |
import com.spice.profitmandi.dao.service.TrialService;
|
| 7 |
import com.spice.profitmandi.service.integrations.gstpro.GstProService;
|
8 |
import com.spice.profitmandi.service.integrations.gstpro.GstProService;
|
| 8 |
import com.spice.profitmandi.service.integrations.gstpro.entity.GstDetails;
|
9 |
import com.spice.profitmandi.service.integrations.gstpro.entity.GstDetails;
|
| 9 |
import org.apache.logging.log4j.LogManager;
|
10 |
import org.apache.logging.log4j.LogManager;
|
| 10 |
import org.apache.logging.log4j.Logger;
|
11 |
import org.apache.logging.log4j.Logger;
|
| Line 39... |
Line 40... |
| 39 |
|
40 |
|
| 40 |
|
41 |
|
| 41 |
@Autowired
|
42 |
@Autowired
|
| 42 |
TrialService trialService;
|
43 |
TrialService trialService;
|
| 43 |
|
44 |
|
| - |
|
45 |
@Autowired
|
| - |
|
46 |
PrivateDealUserRepository privateDealUserRepository;
|
| - |
|
47 |
|
| 44 |
private static final Logger LOGGER = LogManager.getLogger(DealsController.class);
|
48 |
private static final Logger LOGGER = LogManager.getLogger(DealsController.class);
|
| 45 |
|
49 |
|
| 46 |
|
50 |
|
| 47 |
@RequestMapping(value = "/gstValidate", method = RequestMethod.GET)
|
51 |
@RequestMapping(value = "/gstValidate", method = RequestMethod.GET)
|
| 48 |
public ResponseEntity<?> gstValidate(HttpServletRequest request, @RequestParam String gstNo) throws Exception {
|
52 |
public ResponseEntity<?> gstValidate(HttpServletRequest request, @RequestParam String gstNo) throws Exception {
|
| Line 67... |
Line 71... |
| 67 |
try {
|
71 |
try {
|
| 68 |
TrialForm existingUser = trialOnboardingRepository.findByMobile(trialForm.getMobile());
|
72 |
TrialForm existingUser = trialOnboardingRepository.findByMobile(trialForm.getMobile());
|
| 69 |
if (existingUser != null) {
|
73 |
if (existingUser != null) {
|
| 70 |
return responseSender.badRequest("User already exists, PLease check your mobile number");
|
74 |
return responseSender.badRequest("User already exists, PLease check your mobile number");
|
| 71 |
}
|
75 |
}
|
| - |
|
76 |
|
| - |
|
77 |
boolean existingGst= privateDealUserRepository.isActiveByGst(trialForm.getGstNumber());
|
| - |
|
78 |
if(existingGst){
|
| - |
|
79 |
return responseSender.badRequest("User Gst already exists, PLease check your gst number");
|
| - |
|
80 |
}
|
| - |
|
81 |
|
| 72 |
trialForm.setStatus(ProfitMandiConstants.Status.PENDING);
|
82 |
trialForm.setStatus(ProfitMandiConstants.Status.PENDING);
|
| 73 |
trialForm.setCreatedOn(LocalDateTime.now());
|
83 |
trialForm.setCreatedOn(LocalDateTime.now());
|
| 74 |
trialOnboardingRepository.persist(trialForm);
|
84 |
trialOnboardingRepository.persist(trialForm);
|
| 75 |
trialService.sentMailToTrialUser(trialForm);
|
85 |
trialService.sentMailToTrialUser(trialForm);
|
| 76 |
trialService.sentMailForTrialUser(trialForm);
|
86 |
trialService.sentMailForTrialUser(trialForm);
|