| Line 2069... |
Line 2069... |
| 2069 |
customer.setFirstName(customCustomer.getFirstName());
|
2069 |
customer.setFirstName(customCustomer.getFirstName());
|
| 2070 |
customer.setLastName(customCustomer.getLastName());
|
2070 |
customer.setLastName(customCustomer.getLastName());
|
| 2071 |
customer.setMobileNumber(customCustomer.getMobileNumber());
|
2071 |
customer.setMobileNumber(customCustomer.getMobileNumber());
|
| 2072 |
customer.setEmailId(customCustomer.getEmailId());
|
2072 |
customer.setEmailId(customCustomer.getEmailId());
|
| 2073 |
customerRepository.persist(customer);
|
2073 |
customerRepository.persist(customer);
|
| - |
|
2074 |
if (fofoOrder.getCustomerAddressId() == 0) {
|
| - |
|
2075 |
CustomAddress customAddress = customCustomer.getAddress();
|
| - |
|
2076 |
|
| - |
|
2077 |
if (customAddress == null ||
|
| - |
|
2078 |
isNullOrEmpty(customAddress.getName()) ||
|
| - |
|
2079 |
isNullOrEmpty(customAddress.getLastName()) ||
|
| - |
|
2080 |
isNullOrEmpty(customAddress.getLine1()) ||
|
| - |
|
2081 |
isNullOrEmpty(customAddress.getCity()) ||
|
| - |
|
2082 |
isNullOrEmpty(customAddress.getPinCode()) ||
|
| - |
|
2083 |
isNullOrEmpty(customAddress.getState()) ||
|
| - |
|
2084 |
isNullOrEmpty(customAddress.getCountry()) ||
|
| - |
|
2085 |
isNullOrEmpty(customAddress.getPhoneNumber())) {
|
| - |
|
2086 |
throw new IllegalArgumentException("Required customer address fields are missing.");
|
| - |
|
2087 |
}
|
| - |
|
2088 |
|
| - |
|
2089 |
CustomerAddress customerAddress = new CustomerAddress();
|
| - |
|
2090 |
customerAddress.setCustomerId(fofoOrder.getCustomerId());
|
| - |
|
2091 |
customerAddress.setName(customAddress.getName());
|
| - |
|
2092 |
customerAddress.setLastName(customAddress.getLastName());
|
| - |
|
2093 |
customerAddress.setLine1(customAddress.getLine1());
|
| - |
|
2094 |
customerAddress.setLine2(customAddress.getLine2());
|
| - |
|
2095 |
customerAddress.setLandmark(customAddress.getLandmark());
|
| - |
|
2096 |
customerAddress.setCity(customAddress.getCity());
|
| - |
|
2097 |
customerAddress.setPinCode(customAddress.getPinCode());
|
| - |
|
2098 |
customerAddress.setState(customAddress.getState());
|
| - |
|
2099 |
customerAddress.setCountry(customAddress.getCountry());
|
| - |
|
2100 |
customerAddress.setPhoneNumber(customAddress.getPhoneNumber());
|
| - |
|
2101 |
customerAddressRepository.persist(customerAddress);
|
| - |
|
2102 |
fofoOrder.setCustomerAddressId(customerAddress.getId());
|
| - |
|
2103 |
|
| - |
|
2104 |
}
|
| 2074 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
2105 |
CustomerAddress customerAddress = customerAddressRepository.selectById(fofoOrder.getCustomerAddressId());
|
| 2075 |
if (!customerAddress.getState().equalsIgnoreCase(customCustomer.getAddress().getState())) {
|
2106 |
if (!customerAddress.getState().equalsIgnoreCase(customCustomer.getAddress().getState())) {
|
| 2076 |
List<FofoOrderItem> fofoOrderItems = fofoOrderItemRepository.selectByOrderId(fofoOrder.getId());
|
2107 |
List<FofoOrderItem> fofoOrderItems = fofoOrderItemRepository.selectByOrderId(fofoOrder.getId());
|
| 2077 |
resetTaxation(fofoOrder.getFofoId(), customerAddress, fofoOrderItems);
|
2108 |
resetTaxation(fofoOrder.getFofoId(), customerAddress, fofoOrderItems);
|
| 2078 |
}
|
2109 |
}
|
| 2079 |
this.setCustomerAddress(customerAddress, customCustomer.getAddress());
|
2110 |
this.setCustomerAddress(customerAddress, customCustomer.getAddress());
|
| 2080 |
fofoOrder.setCustomerGstNumber(customCustomer.getGstNumber());
|
2111 |
fofoOrder.setCustomerGstNumber(customCustomer.getGstNumber());
|
| 2081 |
}
|
2112 |
}
|
| 2082 |
|
2113 |
|
| - |
|
2114 |
private boolean isNullOrEmpty(String str) {
|
| - |
|
2115 |
return str == null || str.trim().isEmpty();
|
| - |
|
2116 |
}
|
| - |
|
2117 |
|
| 2083 |
private void resetTaxation(int fofoId, CustomerAddress customerAddress, List<FofoOrderItem> fofoOrderItems) throws
|
2118 |
private void resetTaxation(int fofoId, CustomerAddress customerAddress, List<FofoOrderItem> fofoOrderItems) throws
|
| 2084 |
ProfitMandiBusinessException {
|
2119 |
ProfitMandiBusinessException {
|
| 2085 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoId);
|
2120 |
int retailerAddressId = retailerRegisteredAddressRepository.selectAddressIdByRetailerId(fofoId);
|
| 2086 |
|
2121 |
|
| 2087 |
Address retailerAddress = addressRepository.selectById(retailerAddressId);
|
2122 |
Address retailerAddress = addressRepository.selectById(retailerAddressId);
|