fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [07/12] incubator-fineract git commit: Shares And Dividends Implementation
Date Wed, 13 Apr 2016 14:35:19 GMT
http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountTransaction.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountTransaction.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountTransaction.java
new file mode 100644
index 0000000..384e94f
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/domain/ShareAccountTransaction.java
@@ -0,0 +1,209 @@
+/**
+ * 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.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+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 org.hibernate.annotations.LazyCollection;
+import org.hibernate.annotations.LazyCollectionOption;
+import org.springframework.data.jpa.domain.AbstractPersistable;
+
+@Entity
+@Table(name = "m_share_account_transactions")
+public class ShareAccountTransaction extends AbstractPersistable<Long> {
+
+    @ManyToOne(optional = false)
+    @JoinColumn(name = "account_id", referencedColumnName = "id", nullable = false)
+    private ShareAccount shareAccount;
+
+    @Column(name = "transaction_date")
+    @Temporal(TemporalType.DATE)
+    private Date transactionDate;
+
+    @Column(name = "total_shares")
+    private Long totalShares;
+
+    @Column(name = "unit_price")
+    private BigDecimal shareValue;
+
+    @Column(name = "amount") 
+    private BigDecimal amount ;
+    
+    @Column(name = "charge_amount") 
+    private BigDecimal totalChargeAmount ;
+    
+    @Column(name = "status_enum", nullable = true)
+    private Integer status;
+
+    @Column(name = "type_enum", nullable = true) 
+    private Integer type ;
+    
+    @LazyCollection(LazyCollectionOption.FALSE)
+    @OneToMany(cascade = CascadeType.ALL, mappedBy = "shareAccountTransaction", orphanRemoval
= true)
+    private final Set<ShareAccountChargePaidBy> shareAccountChargesPaid = new HashSet<>();
+    
+    protected ShareAccountTransaction() {
+
+    }
+
+    public void setShareAccount(final ShareAccount shareAccount) {
+        this.shareAccount = shareAccount;
+    }
+
+    public ShareAccountTransaction(final Date transactionDate, final Long totalShares, final
BigDecimal shareValue) {
+        this.transactionDate = transactionDate;
+        this.totalShares = totalShares;
+        this.shareValue = shareValue;
+        this.status = PurchasedSharesStatusType.APPLIED.getValue();
+        this.type = PurchasedSharesStatusType.PURCHASED.getValue() ;
+        this.amount = shareValue.multiply(BigDecimal.valueOf(totalShares)) ;
+    }
+
+    private ShareAccountTransaction(final Date transactionDate, final Long totalShares, final
BigDecimal shareValue,
+            final Integer status, final Integer type, final BigDecimal amount, final BigDecimal
chargeAmount) {
+        this.transactionDate = transactionDate;
+        this.totalShares = totalShares;
+        this.shareValue = shareValue;
+        this.status = status ;
+        this.type = type ;
+        this.amount = amount ;
+        this.totalChargeAmount = chargeAmount ;
+    }
+    
+    public static ShareAccountTransaction createRedeemTransaction(final Date transactionDate,
final Long totalShares, final BigDecimal shareValue) {
+        final Integer status = PurchasedSharesStatusType.APPROVED.getValue() ;
+        final Integer type = PurchasedSharesStatusType.REDEEMED.getValue() ;
+        final BigDecimal amount = shareValue.multiply(BigDecimal.valueOf(totalShares)) ;
+        return new ShareAccountTransaction(transactionDate, totalShares, shareValue, status,
type, amount, null) ; 
+    }
+    
+    public static ShareAccountTransaction createChargeTransaction(final Date transactionDate,
final ShareAccountCharge charge) {
+       final Long totalShares = null ;
+       final BigDecimal unitPrice = null ;
+       final Integer status = PurchasedSharesStatusType.APPROVED.getValue() ;
+       final Integer type = PurchasedSharesStatusType.CHARGE_PAYMENT.getValue() ;
+       BigDecimal amount = charge.percentageOrAmount() ;
+       BigDecimal chargeAmount = amount ;
+       return new ShareAccountTransaction(transactionDate, totalShares, unitPrice, status,
type, amount, chargeAmount) ;
+    }
+    
+    public Date getPurchasedDate() {
+        return this.transactionDate;
+    }
+
+    public Long getTotalShares() {
+        return this.totalShares;
+    }
+
+    public BigDecimal getPurchasePrice() {
+        return this.shareValue;
+    }
+
+    public void update(final Date purchasedDate, final Long totalShares, final BigDecimal
shareValue) {
+        this.transactionDate = purchasedDate;
+        this.totalShares = totalShares;
+        this.shareValue = shareValue;
+        this.amount = shareValue.multiply(BigDecimal.valueOf(totalShares)) ;
+        this.status = PurchasedSharesStatusType.APPLIED.getValue();
+    }
+
+    public void approve() {
+        this.status = PurchasedSharesStatusType.APPROVED.getValue() ;
+    }
+    
+    public void undoApprove() {
+        this.status = PurchasedSharesStatusType.APPLIED.getValue() ;
+    }
+
+    public void reject() {
+       this.status = PurchasedSharesStatusType.REJECTED.getValue() ;
+       if(this.totalChargeAmount != null) {
+           this.amount = this.amount.subtract(totalChargeAmount) ;
+       }
+    }
+    
+    public boolean isPendingForApprovalTransaction() {
+        return this.status.equals(PurchasedSharesStatusType.APPLIED.getValue()) &&
this.type.equals(PurchasedSharesStatusType.PURCHASED.getValue()) ;
+    }
+    
+    public boolean isPurchasTransaction() {
+        return this.status.equals(PurchasedSharesStatusType.APPROVED.getValue()) &&
this.type.equals(PurchasedSharesStatusType.PURCHASED.getValue()) ;
+    }
+    
+    public boolean isRedeemTransaction() {
+        return this.status.equals(PurchasedSharesStatusType.APPROVED.getValue()) &&
this.type.equals(PurchasedSharesStatusType.REDEEMED.getValue()) ;
+    }
+    
+    public boolean isChargeTransaction() {
+        return this.status.equals(PurchasedSharesStatusType.APPROVED.getValue()) &&
this.type.equals(PurchasedSharesStatusType.CHARGE_PAYMENT.getValue()) ;
+    }
+    
+    public void addShareAccountChargePaidBy(final ShareAccountChargePaidBy chargePaidBy)
{
+        this.shareAccountChargesPaid.add(chargePaidBy) ;
+    }
+    
+    public BigDecimal amount() {
+        return this.amount ;
+    }
+
+    public BigDecimal chargeAmount() {
+        return this.totalChargeAmount ;
+    }
+    
+    public void updateChargeAmount(BigDecimal totalChargeAmount) {
+        this.amount = this.amount.add(totalChargeAmount);
+        this.totalChargeAmount = totalChargeAmount ;
+    }
+    
+    public void deductChargesFromTotalAmount(BigDecimal totalChargeAmount) {
+        this.amount = this.amount.subtract(totalChargeAmount);
+        this.totalChargeAmount = totalChargeAmount ;
+    }
+    
+    public Set<ShareAccountChargePaidBy> getChargesPaidBy() {
+        return this.shareAccountChargesPaid ;
+    }
+    
+    public Integer getTransactionStatus() {
+        return this.status ;
+    }
+    
+    public Integer getTransactionType() {
+        return this.type ;
+    }
+    
+    public void adjustRedeemAmount() {
+        if(this.totalChargeAmount != null) {
+            this.amount = this.amount.subtract(totalChargeAmount) ;
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/exceptions/IssueableSharesExceededException.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/exceptions/IssueableSharesExceededException.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/exceptions/IssueableSharesExceededException.java
new file mode 100644
index 0000000..c924df0
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/exceptions/IssueableSharesExceededException.java
@@ -0,0 +1,31 @@
+/**
+ * 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.exceptions;
+
+import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+
+/**
+ * A {@link RuntimeException} 
+ */
+public class IssueableSharesExceededException extends AbstractPlatformResourceNotFoundException
{
+
+    public IssueableSharesExceededException() {
+        super("error.msg.shares.issuable.shares.exceeded", "Issueable Shares exceeded than
product definition");
+    }
+}
\ 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/handler/ActivateShareAccountCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ActivateShareAccountCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ActivateShareAccountCommandHandler.java
new file mode 100644
index 0000000..f40f2dc
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ActivateShareAccountCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "ACTIVATE")
+public class ActivateShareAccountCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public ActivateShareAccountCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.activateShareAccount(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApplyAddtionalSharesCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApplyAddtionalSharesCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApplyAddtionalSharesCommandHandler.java
new file mode 100644
index 0000000..ce9c7dd
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApplyAddtionalSharesCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "APPLYADDITIONALSHARES")
+public class ApplyAddtionalSharesCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public ApplyAddtionalSharesCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.applyAddtionalShares(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApproveAddtionalSharesCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApproveAddtionalSharesCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApproveAddtionalSharesCommandHandler.java
new file mode 100644
index 0000000..4d81eeb
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApproveAddtionalSharesCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "APPROVEADDITIONALSHARES")
+public class ApproveAddtionalSharesCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public ApproveAddtionalSharesCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.approveAdditionalShares(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApproveShareAccountCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApproveShareAccountCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApproveShareAccountCommandHandler.java
new file mode 100644
index 0000000..194627a
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/ApproveShareAccountCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "APPROVE")
+public class ApproveShareAccountCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public ApproveShareAccountCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.approveShareAccount(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/CloseShareAccountCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/CloseShareAccountCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/CloseShareAccountCommandHandler.java
new file mode 100644
index 0000000..62fefa4
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/CloseShareAccountCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "CLOSE")
+public class CloseShareAccountCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public CloseShareAccountCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.closeShareAccount(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/CreateShareAccountCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/CreateShareAccountCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/CreateShareAccountCommandHandler.java
new file mode 100644
index 0000000..5226d32
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/CreateShareAccountCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "CREATE")
+public class CreateShareAccountCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public CreateShareAccountCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.createShareAccount(jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RedeemSharesCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RedeemSharesCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RedeemSharesCommandHandler.java
new file mode 100644
index 0000000..09bf0b4
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RedeemSharesCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "REDEEMSHARES")
+public class RedeemSharesCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public RedeemSharesCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.redeemShares(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RejectAddtionalSharesCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RejectAddtionalSharesCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RejectAddtionalSharesCommandHandler.java
new file mode 100644
index 0000000..dce0f84
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RejectAddtionalSharesCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "REJECTADDITIONALSHARES")
+public class RejectAddtionalSharesCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public RejectAddtionalSharesCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.rejectAdditionalShares(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RejectShareAccountCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RejectShareAccountCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RejectShareAccountCommandHandler.java
new file mode 100644
index 0000000..962eacb
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/RejectShareAccountCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "REJECT")
+public class RejectShareAccountCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public RejectShareAccountCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.rejectShareAccount(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/UndoApproveShareAccountCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/UndoApproveShareAccountCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/UndoApproveShareAccountCommandHandler.java
new file mode 100644
index 0000000..bbfe92f
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/UndoApproveShareAccountCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "UNDOAPPROVAL")
+public class UndoApproveShareAccountCommandHandler implements NewCommandSourceHandler{
+
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public UndoApproveShareAccountCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.undoApproveShareAccount(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/08c553f9/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/UpdateShareAccountCommandHandler.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/UpdateShareAccountCommandHandler.java
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/UpdateShareAccountCommandHandler.java
new file mode 100644
index 0000000..d71ab12
--- /dev/null
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/shareaccounts/handler/UpdateShareAccountCommandHandler.java
@@ -0,0 +1,47 @@
+/**
+ * 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.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.shareaccounts.service.ShareAccountWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "SHAREACCOUNT", action = "UPDATE")
+public class UpdateShareAccountCommandHandler implements NewCommandSourceHandler {
+
+    private final ShareAccountWritePlatformService shareAccountWritePlatformService ;
+    
+    @Autowired
+    public UpdateShareAccountCommandHandler(final ShareAccountWritePlatformService shareAccountWritePlatformService)
{
+        this.shareAccountWritePlatformService = shareAccountWritePlatformService ;
+    }
+
+    @Transactional
+    @Override
+    public CommandProcessingResult processCommand(JsonCommand jsonCommand) {
+        return this.shareAccountWritePlatformService.updateShareAccount(jsonCommand.entityId(),
jsonCommand);
+    }
+
+}



Mime
View raw message