diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/collateral/domain/LoanCollateral.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/collateral/domain/LoanCollateral.java index 28ab6a871ed..4069c1162b9 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/collateral/domain/LoanCollateral.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/collateral/domain/LoanCollateral.java @@ -74,10 +74,6 @@ public void assembleFrom(final CodeValue collateralType, final BigDecimal value, this.value = value; } - public void associateWith(final Loan loan) { - this.loan = loan; - } - public static LoanCollateral fromJson(final Loan loan, final CodeValue collateralType, final JsonCommand command) { final String description = command.stringValueOfParameterNamed(CollateralJSONinputParams.DESCRIPTION.getValue()); final BigDecimal value = command.bigDecimalValueOfParameterNamed(CollateralJSONinputParams.VALUE.getValue()); @@ -119,15 +115,4 @@ public CollateralData toData() { public void setCollateralType(final CodeValue type) { this.type = type; } - - /* - * @Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (obj == this) { return - * true; } if (obj.getClass() != getClass()) { return false; } final LoanCollateral rhs = (LoanCollateral) obj; - * return new EqualsBuilder().appendSuper(super.equals(obj)) // .append(getId(), rhs.getId()) // - * .append(this.type.getId(), rhs.type.getId()) // .append(this.description, rhs.description) // .append(this.value, - * this.value)// .isEquals(); } - * - * @Override public int hashCode() { return new HashCodeBuilder(3, 5) // .append(getId()) // - * .append(this.type.getId()) // .append(this.description) // .append(this.value)// .toHashCode(); } - */ } diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/delinquency/domain/LoanDelinquencyActionRepository.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/delinquency/domain/LoanDelinquencyActionRepository.java index 8167de5903e..a05e35cb507 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/delinquency/domain/LoanDelinquencyActionRepository.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/delinquency/domain/LoanDelinquencyActionRepository.java @@ -18,26 +18,14 @@ */ package org.apache.fineract.portfolio.delinquency.domain; -import java.time.LocalDate; import java.util.List; import org.apache.fineract.portfolio.loanaccount.domain.Loan; -import org.springframework.data.domain.Page; -import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import org.springframework.data.jpa.repository.Query; -import org.springframework.data.repository.query.Param; public interface LoanDelinquencyActionRepository extends JpaRepository, JpaSpecificationExecutor { - @Query(value = "select da from LoanDelinquencyAction da where " - + " ((da.action = org.apache.fineract.portfolio.delinquency.domain.DelinquencyAction.PAUSE and da.endDate is not null and :business_date >= da.startDate and :business_date <= da.endDate) or" - + " (da.action = org.apache.fineract.portfolio.delinquency.domain.DelinquencyAction.RESUME and da.endDate is null and :business_date >= da.startDate)) and" - + " da.loan.id = :loan_id order by da.createdDate desc") - Page getEffectiveDelinquencyActionForLoan(@Param("loan_id") Long loan_id, - @Param("business_date") LocalDate business_date, Pageable page); - List findByLoanOrderById(Loan loan); } diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/delinquency/exception/DelinquencyRangeNotFoundException.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/delinquency/exception/DelinquencyRangeNotFoundException.java deleted file mode 100644 index e0d3b5a622f..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/delinquency/exception/DelinquencyRangeNotFoundException.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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.portfolio.delinquency.exception; - -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException; - -public class DelinquencyRangeNotFoundException extends AbstractPlatformResourceNotFoundException { - - public DelinquencyRangeNotFoundException(String globalisationMessageCode, String defaultUserMessage, Object... defaultUserMessageArgs) { - super(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs); - } - - public static DelinquencyRangeNotFoundException notExist(final Long id, Throwable... e) { - return new DelinquencyRangeNotFoundException("error.msg.delinquency.range.id.not.exist", - "Delinquency range with id `" + id + "` does not exist.", id, e); - } - - public static DelinquencyRangeNotFoundException notFound(final Long id, Throwable... e) { - return new DelinquencyRangeNotFoundException("error.msg.delinquency.range.not.found", - "Delinquency range with id `" + id + "` is not found.", id, e); - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/UndoStateTransitionCommand.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/UndoStateTransitionCommand.java deleted file mode 100644 index 3362c6c394d..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/UndoStateTransitionCommand.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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.portfolio.loanaccount.command; - -/** - * Immutable command for undo'ing a state transition. - */ -public class UndoStateTransitionCommand { - - private final Long loanId; - private final String note; - - public UndoStateTransitionCommand(final Long loanId, final String note) { - this.loanId = loanId; - this.note = note; - } - - public Long getLoanId() { - return this.loanId; - } - - public String getNote() { - return this.note; - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/UpdateLoanOfficerCommand.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/UpdateLoanOfficerCommand.java deleted file mode 100644 index 21d3165fcbc..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/command/UpdateLoanOfficerCommand.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * 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.portfolio.loanaccount.command; - -import java.time.LocalDate; -import java.util.ArrayList; -import java.util.List; -import org.apache.fineract.infrastructure.core.data.ApiParameterError; -import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder; -import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException; - -/** - * Immutable data object for updating relationship between loan officer and a loan. - */ -public class UpdateLoanOfficerCommand { - - private final Long fromLoanOfficerId; - private final Long toLoanOfficerId; - private final LocalDate assignmentDate; - - private final String[] loans; - - public UpdateLoanOfficerCommand(final Long fromLoanOfficerId, final Long toLoanOfficerId, final LocalDate assignmentDate) { - this.fromLoanOfficerId = fromLoanOfficerId; - this.toLoanOfficerId = toLoanOfficerId; - this.assignmentDate = assignmentDate; - this.loans = null; - } - - public UpdateLoanOfficerCommand(final Long fromLoanOfficerId, final Long toLoanOfficerId, final LocalDate assignmentDate, - final String[] loans) { - this.fromLoanOfficerId = fromLoanOfficerId; - this.toLoanOfficerId = toLoanOfficerId; - this.assignmentDate = assignmentDate; - this.loans = loans; - } - - public void validateForBulkLoanReassignment() { - final List dataValidationErrors = new ArrayList<>(); - - final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loans.reassignment"); - - baseDataValidator.reset().parameter("fromLoanOfficerId").value(this.fromLoanOfficerId).notNull().integerGreaterThanZero(); - baseDataValidator.reset().parameter("toLoanOfficerId").value(this.toLoanOfficerId).notNull().integerGreaterThanZero() - .notSameAsParameter("fromLoanOfficerId", this.fromLoanOfficerId); - - baseDataValidator.reset().parameter("assignmentDate").value(this.assignmentDate).notNull(); - - baseDataValidator.reset().parameter("loans").value(this.loans).arrayNotEmpty(); - - if (!dataValidationErrors.isEmpty()) { - throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", - dataValidationErrors); - } - } - - public void validateForLoanReassignment() { - final List dataValidationErrors = new ArrayList<>(); - - final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loans.reassignment"); - - baseDataValidator.reset().parameter("toLoanOfficerId").value(this.toLoanOfficerId).notNull().integerGreaterThanZero() - .notSameAsParameter("fromLoanOfficerId", this.fromLoanOfficerId); - - baseDataValidator.reset().parameter("assignmentDate").value(this.assignmentDate).notNull(); - - if (!dataValidationErrors.isEmpty()) { - throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", - dataValidationErrors); - } - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanConvenienceData.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanConvenienceData.java deleted file mode 100644 index ac2408c3ce1..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanConvenienceData.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * 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.portfolio.loanaccount.data; - -public class LoanConvenienceData { - - private final int maxSubmittedOnOffsetFromToday; - private final int maxApprovedOnOffsetFromToday; - private final int maxDisbursedOnOffsetFromToday; - private final int expectedLoanTermInDays; - private final int actualLoanTermInDays; - private final int expectedLoanTermInMonths; - private final int actualLoanTermInMonths; - - public LoanConvenienceData(final int maxSubmittedOnOffsetFromToday, final int maxApprovedOnOffsetFromToday, - final int maxDisbursedOnOffsetFromToday, final int expectedLoanTermInDays, final int actualLoanTermInDays, - final int expectedLoanTermInMonths, final int actualLoanTermInMonths) { - this.maxSubmittedOnOffsetFromToday = maxSubmittedOnOffsetFromToday; - this.maxApprovedOnOffsetFromToday = maxApprovedOnOffsetFromToday; - this.maxDisbursedOnOffsetFromToday = maxDisbursedOnOffsetFromToday; - this.expectedLoanTermInDays = expectedLoanTermInDays; - this.actualLoanTermInDays = actualLoanTermInDays; - this.expectedLoanTermInMonths = expectedLoanTermInMonths; - this.actualLoanTermInMonths = actualLoanTermInMonths; - } - - public int getMaxSubmittedOnOffsetFromToday() { - return this.maxSubmittedOnOffsetFromToday; - } - - public int getMaxApprovedOnOffsetFromToday() { - return this.maxApprovedOnOffsetFromToday; - } - - public int getMaxDisbursedOnOffsetFromToday() { - return this.maxDisbursedOnOffsetFromToday; - } - - public int getExpectedLoanTermInDays() { - return this.expectedLoanTermInDays; - } - - public int getActualLoanTermInDays() { - return this.actualLoanTermInDays; - } - - public int getExpectedLoanTermInMonths() { - return this.expectedLoanTermInMonths; - } - - public int getActualLoanTermInMonths() { - return this.actualLoanTermInMonths; - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/GLIMAccountInfoRepository.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/GLIMAccountInfoRepository.java index 8e2f68766f4..960f630ec72 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/GLIMAccountInfoRepository.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/GLIMAccountInfoRepository.java @@ -28,13 +28,9 @@ public interface GLIMAccountInfoRepository extends JpaRepository, JpaSpecificationExecutor { - GroupLoanIndividualMonitoringAccount findOneByIsAcceptingChild(boolean acceptingChild); - GroupLoanIndividualMonitoringAccount findOneByIsAcceptingChildAndApplicationId(boolean acceptingChild, BigDecimal applicationId); @Query("select loan.id from GroupLoanIndividualMonitoringAccount glim join glim.childLoan loan where glim.isAcceptingChild = :acceptingChild and glim.applicationId = :applicationId") List findChildLoanIdsByIsAcceptingChildAndApplicationId(@Param("acceptingChild") boolean acceptingChild, @Param("applicationId") BigDecimal applicationId); - - GroupLoanIndividualMonitoringAccount findOneByAccountNumber(String accountNumber); } diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepository.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepository.java index 420cd9e8634..5441a32c365 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepository.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepository.java @@ -175,9 +175,6 @@ List findByClientIdAndGroupIdAndLoanStatus(@Param("clientId") Long clientI List findByIdsAndLoanStatusAndLoanType(@Param("ids") Collection ids, @Param("loanStatuses") Collection loanStatuses, @Param("loanTypes") Collection loanTypes); - @Query("select loan.id from Loan loan where loan.actualDisbursementDate > :disbursalDate order by loan.actualDisbursementDate") - List getLoansDisbursedAfter(@Param("disbursalDate") LocalDate disbursalDate); - @Query("select loan from Loan loan where loan.client.office.id IN :officeIds and loan.loanStatus IN :loanStatuses") List findByClientOfficeIdsAndLoanStatus(@Param("officeIds") Collection officeIds, @Param("loanStatuses") Collection loanStatuses); @@ -280,9 +277,6 @@ List findLoansForAddAccrual(@Param("accountingType") AccountingRuleType ac List findAllLoansBehindOnDisbursementDate(@Param("cobBusinessDate") LocalDate cobBusinessDate, @Param("loanIds") List loanIds, @Param("loanStatuses") Collection loanStatuses); - @Query("SELECT CASE WHEN COUNT(l) > 0 THEN TRUE ELSE FALSE END FROM Loan l WHERE l.id = :loanId and l.loanRepaymentScheduleDetail.loanScheduleType = org.apache.fineract.portfolio.loanaccount.loanschedule.domain.LoanScheduleType.PROGRESSIVE") - Boolean isProgressiveLoan(@Param("loanId") Long loanId); - @Query("SELECT CASE WHEN COUNT(l) > 0 THEN TRUE ELSE FALSE END FROM Loan l WHERE l.id = :loanId and l.loanStatus in :allowedLoanStatuses") Boolean isLoanInAllowedStatus(@Param("loanId") Long loanId, @Param("allowedLoanStatuses") List allowedLoanStatuses); diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepositoryWrapper.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepositoryWrapper.java index d3d768cd300..e232d670d88 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepositoryWrapper.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanRepositoryWrapper.java @@ -215,11 +215,6 @@ public List findByIdsAndLoanStatusAndLoanType(@Param("ids") Collection getLoansDisbursedAfter(@Param("disbursalDate") LocalDate disbursalDate) { - return this.repository.getLoansDisbursedAfter(disbursalDate); - } - // Repayments Schedule public List findByClientOfficeIdsAndLoanStatus(@Param("officeIds") Collection officeIds, @Param("loanStatuses") Collection loanStatuses) { @@ -264,18 +259,10 @@ public Loan findNonClosedLoanByAccountNumber(@Param("accountNumber") String acco return this.repository.findLoanByAccountNumberAndStatuses(accountNumber, NON_CLOSED_LOAN_STATUSES); } - public boolean existsNonClosedLoanByExternalLoanId(final ExternalId externalId) { - return this.repository.existsLoanByExternalLoanIdAndStatuses(externalId, NON_CLOSED_LOAN_STATUSES); - } - public boolean existLoanByExternalId(final ExternalId externalId) { return this.repository.existsByExternalId(externalId); } - public List findAllNonClosedLoanIds() { - return this.repository.findAllLoanIdsByStatuses(NON_CLOSED_LOAN_STATUSES); - } - // Looks like we need complete entity @Transactional(readOnly = true) public Loan findNonClosedLoanThatBelongsToClient(@Param("loanId") Long loanId, @Param("clientId") Long clientId) { diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionRelationRepository.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionRelationRepository.java index 5d5e09955f3..b8691f7e7c3 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionRelationRepository.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionRelationRepository.java @@ -20,17 +20,6 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import org.springframework.data.jpa.repository.Query; public interface LoanTransactionRelationRepository - extends JpaRepository, JpaSpecificationExecutor { - - @Query(""" - SELECT CASE WHEN COUNT(ltr) > 0 THEN true ELSE false END - FROM LoanTransactionRelation ltr - WHERE ltr.toTransaction = :toTransaction AND ltr.relationType = :relationType - AND ltr.fromTransaction.reversed = false - """) - boolean hasLoanTransactionRelationsWithType(LoanTransaction toTransaction, LoanTransactionRelationTypeEnum relationType); - -} + extends JpaRepository, JpaSpecificationExecutor {} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionToRepaymentScheduleMappingRepository.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionToRepaymentScheduleMappingRepository.java deleted file mode 100644 index 7dfe8e99024..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionToRepaymentScheduleMappingRepository.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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.portfolio.loanaccount.domain; - -import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.JpaSpecificationExecutor; - -public interface LoanTransactionToRepaymentScheduleMappingRepository extends JpaRepository, - JpaSpecificationExecutor { - - LoanTransactionToRepaymentScheduleMapping findByLoanTransaction(LoanTransaction loanTransaction); - -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/TransactionProccessingResult.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/TransactionProccessingResult.java deleted file mode 100644 index a6a16d4e454..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/TransactionProccessingResult.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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.portfolio.loanaccount.domain; - -import org.apache.fineract.organisation.monetary.domain.Money; - -public class TransactionProccessingResult { - - private final Money overPaymentAmount; - private final boolean overPayment; - - public TransactionProccessingResult(final Money overPaymentAmount, final boolean overPayment) { - this.overPaymentAmount = overPaymentAmount; - this.overPayment = overPayment; - } - - public Money getOverPaymentAmount() { - return this.overPaymentAmount; - } - - public boolean isOverPayment() { - return this.overPayment; - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/data/GuarantorDTO.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/data/GuarantorDTO.java deleted file mode 100644 index 937e8e26f12..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/guarantor/data/GuarantorDTO.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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.portfolio.loanaccount.guarantor.data; - -import java.math.BigDecimal; -import org.apache.fineract.portfolio.loanaccount.domain.Loan; - -public class GuarantorDTO { - - @SuppressWarnings("unused") - private BigDecimal paidAmount; - @SuppressWarnings("unused") - private Loan loan; - -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/RecalculatedSchedule.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/RecalculatedSchedule.java deleted file mode 100644 index a959c607a0c..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/domain/RecalculatedSchedule.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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.portfolio.loanaccount.loanschedule.domain; - -public class RecalculatedSchedule { - - private final LoanScheduleModel loanScheduleModel; - private final Integer installmentNumber; - - public RecalculatedSchedule(final LoanScheduleModel loanScheduleModel, final Integer installmentNumber) { - this.loanScheduleModel = loanScheduleModel; - this.installmentNumber = installmentNumber; - } - - public LoanScheduleModel getLoanScheduleModel() { - return this.loanScheduleModel; - } - - public Integer getInstallmentNumber() { - return this.installmentNumber; - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/exception/MultiDisbursementDisbursementDateException.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/exception/MultiDisbursementDisbursementDateException.java deleted file mode 100644 index 10d514c6b17..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/exception/MultiDisbursementDisbursementDateException.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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.portfolio.loanaccount.loanschedule.exception; - -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; - -public class MultiDisbursementDisbursementDateException extends AbstractPlatformDomainRuleException { - - public MultiDisbursementDisbursementDateException(final String defaultUserMessage, final Object... defaultUserMessageArgs) { - super("error.msg.loanschedule.out.of.schedule.dusbursement.date", defaultUserMessage, defaultUserMessageArgs); - } - -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanRescheduleModelRepaymentPeriod.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanRescheduleModelRepaymentPeriod.java deleted file mode 100644 index b487c862c40..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/rescheduleloan/domain/LoanRescheduleModelRepaymentPeriod.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * 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.portfolio.loanaccount.rescheduleloan.domain; - -import java.math.BigDecimal; -import java.time.LocalDate; -import lombok.Setter; -import org.apache.fineract.organisation.monetary.domain.Money; -import org.apache.fineract.portfolio.loanaccount.loanschedule.data.LoanSchedulePeriodData; - -@Setter -public final class LoanRescheduleModelRepaymentPeriod implements LoanRescheduleModalPeriod { - - private int periodNumber; - private int oldPeriodNumber; - private LocalDate fromDate; - private LocalDate dueDate; - private Money principalDue; - private Money outstandingLoanBalance; - private Money interestDue; - private Money feeChargesDue; - private Money penaltyChargesDue; - private Money totalDue; - private boolean isNew; - - public LoanRescheduleModelRepaymentPeriod(final int periodNumber, final int oldPeriodNumber, LocalDate fromDate, - final LocalDate dueDate, final Money principalDue, final Money outstandingLoanBalance, final Money interestDue, - final Money feeChargesDue, final Money penaltyChargesDue, final Money totalDue, final boolean isNew) { - this.periodNumber = periodNumber; - this.oldPeriodNumber = oldPeriodNumber; - this.fromDate = fromDate; - this.dueDate = dueDate; - this.principalDue = principalDue; - this.outstandingLoanBalance = outstandingLoanBalance; - this.interestDue = interestDue; - this.feeChargesDue = feeChargesDue; - this.penaltyChargesDue = penaltyChargesDue; - this.totalDue = totalDue; - this.isNew = isNew; - } - - public static LoanRescheduleModelRepaymentPeriod instance(final int periodNumber, final int oldPeriodNumber, LocalDate fromDate, - final LocalDate dueDate, final Money principalDue, final Money outstandingLoanBalance, final Money interestDue, - final Money feeChargesDue, final Money penaltyChargesDue, final Money totalDue, final boolean isNew) { - - return new LoanRescheduleModelRepaymentPeriod(periodNumber, oldPeriodNumber, fromDate, dueDate, principalDue, - outstandingLoanBalance, interestDue, feeChargesDue, penaltyChargesDue, totalDue, isNew); - } - - @Override - public LoanSchedulePeriodData toData() { - return LoanSchedulePeriodData.repaymentOnlyPeriod(this.periodNumber, this.fromDate, this.dueDate, this.principalDue.getAmount(), - this.outstandingLoanBalance.getAmount(), this.interestDue.getAmount(), this.feeChargesDue.getAmount(), - this.penaltyChargesDue.getAmount()); - } - - @Override - public Integer periodNumber() { - return this.periodNumber; - } - - @Override - public Integer oldPeriodNumber() { - return this.oldPeriodNumber; - } - - @Override - public LocalDate periodFromDate() { - return this.fromDate; - } - - @Override - public LocalDate periodDueDate() { - return this.dueDate; - } - - @Override - public BigDecimal principalDue() { - BigDecimal value = null; - - if (this.principalDue != null) { - value = this.principalDue.getAmount(); - } - - return value; - } - - @Override - public BigDecimal interestDue() { - BigDecimal value = null; - - if (this.interestDue != null) { - value = this.interestDue.getAmount(); - } - - return value; - } - - @Override - public BigDecimal feeChargesDue() { - BigDecimal value = null; - - if (this.feeChargesDue != null) { - value = this.feeChargesDue.getAmount(); - } - - return value; - } - - @Override - public BigDecimal penaltyChargesDue() { - BigDecimal value = null; - - if (this.penaltyChargesDue != null) { - value = this.penaltyChargesDue.getAmount(); - } - - return value; - } - - @Override - public boolean isNew() { - return isNew; - } - - public void updatePeriodNumber(Integer periodNumber) { - this.periodNumber = periodNumber; - } - - public void updateOldPeriodNumber(Integer oldPeriodNumber) { - this.oldPeriodNumber = oldPeriodNumber; - } - - public void updatePeriodFromDate(LocalDate periodFromDate) { - this.fromDate = periodFromDate; - } - - public void updatePeriodDueDate(LocalDate periodDueDate) { - this.dueDate = periodDueDate; - } - - public void updatePrincipalDue(Money principalDue) { - this.principalDue = principalDue; - } - - public void updateInterestDue(Money interestDue) { - this.interestDue = interestDue; - } - - public void updateFeeChargesDue(Money feeChargesDue) { - this.feeChargesDue = feeChargesDue; - } - - public void updatePenaltyChargesDue(Money penaltyChargesDue) { - this.penaltyChargesDue = penaltyChargesDue; - } - - public void updateOutstandingLoanBalance(Money outstandingLoanBalance) { - this.outstandingLoanBalance = outstandingLoanBalance; - } - - public void updateTotalDue(Money totalDue) { - this.totalDue = totalDue; - } - - public void updateIsNew(boolean isNew) { - this.isNew = isNew; - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRepository.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRepository.java index d7fb487ec94..3379e461813 100644 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRepository.java +++ b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/domain/LoanProductRepository.java @@ -36,8 +36,6 @@ public interface LoanProductRepository extends JpaRepository, Long countByDelinquencyBucket(DelinquencyBucket delinquencyBucket); - List findByDelinquencyBucketNotNull(); - LoanProduct findByExternalId(ExternalId externalId); @Override diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/exception/InvalidLendingStrategy.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/exception/InvalidLendingStrategy.java deleted file mode 100644 index af27fff7cec..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/exception/InvalidLendingStrategy.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * 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.portfolio.loanproduct.exception; - -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; - -/** - * {@link AbstractPlatformDomainRuleException} thrown when lending strategy mismatch occurs - */ -public class InvalidLendingStrategy extends AbstractPlatformDomainRuleException { - - public InvalidLendingStrategy(final Integer strategyId) { - super("error.msg.unsupported.lending.strategy", "Strategy code [" + strategyId + "] passed is not valid."); - } -} diff --git a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/exception/NotInMinMaxRangeException.java b/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/exception/NotInMinMaxRangeException.java deleted file mode 100644 index ae6a1539af8..00000000000 --- a/fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/exception/NotInMinMaxRangeException.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * 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.portfolio.loanproduct.exception; - -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; - -/** - * {@link AbstractPlatformDomainRuleException} thrown when a value is not within minimum and maximum values. - * - */ -public class NotInMinMaxRangeException extends AbstractPlatformDomainRuleException { - - public NotInMinMaxRangeException(final String entity, final String postFix, final String defaultUserMessage, - final Object... defaultUserMessageArgs) { - super("validation.msg." + entity + "." + postFix + ".is.not.within.min.max.range", defaultUserMessage, defaultUserMessageArgs); - } -}