Repository: fineract
Updated Branches:
  refs/heads/develop 585a791b4 -> b2aeb81be


Fineract-521 Undo Transaction


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

Branch: refs/heads/develop
Commit: 81b2ba1c311e928b30cc80858ff9828fba591d62
Parents: d6accae
Author: avikganguly01 <avikganguly...@gmail.com>
Authored: Fri Sep 22 22:16:22 2017 +0530
Committer: avikganguly01 <avikganguly...@gmail.com>
Committed: Fri Sep 22 22:17:34 2017 +0530

----------------------------------------------------------------------
 .../portfolio/savings/domain/SavingsAccount.java         | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/fineract/blob/81b2ba1c/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
----------------------------------------------------------------------
diff --git 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
index e874701..3f2da48 100755
--- 
a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
+++ 
b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/domain/SavingsAccount.java
@@ -1148,9 +1148,7 @@ public class SavingsAccount extends 
AbstractPersistableCustom<Long> {
                     final List<ApiParameterError> dataValidationErrors = new 
ArrayList<>();
                     final DataValidatorBuilder baseDataValidator = new 
DataValidatorBuilder(dataValidationErrors)
                             .resource(depositAccountType().resourceName() + 
transactionAction);
-                    if (this.allowOverdraft) {
-                        
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("results.in.balance.exceeding.overdraft.limit");
-                    } else {
+                    if (!this.allowOverdraft) {
                         
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("results.in.balance.going.negative");
                     }
                     if (!dataValidationErrors.isEmpty()) { throw new 
PlatformApiDataValidationException(dataValidationErrors); }
@@ -1160,6 +1158,13 @@ public class SavingsAccount extends 
AbstractPersistableCustom<Long> {
             lastSavingsDate = transaction.transactionLocalDate();
 
         }
+        
+        BigDecimal withdrawalFee = null;
+        BigDecimal transactionAmount = null;
+        if(isOverdraft()) {
+                       if 
(runningBalance.minus(minRequiredBalance).isLessThanZero()) { throw new 
InsufficientAccountBalanceException(
+                           "transactionAmount", getAccountBalance(), 
withdrawalFee, transactionAmount); }
+        }
     }
 
     protected boolean isAccountLocked(final LocalDate transactionDate) {

Reply via email to