| Line 26... |
Line 26... |
| 26 |
import com.spice.profitmandi.dao.entity.dtr.CreditStatus;
|
26 |
import com.spice.profitmandi.dao.entity.dtr.CreditStatus;
|
| 27 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
27 |
import com.spice.profitmandi.dao.entity.fofo.FofoStore;
|
| 28 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
28 |
import com.spice.profitmandi.dao.entity.transaction.Loan;
|
| 29 |
import com.spice.profitmandi.dao.entity.transaction.SDCreditRequirement;
|
29 |
import com.spice.profitmandi.dao.entity.transaction.SDCreditRequirement;
|
| 30 |
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
|
30 |
import com.spice.profitmandi.dao.enumuration.fofo.Gateway;
|
| - |
|
31 |
import com.spice.profitmandi.dao.model.CreditSummary;
|
| 31 |
import com.spice.profitmandi.dao.model.SDCreditResponseOut;
|
32 |
import com.spice.profitmandi.dao.model.SDCreditResponseOut;
|
| 32 |
import com.spice.profitmandi.dao.repository.catalog.AddWalletRequestRepository;
|
33 |
import com.spice.profitmandi.dao.repository.catalog.AddWalletRequestRepository;
|
| 33 |
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
|
34 |
import com.spice.profitmandi.dao.repository.dtr.CreditAccountRepository;
|
| 34 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
35 |
import com.spice.profitmandi.dao.repository.dtr.FofoStoreRepository;
|
| 35 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
36 |
import com.spice.profitmandi.dao.repository.dtr.UserAccountRepository;
|
| Line 156... |
Line 157... |
| 156 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.SANCTION_AVAILABLE);
|
157 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.SANCTION_AVAILABLE);
|
| 157 |
accountStatusResponseOut.setRateOfInterest(creditAccount.getInterestRate());
|
158 |
accountStatusResponseOut.setRateOfInterest(creditAccount.getInterestRate());
|
| 158 |
accountStatusResponseOut.setPenalRateOfInterest(ProfitMandiConstants.NEW_DELAYED_INTEREST_RATE);
|
159 |
accountStatusResponseOut.setPenalRateOfInterest(ProfitMandiConstants.NEW_DELAYED_INTEREST_RATE);
|
| 159 |
accountStatusResponseOut.setCreditDays(sdCreditRequirement.getCreditDays());
|
160 |
accountStatusResponseOut.setCreditDays(sdCreditRequirement.getCreditDays());
|
| 160 |
} else if (creditAccount != null && creditAccount.isActive() && creditSummary.getOverdueCount() > 0) {
|
161 |
} else if (creditAccount != null && creditAccount.isActive() && creditSummary.getOverdueCount() > 0) {
|
| 161 |
double freshMoney = sdCreditService.getAvailableFreshMoney(retailerId);
|
162 |
CreditSummary orderSummary = sdCreditService.getCreditSummaryForOrder(retailerId, 0);
|
| 162 |
if (freshMoney > 0 && availability.signum() == 1) {
|
163 |
if (orderSummary.isCanPlaceOrder() && availability.signum() == 1) {
|
| 163 |
BigDecimal effectiveLimit = availability.min(BigDecimal.valueOf(freshMoney));
|
164 |
// Exception partner or has fresh money — allow ordering
|
| 164 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.SANCTION_AVAILABLE);
|
165 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.SANCTION_AVAILABLE);
|
| 165 |
accountStatusResponseOut.setBalanceAmount(effectiveLimit);
|
- |
|
| 166 |
accountStatusResponseOut.setRateOfInterest(creditAccount.getInterestRate());
|
166 |
accountStatusResponseOut.setRateOfInterest(creditAccount.getInterestRate());
|
| 167 |
accountStatusResponseOut.setPenalRateOfInterest(ProfitMandiConstants.NEW_DELAYED_INTEREST_RATE);
|
167 |
accountStatusResponseOut.setPenalRateOfInterest(ProfitMandiConstants.NEW_DELAYED_INTEREST_RATE);
|
| 168 |
accountStatusResponseOut.setCreditDays(sdCreditRequirement.getCreditDays());
|
168 |
accountStatusResponseOut.setCreditDays(sdCreditRequirement.getCreditDays());
|
| - |
|
169 |
if (orderSummary.getFreshMoneyAvailable() > 0) {
|
| - |
|
170 |
BigDecimal effectiveLimit = availability.min(BigDecimal.valueOf(orderSummary.getFreshMoneyAvailable()));
|
| - |
|
171 |
accountStatusResponseOut.setBalanceAmount(effectiveLimit);
|
| 169 |
accountStatusResponseOut.setStatusDescription(String.format(
|
172 |
accountStatusResponseOut.setStatusDescription(String.format(
|
| 170 |
"%d loan(s) overdue. Purchase restricted up to Rs. %.0f",
|
173 |
"%d loan(s) overdue. Purchase restricted up to Rs. %.0f",
|
| 171 |
creditSummary.getOverdueCount(), effectiveLimit));
|
174 |
creditSummary.getOverdueCount(), effectiveLimit));
|
| - |
|
175 |
}
|
| 172 |
} else {
|
176 |
} else {
|
| 173 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.IN_ELIGIBLE);
|
177 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.IN_ELIGIBLE);
|
| 174 |
accountStatusResponseOut.setStatusDescription(String.format(
|
178 |
accountStatusResponseOut.setStatusDescription(String.format(
|
| 175 |
"Due date have been exceeded for %d loans. Pls clear the overdues to utilize balance credit",
|
179 |
"Due date have been exceeded for %d loans. Pls clear the overdues to utilize balance credit",
|
| 176 |
creditSummary.getOverdueCount()));
|
180 |
creditSummary.getOverdueCount()));
|