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

FBR-307: Disburse Loans by cheques #198

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -1086,6 +1086,15 @@ public CommandWrapperBuilder disburseLoanApplication(final Long loanId) {
return this;
}

public CommandWrapperBuilder disburseLoanByCheques() {
this.actionName = "DISBURSEBYCHEQUES";
this.entityName = "LOAN";
this.entityId = loanId;
this.loanId = null;
this.href = "/loans";
return this;
}

public CommandWrapperBuilder disburseLoanToSavingsApplication(final Long loanId) {
this.actionName = "DISBURSETOSAVINGS";
this.entityName = "LOAN";
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public class BankChequeApiConstants {
public static final String CHECK_ACTION_AUTHORIZEREASSIGN = "AUTHORIZEREASSIGN";
public static final String CHECK_ACTION_VOID = "VOID";
public static final String CHECK_ACTION_AUTHORIZEVOID = "AUTHORIZEVOID";
public static final String CHECK_ACTION_DISBURSEBYCHEQUES = "DISBURSEBYCHEQUES";
public static String ID_PARAM_NAME = "id";
public static String BATCH_NO = "batchNo";
public static String AGENCY = "agency";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("paged") @
@QueryParam("status") @Parameter(description = "status") final String status,
@QueryParam("chequeNo") @Parameter(description = "chequeNo") final String chequeNo,
@QueryParam("batchId") @Parameter(description = "batchId") final Long batchId,
@QueryParam("agencyId") @Parameter(description = "agencyId") final Long agencyId,
@QueryParam("chequeId") @Parameter(description = "batchId") final Long chequeId,
@QueryParam("offset") @Parameter(description = "offset") final Integer offset,
@QueryParam("limit") @Parameter(description = "limit") final Integer limit,
Expand All @@ -160,8 +161,8 @@ public String retrieveAll(@Context final UriInfo uriInfo, @QueryParam("paged") @
this.context.authenticatedUser().validateHasReadPermission(BankChequeApiConstants.BANK_CHECK_RESOURCE_NAME);
final PaginationParameters parameters = PaginationParameters.instance(paged, offset, limit, orderBy, sortOrder);
final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
final SearchParameters searchParameters = SearchParameters.forBankCheques(chequeNo, batchId, chequeId, status, offset, limit,
orderBy, sortOrder);
final SearchParameters searchParameters = SearchParameters.forBankCheques(agencyId, chequeNo, batchId, chequeId, status, offset,
limit, orderBy, sortOrder);
final Page<ChequeData> cheques = this.chequeReadPlatformService.retrieveAll(searchParameters, parameters);
return this.toApiJsonSerializer.serialize(settings, cheques);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.fineract.organisation.bankcheque.domain;

import java.math.BigDecimal;
import java.time.LocalDate;
import javax.persistence.Column;
import javax.persistence.Entity;
Expand Down Expand Up @@ -71,6 +72,9 @@ public class Cheque extends AbstractAuditableCustom {
@Column(name = "usedon_date")
private LocalDate usedOnDate;

@Column(name = "guarantee_amount")
private BigDecimal guaranteeAmount;

public Cheque setChequeNo(Long chequeNo) {
this.chequeNo = chequeNo;
return this;
Expand Down Expand Up @@ -129,4 +133,8 @@ public Cheque setUsedOnDate(LocalDate usedOnDate) {
this.usedOnDate = usedOnDate;
return this;
}

public void setGuaranteeAmount(BigDecimal guaranteeAmount) {
this.guaranteeAmount = guaranteeAmount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,15 @@ public Page<ChequeData> retrieveAll(SearchParameters searchParameters, Paginatio
final SQLBuilder extraCriteria = new SQLBuilder();
final Long batchId = searchParameters.getBatchId();
final Long chequeId = searchParameters.getChequeId();
final Long agencyId = searchParameters.getAgencyId();
final String chequeNo = searchParameters.getChequeNo();
final String status = searchParameters.getStatus();
if (batchId != null) {
extraCriteria.addNonNullCriteria("mpb.id = ", batchId);
}
if (agencyId != null) {
extraCriteria.addNonNullCriteria("mba.agency_id = ", agencyId);
}
if (chequeId != null) {
extraCriteria.addNonNullCriteria("mbc.id = ", chequeId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@

public class PrequalificationCollectionConstants extends PrequalificatoinApiConstants {

protected static final Set<String> NEW_GROUP_PREQUALIFICATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(groupIdParamName,
groupNameParamName, productIdParamName, portfolioIdParamName, centerIdParamName, membersParamName, dateFormatParamName,
localeParamName, agencyIdParamName, facilitatorParamName, "individual", prequalilficationTimespanParamName,previousPrequalificationParamName));
protected static final Set<String> NEW_GROUP_PREQUALIFICATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(groupIdParamName, groupNameParamName, productIdParamName, portfolioIdParamName, centerIdParamName,
membersParamName, dateFormatParamName, localeParamName, agencyIdParamName, facilitatorParamName, "individual",
prequalilficationTimespanParamName, previousPrequalificationParamName));

protected static final Set<String> EDIT_GROUP_PREQUALIFICATION_REQUEST_DATA_PARAMETERS = new HashSet<>(
Arrays.asList(groupIdParamName, groupNameParamName, productIdParamName, portfolioIdParamName, centerIdParamName,
membersParamName, dateFormatParamName, localeParamName, agencyIdParamName, facilitatorParamName, "individual",
prequalificationNumberParamName, prequalilficationTimespanParamName,previousPrequalificationParamName));
prequalificationNumberParamName, prequalilficationTimespanParamName, previousPrequalificationParamName));

}
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,24 @@ public class PrequalificationGroup extends AbstractPersistableCustom {
private List<PrequalificationGroupMember> members;

public static PrequalificationGroup fromJson(final AppUser appUser, final AppUser facilitator, final Agency agency, final Group group,
final LoanProduct loanProduct, PrequalificationGroup parentGroup, final JsonCommand command) {
final LoanProduct loanProduct, PrequalificationGroup parentGroup, final JsonCommand command) {
String groupName = command.stringValueOfParameterNamed("groupName");
Long prequalilficationTimespan = command.longValueOfParameterNamed(PrequalificatoinApiConstants.prequalilficationTimespanParamName);
Long center = command.longValueOfParameterNamed(PrequalificatoinApiConstants.centerIdParamName);
if (group != null) {
groupName = group.getName();
}
return new PrequalificationGroup(appUser, facilitator, agency, group, groupName, center, loanProduct, prequalilficationTimespan, parentGroup);
return new PrequalificationGroup(appUser, facilitator, agency, group, groupName, center, loanProduct, prequalilficationTimespan,
parentGroup);
}

protected PrequalificationGroup() {
//
}

private PrequalificationGroup(final AppUser appUser, final AppUser facilitator, final Agency agency, final Group group,
final String groupName, Long center, final LoanProduct loanProduct, Long prequalilficationTimespan, PrequalificationGroup parentGroup) {
final String groupName, Long center, final LoanProduct loanProduct, Long prequalilficationTimespan,
PrequalificationGroup parentGroup) {
this.addedBy = appUser;
this.facilitator = facilitator;
this.status = PrequalificationStatus.BLACKLIST_CHECKED.getValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public CommandProcessingResult processPrequalification(JsonCommand command) {
final Long productId = command.longValueOfParameterNamed(PrequalificatoinApiConstants.productIdParamName);
final Long centerGroupId = command.longValueOfParameterNamed(PrequalificatoinApiConstants.groupIdParamName);
final Long agencyId = command.longValueOfParameterNamed(PrequalificatoinApiConstants.agencyIdParamName);
final Long previousPrequalificationId = command.longValueOfParameterNamed(PrequalificatoinApiConstants.previousPrequalificationParamName);
final Long previousPrequalificationId = command
.longValueOfParameterNamed(PrequalificatoinApiConstants.previousPrequalificationParamName);

PrequalificationGroup parentGroup = null;
if (previousPrequalificationId != null) {
Expand All @@ -149,8 +150,8 @@ public CommandProcessingResult processPrequalification(JsonCommand command) {
if (facilitatorId != null) {
facilitator = this.appUserRepository.findById(facilitatorId).orElseThrow(() -> new UserNotFoundException(facilitatorId));
}
PrequalificationGroup prequalificationGroup = PrequalificationGroup.fromJson(addedBy, facilitator, agency, group, loanProduct, parentGroup,
command);
PrequalificationGroup prequalificationGroup = PrequalificationGroup.fromJson(addedBy, facilitator, agency, group, loanProduct,
parentGroup, command);

this.prequalificationGroupRepositoryWrapper.saveAndFlush(prequalificationGroup);
StringBuilder prequalSB = new StringBuilder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,17 +364,17 @@ public static GroupGeneralData instance(final Long id, final String accountNo, f
}

private GroupGeneralData(final Long id, final String accountNo, final String name, final String externalId, final EnumOptionData status,
final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId, final String centerName,
final Long staffId, final String staffName, final String hierarchy, final String groupLevel,
final Collection<ClientData> clientMembers, final Collection<ClientData> activeClientMembers,
final Collection<CenterData> centerOptions, final Collection<OfficeData> officeOptions,
final Collection<StaffData> staffOptions, final Collection<ClientData> clientOptions,
final Collection<GroupRoleData> groupRoles, final Collection<CodeValueData> availableRoles, final GroupRoleData role,
final Collection<CalendarData> calendarsData, final CalendarData collectionMeetingCalendar,
final Collection<CodeValueData> closureReasons, final GroupTimelineData timeline,
final Collection<OfficeData> parentOfficesOptions, final Collection<AppUserData> responsibleUserOptions,
final Collection<PortfolioCenterData> portfolioCenterOptions, Collection<EnumOptionData> centerGroupLocations,
String prequalificationNumber, Long prequalificationId) {
final LocalDate activationDate, final Long officeId, final String officeName, final Long centerId, final String centerName,
final Long staffId, final String staffName, final String hierarchy, final String groupLevel,
final Collection<ClientData> clientMembers, final Collection<ClientData> activeClientMembers,
final Collection<CenterData> centerOptions, final Collection<OfficeData> officeOptions,
final Collection<StaffData> staffOptions, final Collection<ClientData> clientOptions,
final Collection<GroupRoleData> groupRoles, final Collection<CodeValueData> availableRoles, final GroupRoleData role,
final Collection<CalendarData> calendarsData, final CalendarData collectionMeetingCalendar,
final Collection<CodeValueData> closureReasons, final GroupTimelineData timeline,
final Collection<OfficeData> parentOfficesOptions, final Collection<AppUserData> responsibleUserOptions,
final Collection<PortfolioCenterData> portfolioCenterOptions, Collection<EnumOptionData> centerGroupLocations,
String prequalificationNumber, Long prequalificationId) {
this.id = id;
this.accountNo = accountNo;
this.name = name;
Expand Down Expand Up @@ -632,6 +632,7 @@ public void setGroupLocation(EnumOptionData groupLocation) {
public void setPrequalificationNumber(String prequalificationNumber) {
this.prequalificationNumber = prequalificationNumber;
}

public void setPrequalificationId(Long prequalificationId) {
this.prequalificationId = prequalificationId;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,8 @@ public interface LoanApiConstants {

String LOAN_ASSOCIATIONS_ALL = "all";
String cupoIdParameterName = "cupoId";
String LOAN_ID = "loanId";
String GUARANTEE_AMOUNT = "guaranteeAmount";
String CHEQUE_DESCRIPTION = "description";
String CHEQUE_ID = "chequeId";
}
Loading