| Line 184... |
Line 184... |
| 184 |
if(!StringUtils.isValidMobile(customCustomer.getMobileNumber())){
|
184 |
if(!StringUtils.isValidMobile(customCustomer.getMobileNumber())){
|
| 185 |
LOGGER.error("invalid customer mobileNumber {} ", customCustomer.getMobileNumber());
|
185 |
LOGGER.error("invalid customer mobileNumber {} ", customCustomer.getMobileNumber());
|
| 186 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.MOBILE_NUMBER, customCustomer.getMobileNumber(), "VE_1071");
|
186 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.MOBILE_NUMBER, customCustomer.getMobileNumber(), "VE_1071");
|
| 187 |
}
|
187 |
}
|
| 188 |
|
188 |
|
| - |
|
189 |
if(StringUtils.isValidGstNumber(customCustomer.getGstNumber())) {
|
| - |
|
190 |
LOGGER.error("invalid customer gstNumber {} ", customCustomer.getGstNumber());
|
| - |
|
191 |
throw new ProfitMandiBusinessException(ProfitMandiConstants.CUSTOMER_GST_NUMBER, customCustomer.getGstNumber(), "VE_1072");
|
| - |
|
192 |
}
|
| - |
|
193 |
|
| 189 |
Map<Integer, Integer> itemIdQuantity = new HashMap<>(); //this is for error
|
194 |
Map<Integer, Integer> itemIdQuantity = new HashMap<>(); //this is for error
|
| 190 |
Map<Integer, CustomFofoOrderItem> itemIdCustomFofoOrderItemMap = new HashMap<>();
|
195 |
Map<Integer, CustomFofoOrderItem> itemIdCustomFofoOrderItemMap = new HashMap<>();
|
| 191 |
Map<Integer, Float> lineItemPrice = new HashMap<>(); //this is for pricing error
|
196 |
Map<Integer, Float> lineItemPrice = new HashMap<>(); //this is for pricing error
|
| 192 |
|
197 |
|
| 193 |
float totalAmount = 0;
|
198 |
float totalAmount = 0;
|
| Line 373... |
Line 378... |
| 373 |
|
378 |
|
| 374 |
Customer customer = this.createAndGetCustomer(customCustomer);
|
379 |
Customer customer = this.createAndGetCustomer(customCustomer);
|
| 375 |
|
380 |
|
| 376 |
CustomerAddress customerAddress = this.createCustomerAddress(customCustomer.getAddress(), customer.getId());
|
381 |
CustomerAddress customerAddress = this.createCustomerAddress(customCustomer.getAddress(), customer.getId());
|
| 377 |
|
382 |
|
| 378 |
FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), fofoId, invoiceNumberGenerationSequence, totalAmount, customerAddress.getId());
|
383 |
FofoOrder fofoOrder = this.createAndGetFofoOrder(customer.getId(), customCustomer.getGstNumber(), fofoId, invoiceNumberGenerationSequence, totalAmount, customerAddress.getId());
|
| 379 |
|
384 |
|
| 380 |
this.createPaymentOptions(fofoOrder.getId(), createOrderRequest.getPaymentOptions());
|
385 |
this.createPaymentOptions(fofoOrder.getId(), createOrderRequest.getPaymentOptions());
|
| 381 |
|
386 |
|
| 382 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoId);
|
387 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoId);
|
| 383 |
|
388 |
|
| Line 964... |
Line 969... |
| 964 |
fofoOrderPaymentOption.setAmount(customPaymentOption.getAmount());
|
969 |
fofoOrderPaymentOption.setAmount(customPaymentOption.getAmount());
|
| 965 |
fofoOrderPaymentOptionRepository.persist(fofoOrderPaymentOption);
|
970 |
fofoOrderPaymentOptionRepository.persist(fofoOrderPaymentOption);
|
| 966 |
}
|
971 |
}
|
| 967 |
}
|
972 |
}
|
| 968 |
|
973 |
|
| 969 |
private FofoOrder createAndGetFofoOrder(int customerId, int fofoId, InvoiceNumberGenerationSequence invoiceNumberGenerationSequence, float totalAmount, int customerAddressId){
|
974 |
private FofoOrder createAndGetFofoOrder(int customerId, String customerGstNumber, int fofoId, InvoiceNumberGenerationSequence invoiceNumberGenerationSequence, float totalAmount, int customerAddressId){
|
| 970 |
FofoOrder fofoOrder = new FofoOrder();
|
975 |
FofoOrder fofoOrder = new FofoOrder();
|
| - |
|
976 |
fofoOrder.setCustomerGstNumber(customerGstNumber);
|
| 971 |
fofoOrder.setCustomerId(customerId);
|
977 |
fofoOrder.setCustomerId(customerId);
|
| 972 |
fofoOrder.setFofoId(fofoId);
|
978 |
fofoOrder.setFofoId(fofoId);
|
| 973 |
fofoOrder.setInvoiceNumber(invoiceNumberGenerationSequence.getPrefix() + invoiceNumberGenerationSequence.getSequence());
|
979 |
fofoOrder.setInvoiceNumber(invoiceNumberGenerationSequence.getPrefix() + invoiceNumberGenerationSequence.getSequence());
|
| 974 |
fofoOrder.setTotalAmount(totalAmount);
|
980 |
fofoOrder.setTotalAmount(totalAmount);
|
| 975 |
fofoOrder.setCustomerAddressId(customerAddressId);
|
981 |
fofoOrder.setCustomerAddressId(customerAddressId);
|