Skip to content

Commit

Permalink
Feature/release v1.0.21 committee approvals (#328)
Browse files Browse the repository at this point in the history
* Feature/release v1.0.21 committee approvals

* Feature/release v1.0.21 committee approvals

* Bug/FBR-488: Approve/Reject Loan Request Fixes

* Feature/release v1.0.21 committee approvals

* Bug/FBR-488: Approve/Reject Loan Request Fixes

* Feature/release v1.0.21 committee approvals

---------

Co-authored-by: Muhimbura Brian Mart <[email protected]>
Co-authored-by: Julius Peter Oketayot <[email protected]>
  • Loading branch information
3 people authored Dec 11, 2023
1 parent a37f763 commit 2e3b0f7
Show file tree
Hide file tree
Showing 55 changed files with 700 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ private AccountNumberFormatEnumerations() {
.unmodifiableSet(new HashSet<>(Arrays.asList(AccountNumberPrefixType.OFFICE_NAME,
AccountNumberPrefixType.LOAN_PRODUCT_SHORT_NAME, AccountNumberPrefixType.PREFIX_SHORT_NAME)));

public static final Set<AccountNumberPrefixType> accountNumberPrefixesForSavingsAccounts = Collections
.unmodifiableSet(new HashSet<>(Arrays.asList(AccountNumberPrefixType.OFFICE_NAME,
AccountNumberPrefixType.SAVINGS_PRODUCT_SHORT_NAME, AccountNumberPrefixType.PREFIX_SHORT_NAME,
AccountNumberPrefixType.SAVINGS_CLIENT_ID)));
public static final Set<AccountNumberPrefixType> accountNumberPrefixesForSavingsAccounts = Collections.unmodifiableSet(
new HashSet<>(Arrays.asList(AccountNumberPrefixType.OFFICE_NAME, AccountNumberPrefixType.SAVINGS_PRODUCT_SHORT_NAME,
AccountNumberPrefixType.PREFIX_SHORT_NAME, AccountNumberPrefixType.SAVINGS_CLIENT_ID)));

public static final Set<AccountNumberPrefixType> accountNumberPrefixesForCenters = Collections
.unmodifiableSet(new HashSet<>(Collections.singletonList(AccountNumberPrefixType.OFFICE_NAME)));
Expand All @@ -60,7 +59,7 @@ public enum AccountNumberPrefixType {
"accountNumberPrefixType.loanProductShortName"), SAVINGS_PRODUCT_SHORT_NAME(301,
"accountNumberPrefixType.savingsProductShortName"), PREFIX_SHORT_NAME(401,
"accountNumberPrefixType.prefixShortName"), SAVINGS_CLIENT_ID(501,
"accountNumberPrefixType.savingsAccountClientId");
"accountNumberPrefixType.savingsAccountClientId");

private final Integer value;
private final String code;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.fineract.organisation.bankcheque.service;


import java.util.List;
import org.apache.fineract.infrastructure.core.data.PaginationParameters;
import org.apache.fineract.infrastructure.core.service.Page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package org.apache.fineract.organisation.bankcheque.service;


import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import java.math.BigDecimal;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public List<CenterGroup> findOverLappingCenterGroups(Long portfolioCenter, Local
}

public Collection<CenterGroup> findCenterGroupsByCenterIdAndMeetingTimes(final Long center, final LocalTime startTime,
final LocalTime endTime) {
final LocalTime endTime) {
return this.repository.findCenterGroupsByCenterIdAndMeetingTimes(center, startTime, endTime);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public enum PortfolioCenterSupportedParameters {

PORTFOLIO_CENTER_ID("id"), NAME("name"), PORTFOLIO_ID("portfolioId"), PORTFOLIO_NAME("portfolioName"), OFFICE_PARENT_ID(
"parentId"), RESPONSIBLE_USER_ID("responsibleUserId"), CITY_ID("cityId"), STATE_ID("stateId"), CENTER_TYPE(
"centerTypeId"), LEGACY_CENTER_NUMBER("legacyCenterNumber"), DISTANCE(
"distance"), CREATED_DATE("createdDate"), STATUS_ID("statusId"), MEETING_START("meetingStart"), MEETING_END(
"meetingEnd"), MEETING_DAY("meetingDay"), MEETING_START_TIME("meetingStartTime"), MEETING_END_TIME(
"meetingEndTime"), REFERENCE_POINT("referencePoint"), LOCALE(
"locale"), DATEFORMAT("dateFormat"), CENTER_LOCATION("centerLocation");
"centerTypeId"), LEGACY_CENTER_NUMBER("legacyCenterNumber"), DISTANCE(
"distance"), CREATED_DATE("createdDate"), STATUS_ID("statusId"), MEETING_START("meetingStart"), MEETING_END(
"meetingEnd"), MEETING_DAY("meetingDay"), MEETING_START_TIME("meetingStartTime"), MEETING_END_TIME(
"meetingEndTime"), REFERENCE_POINT("referencePoint"), LOCALE(
"locale"), DATEFORMAT("dateFormat"), CENTER_LOCATION("centerLocation");

private final String value;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {
Long agencyId = null;
Long centerId = null;

if (!StringUtils.isBlank(groupId)){
if (!StringUtils.isBlank(groupId)) {
GroupPrequalificationData prequalificationGroup = this.prequalificationReadPlatformService.retrieveOne(Long.valueOf(groupId));
agencyId = prequalificationGroup.getAgencyId();
centerId = prequalificationGroup.getCenterId();
Expand Down Expand Up @@ -212,7 +212,7 @@ public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {
}

final String hierarchy = this.context.authenticatedUser().getOffice().getHierarchy();
Collection<CenterData> centerData =null;
Collection<CenterData> centerData = null;
if (agencyId != null) {
centerData = this.centerReadPlatformService.retrieveByOfficeHierarchy(hierarchy, agencyId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class PrequalificationDataValidator {

@Autowired
public PrequalificationDataValidator(final FromJsonHelper fromApiJsonHelper,
final PreQualificationGroupRepository preQualificationGroupRepository) {
final PreQualificationGroupRepository preQualificationGroupRepository) {

this.fromApiJsonHelper = fromApiJsonHelper;
this.preQualificationGroupRepository = preQualificationGroupRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class GroupMemberData {
private BigDecimal requestedAmount;

public GroupMemberData(final Long id, final String name, final LocalDate dob, final String dpi, final EnumOptionData status,
final String workWithPuente, final BigDecimal requestedAmount) {
final String workWithPuente, final BigDecimal requestedAmount) {
this.id = id;
this.name = name;
this.dpi = dpi;
Expand All @@ -48,7 +48,7 @@ public GroupMemberData(final Long id, final String name, final LocalDate dob, fi
}

public static GroupMemberData instance(final Long id, final String name, final LocalDate dob, final String dpi,
final EnumOptionData status, final String workWithPuente, final BigDecimal requestedAmount) {
final EnumOptionData status, final String workWithPuente, final BigDecimal requestedAmount) {
return new GroupMemberData(id, name, dob, dpi, status, workWithPuente, requestedAmount);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public static EnumOptionData status(final PrequalificationMemberIndication statu
case INVALID:
optionData = new EnumOptionData(PrequalificationMemberIndication.INVALID.getValue().longValue(),
PrequalificationMemberIndication.INVALID.getCode(), "INVALID");
break;
break;
case ACTIVE:
optionData = new EnumOptionData(PrequalificationMemberIndication.ACTIVE.getValue().longValue(),
PrequalificationMemberIndication.ACTIVE.getCode(), "ACTIVE");
break;
break;
case INACTIVE:
optionData = new EnumOptionData(PrequalificationMemberIndication.INACTIVE.getValue().longValue(),
PrequalificationMemberIndication.INACTIVE.getCode(), "INACTIVE");
Expand All @@ -57,7 +57,7 @@ public static EnumOptionData status(final PrequalificationMemberIndication statu
case NONE:
optionData = new EnumOptionData(PrequalificationMemberIndication.NONE.getValue().longValue(),
PrequalificationMemberIndication.NONE.getCode(), "NONE");
break;
break;
}

return optionData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ public Map<String, Object> update(JsonCommand command) {
}

if (command.isChangeInBigDecimalParameterNamed(PrequalificatoinApiConstants.approvedAmountParamName, this.approvedAmount)) {
final BigDecimal newValue = command
.bigDecimalValueOfParameterNamed(PrequalificatoinApiConstants.approvedAmountParamName);
final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(PrequalificatoinApiConstants.approvedAmountParamName);
actualChanges.put(PrequalificatoinApiConstants.approvedAmountParamName, newValue);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public static PrequalificationMemberIndication fromInt(final Integer statusValue
switch (statusValue) {
case 100:
enumeration = PrequalificationMemberIndication.ACTIVE;
break;
break;
case 200:
enumeration = PrequalificationMemberIndication.INACTIVE;
break;
break;
case 300:
enumeration = PrequalificationMemberIndication.NONE;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
public class MemberHasNoPendingLoanException extends AbstractPlatformResourceNotFoundException {

public MemberHasNoPendingLoanException(String name, String dpi, String product) {
super("error.msg.client.pending.loan.request", "Client "+name+ " with dpi " + dpi + " doesnt have a pending loan request.", name, dpi, product);
super("error.msg.client.pending.loan.request", "Client " + name + " with dpi " + dpi + " doesnt have a pending loan request.", name,
dpi, product);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.organisation.prequalification.exception;

import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;

/**
* A {@link RuntimeException} thrown when client is already blacklisted.
*/
public class PrequalificationIncorrectStatusException extends AbstractPlatformResourceNotFoundException {

public PrequalificationIncorrectStatusException(String status) {
super("error.msg.group.prequalification.status.not.correct", "Provided Prequalificaiton has incorrect status " + status, status);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public class PrequalificationNotMappedException extends AbstractPlatformDomainRu

public PrequalificationNotMappedException(final String prequalificationId) {
super("error.msg.prequalification.not.mapped.exception",
"The Prequalification `" + prequalificationId + "` Should be mapped to a group before validating hard policies. ", prequalificationId);
"The Prequalification `" + prequalificationId + "` Should be mapped to a group before validating hard policies. ",
prequalificationId);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.organisation.prequalification.exception;

import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;

/**
* A {@link RuntimeException} thrown when client is already blacklisted.
*/
public class PrequalificationNotProvidedException extends AbstractPlatformResourceNotFoundException {

public PrequalificationNotProvidedException() {
super("error.msg.group.prequalification.is.not.provided", "Prequalification is a mandatory");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,9 @@ private void validateMemberLoanRequest(PrequalificationGroup group) {
List<PrequalificationGroupMember> members = group.getMembers();
for (PrequalificationGroupMember member : members) {
String pendingLoanRequest = "select count(*) from m_loan ml inner join m_client mc on mc.id = ml.client_id where mc.dpi=? AND ml.loan_status_id = 100 and ml.product_id = ?";
Long loanCount = this.jdbcTemplate.queryForObject(pendingLoanRequest, Long.class, member.getDpi(),group.getLoanProduct().getId());
if (loanCount<=0)
Long loanCount = this.jdbcTemplate.queryForObject(pendingLoanRequest, Long.class, member.getDpi(),
group.getLoanProduct().getId());
if (loanCount <= 0)
throw new MemberHasNoPendingLoanException(member.getName(), member.getDpi(), group.getLoanProduct().getName());

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ public class PrequalificationReadPlatformServiceImpl implements Prequalification

@Autowired
public PrequalificationReadPlatformServiceImpl(final PlatformSecurityContext context, final PaginationHelper paginationHelper,
final DatabaseSpecificSQLGenerator sqlGenerator, final ColumnValidator columnValidator,
final PrequalificationDataValidator dataValidator, final LoanProductRepository loanProductRepository,
final PreQualificationMemberRepository preQualificationMemberRepository,
final ClientReadPlatformService clientReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService,
final JdbcTemplate jdbcTemplate) {
final DatabaseSpecificSQLGenerator sqlGenerator, final ColumnValidator columnValidator,
final PrequalificationDataValidator dataValidator, final LoanProductRepository loanProductRepository,
final PreQualificationMemberRepository preQualificationMemberRepository,
final ClientReadPlatformService clientReadPlatformService, final CodeValueReadPlatformService codeValueReadPlatformService,
final JdbcTemplate jdbcTemplate) {

this.context = context;
this.dataValidator = dataValidator;
Expand Down Expand Up @@ -260,7 +260,7 @@ public Collection<GroupPrequalificationData> retrievePrequalificationGroupsMappi

@Override
public Collection<GroupPrequalificationData> retrievePrequalificationIndividualMappings(final Long clientId) {
final String sql = "select " + this.prequalificationIndividualMappingsMapper.schema() + " WHERE mc.id = ?";
final String sql = "select " + this.prequalificationIndividualMappingsMapper.schema() + " WHERE mc.id = ? AND mpg.status = 600";
final Collection<GroupPrequalificationData> prequalificationGroups = this.jdbcTemplate.query(sql,
this.prequalificationIndividualMappingsMapper, new Object[] { clientId });
return prequalificationGroups;
Expand Down Expand Up @@ -582,11 +582,11 @@ public GroupPrequalificationData mapRow(final ResultSet rs, final int rowNum) th
}
}

private static final class PrequalificationIndividualMappingsMapper implements RowMapper<GroupPrequalificationData> {
public static final class PrequalificationIndividualMappingsMapper implements RowMapper<GroupPrequalificationData> {

private final String schema;

PrequalificationIndividualMappingsMapper() {
public PrequalificationIndividualMappingsMapper() {
this.schema = """
mpg.id AS id, mpg.prequalification_number AS prequalificationNumber, mpg.group_name AS groupName, mpg.status AS status,
mpl.name AS productName, mpg.created_at, ma.firstname, ma.lastname
Expand Down
Loading

0 comments on commit 2e3b0f7

Please sign in to comment.