fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nazeer1100...@apache.org
Subject [1/2] fineract git commit: saving for collection sheet and 347, 251, 360
Date Fri, 09 Jun 2017 10:47:21 GMT
Repository: fineract
Updated Branches:
  refs/heads/develop 06c959ebb -> cbfdfa001


saving for collection sheet and 347,251,360


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

Branch: refs/heads/develop
Commit: f537bae699d51593d05fa43e52734e36d3568146
Parents: 3ddde49
Author: nazeer shaik <nazeer.shaik@confluxtechnologies.com>
Authored: Fri Jun 9 15:38:41 2017 +0530
Committer: nazeer shaik <nazeer.shaik@confluxtechnologies.com>
Committed: Fri Jun 9 15:38:41 2017 +0530

----------------------------------------------------------------------
 .../CollectionSheetConstants.java               |  1 +
 ...CollectionSheetTransactionDataValidator.java |  3 ++-
 .../collectionsheet/data/SavingsDueData.java    | 13 ++++++---
 .../CollectionSheetReadPlatformServiceImpl.java | 22 ++++++++-------
 .../data/SavingsAccountTransactionDTO.java      | 13 +++++++--
 .../savings/data/SavingsProductData.java        | 11 ++++++++
 .../savings/domain/DepositAccountAssembler.java |  5 +++-
 .../domain/DepositAccountDomainService.java     |  3 +++
 .../domain/DepositAccountDomainServiceJpa.java  | 15 +++++++++++
 .../savings/domain/RecurringDepositAccount.java |  2 +-
 .../domain/SavingsAccountDomainServiceJpa.java  |  6 +++--
 ...ntWritePlatformServiceJpaRepositoryImpl.java | 28 +++++++++++++++-----
 ...ntWritePlatformServiceJpaRepositoryImpl.java |  3 ++-
 13 files changed, 98 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
