Untitled
unknown
plain_text
2 years ago
2.0 kB
1
Indexable
Never
kagecom.infy.ekart.cart.api; importjava.util.Set; importjavax.validation.Valid; importjavax.validation.constraints.NotNull; importjavax.validation.constraints.Pattern; importorg.apache.commons.logging.Log; importorg.apache.commons.logging.LogFactory; importorg.springframework.beans.factory.annotation.Autowired; importorg.springframework.core.env.Environment; importorg.springframework.http.HttpStatus; importorg.springframework.http.ResponseEntity; importorg.springframework.validation.annotation.Validated; importorg.springframework.web.bind.annotation.CrossOrigin; importorg.springframework.web.bind.annotation.DeleteMapping; importorg.springframework.web.bind.annotation.GetMapping; importorg.springframework.web.bind.annotation.PathVariable; importorg.springframework.web.bind.annotation.PostMapping; importorg.springframework.web.bind.annotation.PutMapping; importorg.springframework.web.bind.annotation.RequestBody; importorg.springframework.web.bind.annotation.RequestMapping; importorg.springframework.web.bind.annotation.RestController; importorg.springframework.web.client.RestTemplate; importcom.infy.ekart.cart.dto.CartProductDTO; importcom.infy.ekart.cart.dto.CustomerCartDTO; importcom.infy.ekart.cart.dto.ProductDTO; importcom.infy.ekart.cart.exception.EKartCustomerCartException; importcom.infy.ekart.cart.service.CustomerCartService; @CrossOrigin @RestController @RequestMapping(value="/customercart-api") @Validated publicclassCustomerCartAPI{ @Autowired privateCustomerCartServicecustomerCartService; @Autowired privateEnvironmentenvironment; @Autowired privateRestTemplatetemplate; Loglogger=LogFactory.getLog(CustomerCartAPI.class); @PostMapping(value="/products") publicResponseEntity<String>addProductToCart(@Valid@RequestBody CustomerCartDTOcustomerCartDTO) throwsEKartCustomerCartException{ logger.info("Receivedarequesttoaddproductsfor"+ customerCartDTO.getCustomerEmailId()); IntegercartId=customerCartService.addProductToCart(customerCartDTO);