| Line 64... |
Line 64... |
| 64 |
import com.spice.profitmandi.dao.entity.fofo.CustomerReturnItem;
|
64 |
import com.spice.profitmandi.dao.entity.fofo.CustomerReturnItem;
|
| 65 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
65 |
import com.spice.profitmandi.dao.entity.fofo.FofoLineItem;
|
| 66 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
66 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrder;
|
| 67 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
67 |
import com.spice.profitmandi.dao.entity.fofo.FofoOrderItem;
|
| 68 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
68 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| - |
|
69 |
import com.spice.profitmandi.dao.entity.fofo.HygieneData;
|
| 69 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
70 |
import com.spice.profitmandi.dao.entity.fofo.InventoryItem;
|
| 70 |
import com.spice.profitmandi.dao.entity.fofo.InvoiceNumberGenerationSequence;
|
71 |
import com.spice.profitmandi.dao.entity.fofo.InvoiceNumberGenerationSequence;
|
| 71 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
72 |
import com.spice.profitmandi.dao.entity.fofo.LiveDemoSerialNumber;
|
| 72 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
73 |
import com.spice.profitmandi.dao.entity.fofo.ScanRecord;
|
| 73 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
74 |
import com.spice.profitmandi.dao.entity.transaction.Order;
|
| Line 77... |
Line 78... |
| 77 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
78 |
import com.spice.profitmandi.dao.enumuration.catalog.SchemeType;
|
| 78 |
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
|
79 |
import com.spice.profitmandi.dao.enumuration.dtr.PaymentOptionReferenceType;
|
| 79 |
import com.spice.profitmandi.dao.enumuration.fofo.ReturnType;
|
80 |
import com.spice.profitmandi.dao.enumuration.fofo.ReturnType;
|
| 80 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
81 |
import com.spice.profitmandi.dao.enumuration.fofo.ScanType;
|
| 81 |
import com.spice.profitmandi.dao.enumuration.fofo.SettlementType;
|
82 |
import com.spice.profitmandi.dao.enumuration.fofo.SettlementType;
|
| - |
|
83 |
|
| 82 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
84 |
import com.spice.profitmandi.dao.repository.catalog.ItemRepository;
|
| 83 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
85 |
import com.spice.profitmandi.dao.repository.catalog.TagListingRepository;
|
| 84 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
86 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 85 |
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
|
87 |
import com.spice.profitmandi.dao.repository.dtr.InsurancePolicyRepository;
|
| 86 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
88 |
import com.spice.profitmandi.dao.repository.dtr.InsuranceProviderRepository;
|
| Line 96... |
Line 98... |
| 96 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
98 |
import com.spice.profitmandi.dao.repository.fofo.CustomerRepository;
|
| 97 |
import com.spice.profitmandi.dao.repository.fofo.CustomerReturnItemRepository;
|
99 |
import com.spice.profitmandi.dao.repository.fofo.CustomerReturnItemRepository;
|
| 98 |
import com.spice.profitmandi.dao.repository.fofo.FofoLineItemRepository;
|
100 |
import com.spice.profitmandi.dao.repository.fofo.FofoLineItemRepository;
|
| 99 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
101 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderItemRepository;
|
| 100 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
102 |
import com.spice.profitmandi.dao.repository.fofo.FofoOrderRepository;
|
| - |
|
103 |
import com.spice.profitmandi.dao.repository.fofo.HygieneDataRepository;
|
| 101 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
104 |
import com.spice.profitmandi.dao.repository.fofo.InventoryItemRepository;
|
| 102 |
import com.spice.profitmandi.dao.repository.fofo.InvoiceNumberGenerationSequenceRepository;
|
105 |
import com.spice.profitmandi.dao.repository.fofo.InvoiceNumberGenerationSequenceRepository;
|
| 103 |
import com.spice.profitmandi.dao.repository.fofo.LiveDemoBillingRespository;
|
106 |
import com.spice.profitmandi.dao.repository.fofo.LiveDemoBillingRespository;
|
| 104 |
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
|
107 |
import com.spice.profitmandi.dao.repository.fofo.PaymentOptionRepository;
|
| 105 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
108 |
import com.spice.profitmandi.dao.repository.fofo.PurchaseReturnItemRepository;
|
| Line 239... |
Line 242... |
| 239 |
private CustomerCreditNoteRepository customerCreditNoteRepository;
|
242 |
private CustomerCreditNoteRepository customerCreditNoteRepository;
|
| 240 |
|
243 |
|
| 241 |
@Autowired
|
244 |
@Autowired
|
| 242 |
private OrderRepository orderRepository;
|
245 |
private OrderRepository orderRepository;
|
| 243 |
|
246 |
|
| - |
|
247 |
@Autowired
|
| - |
|
248 |
private HygieneDataRepository hygieneDataRepository;
|
| - |
|
249 |
|
| 244 |
@Override
|
250 |
@Override
|
| 245 |
public int createOrder(CreateOrderRequest createOrderRequest, int fofoId, boolean accessoriesDeals)
|
251 |
public int createOrder(CreateOrderRequest createOrderRequest, int fofoId, boolean accessoriesDeals)
|
| 246 |
throws ProfitMandiBusinessException {
|
252 |
throws ProfitMandiBusinessException {
|
| 247 |
|
253 |
|
| 248 |
CustomCustomer customCustomer = createOrderRequest.getCustomer();
|
254 |
CustomCustomer customCustomer = createOrderRequest.getCustomer();
|
| Line 467... |
Line 473... |
| 467 |
CustomerAddress customerAddress = this.createCustomerAddress(customCustomer.getAddress(), customer.getId());
|
473 |
CustomerAddress customerAddress = this.createCustomerAddress(customCustomer.getAddress(), customer.getId());
|
| 468 |
|
474 |
|
| 469 |
FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId,
|
475 |
FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId,
|
| 470 |
documentNumber, totalAmount, customerAddress.getId());
|
476 |
documentNumber, totalAmount, customerAddress.getId());
|
| 471 |
|
477 |
|
| - |
|
478 |
HygieneData hygieneData = this.createAndGetHygieneData(fofoOrder.getId(),fofoOrder.getFofoId());
|
| - |
|
479 |
|
| 472 |
this.createPaymentOptions(fofoOrder, createOrderRequest.getPaymentOptions());
|
480 |
this.createPaymentOptions(fofoOrder, createOrderRequest.getPaymentOptions());
|
| 473 |
|
481 |
|
| 474 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoId);
|
482 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoId);
|
| 475 |
|
483 |
|
| 476 |
Address retailerAddress = addressRepository.selectById(retailerAddressId);
|
484 |
Address retailerAddress = addressRepository.selectById(retailerAddressId);
|
| Line 557... |
Line 565... |
| 557 |
walletService.consumeAmountFromWallet(fofoId, insurancePolicy.getId(),
|
565 |
walletService.consumeAmountFromWallet(fofoId, insurancePolicy.getId(),
|
| 558 |
WalletReferenceType.DAMAGE_PROTECTION, walletDescription, insurancePolicy.getPurchaseAmount());
|
566 |
WalletReferenceType.DAMAGE_PROTECTION, walletDescription, insurancePolicy.getPurchaseAmount());
|
| 559 |
insurancePolicyRepository.persist(insurancePolicy);
|
567 |
insurancePolicyRepository.persist(insurancePolicy);
|
| 560 |
}
|
568 |
}
|
| 561 |
}
|
569 |
}
|
| 562 |
//schemeService.processSchemeOut(fofoOrder.getId(), fofoId);
|
570 |
// schemeService.processSchemeOut(fofoOrder.getId(), fofoId);
|
| 563 |
return fofoOrder.getId();
|
571 |
return fofoOrder.getId();
|
| 564 |
}
|
572 |
}
|
| 565 |
|
573 |
|
| - |
|
574 |
private HygieneData createAndGetHygieneData(int id, int fofoId) {
|
| - |
|
575 |
HygieneData hygieneData = new HygieneData();
|
| - |
|
576 |
hygieneData.setOrderId(id);
|
| - |
|
577 |
hygieneData.setFofoId(fofoId);
|
| - |
|
578 |
hygieneData.setCreatedTimestamp(LocalDateTime.now());
|
| - |
|
579 |
hygieneDataRepository.persist(hygieneData);
|
| - |
|
580 |
|
| - |
|
581 |
return hygieneData;
|
| - |
|
582 |
}
|
| - |
|
583 |
|
| 566 |
private WiseAppInsuaranceModel createWiseAppInsuranceModel(MobileInsurancePlan mobileInsurancePlan,
|
584 |
private WiseAppInsuaranceModel createWiseAppInsuranceModel(MobileInsurancePlan mobileInsurancePlan,
|
| 567 |
InsurancePolicy insurancePolicy, CustomCustomer customer) throws ProfitMandiBusinessException {
|
585 |
InsurancePolicy insurancePolicy, CustomCustomer customer) throws ProfitMandiBusinessException {
|
| 568 |
WiseAppInsuaranceModel wiseAppInsuranceModel = new WiseAppInsuaranceModel();
|
586 |
WiseAppInsuaranceModel wiseAppInsuranceModel = new WiseAppInsuaranceModel();
|
| 569 |
CustomAddress address = customer.getAddress();
|
587 |
CustomAddress address = customer.getAddress();
|
| 570 |
|
588 |
|