Blame | Last modification | View Log | RSS feed
package com.spice.profitmandi.web.v2.controller;import com.spice.profitmandi.dao.entity.fofo.CustomerAddress;import com.spice.profitmandi.dao.entity.fofo.Customer;import com.spice.profitmandi.dao.model.AddCartRequest;import com.spice.profitmandi.common.model.CreatePendingOrderRequest;import com.spice.profitmandi.web.controller.OtpLoginRequest;import com.spice.profitmandi.web.controller.UserModel;import com.spice.profitmandi.service.catalog.BiddingModel;import com.spice.profitmandi.web.controller.StoreController;import com.spice.profitmandi.web.v2.response.ApiResponse;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.http.ResponseEntity;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.*;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;@RestController@RequestMapping("/v2")public class V2StoreController extends V2BaseController {@Autowiredprivate StoreController storeController;@GetMapping("/store/entity/{id}")public ResponseEntity<ApiResponse<?>> getUnitFocoDeal(HttpServletRequest request,@PathVariable(value = "id") long id) throws Throwable {return wrapResponse(storeController.getUnitFocoDeal(request, id));}@GetMapping("/store/brands")public ResponseEntity<ApiResponse<?>> getBrands(HttpServletRequest request,@RequestParam(value = "category_id") String category_id) throws Throwable {return wrapResponse(storeController.getBrands(request, category_id));}@GetMapping("/store/listing/{listingUrl}")public ResponseEntity<ApiResponse<?>> bestSellers(HttpServletRequest request,@PathVariable String listingUrl) throws Throwable {return wrapResponse(storeController.bestSellers(request, listingUrl));}@GetMapping("/store/otp/generateOTP")public ResponseEntity<ApiResponse<?>> generateOtp(HttpServletRequest request,@RequestParam String mobile) throws Throwable {return wrapResponse(storeController.generateOtp(request, mobile));}@GetMapping("/store/checkmobile/{mobile}")public ResponseEntity<ApiResponse<?>> checkRegistrationUsingMobile(HttpServletRequest request,@PathVariable String mobile,@RequestParam(required = false, defaultValue = "false") boolean isSmartSeller) throws Throwable {return wrapResponse(storeController.checkRegistrationUsingMobile(request, mobile, isSmartSeller));}@GetMapping("/store/getCustomerById/{id}")public ResponseEntity<ApiResponse<?>> getCustomerById(HttpServletRequest request,@PathVariable int id) throws Throwable {return wrapResponse(storeController.getCustomerById(request, id));}@PostMapping("/store/signin")public ResponseEntity<ApiResponse<?>> signIn(HttpServletRequest request,@RequestBody UserModel userModel) throws Throwable {return wrapResponse(storeController.signIn(request, userModel));}@PostMapping("/store/resetPassword")public ResponseEntity<ApiResponse<?>> resetPassword(@RequestBody UserModel userModel) throws Throwable {return wrapResponse(storeController.resetPassword(userModel));}@PostMapping("/store/changePassword")public ResponseEntity<ApiResponse<?>> changePassword(@RequestBody UserModel userModel) throws Throwable {return wrapResponse(storeController.changePassword(userModel));}@PostMapping("/store/register")public ResponseEntity<ApiResponse<?>> register(HttpServletRequest request,@RequestBody UserModel userModel) throws Throwable {return wrapResponse(storeController.register(request, userModel));}@PostMapping("/store/signinWithOtp")public ResponseEntity<ApiResponse<?>> signInWithOtp(HttpServletRequest request,@RequestBody OtpLoginRequest otpLoginRequest) throws Throwable {return wrapResponse(storeController.signInWithOtp(request, otpLoginRequest));}@GetMapping("/store/checkplans")public ResponseEntity<ApiResponse<?>> getInsurancePrices(HttpServletRequest request,@RequestParam float price,Model model,@RequestParam int itemId) throws Throwable {return wrapResponse(storeController.getInsurancePrices(request, price, model, itemId));}@PostMapping("/store/confirmOrder")public ResponseEntity<ApiResponse<?>> confirmOrder(HttpServletRequest request,@RequestBody CreatePendingOrderRequest createPendingOrderRequest) throws Throwable {return wrapResponse(storeController.confirmOrder(request, createPendingOrderRequest));}@GetMapping("/store/address")public ResponseEntity<ApiResponse<?>> getAddress(HttpServletRequest request) throws Throwable {return wrapResponse(storeController.getAddress(request));}@PostMapping("/store/address/defaultAddress/{addressId}/{customerId}")public ResponseEntity<ApiResponse<?>> setDefaultAddress(HttpServletRequest request,@PathVariable int addressId,@PathVariable int customerId) throws Throwable {return wrapResponse(storeController.setDefaultAddress(request, addressId, customerId));}@GetMapping("/store/address/{pincode}")public ResponseEntity<ApiResponse<?>> getStoresByPincode(HttpServletRequest request,@PathVariable String pincode) throws Throwable {return wrapResponse(storeController.getStoresByPincode(request, pincode));}@GetMapping("/store/addresses")public ResponseEntity<ApiResponse<?>> getStoresByPincod(HttpServletRequest request,@RequestParam String pincode,@RequestParam(name = "fofoCode", defaultValue = "", required = false) String fofoCode) throws Throwable {return wrapResponse(storeController.getStoresByPincod(request, pincode, fofoCode));}@GetMapping("/store/address/detail/{pincode}")public ResponseEntity<ApiResponse<?>> getStoresDetailsByPincode(HttpServletRequest request,@PathVariable String pincode) throws Throwable {return wrapResponse(storeController.getStoresDetailsByPincode(request, pincode));}@GetMapping("/store/order")public ResponseEntity<ApiResponse<?>> getOrderDetail(HttpServletRequest request,@RequestParam(value = "id") int id,@RequestParam(name = "offset") int offset,@RequestParam(name = "limit") int limit) throws Throwable {return wrapResponse(storeController.getOrderDetail(request, id, offset, limit));}@GetMapping("/store/invoiceOrder")public ResponseEntity<ApiResponse<?>> getOrderInvoiceDetail(HttpServletRequest request,@RequestParam(value = "id") int id,@RequestParam(name = "offset") int offset,@RequestParam(name = "limit") int limit) throws Throwable {return wrapResponse(storeController.getOrderInvoiceDetail(request, id, offset, limit));}@GetMapping("/store/generateInvoice")public ResponseEntity<?> generateInvoice(HttpServletRequest request,@RequestParam(name = "orderId") int orderId) throws Throwable {// Returns PDF binary - pass through directly, cannot wrap in ApiResponsereturn storeController.generateInvoice(request, orderId);}@GetMapping("/store/listing")public ResponseEntity<ApiResponse<?>> getStoresListing(HttpServletRequest request) throws Throwable {return wrapResponse(storeController.getStoresListing(request));}@GetMapping("/store/stateList")public ResponseEntity<ApiResponse<?>> getStateList(HttpServletRequest request) throws Throwable {return wrapResponse(storeController.getStateList(request));}@PostMapping("/store/cart")public ResponseEntity<ApiResponse<?>> cart(HttpServletRequest request,@RequestBody AddCartRequest cartRequest) throws Throwable {return wrapResponse(storeController.cart(request, cartRequest));}@GetMapping("/store/partnerStock")public ResponseEntity<ApiResponse<?>> partnerStock(HttpServletRequest request,@RequestParam(required = false, defaultValue = "3") String categoryId,@RequestParam int offset,@RequestParam int limit,@RequestParam(required = false) String sort,@RequestParam(required = false) String brand,@RequestParam(value = "subCategoryId", required = false) int subCategoryId,@RequestParam(required = false) String queryTerm,@RequestParam(required = false) String listing,@RequestParam(required = false, defaultValue = "true") boolean partnerStockOnly) throws Throwable {return wrapResponse(storeController.partnerStock(request, categoryId, offset, limit, sort, brand, subCategoryId, queryTerm, listing, partnerStockOnly));}@GetMapping("store/order-status/{pendingOrderId}")public ResponseEntity<ApiResponse<?>> orderStatus(HttpServletRequest request,@PathVariable int pendingOrderId) throws Throwable {return wrapResponse(storeController.orderStatus(request, pendingOrderId));}@GetMapping("/store/addresses/{customerId}")public ResponseEntity<ApiResponse<?>> getAll(HttpServletRequest request,@PathVariable int customerId) throws Throwable {return wrapResponse(storeController.getAll(request, customerId));}@PostMapping("/store/address")public ResponseEntity<ApiResponse<?>> addAddress(HttpServletRequest request,@RequestBody CustomerAddress customerAddress) throws Throwable {return wrapResponse(storeController.addAddress(request, customerAddress));}@PostMapping("/store/deactivateCustomerAddress")public ResponseEntity<ApiResponse<?>> deactivateAddresss(HttpServletRequest request,@RequestParam int id) throws Throwable {return wrapResponse(storeController.deactivateAddresss(request, id));}@PostMapping("/store/updateCustomer")public ResponseEntity<ApiResponse<?>> updateCustomerProfile(HttpServletRequest request,@RequestBody Customer customer) throws Throwable {return wrapResponse(storeController.updateCustomerProfile(request, customer));}// TODO: getStoreIndex returns void and writes HTML directly to response - skipping as it's a redirect/page handler// @GetMapping("/stores/{state}/{city}/{storeCode}")@PostMapping("/cancelPendingOrderItem")public ResponseEntity<ApiResponse<?>> cancelPendingOrderItem(HttpServletRequest request,@RequestParam int id,@RequestParam String statusDescription,@RequestParam String reason) throws Throwable {return wrapResponse(storeController.cancelPendingOrderItem(request, id, statusDescription, reason));}@GetMapping("/store/checkEligibilityStoreOffers")public ResponseEntity<ApiResponse<?>> checkEligibilityStoreOffers(HttpServletRequest request,@RequestParam(value = "id") int id) throws Throwable {return wrapResponse(storeController.checkEligibilityStoreOffers(request, id));}@GetMapping("/store/ScratchOffers")public ResponseEntity<ApiResponse<?>> scratchOffers(HttpServletRequest request,@RequestParam(value = "id") int id) throws Throwable {return wrapResponse(storeController.scratchOffers(request, id));}@PostMapping("/store/ScratchedOffer")public ResponseEntity<ApiResponse<?>> scratchedOffer(HttpServletRequest request,@RequestParam(value = "id") int id) throws Throwable {return wrapResponse(storeController.scratchedOffer(request, id));}@GetMapping("/store/navbar")public ResponseEntity<ApiResponse<?>> navBars() throws Throwable {return wrapResponse(storeController.navBars());}@GetMapping("/getMonthSale")public ResponseEntity<ApiResponse<?>> getMonthsale(HttpServletRequest request) throws Throwable {return wrapResponse(storeController.getMonthsale(request));}@GetMapping("/getBrandwisePartnerSale")public ResponseEntity<ApiResponse<?>> getBrandwisePartnerSale(HttpServletRequest request,@RequestParam(name = "month", required = true, defaultValue = "0") int month,Model model) throws Throwable {return wrapResponse(storeController.getBrandwisePartnerSale(request, month, model));}@GetMapping("/getBrandItemwisePartnerSale")public ResponseEntity<ApiResponse<?>> getBrandItemwisePartnerSale(HttpServletRequest request,@RequestParam(name = "month", required = true, defaultValue = "0") int month,@RequestParam(name = "brand") String brand) throws Throwable {return wrapResponse(storeController.getBrandItemwisePartnerSale(request, month, brand));}@GetMapping("/store/clearance")public ResponseEntity<ApiResponse<?>> getLiquidations() throws Throwable {return wrapResponse(storeController.getLiquidations());}@PostMapping("/store/clearance/bid")public ResponseEntity<ApiResponse<?>> saveBidding(HttpServletRequest request,@RequestBody BiddingModel biddingModel) throws Throwable {return wrapResponse(storeController.saveBidding(request, biddingModel));}}