| Line 4... |
Line 4... |
| 4 |
import com.spice.profitmandi.common.model.SamsungUpgradeOfferModel;
|
4 |
import com.spice.profitmandi.common.model.SamsungUpgradeOfferModel;
|
| 5 |
import com.spice.profitmandi.common.model.CreateOrderRequest;
|
5 |
import com.spice.profitmandi.common.model.CreateOrderRequest;
|
| 6 |
import com.spice.profitmandi.common.model.InsuranceModel;
|
6 |
import com.spice.profitmandi.common.model.InsuranceModel;
|
| 7 |
import com.spice.profitmandi.common.util.StringUtils;
|
7 |
import com.spice.profitmandi.common.util.StringUtils;
|
| 8 |
import com.spice.profitmandi.dao.cart.CartService;
|
8 |
import com.spice.profitmandi.dao.cart.CartService;
|
| - |
|
9 |
import com.spice.profitmandi.dao.entity.transaction.NotifyOrder;
|
| 9 |
import com.spice.profitmandi.dao.entity.user.Address;
|
10 |
import com.spice.profitmandi.dao.entity.user.Address;
|
| 10 |
import com.spice.profitmandi.dao.model.UserCart;
|
11 |
import com.spice.profitmandi.dao.model.UserCart;
|
| 11 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
12 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| - |
|
13 |
import com.spice.profitmandi.dao.repository.inventory.NotifyStatus;
|
| - |
|
14 |
import com.spice.profitmandi.dao.repository.transaction.NotifyOrderRespository;
|
| 12 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
15 |
import com.spice.profitmandi.dao.repository.user.AddressRepository;
|
| 13 |
import com.spice.profitmandi.web.controller.checkout.OrderController;
|
16 |
import com.spice.profitmandi.web.controller.checkout.OrderController;
|
| 14 |
import com.spice.profitmandi.web.v2.response.ApiResponse;
|
17 |
import com.spice.profitmandi.web.v2.response.ApiResponse;
|
| 15 |
import in.shop2020.model.v1.order.OrderStatus;
|
18 |
import in.shop2020.model.v1.order.OrderStatus;
|
| 16 |
import org.springframework.beans.factory.annotation.Autowired;
|
19 |
import org.springframework.beans.factory.annotation.Autowired;
|
| Line 41... |
Line 44... |
| 41 |
private AddressRepository addressRepository;
|
44 |
private AddressRepository addressRepository;
|
| 42 |
|
45 |
|
| 43 |
@Autowired
|
46 |
@Autowired
|
| 44 |
private CartService cartService;
|
47 |
private CartService cartService;
|
| 45 |
|
48 |
|
| - |
|
49 |
@Autowired
|
| - |
|
50 |
private NotifyOrderRespository notifyOrderRespository;
|
| - |
|
51 |
|
| 46 |
@RequestMapping(value = "/order/create", method = {RequestMethod.POST, RequestMethod.GET})
|
52 |
@RequestMapping(value = "/order/create", method = {RequestMethod.POST, RequestMethod.GET})
|
| 47 |
public ResponseEntity<ApiResponse<?>> createOrder(HttpServletRequest request,
|
53 |
public ResponseEntity<ApiResponse<?>> createOrder(HttpServletRequest request,
|
| 48 |
@RequestParam(value = "paymentOption") String paymentOption,
|
54 |
@RequestParam(value = "paymentOption") String paymentOption,
|
| 49 |
@RequestParam(value = "walletUsed") double walletUsed,
|
55 |
@RequestParam(value = "walletUsed") double walletUsed,
|
| 50 |
@RequestParam(value = "selfPickup", defaultValue = "false") boolean selfPickup,
|
56 |
@RequestParam(value = "selfPickup", defaultValue = "false") boolean selfPickup,
|
| Line 210... |
Line 216... |
| 210 |
public ResponseEntity<ApiResponse<?>> cancelNotifyOrder(HttpServletRequest request,
|
216 |
public ResponseEntity<ApiResponse<?>> cancelNotifyOrder(HttpServletRequest request,
|
| 211 |
@RequestParam int orderId) throws Throwable {
|
217 |
@RequestParam int orderId) throws Throwable {
|
| 212 |
return wrapResponse(orderController.cancelNotifyOrder(request, orderId));
|
218 |
return wrapResponse(orderController.cancelNotifyOrder(request, orderId));
|
| 213 |
}
|
219 |
}
|
| 214 |
|
220 |
|
| - |
|
221 |
/**
|
| - |
|
222 |
* V2 partner-side cancel for a color-change notify order.
|
| - |
|
223 |
* Flips NotifyOrder.status to `cancel` for every pending row on the given orderId —
|
| - |
|
224 |
* mirrors the pattern used by applyColorChange (`approved`) and NotifyHold (`hold`).
|
| - |
|
225 |
* Does not refund or change the underlying Order.status.
|
| - |
|
226 |
*/
|
| - |
|
227 |
@PostMapping("/order/notify-cancel-request")
|
| - |
|
228 |
public ResponseEntity<ApiResponse<?>> notifyCancelRequest(@RequestParam int orderId) throws Throwable {
|
| - |
|
229 |
List<NotifyOrder> notifyOrders = notifyOrderRespository.selectByOrder(orderId);
|
| - |
|
230 |
for (NotifyOrder no : notifyOrders) {
|
| - |
|
231 |
if (no.getStatus() == NotifyStatus.pending) {
|
| - |
|
232 |
no.setStatus(NotifyStatus.cancel);
|
| - |
|
233 |
no.setUpdateTimestamp(LocalDateTime.now());
|
| - |
|
234 |
}
|
| - |
|
235 |
}
|
| - |
|
236 |
return ResponseEntity.ok(ApiResponse.success(true));
|
| - |
|
237 |
}
|
| - |
|
238 |
|
| 215 |
@PostMapping("/raiseBypassRequest")
|
239 |
@PostMapping("/raiseBypassRequest")
|
| 216 |
public ResponseEntity<ApiResponse<?>> raiseBypassRequest(HttpServletRequest request) throws Throwable {
|
240 |
public ResponseEntity<ApiResponse<?>> raiseBypassRequest(HttpServletRequest request) throws Throwable {
|
| 217 |
return wrapResponse(orderController.raiseBypassRequest(request));
|
241 |
return wrapResponse(orderController.raiseBypassRequest(request));
|
| 218 |
}
|
242 |
}
|
| 219 |
|
243 |
|