Skip to content

Commit

Permalink
Merge pull request #305 from fiterlatam/fix/requalification
Browse files Browse the repository at this point in the history
Fix/requalification
  • Loading branch information
BrianMuhimbura authored Nov 28, 2023
2 parents 4a92047 + 8c3cb15 commit 5da0639
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,22 @@ public String newClientIdentifierDetails(@Context final UriInfo uriInfo) {

String type = queryParameters.getFirst("type");
String groupingType = queryParameters.getFirst("groupingType");
String groupId = queryParameters.getFirst("groupId");
Long agencyId = null;
Long centerId = null;
if (!StringUtils.isBlank(groupId)){
GroupPrequalificationData prequalificationGroup = this.prequalificationReadPlatformService.retrieveOne(Long.valueOf(groupId));
agencyId = prequalificationGroup.getAgencyId();
centerId = prequalificationGroup.getCenterId();
}

if (queryParameters.getFirst("agencyId") != null) {
agencyId = NumberUtils.toLong(queryParameters.getFirst("agencyId"), Long.MAX_VALUE);
}
if (queryParameters.getFirst("centerId") != null) {
centerId = NumberUtils.toLong(queryParameters.getFirst("centerId"), Long.MAX_VALUE);
}

Collection<LoanProductData> loanProducts = this.loanProductReadPlatformService.retrieveAllLoanProducts();
Integer prequalificationType = null;
if (StringUtils.isNotBlank(groupingType)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ public CommandProcessingResult processPrequalification(JsonCommand command) {
if (previousPrequalificationId != null) {
parentGroup = this.prequalificationGroupRepositoryWrapper.findOneWithNotFoundDetection(previousPrequalificationId);
if (!parentGroup.getStatus().equals(PrequalificationStatus.COMPLETED.getValue())
&& !parentGroup.getStatus().equals(PrequalificationStatus.REJECTED.getValue())) {
&& !parentGroup.getStatus().equals(PrequalificationStatus.REJECTED.getValue())
&& !parentGroup.getStatus().equals(PrequalificationStatus.TIME_EXPIRED.getValue())) {
throw new PrequalificationStatusNotCompletedException(PrequalificationStatus.fromInt(parentGroup.getStatus()).toString());
}
existingGroupParentGroup = this.groupRepositoryWrapper.findOneWithPrequalificationIdNotFoundDetection(parentGroup);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,19 @@ public class LoanRepaymentImport {
@Column(name = "Id_error")
private Long errorId;

public void resetMifosFields() {
this.status = null;
this.mifosProcessingDate = null;
this.mifosProcessingTime = null;
this.mifosFileName = null;
this.operationResult = null;
this.scheduledPaymentAmount = null;
this.paymentNumber = null;
this.lastPayment = null;
this.tolerance = null;
this.errorId = null;
}

public void setStatus(Long status) {
this.status = status;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,9 @@ public void importLoanRepaymentBatches() throws JobExecutionException {
for (final LoanRepaymentImportData loanRepaymentImportData : loanRepayments) {
iterations++;
final String loanCode = loanRepaymentImportData.getLoanCode();
LoanRepaymentImport loanRepaymentImport = this.loanRepaymentImportRepository.findById(loanRepaymentImportData.getId())
final LoanRepaymentImport loanRepaymentImport = this.loanRepaymentImportRepository.findById(loanRepaymentImportData.getId())
.orElseThrow(() -> new NotFoundException("error.msg.loanRepaymentImport.not.found."));
loanRepaymentImport.resetMifosFields();
final LocalDateTime localDateTime = DateUtils.getLocalDateTimeOfSystem();
loanRepaymentImport.setMifosProcessingDate(localDateTime);
loanRepaymentImport.setMifosProcessingTime(localDateTime.toLocalTime());
Expand Down

0 comments on commit 5da0639

Please sign in to comment.