diff --git a/api/src/main/java/org/apache/fineract/cn/deposit/api/v1/transaction/domain/data/TransactionActionType.java b/api/src/main/java/org/apache/fineract/cn/deposit/api/v1/transaction/domain/data/TransactionActionType.java
index 4a689e7..efa253d 100644
--- a/api/src/main/java/org/apache/fineract/cn/deposit/api/v1/transaction/domain/data/TransactionActionType.java
+++ b/api/src/main/java/org/apache/fineract/cn/deposit/api/v1/transaction/domain/data/TransactionActionType.java
@@ -22,5 +22,5 @@
 
     WITHDRAWAL,
     DEPOSIT,
-    TRANSFER;
+    ;
 }
diff --git a/api/src/main/java/org/apache/fineract/cn/deposit/api/v1/transaction/domain/data/TransactionRequestData.java b/api/src/main/java/org/apache/fineract/cn/deposit/api/v1/transaction/domain/data/TransactionRequestData.java
index f92a576..deb16ae 100644
--- a/api/src/main/java/org/apache/fineract/cn/deposit/api/v1/transaction/domain/data/TransactionRequestData.java
+++ b/api/src/main/java/org/apache/fineract/cn/deposit/api/v1/transaction/domain/data/TransactionRequestData.java
@@ -56,19 +56,12 @@
 
     private  String subTxnId;
 
-    @Length(max = 32)
-    private String fromAccountId;
-
-    @Length(max = 32)
-    private String toAccountId;
-
     public TransactionRequestData() {
     }
 
     public TransactionRequestData(String transactionCode, String requestCode, String routingCode, String externalId, String accountId,
                                   String note, LocalDateTime expiration,
-                                  MoneyData amount, String subTxnId,
-                                  String fromAccountId, String toAccountId) {
+                                  MoneyData amount, String subTxnId) {
         this.transactionCode = transactionCode;
         this.requestCode = requestCode;
         this.routingCode = routingCode;
@@ -79,8 +72,6 @@
         this.amount = amount;
         //this.geoCode = geoCode;
         this.subTxnId = subTxnId;
-        this.fromAccountId = fromAccountId;
-        this.toAccountId = toAccountId;
     }
 
     @NotNull
@@ -160,19 +151,4 @@
         return transactionCode;
     }
 
-    public String getFromAccountId() {
-        return fromAccountId;
-    }
-
-    public void setFromAccountId(String fromAccountId) {
-        this.fromAccountId = fromAccountId;
-    }
-
-    public String getToAccountId() {
-        return toAccountId;
-    }
-
-    public void setToAccountId(String toAccountId) {
-        this.toAccountId = toAccountId;
-    }
 }
diff --git a/service/src/main/java/org/apache/fineract/cn/deposit/service/internal/command/handler/TransactionCommandHandler.java b/service/src/main/java/org/apache/fineract/cn/deposit/service/internal/command/handler/TransactionCommandHandler.java
index d9a4db0..f3740ad 100644
--- a/service/src/main/java/org/apache/fineract/cn/deposit/service/internal/command/handler/TransactionCommandHandler.java
+++ b/service/src/main/java/org/apache/fineract/cn/deposit/service/internal/command/handler/TransactionCommandHandler.java
@@ -63,9 +63,6 @@
                 //command = dataValidator.validateCommitTransfer(command);
                 return transactionService.deposit(command);
             }
-            case TRANSFER: {
-                return transactionService.transfer(command);
-            }
             default:
                 return null;
         }
diff --git a/service/src/main/java/org/apache/fineract/cn/deposit/service/internal/service/TransactionService.java b/service/src/main/java/org/apache/fineract/cn/deposit/service/internal/service/TransactionService.java
index 97a3ac0..5f88e0d 100644
--- a/service/src/main/java/org/apache/fineract/cn/deposit/service/internal/service/TransactionService.java
+++ b/service/src/main/java/org/apache/fineract/cn/deposit/service/internal/service/TransactionService.java
@@ -54,7 +54,10 @@
 import java.math.MathContext;
 import java.time.Clock;
 import java.time.LocalDateTime;
-import java.util.*;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
 import java.util.stream.Collectors;
 
 @Service
