payment type applicable for disbursement charge configuration added
This commit is contained in:
+2
@@ -68,4 +68,6 @@ public interface ConfigurationDomainService {
|
|||||||
boolean isOrganisationstartDateEnabled();
|
boolean isOrganisationstartDateEnabled();
|
||||||
|
|
||||||
Date retrieveOrganisationStartDate();
|
Date retrieveOrganisationStartDate();
|
||||||
|
|
||||||
|
boolean isPaymnetypeApplicableforDisbursementCharge();
|
||||||
}
|
}
|
||||||
+7
@@ -229,4 +229,11 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
|
|||||||
return property.getDateValue();
|
return property.getDateValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPaymnetypeApplicableforDisbursementCharge() {
|
||||||
|
final String propertyName = "paymenttype-applicable-for-disbursement-charges";
|
||||||
|
final GlobalConfigurationProperty property = this.globalConfigurationRepository.findOneByNameWithNotFoundDetection(propertyName);
|
||||||
|
return property.isEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+5
-4
@@ -125,6 +125,7 @@ import org.apache.fineract.portfolio.loanproduct.domain.LoanRescheduleStrategyMe
|
|||||||
import org.apache.fineract.portfolio.loanproduct.domain.LoanTransactionProcessingStrategy;
|
import org.apache.fineract.portfolio.loanproduct.domain.LoanTransactionProcessingStrategy;
|
||||||
import org.apache.fineract.portfolio.loanproduct.domain.RecalculationFrequencyType;
|
import org.apache.fineract.portfolio.loanproduct.domain.RecalculationFrequencyType;
|
||||||
import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
|
import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
|
||||||
|
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
|
||||||
import org.apache.fineract.useradministration.domain.AppUser;
|
import org.apache.fineract.useradministration.domain.AppUser;
|
||||||
import org.hibernate.annotations.LazyCollection;
|
import org.hibernate.annotations.LazyCollection;
|
||||||
import org.hibernate.annotations.LazyCollectionOption;
|
import org.hibernate.annotations.LazyCollectionOption;
|
||||||
@@ -2287,7 +2288,7 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ChangedTransactionDetail disburse(final AppUser currentUser, final JsonCommand command, final Map<String, Object> actualChanges,
|
public ChangedTransactionDetail disburse(final AppUser currentUser, final JsonCommand command, final Map<String, Object> actualChanges,
|
||||||
final ScheduleGeneratorDTO scheduleGeneratorDTO) {
|
final ScheduleGeneratorDTO scheduleGeneratorDTO,final PaymentDetail paymentDetail) {
|
||||||
|
|
||||||
final LoanStatus statusEnum = this.loanLifecycleStateMachine.transition(LoanEvent.LOAN_DISBURSED,
|
final LoanStatus statusEnum = this.loanLifecycleStateMachine.transition(LoanEvent.LOAN_DISBURSED,
|
||||||
LoanStatus.fromInt(this.loanStatus));
|
LoanStatus.fromInt(this.loanStatus));
|
||||||
@@ -2318,7 +2319,7 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
updateSummaryWithTotalFeeChargesDueAtDisbursement(deriveSumTotalOfChargesDueAtDisbursement());
|
updateSummaryWithTotalFeeChargesDueAtDisbursement(deriveSumTotalOfChargesDueAtDisbursement());
|
||||||
updateLoanRepaymentPeriodsDerivedFields(actualDisbursementDate);
|
updateLoanRepaymentPeriodsDerivedFields(actualDisbursementDate);
|
||||||
LocalDateTime createdDate = DateUtils.getLocalDateTimeOfTenant();
|
LocalDateTime createdDate = DateUtils.getLocalDateTimeOfTenant();
|
||||||
handleDisbursementTransaction(actualDisbursementDate, createdDate, currentUser);
|
handleDisbursementTransaction(actualDisbursementDate, createdDate, currentUser,paymentDetail);
|
||||||
updateLoanSummaryDerivedFields();
|
updateLoanSummaryDerivedFields();
|
||||||
final Money interestApplied = Money.of(getCurrency(), this.summary.getTotalInterestCharged());
|
final Money interestApplied = Money.of(getCurrency(), this.summary.getTotalInterestCharged());
|
||||||
|
|
||||||
@@ -2616,7 +2617,7 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
return interestRate;
|
return interestRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleDisbursementTransaction(final LocalDate disbursedOn, final LocalDateTime createdDate, final AppUser currentUser) {
|
private void handleDisbursementTransaction(final LocalDate disbursedOn, final LocalDateTime createdDate, final AppUser currentUser, final PaymentDetail paymentDetail) {
|
||||||
|
|
||||||
// add repayment transaction to track incoming money from client to mfi
|
// add repayment transaction to track incoming money from client to mfi
|
||||||
// for (charges due at time of disbursement)
|
// for (charges due at time of disbursement)
|
||||||
@@ -2634,7 +2635,7 @@ public class Loan extends AbstractPersistable<Long> {
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
Money disbursentMoney = Money.zero(getCurrency());
|
Money disbursentMoney = Money.zero(getCurrency());
|
||||||
final LoanTransaction chargesPayment = LoanTransaction.repaymentAtDisbursement(getOffice(), disbursentMoney, null, disbursedOn,
|
final LoanTransaction chargesPayment = LoanTransaction.repaymentAtDisbursement(getOffice(), disbursentMoney, paymentDetail, disbursedOn,
|
||||||
null, createdDate, currentUser);
|
null, createdDate, currentUser);
|
||||||
final Integer installmentNumber = null;
|
final Integer installmentNumber = null;
|
||||||
for (final LoanCharge charge : charges()) {
|
for (final LoanCharge charge : charges()) {
|
||||||
|
|||||||
+10
-4
@@ -361,8 +361,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
this.loanScheduleHistoryWritePlatformService.createAndSaveLoanScheduleArchive(loan.fetchRepaymentScheduleInstallments(),
|
this.loanScheduleHistoryWritePlatformService.createAndSaveLoanScheduleArchive(loan.fetchRepaymentScheduleInstallments(),
|
||||||
loan, null);
|
loan, null);
|
||||||
}
|
}
|
||||||
|
if(configurationDomainService.isPaymnetypeApplicableforDisbursementCharge()){
|
||||||
changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO);
|
changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO,paymentDetail);
|
||||||
|
}else{
|
||||||
|
changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO,null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!changes.isEmpty()) {
|
if (!changes.isEmpty()) {
|
||||||
saveAndFlushLoanWithDataIntegrityViolationChecks(loan);
|
saveAndFlushLoanWithDataIntegrityViolationChecks(loan);
|
||||||
@@ -594,8 +597,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
|
|||||||
this.loanScheduleHistoryWritePlatformService.createAndSaveLoanScheduleArchive(
|
this.loanScheduleHistoryWritePlatformService.createAndSaveLoanScheduleArchive(
|
||||||
loan.fetchRepaymentScheduleInstallments(), loan, null);
|
loan.fetchRepaymentScheduleInstallments(), loan, null);
|
||||||
}
|
}
|
||||||
|
if(configurationDomainService.isPaymnetypeApplicableforDisbursementCharge()){
|
||||||
changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO);
|
changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO,paymentDetail);
|
||||||
|
}else{
|
||||||
|
changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO,null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!changes.isEmpty()) {
|
if (!changes.isEmpty()) {
|
||||||
|
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
INSERT INTO `c_configuration` (`name`, `value`, `enabled`, `is_trap_door`, `description`) VALUES ('paymenttype-applicable-for-disbursement-charges', NULL, 0, 0, 'Is the Disbursement Entry need to be considering the fund source of the paymnet type');
|
||||||
Reference in New Issue
Block a user