| Line 155... |
Line 155... |
| 155 |
if (availability.signum() == 1 && creditAccount.isActive() && creditSummary.getOverdueCount() == 0) {
|
155 |
if (availability.signum() == 1 && creditAccount.isActive() && creditSummary.getOverdueCount() == 0) {
|
| 156 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.SANCTION_AVAILABLE);
|
156 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.SANCTION_AVAILABLE);
|
| 157 |
accountStatusResponseOut.setRateOfInterest(creditAccount.getInterestRate());
|
157 |
accountStatusResponseOut.setRateOfInterest(creditAccount.getInterestRate());
|
| 158 |
accountStatusResponseOut.setPenalRateOfInterest(ProfitMandiConstants.NEW_DELAYED_INTEREST_RATE);
|
158 |
accountStatusResponseOut.setPenalRateOfInterest(ProfitMandiConstants.NEW_DELAYED_INTEREST_RATE);
|
| 159 |
accountStatusResponseOut.setCreditDays(sdCreditRequirement.getCreditDays());
|
159 |
accountStatusResponseOut.setCreditDays(sdCreditRequirement.getCreditDays());
|
| - |
|
160 |
} else if (creditAccount != null && creditAccount.isActive() && creditSummary.getOverdueCount() > 0) {
|
| - |
|
161 |
double freshMoney = sdCreditService.getAvailableFreshMoney(retailerId);
|
| - |
|
162 |
if (freshMoney > 0 && availability.signum() == 1) {
|
| - |
|
163 |
BigDecimal effectiveLimit = availability.min(BigDecimal.valueOf(freshMoney));
|
| - |
|
164 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.SANCTION_AVAILABLE);
|
| - |
|
165 |
accountStatusResponseOut.setBalanceAmount(effectiveLimit);
|
| - |
|
166 |
accountStatusResponseOut.setRateOfInterest(creditAccount.getInterestRate());
|
| - |
|
167 |
accountStatusResponseOut.setPenalRateOfInterest(ProfitMandiConstants.NEW_DELAYED_INTEREST_RATE);
|
| - |
|
168 |
accountStatusResponseOut.setCreditDays(sdCreditRequirement.getCreditDays());
|
| - |
|
169 |
accountStatusResponseOut.setStatusDescription(String.format(
|
| - |
|
170 |
"%d loan(s) overdue. Purchase restricted up to Rs. %.0f",
|
| - |
|
171 |
creditSummary.getOverdueCount(), effectiveLimit));
|
| - |
|
172 |
} else {
|
| - |
|
173 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.IN_ELIGIBLE);
|
| - |
|
174 |
accountStatusResponseOut.setStatusDescription(String.format(
|
| - |
|
175 |
"Due date have been exceeded for %d loans. Pls clear the overdues to utilize balance credit",
|
| - |
|
176 |
creditSummary.getOverdueCount()));
|
| - |
|
177 |
}
|
| 160 |
} else {
|
178 |
} else {
|
| 161 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.IN_ELIGIBLE);
|
179 |
accountStatusResponseOut.setStatus(EligibilityStatusEnum.IN_ELIGIBLE);
|
| 162 |
String statusDescription = null;
|
- |
|
| 163 |
if (creditSummary.getOverdueCount() > 0) {
|
- |
|
| 164 |
statusDescription = String.format("Due date have been exceeded for %d loans. Pls clear the overdues to utilize balance credit", creditSummary.getOverdueCount());
|
- |
|
| 165 |
}
|
- |
|
| 166 |
accountStatusResponseOut.setStatusDescription(statusDescription);
|
- |
|
| 167 |
}
|
180 |
}
|
| 168 |
return responseSender.ok(accountStatusResponseOut);
|
181 |
return responseSender.ok(accountStatusResponseOut);
|
| 169 |
}
|
182 |
}
|
| 170 |
|
183 |
|
| 171 |
else {
|
184 |
else {
|