| Line 246... |
Line 246... |
| 246 |
@Override
|
246 |
@Override
|
| 247 |
public int createOrder(CreateOrderRequest createOrderRequest, int fofoId, boolean accessoriesDeals)
|
247 |
public int createOrder(CreateOrderRequest createOrderRequest, int fofoId, boolean accessoriesDeals)
|
| 248 |
throws ProfitMandiBusinessException {
|
248 |
throws ProfitMandiBusinessException {
|
| 249 |
LOGGER.info("fofoId -- {} Order Request -- {}", fofoId, createOrderRequest);
|
249 |
LOGGER.info("fofoId -- {} Order Request -- {}", fofoId, createOrderRequest);
|
| 250 |
CustomCustomer customCustomer = createOrderRequest.getCustomer();
|
250 |
CustomCustomer customCustomer = createOrderRequest.getCustomer();
|
| - |
|
251 |
Customer customer = customerRepository.selectById(customCustomer.getCustomerId());
|
| 251 |
|
252 |
|
| 252 |
if (!StringUtils.isValidGstNumber(customCustomer.getGstNumber())) {
|
253 |
if (!StringUtils.isValidGstNumber(customCustomer.getGstNumber())) {
|
| 253 |
LOGGER.error("invalid customer gstNumber {} ", customCustomer.getGstNumber());
|
254 |
LOGGER.error("invalid customer gstNumber {} ", customCustomer.getGstNumber());
|
| 254 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.CUSTOMER_GST_NUMBER,
|
255 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.CUSTOMER_GST_NUMBER,
|
| 255 |
customCustomer.getGstNumber(), "VE_1072");
|
256 |
customCustomer.getGstNumber(), "VE_1072");
|
| Line 319... |
Line 320... |
| 319 |
noGST = item.getHsnCode().equals("NOGST");
|
320 |
noGST = item.getHsnCode().equals("NOGST");
|
| 320 |
if (item.getType().equals(ItemType.SERIALIZED)) {
|
321 |
if (item.getType().equals(ItemType.SERIALIZED)) {
|
| 321 |
for (SerialNumberDetail serialNumberDetail : customFofoOrderItem.getSerialNumberDetails()) {
|
322 |
for (SerialNumberDetail serialNumberDetail : customFofoOrderItem.getSerialNumberDetails()) {
|
| 322 |
serialNumbers.add(serialNumberDetail.getSerialNumber());
|
323 |
serialNumbers.add(serialNumberDetail.getSerialNumber());
|
| 323 |
if (serialNumberDetail.getAmount() > 0) {
|
324 |
if (serialNumberDetail.getAmount() > 0) {
|
| 324 |
if (customCustomer.getEmailId() == null || customCustomer.getEmailId().equals("")) {
|
325 |
if (customer.getEmailId() == null || customer.getEmailId().equals("")
|
| - |
|
326 |
) {
|
| 325 |
throw new ProfitMandiBusinessException("Email Id is required for insurance", "Email Id is required for insurance",
|
327 |
throw new ProfitMandiBusinessException("Email Id is required for insurance", "Email Id is required for insurance",
|
| 326 |
"Email Id is required for insurance");
|
328 |
"Email Id is required for insurance");
|
| 327 |
}
|
329 |
}
|
| 328 |
InsuranceModel im = new InsuranceModel();
|
330 |
InsuranceModel im = new InsuranceModel();
|
| 329 |
im.setBrand(item.getBrand());
|
331 |
im.setBrand(item.getBrand());
|
| Line 458... |
Line 460... |
| 458 |
|
460 |
|
| 459 |
} else {
|
461 |
} else {
|
| 460 |
documentNumber = this.getInvoiceNumber(fofoId, fofoStoreCode);
|
462 |
documentNumber = this.getInvoiceNumber(fofoId, fofoStoreCode);
|
| 461 |
}
|
463 |
}
|
| 462 |
|
464 |
|
| 463 |
Customer customer = customerRepository.selectById(customCustomer.getCustomerId());
|
- |
|
| 464 |
|
- |
|
| 465 |
CustomerAddress customerAddress = customer.getCustomerAddress().stream()
|
465 |
CustomerAddress customerAddress = customer.getCustomerAddress().stream()
|
| 466 |
.filter(x -> x.getId() == customCustomer.getCustomerAddressId()).findFirst().get();
|
466 |
.filter(x -> x.getId() == customCustomer.getCustomerAddressId()).findFirst().get();
|
| 467 |
|
467 |
|
| 468 |
FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId,
|
468 |
FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId,
|
| 469 |
documentNumber, totalAmount, customerAddress.getId());
|
469 |
documentNumber, totalAmount, customerAddress.getId());
|