| Line 21... |
Line 21... |
| 21 |
import org.springframework.web.bind.annotation.RequestMapping;
|
21 |
import org.springframework.web.bind.annotation.RequestMapping;
|
| 22 |
import org.springframework.web.bind.annotation.RequestMethod;
|
22 |
import org.springframework.web.bind.annotation.RequestMethod;
|
| 23 |
import org.springframework.web.bind.annotation.RequestParam;
|
23 |
import org.springframework.web.bind.annotation.RequestParam;
|
| 24 |
|
24 |
|
| 25 |
import com.google.gson.Gson;
|
25 |
import com.google.gson.Gson;
|
| - |
|
26 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| 26 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
27 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 27 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
28 |
import com.spice.profitmandi.common.web.util.ResponseSender;
|
| 28 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
29 |
import com.spice.profitmandi.dao.entity.catalog.Item;
|
| 29 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
30 |
import com.spice.profitmandi.dao.entity.dtr.UserAccount;
|
| 30 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
31 |
import com.spice.profitmandi.dao.enumuration.dtr.AccountType;
|
| Line 82... |
Line 83... |
| 82 |
logger.info("UserAccount................."+userAccount);
|
83 |
logger.info("UserAccount................."+userAccount);
|
| 83 |
|
84 |
|
| 84 |
List<ItemQuantity> itemQuantities = new ArrayList<ItemQuantity>();
|
85 |
List<ItemQuantity> itemQuantities = new ArrayList<ItemQuantity>();
|
| 85 |
CartItems[] cartItems = cartRequest.getCartItems();
|
86 |
CartItems[] cartItems = cartRequest.getCartItems();
|
| 86 |
List<Integer> itemsList = new ArrayList<Integer>();
|
87 |
List<Integer> itemsList = new ArrayList<Integer>();
|
| - |
|
88 |
//Only Keep Billable Stock if partner adds both
|
| 87 |
boolean hasJio = false;
|
89 |
boolean noGst = false;
|
| 88 |
for (CartItems ci: cartItems){
|
90 |
for (CartItems ci: cartItems) {
|
| 89 |
if(itemRepository.selectById(ci.getItemId()).getBrand().equalsIgnoreCase("reliance")) {
|
91 |
if (itemRepository.selectById(ci.getItemId()).getHsnCode().equals("NOGST")) {
|
| 90 |
hasJio = true;
|
- |
|
| 91 |
continue;
|
92 |
noGst=true;
|
| 92 |
}
|
93 |
}
|
| 93 |
}
|
94 |
}
|
| 94 |
for (CartItems ci: cartItems){
|
95 |
for (CartItems ci: cartItems) {
|
| 95 |
if(hasJio && itemRepository.selectById(ci.getItemId()).getBrand().equalsIgnoreCase("reliance")) {
|
96 |
if (noGst && !itemRepository.selectById(ci.getItemId()).getHsnCode().equals("NOGST")) {
|
| 96 |
continue;
|
- |
|
| - |
|
97 |
throw new ProfitMandiBusinessException("Cart Items", "NOGST", "Billable and Nonbillable orders can't be processed together");
|
| 97 |
}
|
98 |
}
|
| 98 |
itemsList.add(ci.getItemId());
|
99 |
itemsList.add(ci.getItemId());
|
| 99 |
ItemQuantity iq = new ItemQuantity(ci.getItemId(), ci.getQuantity());
|
100 |
ItemQuantity iq = new ItemQuantity(ci.getItemId(), ci.getQuantity());
|
| 100 |
itemQuantities.add(iq);
|
101 |
itemQuantities.add(iq);
|
| 101 |
}
|
102 |
}
|