index 7021849..bb4e9b0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/CollectionSheetConstants.java
@@ -50,6 +50,7 @@ public class CollectionSheetConstants {
     public static final String loanIdParamName = "loanId";
     public static final String savingsIdParamName = "savingsId";
     public static final String transactionAmountParamName = "transactionAmount";
+    public static final String depositAccountTypeParamName = "depositAccountType";
 
     public static final Set<String> COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName,
             dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName,
bulkRepaymentTransactionsParamName,

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
index 39200e7..56edceb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java
@@ -48,6 +48,7 @@ import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
 import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
 import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
 import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.infrastructure.core.service.DateUtils;
 import org.apache.fineract.portfolio.paymentdetail.PaymentDetailConstants;
 import org.joda.time.LocalDate;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -119,7 +120,7 @@ public class CollectionSheetTransactionDataValidator {
         final JsonElement element = this.fromApiJsonHelper.parse(json);
 
         final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transactionDateParamName,
element);
-        baseDataValidator.reset().parameter(transactionDateParamName).value(transactionDate).notNull();
+        baseDataValidator.reset().parameter(transactionDateParamName).value(transactionDate).notNull().validateDateBeforeOrEqual(DateUtils.getLocalDateOfTenant());
 
         final String note = this.fromApiJsonHelper.extractStringNamed(noteParamName, element);
         if (StringUtils.isNotBlank(note)) {

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/SavingsDueData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/SavingsDueData.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/SavingsDueData.java
index c084b3e..e09c290 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/SavingsDueData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/data/SavingsDueData.java
@@ -40,14 +40,16 @@ public class SavingsDueData {
     private final CurrencyData currency;
     @SuppressWarnings("unused")
     private BigDecimal dueAmount = BigDecimal.ZERO;
+    @SuppressWarnings("unused")
+    private String depositAccountType;
 
     public static SavingsDueData instance(final Long savingsId, final String accountId, final
Integer accountStatusId,
-            final String productName, final Long productId, final CurrencyData currency,
final BigDecimal dueAmount) {
-        return new SavingsDueData(savingsId, accountId, accountStatusId, productName, productId,
currency, dueAmount);
+            final String productName, final Long productId, final CurrencyData currency,
final BigDecimal dueAmount, final String depositAccountType) {
+        return new SavingsDueData(savingsId, accountId, accountStatusId, productName, productId,
currency, dueAmount, depositAccountType);
     }
 
     private SavingsDueData(final Long savingsId, final String accountId, final Integer accountStatusId,
final String productName,
-            final Long productId, final CurrencyData currency, final BigDecimal dueAmount)
{
+            final Long productId, final CurrencyData currency, final BigDecimal dueAmount,
final String depositAccountType) {
         this.savingsId = savingsId;
         this.accountId = accountId;
         this.accountStatusId = accountStatusId;
@@ -55,6 +57,7 @@ public class SavingsDueData {
         this.productId = productId;
         this.currency = currency;
         this.dueAmount = dueAmount;
+        this.depositAccountType = depositAccountType;
     }
     
     public String productName() {
@@ -64,5 +67,9 @@ public class SavingsDueData {
     public Long productId() {
         return this.productId;
     }
+
+	public String getDepositAccountType() {
+		return depositAccountType;
+	}
     
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java
index 8432d36..18be4d0 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java
@@ -235,7 +235,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
                     .append("if(ln.loan_status_id = 200 , ln.principal_amount , null) As
disbursementAmount, ")
                     .append("sum(ifnull(if(ln.loan_status_id = 300, ls.principal_amount,
0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.principal_completed_derived, 0.0), 0.0))
As principalDue, ")
                     .append("ln.principal_repaid_derived As principalPaid, ")
-                    .append("sum(ifnull(if(ln.loan_status_id = 300, ls.interest_amount, 0.0),
0.0) - ifnull(if(ln.loan_status_id = 300, ls.interest_completed_derived, 0.0), 0.0)) As interestDue,
")
+                    .append("sum(ifnull(if(ln.loan_status_id = 300, ls.interest_amount, 0.0),
0.0) - ifnull(if(ln.loan_status_id = 300, ls.interest_completed_derived, 0.0), 0.0) - IFNULL(IF(ln.loan_status_id
= 300, ls.interest_waived_derived, 0.0), 0.0)) As interestDue, ")
                     .append("ln.interest_repaid_derived As interestPaid, ")
                     .append("sum(ifnull(if(ln.loan_status_id = 300, ls.fee_charges_amount,
0.0), 0.0) - ifnull(if(ln.loan_status_id = 300, ls.fee_charges_completed_derived, 0.0), 0.0))
As feeDue, ")
                     .append("ln.fee_charges_repaid_derived As feePaid, ")
@@ -439,6 +439,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
                 for (SavingsDueData savingsDueData : savingsDatas) {
                     final SavingsProductData savingsProduct = SavingsProductData.lookup(savingsDueData.productId(),
                             savingsDueData.productName());
+                    savingsProduct.setDepositAccountType(savingsDueData.getDepositAccountType());
                     if (!savingsProducts.contains(savingsProduct)) {
                         savingsProducts.add(savingsProduct);
                     }
@@ -515,6 +516,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
                     .append("sa.currency_multiplesof as inMultiplesOf, ")
                     .append("rc.`name` as currencyName, ")
                     .append("rc.display_symbol as currencyDisplaySymbol, ")
+                    .append("if(sa.deposit_type_enum=100,'Saving Deposit',if(sa.deposit_type_enum=300,'Recurring
Deposit','Current Deposit')) as depositAccountType, ")
                     .append("rc.internationalized_name_code as currencyNameCode, ")
                     .append("sum(ifnull(mss.deposit_amount,0) - ifnull(mss.deposit_amount_completed_derived,0))
as dueAmount ")
 
@@ -526,8 +528,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
                     .append("JOIN m_client cl ON cl.id = gc.client_id ")
                     .append("JOIN m_savings_account sa ON sa.client_id=cl.id and sa.status_enum=300
")
                     .append("JOIN m_savings_product sp ON sa.product_id=sp.id ")
-                    .append("JOIN m_deposit_account_recurring_detail dard ON sa.id = dard.savings_account_id
AND dard.is_mandatory = true AND dard.is_calendar_inherited = true ")
-                    .append("JOIN m_mandatory_savings_schedule mss ON mss.savings_account_id=sa.id
AND mss.duedate <= :dueDate ")
+                    .append("LEFT JOIN m_deposit_account_recurring_detail dard ON sa.id =
dard.savings_account_id AND dard.is_mandatory = true AND dard.is_calendar_inherited = true
")
+                    .append("LEFT JOIN m_mandatory_savings_schedule mss ON mss.savings_account_id=sa.id
AND mss.duedate <= :dueDate ")
                     .append("LEFT JOIN m_currency rc on rc.`code` = sa.currency_code ");
 
             if (isCenterCollection) {
@@ -655,25 +657,25 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
         private SavingsDueDataMapper() {}
 
         @Override
-        public SavingsDueData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum)
throws SQLException {
+        public SavingsDueData mapRow(ResultSet rs, int rowNum) throws SQLException {
             final Long savingsId = rs.getLong("savingsId");
             final String accountId = rs.getString("accountId");
             final Integer accountStatusId = JdbcSupport.getInteger(rs, "accountStatusId");
             final String productName = rs.getString("productShortName");
             final Long productId = rs.getLong("productId");
             final BigDecimal dueAmount = rs.getBigDecimal("dueAmount");
-
             final String currencyCode = rs.getString("currencyCode");
             final String currencyName = rs.getString("currencyName");
             final String currencyNameCode = rs.getString("currencyNameCode");
             final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
             final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
             final Integer inMultiplesOf = JdbcSupport.getInteger(rs, "inMultiplesOf");
+            final String depositAccountType = rs.getString("depositAccountType");
             // currency
             final CurrencyData currency = new CurrencyData(currencyCode, currencyName, currencyDigits,
inMultiplesOf,
                     currencyDisplaySymbol, currencyNameCode);
 
-            return SavingsDueData.instance(savingsId, accountId, accountStatusId, productName,
productId, currency, dueAmount);
+            return SavingsDueData.instance(savingsId, accountId, accountStatusId, productName,
productId, currency, dueAmount, depositAccountType);
         }
     }
 
@@ -818,7 +820,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
         public IndividualMandatorySavingsCollectionsheetExtractor(final boolean checkForOfficeId,
final boolean checkforStaffId) {
 
             final StringBuffer sb = new StringBuffer(400);
-            sb.append("SELECT cl.display_name As clientName, cl.id As clientId, ");
+            sb.append("SELECT if(sa.deposit_type_enum=100,'Saving Deposit',if(sa.deposit_type_enum=300,'Recurring
Deposit','Current Deposit')) as depositAccountType, cl.display_name As clientName, cl.id As
clientId, ");
             sb.append("sa.id As savingsId, sa.account_no As accountId, sa.status_enum As
accountStatusId, ");
             sb.append("sp.short_name As productShortName, sp.id As productId, ");
             sb.append("sa.currency_code as currencyCode, sa.currency_digits as currencyDigits,
sa.currency_multiplesof as inMultiplesOf, ");
@@ -827,11 +829,11 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe
             sb.append("FROM m_savings_account sa ");
             sb.append("JOIN m_client cl ON cl.id = sa.client_id ");
             sb.append("JOIN m_savings_product sp ON sa.product_id=sp.id ");
-            sb.append("JOIN m_deposit_account_recurring_detail dard ON sa.id = dard.savings_account_id
AND dard.is_mandatory = true AND dard.is_calendar_inherited = false ");
-            sb.append("JOIN m_mandatory_savings_schedule mss ON mss.savings_account_id=sa.id
AND mss.completed_derived = 0 AND mss.duedate <= :dueDate ");
+            sb.append("LEFT JOIN m_deposit_account_recurring_detail dard ON sa.id = dard.savings_account_id
AND dard.is_mandatory = true AND dard.is_calendar_inherited = false ");
+            sb.append("LEFT JOIN m_mandatory_savings_schedule mss ON mss.savings_account_id=sa.id
AND mss.completed_derived = 0 AND mss.duedate <= :dueDate ");
             sb.append("LEFT JOIN m_office of ON of.id = cl.office_id AND of.hierarchy like
:officeHierarchy ");
             sb.append("LEFT JOIN m_currency rc on rc.`code` = sa.currency_code ");
-            sb.append("WHERE sa.status_enum=300 and sa.group_id is null ");
+            sb.append("WHERE sa.status_enum=300 and sa.group_id is null and sa.deposit_type_enum
in (100,300,400) ");
             sb.append("and (cl.status_enum = 300 or (cl.status_enum = 600 and cl.closedon_date
>= :dueDate)) ");
             if (checkForOfficeId) {
                 sb.append("and of.id = :officeId ");

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDTO.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDTO.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDTO.java
index fb91c85..4cfaa30 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDTO.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsAccountTransactionDTO.java
@@ -35,9 +35,10 @@ public class SavingsAccountTransactionDTO {
     private final Date createdDate;
     private final Long savingsAccountId;
     private final AppUser appUser;
+    private final Integer depositAccountType;
 
     public SavingsAccountTransactionDTO(final DateTimeFormatter formatter, final LocalDate
transactionDate,
-            final BigDecimal transactionAmount, final PaymentDetail paymentDetail, final
Date createdDate, final AppUser appUser) {
+            final BigDecimal transactionAmount, final PaymentDetail paymentDetail, final
Date createdDate, final AppUser appUser, final Integer depositAccountType) {
         this.formatter = formatter;
         this.transactionDate = transactionDate;
         this.transactionAmount = transactionAmount;
@@ -45,6 +46,7 @@ public class SavingsAccountTransactionDTO {
         this.createdDate = createdDate;
         this.savingsAccountId = null;
         this.appUser = appUser;
+        this.depositAccountType = depositAccountType;
     }
 
     /**
@@ -58,7 +60,7 @@ public class SavingsAccountTransactionDTO {
      * @param savingsAccountId
      */
     public SavingsAccountTransactionDTO(DateTimeFormatter formatter, LocalDate transactionDate,
BigDecimal transactionAmount,
-            PaymentDetail paymentDetail, Date createdDate, Long savingsAccountId, AppUser
appUser) {
+            PaymentDetail paymentDetail, Date createdDate, Long savingsAccountId, AppUser
appUser, final Integer depositAccountType) {
         this.formatter = formatter;
         this.transactionDate = transactionDate;
         this.transactionAmount = transactionAmount;
@@ -66,6 +68,7 @@ public class SavingsAccountTransactionDTO {
         this.createdDate = createdDate;
         this.savingsAccountId = savingsAccountId;
         this.appUser = appUser;
+        this.depositAccountType = depositAccountType;
     }
 
     public DateTimeFormatter getFormatter() {
@@ -95,4 +98,10 @@ public class SavingsAccountTransactionDTO {
     public AppUser getAppUser() {
         return this.appUser;
     }
+
+	public Integer getAccountType() {
+		return this.depositAccountType;
+	}
+    
+    
 }

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java
index f8bba20..277126e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsProductData.java
@@ -61,6 +61,7 @@ public class SavingsProductData {
     private final BigDecimal minOverdraftForInterestCalculation;
     private final boolean withHoldTax;
     private final TaxGroupData taxGroup;
+    private String depositAccountType = null;
 
     // accounting
     private final EnumOptionData accountingRule;
@@ -436,4 +437,14 @@ public class SavingsProductData {
     public String getName() {
         return this.name;
     }
+
+	public String getDepositAccountType() {
+		return depositAccountType;
+	}
+
+	public void setDepositAccountType(String depositAccountType) {
+		this.depositAccountType = depositAccountType;
+	}
+    
+    
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java
index efc2e58..80025bb 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountAssembler.java
@@ -73,6 +73,7 @@ import org.apache.fineract.portfolio.accountdetails.domain.AccountType;
 import org.apache.fineract.portfolio.client.domain.Client;
 import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
 import org.apache.fineract.portfolio.client.exception.ClientNotActiveException;
+import org.apache.fineract.portfolio.collectionsheet.CollectionSheetConstants;
 import org.apache.fineract.portfolio.group.domain.Group;
 import org.apache.fineract.portfolio.group.domain.GroupRepositoryWrapper;
 import org.apache.fineract.portfolio.group.exception.CenterNotActiveException;
@@ -444,12 +445,14 @@ public class DepositAccountAssembler {
                     final Long savingsId = this.fromApiJsonHelper.extractLongNamed(savingsIdParamName,
savingsTransactionElement);
                     final BigDecimal dueAmount = this.fromApiJsonHelper.extractBigDecimalNamed(transactionAmountParamName,
                             savingsTransactionElement, locale);
+                    final Integer depositAccountType = this.fromApiJsonHelper.extractIntegerNamed(
+                            CollectionSheetConstants.depositAccountTypeParamName, savingsTransactionElement,
locale);
                     PaymentDetail detail = paymentDetail;
                     if (paymentDetail == null) {
                         detail = this.paymentDetailAssembler.fetchPaymentDetail(savingsTransactionElement);
                     }
                     final SavingsAccountTransactionDTO savingsAccountTransactionDTO = new
SavingsAccountTransactionDTO(formatter,
-                            transactionDate, dueAmount, detail, new Date(), savingsId, user);
+                            transactionDate, dueAmount, detail, new Date(), savingsId, user,
depositAccountType);
                     savingsAccountTransactions.add(savingsAccountTransactionDTO);
                 }
             }

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainService.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainService.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainService.java
index 9df5b63..f97ed49 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainService.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainService.java
@@ -37,6 +37,9 @@ public interface DepositAccountDomainService {
 
     SavingsAccountTransaction handleRDDeposit(RecurringDepositAccount account, DateTimeFormatter
fmt, LocalDate transactionDate,
             BigDecimal transactionAmount, PaymentDetail paymentDetail, boolean isRegularTransaction);
+    
+    SavingsAccountTransaction handleSavingDeposit(SavingsAccount account, DateTimeFormatter
fmt, LocalDate transactionDate,
+            BigDecimal transactionAmount, PaymentDetail paymentDetail, boolean isRegularTransaction);
 
     Long handleFDAccountClosure(FixedDepositAccount account, PaymentDetail paymentDetail,
AppUser user, JsonCommand command,
             LocalDate tenantsTodayDate, Map<String, Object> changes);

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainServiceJpa.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainServiceJpa.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainServiceJpa.java
index ac277fb..2b023c3 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainServiceJpa.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/DepositAccountDomainServiceJpa.java
@@ -163,6 +163,21 @@ public class DepositAccountDomainServiceJpa implements DepositAccountDomainServi
         }
         return deposit;
     }
+    
+    @Transactional
+    @Override
+    public SavingsAccountTransaction handleSavingDeposit(final SavingsAccount account, final
DateTimeFormatter fmt,
+            final LocalDate transactionDate, final BigDecimal transactionAmount, final PaymentDetail
paymentDetail,
+            final boolean isRegularTransaction) {
+        boolean isAccountTransfer = false;
+        final SavingsAccountTransaction deposit = this.savingsAccountDomainService.handleDeposit(account,
fmt, transactionDate,
+                transactionAmount, paymentDetail, isAccountTransfer, isRegularTransaction);
+        final Set<Long> existingTransactionIds = new HashSet<>();
+        final Set<Long> existingReversedTransactionIds = new HashSet<>();
+        updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
+        postJournalEntries(account, existingTransactionIds, existingReversedTransactionIds,
isAccountTransfer);
+        return deposit;
+    }
 
     private boolean isAnyActivationChargesDue(final RecurringDepositAccount account) {
         for (final SavingsAccountCharge savingsAccountCharge : account.charges()) {

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java
index 9b02027..8e276a9 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/RecurringDepositAccount.java
@@ -523,7 +523,7 @@ public class RecurringDepositAccount extends SavingsAccount {
         final Money minRequiredOpeningBalance = Money.of(this.currency, this.minRequiredOpeningBalance);
         if (minRequiredOpeningBalance.isGreaterThanZero()) {
             final SavingsAccountTransactionDTO transactionDTO = new SavingsAccountTransactionDTO(fmt,
getActivationLocalDate(),
-                    minRequiredOpeningBalance.getAmount(), null, new Date(), user);
+                    minRequiredOpeningBalance.getAmount(), null, new Date(), user, accountType);
             deposit(transactionDTO);
 
             // update existing transactions so derived balance fields are

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java
index dd72aea..32fdcd2 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java
@@ -95,8 +95,9 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
         final LocalDate postInterestOnDate = null;
         final Set<Long> existingReversedTransactionIds = new HashSet<>();
         updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
+        Integer accountType = null;
         final SavingsAccountTransactionDTO transactionDTO = new SavingsAccountTransactionDTO(fmt,
transactionDate, transactionAmount,
-                paymentDetail, new Date(), user);
+                paymentDetail, new Date(), user, accountType);
         final SavingsAccountTransaction withdrawal = account.withdraw(transactionDTO, transactionBooleanValues.isApplyWithdrawFee());
         final MathContext mc = MathContext.DECIMAL64;
         if (account.isBeforeLastPostingPeriod(transactionDate)) {
@@ -157,8 +158,9 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi
         final Set<Long> existingTransactionIds = new HashSet<>();
         final Set<Long> existingReversedTransactionIds = new HashSet<>();
         updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds);
+        Integer accountType = null;
         final SavingsAccountTransactionDTO transactionDTO = new SavingsAccountTransactionDTO(fmt,
transactionDate, transactionAmount,
-                paymentDetail, new Date(), user);
+                paymentDetail, new Date(), user, accountType);
         final SavingsAccountTransaction deposit = account.deposit(transactionDTO, savingsAccountTransactionType);
         final LocalDate postInterestOnDate = null;
         final MathContext mc = MathContext.DECIMAL64;

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java
index 6b0402e..8726bdd 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java
@@ -699,13 +699,14 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements
Depo
         account.undoTransaction(transactionId);
 
         SavingsAccountTransaction transaction = null;
+        Integer accountType = null;
         if (savingsAccountTransaction.isDeposit()) {
             final SavingsAccountTransactionDTO transactionDTO = new SavingsAccountTransactionDTO(fmt,
transactionDate, transactionAmount,
-                    paymentDetail, savingsAccountTransaction.createdDate(), user);
+                    paymentDetail, savingsAccountTransaction.createdDate(), user, accountType);
             transaction = account.deposit(transactionDTO);
         } else {
             final SavingsAccountTransactionDTO transactionDTO = new SavingsAccountTransactionDTO(fmt,
transactionDate, transactionAmount,
-                    paymentDetail, savingsAccountTransaction.createdDate(), user);
+                    paymentDetail, savingsAccountTransaction.createdDate(), user, accountType);
             transaction = account.withdraw(transactionDTO, true);
         }
         final Long newtransactionId = saveTransactionToGenerateTransactionId(transaction);
@@ -1353,22 +1354,37 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements
Depo
                 existingTransactionIds, existingReversedTransactionIds, isAccountTransfer);
         this.journalEntryWritePlatformService.createJournalEntriesForSavings(accountingBridgeData);
     }
-
+    
     @Transactional
     @Override
     public SavingsAccountTransaction mandatorySavingsAccountDeposit(final SavingsAccountTransactionDTO
accountTransactionDTO) {
         boolean isRegularTransaction = false;
-        final RecurringDepositAccount account = (RecurringDepositAccount) this.depositAccountAssembler.assembleFrom(
-                accountTransactionDTO.getSavingsAccountId(), DepositAccountType.RECURRING_DEPOSIT);
         final PaymentDetail paymentDetail = accountTransactionDTO.getPaymentDetail();
         if (paymentDetail != null && paymentDetail.getId() == null) {
             this.paymentDetailWritePlatformService.persistPaymentDetail(paymentDetail);
         }
-        return this.depositAccountDomainService.handleRDDeposit(account, accountTransactionDTO.getFormatter(),
+        if (accountTransactionDTO.getAccountType().equals(DepositAccountType.RECURRING_DEPOSIT.getValue()))
{
+            RecurringDepositAccount account = (RecurringDepositAccount) this.depositAccountAssembler.assembleFrom(
+                    accountTransactionDTO.getSavingsAccountId(), DepositAccountType.RECURRING_DEPOSIT);
+            return this.depositAccountDomainService.handleRDDeposit(account, accountTransactionDTO.getFormatter(),
+                    accountTransactionDTO.getTransactionDate(), accountTransactionDTO.getTransactionAmount(),
paymentDetail,
+                    isRegularTransaction);
+        }
+        SavingsAccount account = null;
+        if (accountTransactionDTO.getAccountType().equals(DepositAccountType.SAVINGS_DEPOSIT.getValue()))
{
+            account = this.depositAccountAssembler.assembleFrom(accountTransactionDTO.getSavingsAccountId(),
+                    DepositAccountType.SAVINGS_DEPOSIT);
+        } else {
+            account = this.depositAccountAssembler.assembleFrom(accountTransactionDTO.getSavingsAccountId(),
+                    DepositAccountType.CURRENT_DEPOSIT);
+        }       
+    	return this.depositAccountDomainService.handleSavingDeposit(account, accountTransactionDTO.getFormatter(),
                 accountTransactionDTO.getTransactionDate(), accountTransactionDTO.getTransactionAmount(),
paymentDetail,
                 isRegularTransaction);
+        
     }
 
+
     private AppUser getAppUserIfPresent() {
         AppUser user = null;
         if (this.context != null) {

http://git-wip-us.apache.org/repos/asf/fineract/blob/f537bae6/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
index 2064f57..afc46fd 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java
@@ -550,8 +550,9 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements
Savi
 
         SavingsAccountTransaction transaction = null;
         boolean isInterestTransfer = false;
+        Integer accountType = null;
         final SavingsAccountTransactionDTO transactionDTO = new SavingsAccountTransactionDTO(fmt,
transactionDate, transactionAmount,
-                paymentDetail, savingsAccountTransaction.createdDate(), user);
+                paymentDetail, savingsAccountTransaction.createdDate(), user, accountType);
         if (savingsAccountTransaction.isDeposit()) {
             transaction = account.deposit(transactionDTO);
         } else {


Mime
View raw message