| Line 55... |
Line 55... |
| 55 |
return responseSender.ok(this.toCustomAddress(customerAddress));
|
55 |
return responseSender.ok(this.toCustomAddress(customerAddress));
|
| 56 |
|
56 |
|
| 57 |
}
|
57 |
}
|
| 58 |
|
58 |
|
| 59 |
@RequestMapping(value = "/customer/add", method = RequestMethod.POST)
|
59 |
@RequestMapping(value = "/customer/add", method = RequestMethod.POST)
|
| 60 |
public ResponseEntity<?> addAddress(HttpServletRequest request, @RequestBody CustomCustomer customCustomer) throws ProfitMandiBusinessException {
|
60 |
public ResponseEntity<?> addCustomer(HttpServletRequest request, @RequestBody CustomCustomer customCustomer) throws ProfitMandiBusinessException {
|
| 61 |
Customer customer = new Customer();
|
61 |
Customer customer = new Customer();
|
| 62 |
if(StringUtils.isEmpty(customCustomer.getFirstName())) {
|
62 |
if(StringUtils.isEmpty(customCustomer.getFirstName())) {
|
| 63 |
throw new ProfitMandiBusinessException("First Name", "Empty", "First Name required");
|
63 |
throw new ProfitMandiBusinessException("First Name", "Empty", "First Name required");
|
| 64 |
}
|
64 |
}
|
| 65 |
customer.setEmailId(customCustomer.getEmailId());
|
65 |
customer.setEmailId(customCustomer.getEmailId());
|
| Line 69... |
Line 69... |
| 69 |
customer = customerService.addCustomer(customer);
|
69 |
customer = customerService.addCustomer(customer);
|
| 70 |
customCustomer.setCustomerId(customer.getId());
|
70 |
customCustomer.setCustomerId(customer.getId());
|
| 71 |
return responseSender.ok(customCustomer);
|
71 |
return responseSender.ok(customCustomer);
|
| 72 |
|
72 |
|
| 73 |
}
|
73 |
}
|
| - |
|
74 |
@RequestMapping(value = "/customer/add-email", method = RequestMethod.POST)
|
| - |
|
75 |
public ResponseEntity<?> addEmail(HttpServletRequest request, @RequestBody CustomCustomer customCustomer) throws ProfitMandiBusinessException {
|
| - |
|
76 |
String emailId = customCustomer.getEmailId();
|
| - |
|
77 |
int customerId = customCustomer.getCustomerId();
|
| - |
|
78 |
Customer customer = customerRepository.selectById(customerId);
|
| - |
|
79 |
customer.setEmailId(emailId);
|
| - |
|
80 |
return this.getCustomerByMobileNumber(request, customer.getMobileNumber());
|
| - |
|
81 |
|
| - |
|
82 |
}
|
| 74 |
|
83 |
|
| 75 |
@RequestMapping(value = "/customer/mobileNumber", method = RequestMethod.GET)
|
84 |
@RequestMapping(value = "/customer/mobileNumber", method = RequestMethod.GET)
|
| 76 |
public ResponseEntity<?> getCustomerByMobileNumber(HttpServletRequest request,
|
85 |
public ResponseEntity<?> getCustomerByMobileNumber(HttpServletRequest request,
|
| 77 |
@RequestParam(name = ProfitMandiConstants.MOBILE_NUMBER) String mobileNumber)
|
86 |
@RequestParam(name = ProfitMandiConstants.MOBILE_NUMBER) String mobileNumber)
|
| 78 |
throws ProfitMandiBusinessException {
|
87 |
throws ProfitMandiBusinessException {
|