http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountData.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountData.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountData.java
new file mode 100644
index 0000000..36d3e9b
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountData.java
@@ -0,0 +1,247 @@
+/**
+ * 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.shareaccounts.data;
+
+import java.math.BigDecimal;
+import java.util.Collection;
+import java.util.Date;
+
+import org.apache.fineract.accounting.glaccount.data.GLAccountData;
+import org.apache.fineract.infrastructure.core.data.EnumOptionData;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import 
org.apache.fineract.portfolio.accountdetails.data.ShareAccountSummaryData;
+import org.apache.fineract.portfolio.accounts.data.AccountData;
+import org.apache.fineract.portfolio.charge.data.ChargeData;
+import org.apache.fineract.portfolio.products.data.ProductData;
+import org.apache.fineract.portfolio.savings.data.SavingsAccountData;
+import org.apache.fineract.portfolio.shareproducts.data.ShareProductData;
+
+@SuppressWarnings("unused")
+public class ShareAccountData implements AccountData {
+
+    private Long id;
+
+    private String accountNo;
+
+    private String externalId;
+
+    private String savingsAccountNumber;
+
+    private Long clientId;
+
+    private String clientName;
+
+    private Long defaultShares ;
+    
+    private Long productId;
+
+    private String productName;
+
+    private ShareAccountStatusEnumData status;
+
+    ShareAccountApplicationTimelineData timeline;
+
+    private CurrencyData currency;
+
+    private ShareAccountSummaryData summary;
+
+    private Collection<PurchasedSharesData> purchasedShares;
+
+    private Long savingsAccountId;
+
+    private BigDecimal currentMarketPrice;
+
+    private Integer lockinPeriod;
+
+    private EnumOptionData lockPeriodTypeEnum;
+
+    private Integer minimumActivePeriod;
+
+    private EnumOptionData minimumActivePeriodTypeEnum;
+
+    private Boolean allowDividendCalculationForInactiveClients;
+
+    private Collection<ShareAccountChargeData> charges;
+
+    private Collection<ShareAccountDividendData> dividends ;
+    
+    // Data for template
+    private Collection<ProductData> productOptions;
+    private Collection<ChargeData> chargeOptions;
+    private Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions;
+    private Collection<EnumOptionData> minimumActivePeriodFrequencyTypeOptions;
+    private Collection<SavingsAccountData> clientSavingsAccounts;
+
+    public ShareAccountData(final Long id, final String accountNo, final 
String externalId, final Long savingsAccountId,
+            final String savingsAccountNumber, final Long clientId, final 
String clientName, final Long productId,
+            final String productName, final ShareAccountStatusEnumData status, 
final ShareAccountApplicationTimelineData timeline,
+            final CurrencyData currency, final ShareAccountSummaryData 
summaryData, final Collection<ShareAccountChargeData> charges,
+            final Collection<PurchasedSharesData> purchasedSharesData, final 
Integer lockinPeriod, final EnumOptionData lockPeriodTypeEnum,
+            final Integer minimumActivePeriod, final EnumOptionData 
minimumActivePeriodTypeEnum, Boolean allowdividendsforinactiveclients) {
+        this.id = id;
+        this.accountNo = accountNo;
+        this.externalId = externalId;
+        this.savingsAccountId = savingsAccountId;
+        this.savingsAccountNumber = savingsAccountNumber;
+        this.clientId = clientId;
+        this.clientName = clientName;
+        this.productId = productId;
+        this.productName = productName;
+        this.status = status;
+        this.timeline = timeline;
+        this.currency = currency;
+        this.summary = summaryData;
+        this.charges = charges;
+        this.purchasedShares = purchasedSharesData;
+        this.lockinPeriod = lockinPeriod;
+        this.lockPeriodTypeEnum = lockPeriodTypeEnum;
+        this.minimumActivePeriod = minimumActivePeriod;
+        this.minimumActivePeriodTypeEnum = minimumActivePeriodTypeEnum;
+        this.allowDividendCalculationForInactiveClients = 
allowdividendsforinactiveclients;
+    }
+
+    public ShareAccountData(final Long clientId, final String clientName, 
final Collection<ProductData> productOptions,
+            final Collection<ChargeData> chargeOptions) {
+        this.clientId = clientId;
+        this.clientName = clientName;
+        this.productOptions = productOptions;
+        this.chargeOptions = chargeOptions;
+    }
+
+    public ShareAccountData(final Long clientId, final String clientName, 
final CurrencyData currency,
+            final Collection<ShareAccountChargeData> charges, final BigDecimal 
currentMarketPrice,
+            final Collection<EnumOptionData> 
minimumActivePeriodFrequencyTypeOptions,
+            final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, 
final Collection<SavingsAccountData> clientSavingsAccounts,
+            final Long defaultShares) {
+        this.clientId = clientId;
+        this.clientName = clientName;
+        this.charges = charges;
+        this.currency = currency;
+        this.currentMarketPrice = currentMarketPrice;
+        // template
+        this.minimumActivePeriodFrequencyTypeOptions = 
minimumActivePeriodFrequencyTypeOptions;
+        this.lockinPeriodFrequencyTypeOptions = 
lockinPeriodFrequencyTypeOptions;
+        this.clientSavingsAccounts = clientSavingsAccounts;
+        this.defaultShares = defaultShares ;
+    }
+
+    private ShareAccountData(final Long id, final String accountNo, final 
String externalId, final Long savingsAccountId,
+            final String savingsAccountNumber, final Long clientId, final 
String clientName, final Long productId,
+            final String productName, final ShareAccountStatusEnumData status, 
final ShareAccountApplicationTimelineData timeline,
+            final CurrencyData currency, final ShareAccountSummaryData 
summaryData, final Collection<ShareAccountChargeData> charges,
+            final Collection<PurchasedSharesData> purchasedSharesData, final 
Integer lockinPeriod, final EnumOptionData lockPeriodTypeEnum,
+            final Integer minimumActivePeriod, final EnumOptionData 
minimumActivePeriodTypeEnum,
+            final Boolean allowDividendCalculationForInactiveClients, final 
Collection<ProductData> productOptions,
+            final Collection<ChargeData> chargeOptions, final 
Collection<SavingsAccountData> clientSavingsAccounts,
+            final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions,
+            final Collection<EnumOptionData> 
minimumActivePeriodFrequencyTypeOption, final BigDecimal currenMarketPrice) {
+        this.id = id;
+        this.accountNo = accountNo;
+        this.externalId = externalId;
+        this.savingsAccountId = savingsAccountId;
+        this.savingsAccountNumber = savingsAccountNumber;
+        this.clientId = clientId;
+        this.clientName = clientName;
+        this.productId = productId;
+        this.productName = productName;
+        this.status = status;
+        this.timeline = timeline;
+        this.currency = currency;
+        this.summary = summaryData;
+        this.charges = charges;
+        this.purchasedShares = purchasedSharesData;
+        this.lockinPeriod = lockinPeriod;
+        this.lockPeriodTypeEnum = lockPeriodTypeEnum;
+        this.minimumActivePeriod = minimumActivePeriod;
+        this.minimumActivePeriodTypeEnum = minimumActivePeriodTypeEnum;
+        this.allowDividendCalculationForInactiveClients = 
allowDividendCalculationForInactiveClients;
+        this.productOptions = productOptions;
+        this.chargeOptions = chargeOptions;
+        this.clientSavingsAccounts = clientSavingsAccounts;
+        this.lockinPeriodFrequencyTypeOptions = 
lockinPeriodFrequencyTypeOptions;
+        this.minimumActivePeriodFrequencyTypeOptions = 
minimumActivePeriodFrequencyTypeOption;
+        this.currentMarketPrice = currenMarketPrice;
+    }
+
+    public Long getProductId() {
+        return this.productId;
+    }
+
+    public Long getClientId() {
+        return this.clientId;
+    }
+
+    public static ShareAccountData template(ShareAccountData data, 
Collection<ProductData> productOptions,
+            Collection<ChargeData> chargeOptions, 
Collection<SavingsAccountData> clientSavingsAccounts,
+            Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions, 
Collection<EnumOptionData> minimumActivePeriodFrequencyTypeOptions) {
+        return new ShareAccountData(data.id, data.accountNo, data.externalId, 
data.savingsAccountId, data.savingsAccountNumber,
+                data.clientId, data.clientName, data.productId, 
data.productName, data.status, data.timeline, data.currency, data.summary,
+                data.charges, data.purchasedShares, data.lockinPeriod, 
data.lockPeriodTypeEnum, data.minimumActivePeriod,
+                data.minimumActivePeriodTypeEnum, 
data.allowDividendCalculationForInactiveClients, productOptions, chargeOptions,
+                clientSavingsAccounts, lockinPeriodFrequencyTypeOptions, 
minimumActivePeriodFrequencyTypeOptions, data.currentMarketPrice);
+    }
+
+    public static ShareAccountData lookup(final Long id, final String 
accountNo, final Long clientId, final String clientName) {
+        String externalId = null;
+        ShareAccountSummaryData summaryData = null;
+        Collection<PurchasedSharesData> purchasedSharesData = null;
+        GLAccountData suspenseAccount = null;
+        Integer lockinPeriod = null;
+        EnumOptionData lockPeriodTypeEnum = null;
+        Integer minimumActivePeriod = null;
+        EnumOptionData minimumActivePeriodTypeEnum = null;
+        Collection<ShareAccountChargeData> charges = null;
+        ShareAccountStatusEnumData status = null;
+        ShareAccountApplicationTimelineData timeline = null;
+        CurrencyData currency = null;
+        Boolean allowDividendCalculationForInactiveClients = null;
+        final Long savingsAccountId = null;
+        final String savingsAccountNumber = null;
+        final String productName = null;
+        final Collection<ChargeData> chargeOptions = null;
+        final Collection<SavingsAccountData> clientSavingsAccounts = null;
+        final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions = 
null;
+        final Collection<EnumOptionData> 
minimumActivePeriodFrequencyTypeOption = null;
+        final BigDecimal currenMarketPrice = null;
+        final Long productId = null;
+        final Collection<ProductData> productOptions = null;
+
+        return new ShareAccountData(id, accountNo, externalId, 
savingsAccountId, savingsAccountNumber, clientId, clientName, productId,
+                productName, status, timeline, currency, summaryData, charges, 
purchasedSharesData, lockinPeriod, lockPeriodTypeEnum,
+                minimumActivePeriod, minimumActivePeriodTypeEnum, 
allowDividendCalculationForInactiveClients, productOptions,
+                chargeOptions, clientSavingsAccounts, 
lockinPeriodFrequencyTypeOptions, minimumActivePeriodFrequencyTypeOption,
+                currenMarketPrice);
+    }
+
+    public Long getId() {
+        return this.id;
+    }
+
+    public Collection<PurchasedSharesData> getPurchasedShares() {
+        return this.purchasedShares;
+    }
+
+    public void setCurrentMarketPrice(final BigDecimal currentMarketPrice) {
+        this.currentMarketPrice = currentMarketPrice;
+    }
+    
+    public void setDividends(Collection<ShareAccountDividendData> dividends) {
+        this.dividends = dividends ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountDividendData.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountDividendData.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountDividendData.java
new file mode 100644
index 0000000..ad195f4
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountDividendData.java
@@ -0,0 +1,64 @@
+/**
+ * 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.shareaccounts.data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+import org.apache.fineract.infrastructure.core.data.EnumOptionData;
+
+@SuppressWarnings("unused")
+public class ShareAccountDividendData {
+
+    private final Long id;
+    private final Date postedDate ;
+    private final ShareAccountData accountData;
+    private final BigDecimal amount;
+    private final EnumOptionData status;
+    private final Long savingsTransactionId;
+
+    public ShareAccountDividendData(final Long id, final ShareAccountData 
accountData, final BigDecimal amount) {
+        this.id = id;
+        this.accountData = accountData;
+        this.amount = amount;
+        this.status = null;
+        this.savingsTransactionId = null;
+        this.postedDate = null ;
+    }
+
+    public ShareAccountDividendData(final Long id, final ShareAccountData 
accountData, final BigDecimal amount,
+            final EnumOptionData status, final Long savingsTransactionId) {
+        this.id = id;
+        this.accountData = accountData;
+        this.amount = amount;
+        this.status = status;
+        this.savingsTransactionId = savingsTransactionId;
+        this.postedDate = null ;
+    }
+    
+    public ShareAccountDividendData(final Long id, final Date postedDate, 
final ShareAccountData accountData, final BigDecimal amount,
+            final EnumOptionData status, final Long savingsTransactionId) {
+        this.id = id;
+        this.accountData = accountData;
+        this.amount = amount;
+        this.status = status;
+        this.savingsTransactionId = savingsTransactionId;
+        this.postedDate = postedDate ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountStatusEnumData.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountStatusEnumData.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountStatusEnumData.java
new file mode 100644
index 0000000..c1dffc9
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountStatusEnumData.java
@@ -0,0 +1,52 @@
+/**
+ * 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.shareaccounts.data;
+
+/**
+ * Immutable data object represent savings account status enumerations.
+ */
+@SuppressWarnings("unused")
+public class ShareAccountStatusEnumData {
+
+    private final Long id;
+   
+    private final String code;
+    private final String value;
+    private final boolean submittedAndPendingApproval;
+    private final boolean approved;
+    private final boolean rejected;
+    private final boolean active;
+    private final boolean closed;
+
+    public ShareAccountStatusEnumData(final Long id, final String code, final 
String value, final boolean submittedAndPendingApproval,
+            final boolean approved, final boolean rejected, final boolean 
active, final boolean closed) {
+        this.id = id;
+        this.code = code;
+        this.value = value;
+        this.submittedAndPendingApproval = submittedAndPendingApproval;
+        this.approved = approved;
+        this.rejected = rejected;
+        this.active = active;
+        this.closed = closed;
+    }
+
+    public Long id() {
+        return this.id;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountTransactionEnumData.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountTransactionEnumData.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountTransactionEnumData.java
new file mode 100644
index 0000000..cfc7748
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/data/ShareAccountTransactionEnumData.java
@@ -0,0 +1,83 @@
+/**
+ * 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.shareaccounts.data;
+
+public class ShareAccountTransactionEnumData {
+
+    private final Long id;
+    private final String code;
+    private final String value;
+
+    private final boolean isApplied;
+    private final boolean isApproved;
+    private final boolean isRejected;
+    private final boolean isPurchased;
+    private final boolean isRedeemed;
+    private final boolean isChargePayment;
+
+    public ShareAccountTransactionEnumData(final Long id, final String code, 
final String value) {
+        this.id = id;
+        this.code = code;
+        this.value = value;
+        this.isApplied = Long.valueOf(100).equals(this.id);
+        this.isApproved = Long.valueOf(300).equals(this.id);
+        this.isRejected = Long.valueOf(400).equals(this.id);
+        this.isPurchased = Long.valueOf(500).equals(this.id);
+        this.isRedeemed = Long.valueOf(600).equals(this.id);
+        this.isChargePayment = Long.valueOf(700).equals(this.id);
+    }
+
+    public Long getId() {
+        return this.id;
+    }
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public String getValue() {
+        return this.value;
+    }
+
+    public boolean isApplied() {
+        return this.isApplied;
+    }
+
+    public boolean isApproved() {
+        return this.isApproved;
+    }
+
+    public boolean isRejected() {
+        return this.isRejected;
+    }
+
+    public boolean isPurchased() {
+        return this.isPurchased;
+    }
+
+    public boolean isRedeemed() {
+        return this.isRedeemed;
+    }
+
+    
+    public boolean isChargePayment() {
+        return this.isChargePayment;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/PurchasedSharesStatusType.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/PurchasedSharesStatusType.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/PurchasedSharesStatusType.java
new file mode 100644
index 0000000..949218a
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/PurchasedSharesStatusType.java
@@ -0,0 +1,80 @@
+/**
+ * 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.shareaccounts.domain;
+
+public enum PurchasedSharesStatusType {
+    INVALID(0, "purchasedSharesStatusType.invalid"), APPLIED(100, 
"purchasedSharesStatusType.applied"), APPROVED(300,
+            "purchasedSharesStatusType.approved"), REJECTED(400, 
"purchasedSharesStatusType.rejected"), PURCHASED(500,
+            "purchasedSharesType.purchased"), REDEEMED(600, 
"purchasedSharesType.redeemed"),
+            CHARGE_PAYMENT(700, "charge.payment");
+
+    private final Integer value;
+    private final String code;
+
+    private PurchasedSharesStatusType(final Integer value, final String code) {
+        this.value = value;
+        this.code = code;
+    }
+
+    public static PurchasedSharesStatusType fromInt(final Integer type) {
+
+        PurchasedSharesStatusType enumeration = 
PurchasedSharesStatusType.INVALID;
+        switch (type) {
+            case 100:
+                enumeration = PurchasedSharesStatusType.APPLIED;
+            break;
+            case 300:
+                enumeration = PurchasedSharesStatusType.APPROVED;
+            break;
+            case 400:
+                enumeration = PurchasedSharesStatusType.REJECTED;
+            break;
+            case 500:
+                enumeration = PurchasedSharesStatusType.PURCHASED;
+            break;
+            case 600:
+                enumeration = PurchasedSharesStatusType.REDEEMED;
+            break;
+            case 700:
+                enumeration = PurchasedSharesStatusType.CHARGE_PAYMENT;
+                break ;
+        }
+        return enumeration;
+    }
+
+    public Integer getValue() {
+        return this.value;
+    }
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public boolean isApproved() {
+        return 
this.value.equals(PurchasedSharesStatusType.APPROVED.getValue());
+    }
+
+    public boolean isPurchased() {
+        return 
this.value.equals(PurchasedSharesStatusType.PURCHASED.getValue());
+    }
+    
+    public boolean isChargePayment() {
+        return 
this.value.equals(PurchasedSharesStatusType.CHARGE_PAYMENT.getValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccount.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccount.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccount.java
new file mode 100644
index 0000000..36facf6
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccount.java
@@ -0,0 +1,526 @@
+/**
+ * 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.shareaccounts.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Embedded;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+
+import org.apache.commons.lang.StringUtils;
+import 
org.apache.fineract.infrastructure.security.service.RandomPasswordGenerator;
+import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
+import org.apache.fineract.portfolio.client.domain.Client;
+import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
+import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
+import org.apache.fineract.portfolio.shareproducts.domain.ShareProduct;
+import org.apache.fineract.useradministration.domain.AppUser;
+import org.hibernate.annotations.LazyCollection;
+import org.hibernate.annotations.LazyCollectionOption;
+import org.springframework.data.jpa.domain.AbstractPersistable;
+
+@Entity
+@Table(name = "m_share_account")
+public class ShareAccount extends AbstractPersistable<Long> {
+
+    @ManyToOne
+    @JoinColumn(name = "client_id", nullable = true)
+    private Client client;
+
+    @ManyToOne
+    @JoinColumn(name = "product_id", nullable = true)
+    private ShareProduct shareProduct;
+
+    @Column(name = "status_enum", nullable = false)
+    protected Integer status;
+
+    @Column(name = "submitted_date")
+    @Temporal(TemporalType.DATE)
+    private Date submittedDate;
+
+    @ManyToOne(optional = true)
+    @JoinColumn(name = "submitted_userid", nullable = true)
+    protected AppUser submittedBy;
+
+    @Temporal(TemporalType.DATE)
+    @Column(name = "approved_date")
+    protected Date approvedDate;
+
+    @ManyToOne(optional = true)
+    @JoinColumn(name = "approved_userid", nullable = true)
+    protected AppUser approvedBy;
+
+    @Temporal(TemporalType.DATE)
+    @Column(name = "rejected_date")
+    protected Date rejectedDate;
+
+    @ManyToOne(optional = true)
+    @JoinColumn(name = "rejected_userid", nullable = true)
+    protected AppUser rejectedBy;
+
+    @Temporal(TemporalType.DATE)
+    @Column(name = "activated_date", nullable = true)
+    protected Date activatedDate;
+
+    @ManyToOne(optional = true)
+    @JoinColumn(name = "activated_userid", nullable = true)
+    protected AppUser activatedBy;
+
+    @Temporal(TemporalType.DATE)
+    @Column(name = "closed_date")
+    protected Date closedDate;
+
+    @ManyToOne(optional = true)
+    @JoinColumn(name = "closed_userid", nullable = true)
+    protected AppUser closedBy;
+
+    @Temporal(TemporalType.DATE)
+    @Column(name = "lastmodified_date")
+    protected Date modifiedDate;
+
+    @ManyToOne(optional = true)
+    @JoinColumn(name = "lastmodifiedby_id", nullable = true)
+    protected AppUser modifiedBy;
+
+    @Column(name = "external_id")
+    private String externalId;
+
+    @Column(name = "account_no", length = 20, unique = true, nullable = false)
+    private String accountNumber;
+
+    @Column(name = "total_approved_shares")
+    private Long totalSharesApproved;
+
+    @Column(name = "total_pending_shares")
+    private Long totalSharesPending;
+
+    @Embedded
+    private MonetaryCurrency currency;
+
+    @Column(name = "allow_dividends_inactive_clients")
+    private Boolean allowDividendCalculationForInactiveClients;
+
+    @ManyToOne
+    @JoinColumn(name = "savings_account_id", nullable = true)
+    private SavingsAccount savingsAccount;
+
+    @LazyCollection(LazyCollectionOption.FALSE)
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "shareAccount", 
orphanRemoval = true)
+    private Set<ShareAccountTransaction> shareAccountTransactions;
+
+    @Column(name = "lockin_period_frequency")
+    private Integer lockinPeriodFrequency;
+
+    @Enumerated(EnumType.ORDINAL)
+    @Column(name = "lockin_period_frequency_enum", nullable = true)
+    private PeriodFrequencyType lockinPeriodFrequencyType;
+
+    @Column(name = "minimum_active_period_frequency")
+    private Integer minimumActivePeriodFrequency;
+
+    @Enumerated(EnumType.ORDINAL)
+    @Column(name = "minimum_active_period_frequency_enum", nullable = true)
+    private PeriodFrequencyType minimumActivePeriodFrequencyType;
+
+    @LazyCollection(LazyCollectionOption.FALSE)
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "shareAccount", 
orphanRemoval = true)
+    private Set<ShareAccountCharge> charges;
+
+    @Transient
+    protected boolean accountNumberRequiresAutoGeneration = false;
+
+    protected ShareAccount() {
+
+    }
+
+    public ShareAccount(final Client client, final ShareProduct shareProduct, 
final String externalId, final MonetaryCurrency currency,
+            final SavingsAccount savingsAccount, final String accountNo, final 
Long totalSharesApproved, final Long totalSharesPending,
+            final Set<ShareAccountTransaction> purchasedShares, final Boolean 
allowDividendCalculationForInactiveClients,
+            final Integer lockinPeriodFrequency, final PeriodFrequencyType 
lockPeriodType, final Integer minimumActivePeriodFrequency,
+            final PeriodFrequencyType minimumActivePeriodType, 
Set<ShareAccountCharge> charges, AppUser submittedBy,
+            final Date submittedDate, AppUser approvedBy, Date approvedDate, 
AppUser rejectedBy, Date rejectedDate, AppUser activatedBy,
+            Date activatedDate, AppUser closedBy, Date closedDate, AppUser 
modifiedBy, Date modifiedDate) {
+
+        this.client = client;
+        this.shareProduct = shareProduct;
+        this.externalId = externalId;
+        this.currency = currency;
+        this.savingsAccount = savingsAccount;
+        if (StringUtils.isBlank(accountNo)) {
+            this.accountNumber = new RandomPasswordGenerator(19).generate();
+            this.accountNumberRequiresAutoGeneration = true;
+        } else {
+            this.accountNumber = accountNo;
+        }
+        this.totalSharesApproved = totalSharesApproved;
+        this.totalSharesPending = totalSharesPending;
+        this.shareAccountTransactions = purchasedShares;
+        this.allowDividendCalculationForInactiveClients = 
allowDividendCalculationForInactiveClients;
+        this.lockinPeriodFrequency = lockinPeriodFrequency;
+        this.lockinPeriodFrequencyType = lockPeriodType;
+        this.minimumActivePeriodFrequency = minimumActivePeriodFrequency;
+        this.minimumActivePeriodFrequencyType = minimumActivePeriodType;
+        this.charges = charges;
+        this.submittedDate = submittedDate;
+        this.submittedBy = submittedBy;
+        this.approvedDate = approvedDate;
+        this.approvedBy = approvedBy;
+        this.rejectedDate = rejectedDate;
+        this.rejectedBy = rejectedBy;
+        this.activatedDate = activatedDate;
+        this.activatedBy = activatedBy;
+        this.closedDate = closedDate;
+        this.closedBy = closedBy;
+        this.modifiedBy = modifiedBy;
+        this.modifiedDate = modifiedDate;
+        this.status = 
ShareAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL.getValue();
+    }
+
+    public boolean setShareProduct(final ShareProduct shareProduct) {
+        boolean toReturn = false;
+        if (!this.shareProduct.getId().equals(shareProduct.getId())) {
+            this.shareProduct = shareProduct;
+            toReturn = true;
+        }
+        return toReturn;
+    }
+
+    public ShareProduct getShareProduct() {
+        return this.shareProduct;
+    }
+
+    public boolean setSubmittedDate(final Date submittedDate) {
+        boolean toReturn = false;
+        if (!this.submittedDate.equals(submittedDate)) {
+            this.submittedDate = submittedDate;
+            toReturn = true;
+        }
+        return toReturn;
+    }
+
+    public boolean setApprovedDate(final Date approvedDate) {
+        boolean toReturn = false;
+        if (!this.approvedDate.equals(approvedDate)) {
+            this.approvedDate = approvedDate;
+            toReturn = true;
+        }
+        return toReturn;
+    }
+
+    public boolean setExternalId(final String externalId) {
+        boolean toReturn = false;
+        if (!this.externalId.equals(externalId)) {
+            this.externalId = externalId;
+            toReturn = true;
+        }
+        return toReturn;
+    }
+
+    public boolean setSavingsAccount(final SavingsAccount savingsAccount) {
+        boolean returnValue = false;
+        if (!this.savingsAccount.getId().equals(savingsAccount.getId())) {
+            this.savingsAccount = savingsAccount;
+            returnValue = true;
+        }
+        return returnValue;
+    }
+
+    public boolean setPurchasedShares(Set<ShareAccountTransaction> 
purchasedShares) {
+        this.shareAccountTransactions = purchasedShares;
+        return true;
+    }
+
+    public boolean setAllowDividendCalculationForInactiveClients(Boolean 
allowDividendCalculationForInactiveClients) {
+        boolean returnValue = false;
+        if (this.allowDividendCalculationForInactiveClients == null) {
+            this.allowDividendCalculationForInactiveClients = 
allowDividendCalculationForInactiveClients;
+            returnValue = true;
+        } else if 
(!this.allowDividendCalculationForInactiveClients.equals(allowDividendCalculationForInactiveClients))
 {
+            this.allowDividendCalculationForInactiveClients = 
allowDividendCalculationForInactiveClients;
+            returnValue = true;
+        }
+        return returnValue;
+    }
+
+    public boolean setLockPeriod(final Integer lockinPeriod) {
+        boolean returnValue = false;
+        if (this.lockinPeriodFrequency == null || 
!this.lockinPeriodFrequency.equals(lockinPeriod)) {
+            this.lockinPeriodFrequency = lockinPeriod;
+            returnValue = true;
+        }
+        return returnValue;
+    }
+
+    public boolean setLockPeriodFrequencyEnum(final PeriodFrequencyType 
lockinPeriodFrequencyType) {
+        boolean returnValue = false;
+        if 
(!this.lockinPeriodFrequencyType.getValue().equals(lockinPeriodFrequencyType.getValue()))
 {
+            this.lockinPeriodFrequencyType = lockinPeriodFrequencyType;
+            returnValue = true;
+        }
+        return returnValue;
+    }
+
+    public boolean setminimumActivePeriod(final Integer 
minimumActivePeriodFrequency) {
+        boolean returnValue = false;
+        if (this.minimumActivePeriodFrequency == null || 
!this.minimumActivePeriodFrequency.equals(minimumActivePeriodFrequency)) {
+            this.minimumActivePeriodFrequency = minimumActivePeriodFrequency;
+            returnValue = true;
+        }
+        return returnValue;
+    }
+
+    public boolean setminimumActivePeriodTypeEnum(final PeriodFrequencyType 
minimumActivePeriodForDividends) {
+        boolean returnValue = false;
+        if 
(!this.minimumActivePeriodFrequencyType.getValue().equals(minimumActivePeriodForDividends.getValue()))
 {
+            this.minimumActivePeriodFrequencyType = 
minimumActivePeriodForDividends;
+            returnValue = true;
+        }
+        return returnValue;
+    }
+
+    public boolean setCharges(final Set<ShareAccountCharge> charges) {
+        this.charges = charges;
+        return true;
+    }
+
+    public void updateAccountNumber(String accountNo) {
+        this.accountNumber = accountNo;
+        this.accountNumberRequiresAutoGeneration = false;
+    }
+
+    public boolean isAccountNumberRequiresAutoGeneration() {
+        return this.accountNumberRequiresAutoGeneration;
+    }
+
+    public Long getClientId() {
+        return this.client.getId();
+    }
+
+    public String getClientName() {
+        return this.client.getDisplayName();
+    }
+
+    public String getSavingsAccountNo() {
+        return this.savingsAccount.getAccountNumber();
+    }
+
+    public void addAddtionalShares(Set<ShareAccountTransaction> 
additionalShares) {
+        this.shareAccountTransactions.addAll(additionalShares);
+    }
+
+    public Set<ShareAccountTransaction> getShareAccountTransactions() {
+        return this.shareAccountTransactions;
+    }
+
+    public Set<ShareAccountTransaction> getChargeTransactions() {
+        Set<ShareAccountTransaction> chargeTransactions = new HashSet<>();
+        for (ShareAccountTransaction transaction : 
this.shareAccountTransactions) {
+            if (transaction.isChargeTransaction()) {
+                chargeTransactions.add(transaction);
+            }
+        }
+        return chargeTransactions;
+    }
+
+    public void updateRequestedShares(ShareAccountTransaction purchased) {
+        if (!this.shareAccountTransactions.isEmpty()) {
+            Iterator<ShareAccountTransaction> iter = 
this.shareAccountTransactions.iterator();
+            ShareAccountTransaction existing = iter.next();
+            existing.update(purchased.getPurchasedDate(), 
purchased.getTotalShares(), purchased.getPurchasePrice());
+        }
+    }
+
+    public void addAdditionalPurchasedShares(ShareAccountTransaction 
purchased) {
+        purchased.setShareAccount(this);
+        if (purchased.isRedeemTransaction()) {
+            this.totalSharesApproved -= purchased.getTotalShares();
+        } else {
+            if (this.totalSharesPending == null) {
+                this.totalSharesPending = purchased.getTotalShares();
+            } else {
+                this.totalSharesPending += purchased.getTotalShares();
+            }
+        }
+        this.shareAccountTransactions.add(purchased);
+    }
+
+    public void addShareAccountCharge(ShareAccountCharge charge) {
+        charge.update(this);
+        this.charges.add(charge);
+    }
+
+    public ShareAccountCharge updateShareCharge(final Long id, final Long 
chargeId, final BigDecimal amount) {
+        ShareAccountCharge updatedCharge = null;
+        for (ShareAccountCharge charge : this.charges) {
+            if (charge.getId() == id && charge.getChargeId() == chargeId) {
+                updatedCharge = charge;
+                charge.update(amount);
+                break;
+            }
+        }
+        return updatedCharge;
+    }
+
+    public void approve(final Date approvedDate, final AppUser approvedUser) {
+        this.approvedDate = approvedDate;
+        this.approvedBy = approvedUser;
+        for (ShareAccountTransaction transaction : 
this.shareAccountTransactions) {
+            transaction.approve();
+        }
+        this.status = ShareAccountStatusType.APPROVED.getValue();
+        this.totalSharesApproved = this.totalSharesPending;
+        this.totalSharesPending = null;
+    }
+
+    public void activate(final Date approvedDate, final AppUser approvedUser) {
+        this.activatedDate = approvedDate;
+        this.activatedBy = approvedUser;
+        this.status = ShareAccountStatusType.ACTIVE.getValue();
+    }
+
+    public void undoApprove() {
+        this.status = 
ShareAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL.getValue();
+        this.approvedDate = null;
+        this.approvedBy = null;
+        this.rejectedDate = null;
+        this.rejectedBy = null;
+        this.closedDate = null;
+        this.closedBy = null;
+        this.totalSharesApproved = null;
+        Iterator<ShareAccountTransaction> iter = 
this.shareAccountTransactions.iterator();
+        ShareAccountTransaction share = iter.next();
+        share.undoApprove();
+        this.totalSharesPending = share.getTotalShares();
+    }
+
+    public void reject(final Date rejectedDate, final AppUser rejectedUser) {
+        this.rejectedDate = rejectedDate;
+        this.rejectedBy = rejectedUser;
+        this.status = ShareAccountStatusType.REJECTED.getValue();
+        this.totalSharesPending = null;
+        this.totalSharesApproved = null;
+        Iterator<ShareAccountTransaction> iter = 
this.shareAccountTransactions.iterator();
+        ShareAccountTransaction share = iter.next();
+        share.reject();
+    }
+
+    public void close(final Date closedDate, final AppUser closedBy) {
+        this.closedDate = closedDate ;
+        this.closedBy = closedBy ;
+        this.status = ShareAccountStatusType.CLOSED.getValue() ;
+        this.totalSharesPending = null;
+        this.totalSharesApproved = null;
+    }
+    public String getAccountNumber() {
+        return this.accountNumber;
+    }
+
+    public ShareAccountTransaction retrievePurchasedShares(final Long id) {
+        ShareAccountTransaction toReturn = null;
+        for (ShareAccountTransaction share : this.shareAccountTransactions) {
+            if (share.getId().equals(id)) {
+                toReturn = share;
+                break;
+            }
+        }
+        return toReturn;
+    }
+
+    public Set<ShareAccountCharge> getCharges() {
+        return this.charges;
+    }
+
+    public void addChargeTransaction(ShareAccountTransaction 
chargeTransaction) {
+        chargeTransaction.setShareAccount(this);
+        this.shareAccountTransactions.add(chargeTransaction);
+    }
+
+    public Set<ShareAccountTransaction> 
getPendingForApprovalSharePurchaseTransactions() {
+        Set<ShareAccountTransaction> purchaseTransactions = new HashSet<>();
+        for (ShareAccountTransaction transaction : 
this.shareAccountTransactions) {
+            if (transaction.isPendingForApprovalTransaction()) {
+                purchaseTransactions.add(transaction);
+            }
+        }
+        return purchaseTransactions;
+    }
+
+    public MonetaryCurrency getCurrency() {
+        return this.currency;
+    }
+
+    public void updateApprovedShares(Long shares) {
+        if (this.totalSharesApproved == null) {
+            this.totalSharesApproved = shares;
+        } else {
+            this.totalSharesApproved += shares;
+            this.totalSharesPending -= shares;
+        }
+    }
+
+    public Long getTotalApprovedShares() {
+        return this.totalSharesApproved ;
+    }
+    
+    public void removePendingShares(Long totalShares) {
+        this.totalSharesPending -= totalShares;
+    }
+
+    public Long getOfficeId() {
+        return this.client.getOffice().getId();
+    }
+
+    public ShareAccountTransaction getShareAccountTransaction(final 
ShareAccountTransaction transaction) {
+        ShareAccountTransaction returnTrans = null;
+        for (ShareAccountTransaction tran : this.shareAccountTransactions) {
+            if (tran.getPurchasedDate().equals(transaction.getPurchasedDate())
+                    && 
tran.getTotalShares().equals(transaction.getTotalShares())
+                    && 
tran.getPurchasePrice().equals(transaction.getPurchasePrice())
+                    && 
tran.getTransactionStatus().equals(transaction.getTransactionStatus())
+                    && 
tran.getTransactionType().equals(transaction.getTransactionType())) {
+                returnTrans = tran;
+                break;
+            }
+        }
+        return returnTrans;
+    }
+    
+    public Date getSubmittedDate(){
+        return this.submittedDate ;
+    }
+    
+    public Date getApprovedDate() {
+        return this.approvedDate ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountCharge.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountCharge.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountCharge.java
new file mode 100644
index 0000000..a415c36
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountCharge.java
@@ -0,0 +1,444 @@
+/**
+ * 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.shareaccounts.domain;
+
+import java.math.BigDecimal;
+import java.math.MathContext;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
+import org.apache.fineract.organisation.monetary.domain.Money;
+import org.apache.fineract.organisation.monetary.domain.MoneyHelper;
+import org.apache.fineract.portfolio.charge.domain.Charge;
+import org.apache.fineract.portfolio.charge.domain.ChargeCalculationType;
+import org.apache.fineract.portfolio.charge.domain.ChargeTimeType;
+import org.springframework.data.jpa.domain.AbstractPersistable;
+
+@Entity
+@Table(name = "m_share_account_charge")
+public class ShareAccountCharge extends AbstractPersistable<Long> {
+
+    @ManyToOne(optional = false)
+    @JoinColumn(name = "account_id", referencedColumnName = "id", nullable = 
false)
+    private ShareAccount shareAccount;
+
+    @ManyToOne(optional = false)
+    @JoinColumn(name = "charge_id", referencedColumnName = "id", nullable = 
false)
+    private Charge charge;
+
+    @Column(name = "charge_time_enum", nullable = false)
+    private Integer chargeTime;
+
+    @Column(name = "charge_calculation_enum")
+    private Integer chargeCalculation;
+
+    @Column(name = "calculation_percentage", scale = 6, precision = 19, 
nullable = true)
+    private BigDecimal percentage;
+
+    @Column(name = "calculation_on_amount", scale = 6, precision = 19, 
nullable = true)
+    private BigDecimal amountPercentageAppliedTo;
+
+    @Column(name = "amount", scale = 6, precision = 19, nullable = false)
+    private BigDecimal amount;
+
+    @Column(name = "amount_paid_derived", scale = 6, precision = 19, nullable 
= true)
+    private BigDecimal amountPaid;
+
+    @Column(name = "amount_waived_derived", scale = 6, precision = 19, 
nullable = true)
+    private BigDecimal amountWaived;
+
+    @Column(name = "amount_writtenoff_derived", scale = 6, precision = 19, 
nullable = true)
+    private BigDecimal amountWrittenOff;
+
+    @Column(name = "amount_outstanding_derived", scale = 6, precision = 19, 
nullable = false)
+    private BigDecimal amountOutstanding;
+
+    @Column(name = "is_paid_derived", nullable = false)
+    private boolean paid = false;
+
+    @Column(name = "waived", nullable = false)
+    private boolean waived = false;
+
+    @Column(name = "is_active", nullable = false)
+    private boolean status = true;
+
+    @Column(name = "charge_amount_or_percentage")
+    private BigDecimal amountOrPercentage;
+
+    public static ShareAccountCharge createNewWithoutShareAccount(final Charge 
chargeDefinition, final BigDecimal amountPayable,
+            final ChargeTimeType chargeTime, final ChargeCalculationType 
chargeCalculation, final boolean status) {
+        return new ShareAccountCharge(null, chargeDefinition, amountPayable, 
chargeTime, chargeCalculation, status);
+    }
+
+    protected ShareAccountCharge() {
+        //
+    }
+
+    private ShareAccountCharge(final ShareAccount shareAccount, final Charge 
chargeDefinition, final BigDecimal amount,
+            final ChargeTimeType chargeTime, final ChargeCalculationType 
chargeCalculation, final boolean status) {
+
+        this.shareAccount = shareAccount;
+        this.charge = chargeDefinition;
+        this.chargeTime = (chargeTime == null) ? 
chargeDefinition.getChargeTimeType() : chargeTime.getValue();
+
+        this.chargeCalculation = chargeDefinition.getChargeCalculation();
+        if (chargeCalculation != null) {
+            this.chargeCalculation = chargeCalculation.getValue();
+        }
+
+        BigDecimal chargeAmount = chargeDefinition.getAmount();
+        if (amount != null) {
+            chargeAmount = amount;
+        }
+
+        final BigDecimal transactionAmount = new BigDecimal(0);
+
+        populateDerivedFields(transactionAmount, chargeAmount);
+        this.paid = determineIfFullyPaid();
+        this.status = status;
+    }
+
+    public void populateDerivedFields(final BigDecimal transactionAmount, 
final BigDecimal chargeAmount) {
+        if 
(this.chargeCalculation.equals(ChargeCalculationType.FLAT.getValue())) {
+            this.percentage = null;
+            this.amountOrPercentage = chargeAmount ;
+            this.amount = BigDecimal.ZERO;
+            this.amountPercentageAppliedTo = null;
+            this.amountPaid = null;
+            this.amountOutstanding = BigDecimal.ZERO;
+            this.amountWaived = null;
+            this.amountWrittenOff = null;
+        } else if 
(this.chargeCalculation.equals(ChargeCalculationType.PERCENT_OF_AMOUNT.getValue()))
 {
+            this.percentage = chargeAmount;
+            this.amountPercentageAppliedTo = transactionAmount;
+            this.amount = percentageOf(this.amountPercentageAppliedTo, 
this.percentage);
+            this.amountPaid = null;
+            this.amountOutstanding = calculateOutstanding();
+            this.amountWaived = null;
+            this.amountWrittenOff = null;
+        }
+    }
+
+    public void markAsFullyPaid() {
+        this.amountPaid = this.amount;
+        this.amountOutstanding = BigDecimal.ZERO;
+        this.paid = true;
+    }
+
+    public void resetToOriginal(final MonetaryCurrency currency) {
+        this.amountPaid = BigDecimal.ZERO;
+        this.amountWaived = BigDecimal.ZERO;
+        this.amountWrittenOff = BigDecimal.ZERO;
+        this.amountOutstanding = calculateAmountOutstanding(currency);
+        this.paid = false;
+        this.waived = false;
+    }
+
+    public void undoPayment(final MonetaryCurrency currency, final Money 
transactionAmount) {
+        Money amountPaid = getAmountPaid(currency);
+        amountPaid = amountPaid.minus(transactionAmount);
+        this.amountPaid = amountPaid.getAmount();
+        this.amountOutstanding = calculateAmountOutstanding(currency);
+        this.paid = false;
+        this.status = true;
+    }
+
+    public Money waive(final MonetaryCurrency currency) {
+        Money amountWaivedToDate = Money.of(currency, this.amountWaived);
+        Money amountOutstanding = Money.of(currency, this.amountOutstanding);
+        this.amountWaived = 
amountWaivedToDate.plus(amountOutstanding).getAmount();
+        this.amountOutstanding = BigDecimal.ZERO;
+        this.waived = true;
+        return amountOutstanding;
+    }
+
+    public void undoWaiver(final MonetaryCurrency currency, final Money 
transactionAmount) {
+        Money amountWaived = getAmountWaived(currency);
+        amountWaived = amountWaived.minus(transactionAmount);
+        this.amountWaived = amountWaived.getAmount();
+        this.amountOutstanding = calculateAmountOutstanding(currency);
+        this.waived = false;
+        this.status = true;
+    }
+
+    public Money pay(final MonetaryCurrency currency, final Money amountPaid) {
+        Money amountPaidToDate = Money.of(currency, this.amountPaid);
+        Money amountOutstanding = Money.of(currency, this.amountOutstanding);
+        amountPaidToDate = amountPaidToDate.plus(amountPaid);
+        amountOutstanding = amountOutstanding.minus(amountPaid);
+        this.amountPaid = amountPaidToDate.getAmount();
+        this.amountOutstanding = amountOutstanding.getAmount();
+        this.paid = determineIfFullyPaid();
+        return Money.of(currency, this.amountOutstanding);
+    }
+
+    private BigDecimal calculateAmountOutstanding(final MonetaryCurrency 
currency) {
+        return 
getAmount(currency).minus(getAmountWaived(currency)).minus(getAmountPaid(currency)).getAmount();
+    }
+
+    public void update(final ShareAccount shareAccount) {
+        this.shareAccount = shareAccount;
+    }
+
+    public void update(final BigDecimal amount) {
+        final BigDecimal transactionAmount = BigDecimal.ZERO;
+        if 
(this.chargeCalculation.equals(ChargeCalculationType.FLAT.getValue())) {
+            this.amountOrPercentage = amount;
+            this.amountOutstanding = calculateOutstanding();
+        } else if 
(this.chargeCalculation.equals(ChargeCalculationType.PERCENT_OF_AMOUNT.getValue()))
 {
+            this.percentage = amount;
+            this.amountPercentageAppliedTo = transactionAmount;
+            this.amount = percentageOf(this.amountPercentageAppliedTo, 
this.percentage);
+            this.amountOutstanding = calculateOutstanding();
+        }
+    }
+
+    private boolean isGreaterThanZero(final BigDecimal value) {
+        return value.compareTo(BigDecimal.ZERO) == 1;
+    }
+
+    private boolean determineIfFullyPaid() {
+        return BigDecimal.ZERO.compareTo(calculateOutstanding()) == 0;
+    }
+
+    private BigDecimal calculateOutstanding() {
+
+        BigDecimal amountPaidLocal = BigDecimal.ZERO;
+        if (this.amountPaid != null) {
+            amountPaidLocal = this.amountPaid;
+        }
+
+        BigDecimal amountWaivedLocal = BigDecimal.ZERO;
+        if (this.amountWaived != null) {
+            amountWaivedLocal = this.amountWaived;
+        }
+
+        BigDecimal amountWrittenOffLocal = BigDecimal.ZERO;
+        if (this.amountWrittenOff != null) {
+            amountWrittenOffLocal = this.amountWrittenOff;
+        }
+
+        final BigDecimal totalAccountedFor = 
amountPaidLocal.add(amountWaivedLocal).add(amountWrittenOffLocal);
+
+        return this.amount.subtract(totalAccountedFor);
+    }
+
+    private BigDecimal percentageOf(final BigDecimal value, final BigDecimal 
percentage) {
+        BigDecimal percentageOf = BigDecimal.ZERO;
+        if (isGreaterThanZero(value)) {
+            final MathContext mc = new MathContext(8, 
MoneyHelper.getRoundingMode());
+            final BigDecimal multiplicand = 
percentage.divide(BigDecimal.valueOf(100l), mc);
+            percentageOf = value.multiply(multiplicand, mc);
+        }
+        return percentageOf;
+    }
+
+    public BigDecimal percentageOrAmount() {
+        return this.amountOrPercentage;
+    }
+
+    public BigDecimal amoutOutstanding() {
+        return this.amountOutstanding;
+    }
+
+    public boolean isNotFullyPaid() {
+        return !isPaid();
+    }
+
+    public boolean isPaid() {
+        return this.paid;
+    }
+
+    public boolean isWaived() {
+        return this.waived;
+    }
+
+    public boolean isPaidOrPartiallyPaid(final MonetaryCurrency currency) {
+
+        final Money amountWaivedOrWrittenOff = 
getAmountWaived(currency).plus(getAmountWrittenOff(currency));
+        return Money.of(currency, 
this.amountPaid).plus(amountWaivedOrWrittenOff).isGreaterThanZero();
+    }
+
+    public Money getAmount(final MonetaryCurrency currency) {
+        return Money.of(currency, this.amount);
+    }
+
+    private Money getAmountPaid(final MonetaryCurrency currency) {
+        return Money.of(currency, this.amountPaid);
+    }
+
+    public Money getAmountWaived(final MonetaryCurrency currency) {
+        return Money.of(currency, this.amountWaived);
+    }
+
+    public Money getAmountWrittenOff(final MonetaryCurrency currency) {
+        return Money.of(currency, this.amountWrittenOff);
+    }
+
+    public Money getAmountOutstanding(final MonetaryCurrency currency) {
+        return Money.of(currency, this.amountOutstanding);
+    }
+
+    /**
+     * @param incrementBy
+     *            Amount used to pay off this charge
+     * @return Actual amount paid on this charge
+     */
+    public Money updatePaidAmountBy(final Money incrementBy) {
+        Money amountPaidToDate = Money.of(incrementBy.getCurrency(), 
this.amountPaid);
+        Money amountPaidOnThisCharge = Money.zero(incrementBy.getCurrency());
+        amountPaidOnThisCharge = incrementBy;
+        amountPaidToDate = amountPaidToDate.plus(incrementBy);
+        this.amountPaid = amountPaidToDate.getAmount();
+        final Money amountExpected = Money.of(incrementBy.getCurrency(), 
this.amountPaid);
+        this.amountOutstanding = 
amountExpected.minus(amountPaidToDate).getAmount();
+        this.paid = determineIfFullyPaid();
+        return amountPaidOnThisCharge;
+    }
+
+    public String name() {
+        return this.charge.getName();
+    }
+
+    public String currencyCode() {
+        return this.charge.getCurrencyCode();
+    }
+
+    public Charge getCharge() {
+        return this.charge;
+    }
+
+    public ShareAccount shareAccount() {
+        return this.shareAccount;
+    }
+
+    public boolean isShareAccountActivation() {
+        return 
ChargeTimeType.fromInt(this.chargeTime).isShareAccountActivation();
+    }
+
+    public boolean isShareAccountClosure() {
+        return ChargeTimeType.fromInt(this.chargeTime).isSavingsClosure();
+    }
+
+    public boolean hasCurrencyCodeOf(final String matchingCurrencyCode) {
+        if (this.currencyCode() == null || matchingCurrencyCode == null) { 
return false; }
+        return this.currencyCode().equalsIgnoreCase(matchingCurrencyCode);
+    }
+
+    public BigDecimal updateWithdralFeeAmount(final BigDecimal 
transactionAmount) {
+        BigDecimal amountPaybale = BigDecimal.ZERO;
+        if (ChargeCalculationType.fromInt(this.chargeCalculation).isFlat()) {
+            amountPaybale = this.amount;
+        } else if 
(ChargeCalculationType.fromInt(this.chargeCalculation).isPercentageOfAmount()) {
+            amountPaybale = 
transactionAmount.multiply(this.percentage).divide(BigDecimal.valueOf(100l));
+        }
+        this.amountOutstanding = amountPaybale;
+        return amountPaybale;
+    }
+
+    public boolean isActive() {
+        return this.status;
+    }
+
+    public boolean isNotActive() {
+        return !isActive();
+    }
+
+    public Long getChargeId() {
+        return this.charge.getId();
+    }
+
+    public boolean isSharesPurchaseCharge() {
+        return ChargeTimeType.fromInt(this.chargeTime).isSharesPurchase();
+    }
+
+    public boolean isSharesRedeemCharge() {
+        return ChargeTimeType.fromInt(this.chargeTime).isSharesRedeem();
+    }
+
+    public Integer getChargeTimeType() {
+        return this.chargeTime;
+    }
+
+    public BigDecimal deriveChargeAmount(BigDecimal transactionAmount) {
+        BigDecimal toReturnAmount = amountOrPercentage;
+        if (ChargeCalculationType.fromInt(this.chargeCalculation) == 
ChargeCalculationType.PERCENT_OF_AMOUNT) {
+            toReturnAmount = percentageOf(transactionAmount, this.percentage);
+            this.amountPercentageAppliedTo = transactionAmount;
+            this.amount = percentageOf(this.amountPercentageAppliedTo, 
this.percentage);
+            this.amountPaid = null;
+            this.amountOutstanding = calculateOutstanding();
+            this.amountWaived = null;
+            this.amountWrittenOff = null;
+        }else {
+            this.amount = this.amountOrPercentage;
+            this.amountOutstanding = calculateOutstanding();
+            this.amountWaived = null;
+            this.amountWrittenOff = null;
+        }
+        return toReturnAmount;
+    }
+
+    public BigDecimal updateChargeDetailsForAdditionalSharesRequest(final 
BigDecimal transactionAmount) {
+        BigDecimal toReturnAmount = amountOrPercentage;
+        if (ChargeCalculationType.fromInt(this.chargeCalculation) == 
ChargeCalculationType.PERCENT_OF_AMOUNT) {
+            toReturnAmount = percentageOf(transactionAmount, this.percentage);
+            this.amountPercentageAppliedTo = 
this.amountPercentageAppliedTo.add(transactionAmount);
+            this.amount = percentageOf(this.amountPercentageAppliedTo, 
this.percentage);
+            this.amountOutstanding = calculateOutstanding();
+            this.amountWaived = null;
+            this.amountWrittenOff = null;
+        } else {
+            this.amount = this.amount.add(this.amountOrPercentage);
+            this.amountOutstanding = calculateOutstanding();
+            this.amountWaived = null;
+            this.amountWrittenOff = null;
+        }
+        return toReturnAmount;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj == null) { return false; }
+        if (obj == this) { return true; }
+        if (obj.getClass() != getClass()) { return false; }
+        final ShareAccountCharge rhs = (ShareAccountCharge) obj;
+        return new EqualsBuilder().appendSuper(super.equals(obj)) //
+                .append(getId(), rhs.getId()) //
+                .append(this.charge.getId(), rhs.charge.getId()) //
+                .append(this.amount, rhs.amount) //
+                .isEquals();
+    }
+
+    @Override
+    public int hashCode() {
+        return new HashCodeBuilder(3, 5) //
+                .append(getId()) //
+                .append(this.charge.getId()) //
+                .append(this.amount)//
+                .toHashCode();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountChargePaidBy.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountChargePaidBy.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountChargePaidBy.java
new file mode 100644
index 0000000..97f1ce3
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountChargePaidBy.java
@@ -0,0 +1,77 @@
+/**
+ * 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.shareaccounts.domain;
+
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.Table;
+
+import org.springframework.data.jpa.domain.AbstractPersistable;
+
+
+@Entity
+@Table(name = "m_share_account_charge_paid_by")
+public class ShareAccountChargePaidBy extends AbstractPersistable<Long>{
+
+    @ManyToOne(optional = false)
+    @JoinColumn(name = "share_transaction_id", referencedColumnName = "id", 
nullable = false)
+    private ShareAccountTransaction shareAccountTransaction;
+    
+    @ManyToOne(optional = false)
+    @JoinColumn(name = "charge_transaction_id", referencedColumnName = "id", 
nullable = false)
+    private ShareAccountCharge shareAccountCharge;
+    
+    @Column(name = "amount", scale = 6, precision = 19, nullable = false) 
+    private BigDecimal amount ;
+    
+    protected ShareAccountChargePaidBy() {
+        
+    }
+    
+    public ShareAccountChargePaidBy(final ShareAccountTransaction 
shareAccountTransaction,
+            final ShareAccountCharge shareAccountCharge, final BigDecimal 
amount) {
+        this.shareAccountTransaction = shareAccountTransaction ;
+        this.shareAccountCharge = shareAccountCharge ;
+        this.amount = amount ;
+    }
+    
+    public ShareAccountCharge getCharge() {
+        return this.shareAccountCharge ;
+    }
+    
+    public BigDecimal getAmount() {
+        return this.amount ;
+    }
+    
+    public ShareAccountTransaction getShareAccountTransaction() {
+        return this.shareAccountTransaction ;
+    }
+    
+    public Long getChargeId() {
+        return this.shareAccountCharge.getChargeId() ;
+    }
+    
+    public Long getShareChargeId() {
+        return this.shareAccountCharge.getId() ;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendDetails.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendDetails.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendDetails.java
new file mode 100644
index 0000000..40821cb
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendDetails.java
@@ -0,0 +1,64 @@
+/**
+ * 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.shareaccounts.domain;
+
+import java.math.BigDecimal;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+import org.springframework.data.jpa.domain.AbstractPersistable;
+
+@Entity
+@Table(name = "m_share_account_dividend_details")
+public class ShareAccountDividendDetails extends AbstractPersistable<Long> {
+
+    @Column(name = "account_id", nullable = false)
+    private Long shareAccountId;
+
+    @Column(name = "amount", scale = 6, precision = 19)
+    private BigDecimal amount;
+
+    @Column(name = "status")
+    private Integer status;
+
+    @Column(name = "savings_transaction_id")
+    private Long savingsTransactionId;
+
+    protected ShareAccountDividendDetails() {
+
+    }
+
+    public ShareAccountDividendDetails(final Long shareAccountId, final 
BigDecimal amount) {
+        this.shareAccountId = shareAccountId;
+        this.amount = amount;
+        this.status = ShareAccountDividendStatusType.INITIATED.getValue();
+    }
+
+    public void update(final Integer status, final Long savingsTransactionId) {
+        this.status = status;
+        this.savingsTransactionId = savingsTransactionId;
+    }
+
+    public BigDecimal getAmount() {
+        return this.amount;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendRepository.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendRepository.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendRepository.java
new file mode 100644
index 0000000..04ae892
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendRepository.java
@@ -0,0 +1,27 @@
+/**
+ * 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.shareaccounts.domain;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface ShareAccountDividendRepository extends 
JpaRepository<ShareAccountDividendDetails, Long>,
+        JpaSpecificationExecutor<ShareAccountDividendDetails> {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendStatusType.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendStatusType.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendStatusType.java
new file mode 100644
index 0000000..99b03c8
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountDividendStatusType.java
@@ -0,0 +1,57 @@
+/**
+ * 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.shareaccounts.domain;
+
+public enum ShareAccountDividendStatusType {
+
+    INVALID(0, "shareAccountDividendStatusType.invalid"), INITIATED(100, 
"shareAccountDividendStatusType.initiated"), POSTED(300,
+            "shareAccountDividendStatusType.posted");
+
+    private final Integer value;
+    private final String code;
+
+    private ShareAccountDividendStatusType(final Integer value, final String 
code) {
+        this.value = value;
+        this.code = code;
+    }
+
+    public static ShareAccountDividendStatusType fromInt(final Integer type) {
+
+        ShareAccountDividendStatusType enumeration = 
ShareAccountDividendStatusType.INVALID;
+        switch (type) {
+            case 100:
+                enumeration = ShareAccountDividendStatusType.INITIATED;
+            break;
+            case 300:
+                enumeration = ShareAccountDividendStatusType.POSTED;
+            break;
+
+        }
+        return enumeration;
+    }
+
+    public Integer getValue() {
+        return this.value;
+    }
+
+    public String getCode() {
+        return this.code;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountRepository.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountRepository.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountRepository.java
new file mode 100644
index 0000000..285203b
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountRepository.java
@@ -0,0 +1,27 @@
+/**
+ * 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.shareaccounts.domain;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+
+public interface ShareAccountRepository extends JpaRepository<ShareAccount, 
Long>, JpaSpecificationExecutor<ShareAccount> {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountRepositoryWrapper.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountRepositoryWrapper.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountRepositoryWrapper.java
new file mode 100644
index 0000000..33d556b
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountRepositoryWrapper.java
@@ -0,0 +1,49 @@
+/**
+ * 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.shareaccounts.domain;
+
+import 
org.apache.fineract.portfolio.accounts.exceptions.ShareAccountNotFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ShareAccountRepositoryWrapper {
+
+       private final ShareAccountRepository shareAccountRepository ;
+
+       @Autowired
+       public ShareAccountRepositoryWrapper(final ShareAccountRepository 
shareAccountRepository) {
+               this.shareAccountRepository = shareAccountRepository ;
+       }
+       
+       public ShareAccount findOneWithNotFoundDetection(final Long accountId) {
+               ShareAccount account = 
this.shareAccountRepository.findOne(accountId) ;
+               if(account == null) {
+                       throw new ShareAccountNotFoundException(accountId) ;
+               }
+               return account ;
+       }
+       public void save(final ShareAccount shareAccount) {
+               this.shareAccountRepository.save(shareAccount) ;
+       }
+       
+       public void saveAndFlush(final ShareAccount shareAccount) {
+               this.shareAccountRepository.saveAndFlush(shareAccount) ;
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountStatusType.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountStatusType.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountStatusType.java
new file mode 100644
index 0000000..c276c8f
--- /dev/null
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountStatusType.java
@@ -0,0 +1,100 @@
+/**
+ * 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.shareaccounts.domain;
+
+/**
+ * Enum representation of {@link ShareAccount} status states.
+ */
+public enum ShareAccountStatusType {
+
+    INVALID(0, "shareAccountStatusType.invalid"), //
+    SUBMITTED_AND_PENDING_APPROVAL(100, 
"shareAccountStatusType.submitted.and.pending.approval"), //
+    APPROVED(200, "shareAccountStatusType.approved"), //
+    ACTIVE(300, "shareAccountStatusType.active"), //
+    REJECTED(500, "shareAccountStatusType.rejected"), //
+    CLOSED(600, "shareAccountStatusType.closed");
+
+    private final Integer value;
+    private final String code;
+
+    public static ShareAccountStatusType fromInt(final Integer type) {
+
+        ShareAccountStatusType enumeration = ShareAccountStatusType.INVALID;
+        switch (type) {
+            case 100:
+                enumeration = 
ShareAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL;
+            break;
+            case 200:
+                enumeration = ShareAccountStatusType.APPROVED;
+            break;
+            case 300:
+                enumeration = ShareAccountStatusType.ACTIVE;
+            break;
+            case 500:
+                enumeration = ShareAccountStatusType.REJECTED;
+            break;
+            case 600:
+                enumeration = ShareAccountStatusType.CLOSED;
+            break;
+        }
+        return enumeration;
+    }
+
+    private ShareAccountStatusType(final Integer value, final String code) {
+        this.value = value;
+        this.code = code;
+    }
+
+    public boolean hasStateOf(final ShareAccountStatusType state) {
+        return this.value.equals(state.getValue());
+    }
+
+    public Integer getValue() {
+        return this.value;
+    }
+
+    public String getCode() {
+        return this.code;
+    }
+
+    public boolean isSubmittedAndPendingApproval() {
+        return 
this.value.equals(ShareAccountStatusType.SUBMITTED_AND_PENDING_APPROVAL.getValue());
+    }
+
+    public boolean isApproved() {
+        return this.value.equals(ShareAccountStatusType.APPROVED.getValue());
+    }
+
+    public boolean isRejected() {
+        return this.value.equals(ShareAccountStatusType.REJECTED.getValue());
+    }
+
+    public boolean isActive() {
+        return this.value.equals(ShareAccountStatusType.ACTIVE.getValue());
+    }
+
+    public boolean isActiveOrAwaitingApprovalOrDisbursal() {
+        return isApproved() || isSubmittedAndPendingApproval() || isActive();
+    }
+
+    public boolean isClosed() {
+        return this.value.equals(ShareAccountStatusType.CLOSED.getValue()) || 
isRejected();
+    }
+
+}
\ No newline at end of file

Reply via email to