| Line 41... |
Line 41... |
| 41 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
41 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 42 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
42 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 43 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
43 |
import com.spice.profitmandi.dao.entity.catalog.TagListing;
|
| 44 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
44 |
import com.spice.profitmandi.dao.entity.fofo.CurrentInventorySnapshot;
|
| 45 |
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
|
45 |
import com.spice.profitmandi.dao.entity.inventory.ItemAvailabilityCache;
|
| - |
|
46 |
import com.spice.profitmandi.dao.enumuration.dtr.OtpType;
|
| 46 |
import com.spice.profitmandi.dao.model.AddCartRequest;
|
47 |
import com.spice.profitmandi.dao.model.AddCartRequest;
|
| 47 |
import com.spice.profitmandi.dao.model.CartItem;
|
48 |
import com.spice.profitmandi.dao.model.CartItem;
|
| 48 |
import com.spice.profitmandi.dao.model.CartItemResponseModel;
|
49 |
import com.spice.profitmandi.dao.model.CartItemResponseModel;
|
| 49 |
import com.spice.profitmandi.dao.model.CartResponse;
|
50 |
import com.spice.profitmandi.dao.model.CartResponse;
|
| 50 |
import com.spice.profitmandi.dao.repository.catalog.CategoryRepository;
|
51 |
import com.spice.profitmandi.dao.repository.catalog.CategoryRepository;
|
| Line 56... |
Line 57... |
| 56 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
57 |
import com.spice.profitmandi.dao.repository.inventory.ItemAvailabilityCacheRepository;
|
| 57 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
58 |
import com.spice.profitmandi.service.authentication.RoleManager;
|
| 58 |
import com.spice.profitmandi.service.inventory.FofoAvailabilityInfo;
|
59 |
import com.spice.profitmandi.service.inventory.FofoAvailabilityInfo;
|
| 59 |
import com.spice.profitmandi.service.inventory.FofoCatalogResponse;
|
60 |
import com.spice.profitmandi.service.inventory.FofoCatalogResponse;
|
| 60 |
import com.spice.profitmandi.service.pricing.PricingService;
|
61 |
import com.spice.profitmandi.service.pricing.PricingService;
|
| - |
|
62 |
import com.spice.profitmandi.web.processor.OtpProcessor;
|
| 61 |
import com.spice.profitmandi.web.res.DealBrands;
|
63 |
import com.spice.profitmandi.web.res.DealBrands;
|
| 62 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
64 |
import com.spice.profitmandi.web.res.DealObjectResponse;
|
| 63 |
import com.spice.profitmandi.web.res.DealsResponse;
|
65 |
import com.spice.profitmandi.web.res.DealsResponse;
|
| 64 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
66 |
import com.spice.profitmandi.web.res.ValidateCartResponse;
|
| 65 |
|
67 |
|
| Line 70... |
Line 72... |
| 70 |
@Controller
|
72 |
@Controller
|
| 71 |
@Transactional(rollbackFor = Throwable.class)
|
73 |
@Transactional(rollbackFor = Throwable.class)
|
| 72 |
public class StoreController {
|
74 |
public class StoreController {
|
| 73 |
|
75 |
|
| 74 |
private static final Logger logger = LogManager.getLogger(StoreController.class);
|
76 |
private static final Logger logger = LogManager.getLogger(StoreController.class);
|
| 75 |
|
77 |
|
| 76 |
private static final LocalTime CUTOFF_TIME = LocalTime.of(15, 0);
|
78 |
private static final LocalTime CUTOFF_TIME = LocalTime.of(15, 0);
|
| 77 |
|
79 |
|
| 78 |
@Value("${python.api.host}")
|
80 |
@Value("${python.api.host}")
|
| 79 |
private String host;
|
81 |
private String host;
|
| 80 |
|
82 |
|
| Line 96... |
Line 98... |
| 96 |
|
98 |
|
| 97 |
@Autowired
|
99 |
@Autowired
|
| 98 |
private Mongo mongoClient;
|
100 |
private Mongo mongoClient;
|
| 99 |
|
101 |
|
| 100 |
@Autowired
|
102 |
@Autowired
|
| - |
|
103 |
private OtpProcessor otpProcessor;
|
| - |
|
104 |
|
| - |
|
105 |
@Autowired
|
| 101 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
106 |
private CurrentInventorySnapshotRepository currentInventorySnapshotRepository;
|
| 102 |
|
107 |
|
| 103 |
@Autowired
|
108 |
@Autowired
|
| 104 |
private UserAccountRepository userAccountRepository;
|
109 |
private UserAccountRepository userAccountRepository;
|
| 105 |
|
110 |
|
| Line 222... |
Line 227... |
| 222 |
}.getType());
|
227 |
}.getType());
|
| 223 |
|
228 |
|
| 224 |
return responseSender.ok(dealBrandsResponse);
|
229 |
return responseSender.ok(dealBrandsResponse);
|
| 225 |
}
|
230 |
}
|
| 226 |
|
231 |
|
| - |
|
232 |
@RequestMapping(value = "/store/otp/verifyOTP", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| - |
|
233 |
public ResponseEntity<?> cart(HttpServletRequest request, @RequestParam String email, @RequestParam String phone)
|
| - |
|
234 |
throws Exception {
|
| - |
|
235 |
|
| - |
|
236 |
return responseSender.ok(otpProcessor.generateOtp(email, phone, OtpType.PREBOOKING_ORDER));
|
| - |
|
237 |
|
| - |
|
238 |
}
|
| - |
|
239 |
|
| 227 |
@RequestMapping(value = "/store/cart", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
240 |
@RequestMapping(value = "/store/cart", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
| 228 |
@ApiImplicitParams({
|
241 |
@ApiImplicitParams({
|
| 229 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
242 |
@ApiImplicitParam(name = "Auth-Token", value = "Auth-Token", required = true, dataType = "string", paramType = "header") })
|
| 230 |
@ApiOperation(value = "Get brand list and count for category")
|
243 |
@ApiOperation(value = "Get brand list and count for category")
|
| 231 |
public ResponseEntity<?> cart(HttpServletRequest request, @RequestBody AddCartRequest cartRequest)
|
244 |
public ResponseEntity<?> cart(HttpServletRequest request, @RequestBody AddCartRequest cartRequest)
|
| Line 277... |
Line 290... |
| 277 |
} else if (tagListing.isActive()) {
|
290 |
} else if (tagListing.isActive()) {
|
| 278 |
estimate = 2;
|
291 |
estimate = 2;
|
| 279 |
} else {
|
292 |
} else {
|
| 280 |
estimate = -2;
|
293 |
estimate = -2;
|
| 281 |
}
|
294 |
}
|
| 282 |
if(estimate>=0 && LocalTime.now().isAfter(CUTOFF_TIME)) {
|
295 |
if (estimate >= 0 && LocalTime.now().isAfter(CUTOFF_TIME)) {
|
| 283 |
estimate = estimate + 1;
|
296 |
estimate = estimate + 1;
|
| 284 |
}
|
297 |
}
|
| 285 |
cartItemResponseModel.setEstimate(estimate);
|
298 |
cartItemResponseModel.setEstimate(estimate);
|
| 286 |
cartItemResponseModel.setTitle(item.getItemDescriptionNoColor());
|
299 |
cartItemResponseModel.setTitle(item.getItemDescriptionNoColor());
|
| 287 |
cartItemResponseModel.setItemId(cartItem.getItemId());
|
300 |
cartItemResponseModel.setItemId(cartItem.getItemId());
|