@@ -89,13 +92,13 @@
     @Transactional
     public TransactionResponseData withdraw(TransactionCommand command) {
         TransactionRequestData request = command.getTransactionRequest();
-        AccountWrapper accountWrapper = validateAndGetAccount(request, request.getAccountId(), TransactionTypeEnum.WITHDRAWAL);
+        AccountWrapper accountWrapper = validateAndGetAccount(request, TransactionTypeEnum.WITHDRAWAL);
         LocalDateTime transactionDate = getNow();
         //get txntype charges
         List<Charge> charges = getCharges(accountWrapper.account.getIdentifier(), TransactionTypeEnum.WITHDRAWAL);
         //todo: get subTxnType charges
 
-        TransactionEntity txn = doWithdraw(request, accountWrapper, charges, getNow(), request.getAccountId());
+        TransactionEntity txn = doWithdraw(request, accountWrapper, charges, getNow());
 
 
         return TransactionResponseData.build(request.getRoutingCode(), request.getExternalId(),
@@ -106,40 +109,22 @@
     @Transactional
     public TransactionResponseData deposit(TransactionCommand command) {
         TransactionRequestData request = command.getTransactionRequest();
-        AccountWrapper accountWrapper = validateAndGetAccount(request, request.getAccountId(), TransactionTypeEnum.DEPOSIT);
+        AccountWrapper accountWrapper = validateAndGetAccount(request, TransactionTypeEnum.DEPOSIT);
         LocalDateTime transactionDate = getNow();
         //get txntype charges
         List<Charge> charges = getCharges(accountWrapper.account.getIdentifier(), TransactionTypeEnum.DEPOSIT);
         //todo: get subTxnType charges
-        TransactionEntity txn = doDeposit(request, accountWrapper, charges, getNow(), request.getAccountId());
+        TransactionEntity txn = doDeposit(request, accountWrapper, charges, getNow());
 
         return TransactionResponseData.build(request.getRoutingCode(), request.getExternalId(),
                 request.getRequestCode(), ActionState.ACCEPTED,
                 null, txn.getIdentifier(), transactionDate);
     }
 
-    public TransactionResponseData transfer(TransactionCommand command) {
-        TransactionRequestData request = command.getTransactionRequest();
-        AccountWrapper fromAccountWrapper = validateAndGetAccount(request, request.getFromAccountId(), TransactionTypeEnum.WITHDRAWAL);
-        AccountWrapper toAccountWrapper = validateAndGetAccount(request, request.getToAccountId(), TransactionTypeEnum.DEPOSIT);
-        LocalDateTime transactionDate = getNow();
-        //get txntype charges
-        List<Charge> charges = getCharges(fromAccountWrapper.account.getIdentifier(), TransactionTypeEnum.ACCOUNT_TRANSFER);
-        //todo: get subTxnType charges
-
-        TransactionEntity txn = doWithdraw(request, fromAccountWrapper, charges, getNow(), request.getFromAccountId());
-        TransactionEntity txn2 = doDeposit(request, toAccountWrapper, new ArrayList<>(), getNow(), request.getToAccountId());
-
-        return TransactionResponseData.build(request.getRoutingCode(), request.getExternalId(),
-                request.getRequestCode(), ActionState.ACCEPTED,
-                null, txn.getIdentifier() +"_to_"+ txn2.getIdentifier(), transactionDate);
-    }
-
-    private TransactionEntity doDeposit(TransactionRequestData request, AccountWrapper accountWrapper,
-                                        List<Charge> charges, LocalDateTime transactionDate, String accountId) {
+    private TransactionEntity doDeposit(TransactionRequestData request, AccountWrapper accountWrapper, List<Charge> charges, LocalDateTime transactionDate) {
         BigDecimal amount = request.getAmount().getAmount();
 
-        TransactionEntity txn = createTransaction(request,TransactionTypeEnum.DEPOSIT, transactionDate, CREDIT, null, accountId);
+        TransactionEntity txn = createTransaction(request,TransactionTypeEnum.DEPOSIT, transactionDate, CREDIT, null);
         String debitAccountIdentifier = accountWrapper.productDefinition.getCashAccountIdentifier();
         /* if subtxn is provided and it has an account configured the do debit that account*/
         if(StringUtils.isNotBlank(request.getSubTxnId())){
@@ -161,7 +146,7 @@
         addDebtor(debitAccountIdentifier, amount.doubleValue(), debtors);
 
 
-        prepareCharges(request, accountWrapper, charges, debtors, creditors, txn, accountId);
+        prepareCharges(request, accountWrapper, charges, debtors, creditors, txn);
 
         if (debtors.isEmpty()) // must be same size as creditors
             throw ServiceException.badRequest("Debit and Credit doesn't match");
@@ -177,10 +162,10 @@
 
 
     private TransactionEntity doWithdraw(@NotNull TransactionRequestData request, @NotNull AccountWrapper accountWrapper,
-                                 List<Charge> charges, LocalDateTime transactionDate, String accountId) {
+                                 List<Charge> charges, LocalDateTime transactionDate) {
         BigDecimal amount = request.getAmount().getAmount();
 
-        TransactionEntity txn = createTransaction(request, TransactionTypeEnum.WITHDRAWAL, transactionDate, DEBIT, null, accountId);
+        TransactionEntity txn = createTransaction(request, TransactionTypeEnum.WITHDRAWAL, transactionDate, DEBIT, null);
 
         String creditAccountIdentifier = accountWrapper.productDefinition.getCashAccountIdentifier();
         /* if subtxn is provided and it has an account configured the do credit that account*/
@@ -202,7 +187,7 @@
         addCreditor(creditAccountIdentifier, amount.doubleValue(), creditors);
         addDebtor(accountWrapper.account.getIdentifier(), amount.doubleValue(), debtors);
 
-        prepareCharges(request, accountWrapper, charges, debtors, creditors, txn, accountId);
+        prepareCharges(request, accountWrapper, charges, debtors, creditors, txn);
 
         if (debtors.isEmpty()) // must be same size as creditors
             throw ServiceException.badRequest("Debit and Credit doesn't match");
@@ -218,7 +203,7 @@
 
     private void prepareCharges(@NotNull TransactionRequestData request, @NotNull AccountWrapper accountWrapper,
                                 @NotNull List<Charge> charges, HashSet<Debtor> debtors, HashSet<Creditor> creditors,
-                                TransactionEntity txn, String accountId) {
+                                TransactionEntity txn) {
 
 
         BigDecimal amount = request.getAmount().getAmount();
@@ -239,16 +224,18 @@
         for(Charge charge : charges){
             addCreditor(charge.getIncomeAccountIdentifier(), calcChargeAmount(amount, charge).doubleValue(), creditors);
             addDebtor(accountWrapper.account.getIdentifier(), calcChargeAmount(amount, charge).doubleValue(), debtors);
-            createTransaction(request,TransactionTypeEnum.CHARGES_PAYMENT, getNow(), DEBIT, txn, accountId);
+            createTransaction(request,TransactionTypeEnum.CHARGES_PAYMENT, getNow(), DEBIT, txn);
         }
 
     }
 
 
-    private AccountWrapper validateAndGetAccount(@NotNull TransactionRequestData request, String accountId, TransactionTypeEnum txnType) {
+
+    private AccountWrapper validateAndGetAccount(@NotNull TransactionRequestData request, TransactionTypeEnum txnType) {
         //TODO: error handling
+        String accountId = request.getAccountId();
         Account account = ledgerManager.findAccount(accountId);
-        validateAccount(request.getAmount(), account);
+        validateAccount(request, account);
 
         ProductInstance product = productInstanceService.findByAccountIdentifier(accountId).get();
         ProductDefinition productDefinition = productDefinitionService.findProductDefinition(product.getProductIdentifier()).get();
@@ -272,7 +259,7 @@
     }
 
 
-    private void validateAccount(MoneyData requestAmount, Account account) {
+    private void validateAccount(@NotNull TransactionRequestData request, Account account) {
         validateAccount(account);
 
         String accountId = account.getIdentifier();
@@ -284,7 +271,7 @@
                 throw new UnsupportedOperationException("Product Definition is inactive");
 
             Currency currency = productDefinition.getCurrency();
-            if (!currency.getCode().equals(requestAmount.getCurrency()))
+            if (!currency.getCode().equals(request.getAmount().getCurrency()))
                 throw new UnsupportedOperationException();
         }
     }
@@ -374,7 +361,7 @@
 
     private TransactionEntity createTransaction(TransactionRequestData request, TransactionTypeEnum txnType,
                                                 LocalDateTime transactionDate, String tranType,
-                                                TransactionEntity parent, String accountId) {
+                                                TransactionEntity parent) {
         TransactionEntity txn = new TransactionEntity();
         UUID uuid=UUID.randomUUID();
 
@@ -396,8 +383,8 @@
         txn.setCreatedOn(getNow());
         /*txn.setLastModifiedBy();
         txn.setLastModifiedOn();*/
-        markLastTransaction(accountId, transactionDate);
-        txn.setAccountId(accountId);
+        markLastTransaction(request.getAccountId(), transactionDate);
+        txn.setAccountId(request.getAccountId());
         txn.setType(tranType);
         txn.setParentTransaction(parent);
         transactionRepository.save(txn);
@@ -442,7 +429,6 @@
     }
 
 
-
     public static class AccountWrapper {
         @NotNull
         private final Account account;
