Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/FBR-710-714-QA #1019

Merged
merged 24 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6a665db
fix FSF-9
BrianMuhimbura Jul 24, 2024
696b88d
Merge pull request #940 from fiterlatam/fix/FSF-9
BrianMuhimbura Jul 24, 2024
52aa50f
fix FSF-4 (#945)
BrianMuhimbura Jul 25, 2024
1178361
Fix/fsf 11 (#947)
BrianMuhimbura Jul 25, 2024
2b372ff
Fix/fsf 11 (#950)
BrianMuhimbura Jul 26, 2024
60e22c2
fix FSF-17 (#957)
BrianMuhimbura Jul 30, 2024
2ad90d5
fix FSF-15
BrianMuhimbura Jul 31, 2024
930d8b4
Merge pull request #963 from fiterlatam/fix/FSF-15
BrianMuhimbura Jul 31, 2024
8dcdc09
fix FSF-12
BrianMuhimbura Jul 31, 2024
b822857
Merge pull request #964 from fiterlatam/fix/FSF-12
BrianMuhimbura Jul 31, 2024
ea8aea0
fix FSF-19
BrianMuhimbura Aug 1, 2024
bd1500d
fix FSF-19 (#969)
BrianMuhimbura Aug 1, 2024
0e6269a
Merge branch 'fiter/fb/dev' of https://github.com/fiterlatam/fineract…
BrianMuhimbura Aug 2, 2024
e73fc1e
Fix/fs 18 (#977)
BrianMuhimbura Aug 2, 2024
22f5627
Fix/fsf 20 (#980)
BrianMuhimbura Aug 2, 2024
c199fef
QA-FSF-18-20
BrianMuhimbura Aug 5, 2024
1cdf7f7
Merge pull request #986 from fiterlatam/fix/FSF-21
BrianMuhimbura Aug 5, 2024
2d6c4a6
Fix/fsf 21 (#989)
BrianMuhimbura Aug 5, 2024
e928290
Fix/fsf 21 (#990)
BrianMuhimbura Aug 5, 2024
4da29c7
FSF 23 (#992)
BrianMuhimbura Aug 6, 2024
a01acda
FBR-710 (#1000)
BrianMuhimbura Aug 8, 2024
6adf845
Fix/fsf 24 (#1014)
BrianMuhimbura Aug 13, 2024
f3728f6
Feature/fbr 714 (#1018)
BrianMuhimbura Aug 14, 2024
ab01a26
Merge branch 'fiter/fb/dev' of https://github.com/fiterlatam/fineract…
BrianMuhimbura Aug 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public static SearchParameters forBlacklist(final String displayName, final Stri

public static SearchParameters forPrequalification(final String displayName, final String status, final Integer offset,
final Integer limit, final String orderBy, final String sortOrder, final String type, String searchText,
final String groupingType, Long portfolioCenterId) {
final String groupingType, Long portfolioCenterId, Long agencyId) {

final Integer maxLimitAllowed = getCheckedLimit(limit);
final Long staffId = null;
Expand All @@ -139,7 +139,7 @@ public static SearchParameters forPrequalification(final String displayName, fin

return new SearchParameters(searchText, null, null, displayName, null, null, null, status, offset, maxLimitAllowed, orderBy,
sortOrder, staffId, accountNo, loanId, savingsId, null, false, null, type, null, null, null, groupingType,
portfolioCenterId);
portfolioCenterId,agencyId);
}

public static SearchParameters forBankCheques(final Long agencyId, final String chequeNo, final String bankAccNo, final Long batchId,
Expand Down Expand Up @@ -622,7 +622,7 @@ private SearchParameters(final String sqlSearch, final Long officeId, final Stri
final Integer limit, final String orderBy, final String sortOrder, final Long staffId, final String accountNo,
final Long loanId, final Long savingsId, final Boolean orphansOnly, boolean isSelfUser, final String dpiNumber,
final String type, final String groupName, final String groupNumber, final String centerName, final String groupingType,
Long portfolioCenterId) {
Long portfolioCenterId, Long agencyId) {
this.sqlSearch = sqlSearch;
this.officeId = officeId;
this.externalId = externalId;
Expand Down Expand Up @@ -659,7 +659,7 @@ private SearchParameters(final String sqlSearch, final Long officeId, final Stri
this.disbursementStartDate = null;
this.approvalEndDate = null;
this.approvalStartDate = null;
this.agencyId = null;
this.agencyId = agencyId;
this.clientNo = null;
this.groupId = null;
this.centerId = portfolioCenterId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo,
@QueryParam("limit") @Parameter(description = "limit") final Integer limit,
@QueryParam("orderBy") @Parameter(description = "orderBy") final String orderBy,
@QueryParam("status") @Parameter(description = "status") final String status,
@QueryParam("agencyId") @Parameter(description = "agencyId") final Long agencyId,
@QueryParam("type") @Parameter(description = "type") final String type,
@QueryParam("portfolioCenterId") @Parameter(description = "type") final Long portfolioCenterId,
@QueryParam("searchText") @Parameter(description = "searchText") final String searchText,
Expand All @@ -157,7 +158,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo,

String clientName = queryParameters.getFirst("clientName");
SearchParameters searchParameters = SearchParameters.forPrequalification(clientName, status, offset, limit, orderBy, sortOrder,
type, searchText, groupingType, portfolioCenterId);
type, searchText, groupingType, portfolioCenterId, agencyId);
final Page<GroupPrequalificationData> clientData = this.prequalificationReadPlatformService.retrieveAll(searchParameters);

final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(queryParameters);
Expand All @@ -174,6 +175,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo,
public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {

this.context.authenticatedUser().validateHasViewPermission(this.resourceNameForPermissions);
final String hierarchy = this.context.authenticatedUser().getOffice().getHierarchy();

MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();

Expand All @@ -183,7 +185,7 @@ public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {
Long agencyId = null;
Long centerId = null;
Collection<CenterData> centerData = null;
Collection<AgencyData> agencies = null;
Collection<AgencyData> agencies = this.agencyReadPlatformService.retrieveByOfficeHierarchy(hierarchy);
Collection<AppUserData> appUsers = null;
Collection<LoanProductData> loanProducts = null;
GlobalConfigurationPropertyData timespan = null;
Expand Down Expand Up @@ -226,7 +228,6 @@ public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {
}
}

final String hierarchy = this.context.authenticatedUser().getOffice().getHierarchy();
centerData = this.centerReadPlatformService.retrieveByOfficeHierarchy(hierarchy, agencyId);
agencies = this.agencyReadPlatformService.retrieveAllByAgencyLeader();
if (agencies.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public String retrieveAllBlacklistItems(@Context final UriInfo uriInfo,

String clientName = queryParameters.getFirst("clientName");
SearchParameters searchParameters = SearchParameters.forPrequalification(clientName, status, offset, limit, orderBy, sortOrder,
type, searchText, groupingType, portfolioCenterId);
type, searchText, groupingType, portfolioCenterId,null);
final Page<MemberPrequalificationData> memberData = this.prequalificationReadPlatformService.retrieveAllMembers(searchParameters);

final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(queryParameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ private CheckValidationColor runCheck7(final ClientData clientData) {
reportParams.put("${prequalificationId}", prequalificationId);
reportParams.put("${loanProductId}", productId);
reportParams.put("${clientArea}", clientArea);
reportParams.put("${categorization}", clientData.getCategorization());
reportParams.put("${categorization}", clientData.getRecreditCategorization());
reportParams.put("${isTopup}", String.valueOf(clientData.getIsLoanTopup()));
reportParams.put("${requestedAmount}", String.valueOf(clientData.getRequestedAmount()));
final GenericResultsetData result = this.readReportingService.retrieveGenericResultset(reportName, "report", reportParams, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search
String sqlSearch = searchParameters.getSqlSearch();
final Long officeId = searchParameters.getOfficeId();
final Long centerId = searchParameters.getCenterId();
final Long agencyId = searchParameters.getAgencyId();
final String dpiNumber = searchParameters.getName();
final String status = searchParameters.getStatus();
final String type = searchParameters.getType();
Expand All @@ -298,12 +299,6 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search
paramList.add(appUser.getId());
}
}

// add hierrachy filter here.
extraCriteria += " and (mo.hierarchy LIKE CONCAT(?, '%') OR ? like CONCAT(mo.hierarchy, '%'))";
paramList.add(appUser.getOffice().getHierarchy());
paramList.add(appUser.getOffice().getHierarchy());

}

if (StringUtils.equals(groupingType, "individual")) {
Expand All @@ -314,6 +309,14 @@ private String buildSqlStringFromBlacklistCriteria(final SearchParameters search
paramList.add(dpiNumber);
}
}
extraCriteria += " and (moind.hierarchy LIKE CONCAT(?, '%') OR ? like CONCAT(moind.hierarchy, '%'))";
paramList.add(appUser.getOffice().getHierarchy());
paramList.add(appUser.getOffice().getHierarchy());

if (agencyId != null) {
extraCriteria += " and individualOffice.agency_id = ? ";
paramList.add(agencyId);
}
}

if (sqlSearch != null && !isGroup) {
Expand Down Expand Up @@ -457,12 +460,25 @@ LEFT JOIN (
FROM m_prequalification_group_members mpgm
GROUP BY mpgm.group_id
) prequalification_numbers ON prequalification_numbers.prequalification_id = g.id

LEFT JOIN(
select DISTINCT mc.office_id, ms.agency_id, mpgm.group_id, ms.linked_office_id as supervision_office
from m_prequalification_group_members mpgm
INNER JOIN m_client mc on mc.dpi = mpgm.dpi
INNER JOIN m_group_client mgc on mgc.client_id = mc.id
INNER JOIN m_group mg on mg.id = mgc.group_id
INNER JOIN m_group center on center.id = mg.parent_id
INNER JOIN m_portfolio mp on mp.id = center.portfolio_id
INNER JOIN m_supervision ms on ms.id = mp.supervision_id
) individualOffice ON individualOffice.group_id = g.id

LEFT JOIN m_agency ma ON
g.agency_id = ma.id
LEFT JOIN(
select agency_id, linked_office_id from m_supervision GROUP BY agency_id
) supv ON supv.agency_id = ma.id
LEFT JOIN m_office mo on mo.id = supv.linked_office_id
LEFT JOIN m_office moind on moind.id = individualOffice.supervision_office
LEFT JOIN
(
SELECT p.id AS groupid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,5 @@
<include file="parts/0132_AddConfigurationForAmountFormats.xml" relativeToChangelogFile="true"/>
<include file="parts/0133_UpdateNewHardPolicyQueries.xml" relativeToChangelogFile="true"/>
<include file="parts/0134_HardPolicyFixes.xml" relativeToChangelogFile="true"/>
<include file="parts/0135_FBR-714-BANCO_COMMUNAL_MEDA.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
--
-- 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.
--

SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1);
UPDATE stretchy_report SET report_sql = concat('SELECT mc.id,
client_age.client_age AS client_age,
mc.date_of_birth AS date_of_birth,
CASE
-- Banco Comunal normal
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 2) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''

-- Banco Comunal normal meda
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = ',@productId,') AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''

-- Banco Comunal temporal
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 9) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''


-- Banco Comunal Agricola
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 8) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''


-- Grupo Solidario
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 4) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''


-- Grupo Solidario Agricola
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 70) THEN ''GREEN''
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) BETWEEN 71 AND 75) THEN ''YELLOW''
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''NEW'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) BETWEEN 18 AND 75) THEN ''GREEN''
WHEN (${loanProductId} = 5) AND (''${clientCategorization}'' = ''RECURRING'') AND (IFNULL(client_age.client_age, 0) NOT BETWEEN 18 AND 75) THEN ''RED''
END AS color
FROM m_client mc
INNER JOIN (
SELECT mct.id AS client_id, mct.date_of_birth AS date_of_birth, IFNULL(TIMESTAMPDIFF(YEAR, mct.date_of_birth, CURDATE()), 0) AS client_age
FROM m_client mct
) client_age ON client_age.client_id = mc.id
WHERE mc.id = ${clientId}')
WHERE report_name = 'Client age Policy Check';
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--
-- 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.
--

SELECT @productId := (select id from m_product_loan where short_name='BCOMMEDA' limit 1);
UPDATE stretchy_report SET report_sql = concat(' SELECT CASE
WHEN (${loanProductId} IN (9)) AND ''${categorization}'' = ''RECREDITO'' AND ${requestedAmount} <= 6000 THEN ''GREEN''
WHEN (${loanProductId} IN (2,',@productId,',8)) AND ${requestedAmount} <= 6000 THEN ''GREEN''
WHEN (${loanProductId} IN (2,',@productId,',9,8,4,5,7)) AND (${photographs} <= 0 OR ${investmentPlan} <= 0) THEN ''RED''
ELSE ''GREEN''
END AS color')
WHERE report_name = 'Mandatory to attach photographs and investment plan Policy Check';
Loading
Loading