fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject incubator-fineract git commit: payment type applicable for disbursement charge configuration added
Date Wed, 09 Mar 2016 09:17:33 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop b786d459b -> 6ecbd2812


payment type applicable for disbursement charge configuration added


Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/6ecbd281
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/6ecbd281
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/6ecbd281

Branch: refs/heads/develop
Commit: 6ecbd28121f5fb20781c4a7f1135223d94364eab
Parents: b786d45
Author: venkatconflux <venkata.conflux@confluxtechnologies.com>
Authored: Wed Mar 9 12:42:43 2016 +0530
Committer: venkatconflux <venkata.conflux@confluxtechnologies.com>
Committed: Wed Mar 9 12:43:10 2016 +0530

----------------------------------------------------------------------
 .../domain/ConfigurationDomainService.java            |  2 ++
 .../domain/ConfigurationDomainServiceJpa.java         |  7 +++++++
 .../fineract/portfolio/loanaccount/domain/Loan.java   |  9 +++++----
 .../LoanWritePlatformServiceJpaRepositoryImpl.java    | 14 ++++++++++----
 ...paymnettype_application_forDisbursement_charge.sql |  1 +
 5 files changed, 25 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/6ecbd281/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
index 67c7b6a..3985fc5 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainService.java
@@ -68,4 +68,6 @@ public interface ConfigurationDomainService {
     boolean isOrganisationstartDateEnabled();
     
     Date retrieveOrganisationStartDate();
+    
+    boolean isPaymnetypeApplicableforDisbursementCharge();
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/6ecbd281/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
index fcafaac..45906af 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/configuration/domain/ConfigurationDomainServiceJpa.java
@@ -229,4 +229,11 @@ public class ConfigurationDomainServiceJpa implements ConfigurationDomainService
         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();
+	}
+
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/6ecbd281/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
index 78e284e..db159b9 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/Loan.java
@@ -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.RecalculationFrequencyType;
 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.hibernate.annotations.LazyCollection;
 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,
-            final ScheduleGeneratorDTO scheduleGeneratorDTO) {
+            final ScheduleGeneratorDTO scheduleGeneratorDTO,final PaymentDetail paymentDetail)
{
 
         final LoanStatus statusEnum = this.loanLifecycleStateMachine.transition(LoanEvent.LOAN_DISBURSED,
                 LoanStatus.fromInt(this.loanStatus));
@@ -2318,7 +2319,7 @@ public class Loan extends AbstractPersistable<Long> {
         updateSummaryWithTotalFeeChargesDueAtDisbursement(deriveSumTotalOfChargesDueAtDisbursement());
         updateLoanRepaymentPeriodsDerivedFields(actualDisbursementDate);
         LocalDateTime createdDate = DateUtils.getLocalDateTimeOfTenant();
-        handleDisbursementTransaction(actualDisbursementDate, createdDate, currentUser);
+        handleDisbursementTransaction(actualDisbursementDate, createdDate, currentUser,paymentDetail);
         updateLoanSummaryDerivedFields();
         final Money interestApplied = Money.of(getCurrency(), this.summary.getTotalInterestCharged());
 
@@ -2616,7 +2617,7 @@ public class Loan extends AbstractPersistable<Long> {
         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
         // for (charges due at time of disbursement)
@@ -2634,7 +2635,7 @@ public class Loan extends AbstractPersistable<Long> {
          **/
 
         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);
         final Integer installmentNumber = null;
         for (final LoanCharge charge : charges()) {

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/6ecbd281/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
index dddc901..bcdb3e0 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java
@@ -361,8 +361,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
                 this.loanScheduleHistoryWritePlatformService.createAndSaveLoanScheduleArchive(loan.fetchRepaymentScheduleInstallments(),
                         loan, null);
             }
-
-            changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO);
+            if(configurationDomainService.isPaymnetypeApplicableforDisbursementCharge()){
+            	changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO,paymentDetail);
+            }else{
+            	changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO,null);
+            }
         }
         if (!changes.isEmpty()) {
             saveAndFlushLoanWithDataIntegrityViolationChecks(loan);
@@ -594,8 +597,11 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf
                     this.loanScheduleHistoryWritePlatformService.createAndSaveLoanScheduleArchive(
                             loan.fetchRepaymentScheduleInstallments(), loan, null);
                 }
-
-                changedTransactionDetail = loan.disburse(currentUser, command, changes, scheduleGeneratorDTO);
+                if(configurationDomainService.isPaymnetypeApplicableforDisbursementCharge()){
+                	changedTransactionDetail = loan.disburse(currentUser, command, changes,
scheduleGeneratorDTO,paymentDetail);
+                }else{
+                	changedTransactionDetail = loan.disburse(currentUser, command, changes,
scheduleGeneratorDTO,null);
+                }
             }
             if (!changes.isEmpty()) {
 

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/6ecbd281/fineract-provider/src/main/resources/sql/migrations/core_db/V294__configuration_for_paymnettype_application_forDisbursement_charge.sql
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/resources/sql/migrations/core_db/V294__configuration_for_paymnettype_application_forDisbursement_charge.sql
b/fineract-provider/src/main/resources/sql/migrations/core_db/V294__configuration_for_paymnettype_application_forDisbursement_charge.sql
new file mode 100644
index 0000000..3c4ac2b
--- /dev/null
+++ b/fineract-provider/src/main/resources/sql/migrations/core_db/V294__configuration_for_paymnettype_application_forDisbursement_charge.sql
@@ -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');


Mime
View raw message