FINERACT-1553: Lien added
This commit is contained in:
+304
-19
@@ -2017,6 +2017,68 @@ public class ClientSavingsIntegrationTest {
|
||||
enforceMinRequiredBalance, allowOverdraft, taxGroupId, false);
|
||||
}
|
||||
|
||||
// LienAtProductLevel
|
||||
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final String minOpenningBalance, String minBalanceForInterestCalculation, final boolean enforceMinRequiredBalance,
|
||||
final boolean allowOverDraft, final boolean lienAllowed) {
|
||||
|
||||
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT WITH LIEN---------------------------------------");
|
||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||
if (lienAllowed) {
|
||||
final String maxAllowedLienLimit = "2000.0";
|
||||
savingsProductHelper.withLienAllowed(maxAllowedLienLimit);
|
||||
}
|
||||
if (enforceMinRequiredBalance) {
|
||||
final String minRequiredBalance = "100.0";
|
||||
savingsProductHelper.withMinRequiredBalance(minRequiredBalance);
|
||||
savingsProductHelper.withEnforceMinRequiredBalance("true");
|
||||
}
|
||||
if (allowOverDraft) {
|
||||
final String overDraftLimit = "500.0";
|
||||
savingsProductHelper.withOverDraft(overDraftLimit);
|
||||
}
|
||||
final String savingsProductJSON = savingsProductHelper.withInterestCompoundingPeriodTypeAsDaily()
|
||||
|
||||
.withInterestPostingPeriodTypeAsMonthly()
|
||||
|
||||
.withInterestCalculationPeriodTypeAsDailyBalance()
|
||||
|
||||
.withMinBalanceForInterestCalculation(minBalanceForInterestCalculation)
|
||||
|
||||
.withMinimumOpenningBalance(minOpenningBalance).build();
|
||||
|
||||
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
// LienAtProductlevel with Overdraft Limit > Lien Limit
|
||||
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final String minOpenningBalance, String minBalanceForInterestCalculation, final boolean enforceMinRequiredBalance,
|
||||
final boolean allowOverDraft, final String overDraftLimit, final boolean lienAllowed, final String lienAllowedLimit) {
|
||||
LOG.info("------------------------------CREATING NEW SAVINGS PRODUCT WITH LIEN---------------------------------------");
|
||||
SavingsProductHelper savingsProductHelper = new SavingsProductHelper();
|
||||
if (lienAllowed) {
|
||||
savingsProductHelper.withLienAllowed(lienAllowedLimit);
|
||||
}
|
||||
if (enforceMinRequiredBalance) {
|
||||
final String minRequiredBalance = "100.0";
|
||||
savingsProductHelper.withMinRequiredBalance(minRequiredBalance);
|
||||
savingsProductHelper.withEnforceMinRequiredBalance("true");
|
||||
}
|
||||
if (allowOverDraft) {
|
||||
savingsProductHelper.withOverDraft(overDraftLimit);
|
||||
}
|
||||
final String savingsProductJSON = savingsProductHelper.withInterestCompoundingPeriodTypeAsDaily()
|
||||
|
||||
.withInterestPostingPeriodTypeAsMonthly()
|
||||
|
||||
.withInterestCalculationPeriodTypeAsDailyBalance()
|
||||
|
||||
.withMinBalanceForInterestCalculation(minBalanceForInterestCalculation)
|
||||
|
||||
.withMinimumOpenningBalance(minOpenningBalance).build();
|
||||
return SavingsProductHelper.createSavingsProduct(savingsProductJSON, requestSpec, responseSpec);
|
||||
}
|
||||
|
||||
private Integer createSavingsProduct(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
|
||||
final String minOpenningBalance, String minBalanceForInterestCalculation, String minRequiredBalance,
|
||||
String enforceMinRequiredBalance, final boolean allowOverdraft, final String taxGroupId, boolean withDormancy) {
|
||||
@@ -2177,26 +2239,23 @@ public class ClientSavingsIntegrationTest {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSavingsAccountLienStatus() {
|
||||
|
||||
public void testSavingsAccountLienAllowedAtProductLevelWithEnforceBalance() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
SavingsAccountHelper savingsAccountHelperValidationError = new SavingsAccountHelper(this.requestSpec,
|
||||
new ResponseSpecBuilder().build());
|
||||
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
|
||||
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
|
||||
|
||||
final String minBalanceForInterestCalculation = null;
|
||||
final String minRequiredBalance = null;
|
||||
final String enforceMinRequiredBalance = "true";
|
||||
final boolean enforceMinRequiredBalance = true;
|
||||
final boolean allowOverdraft = false;
|
||||
final boolean lienAllowed = true;
|
||||
|
||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||
minBalanceForInterestCalculation, minRequiredBalance, enforceMinRequiredBalance, allowOverdraft);
|
||||
minBalanceForInterestCalculation, enforceMinRequiredBalance, allowOverdraft, lienAllowed);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
|
||||
@@ -2211,38 +2270,264 @@ public class ClientSavingsIntegrationTest {
|
||||
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||
|
||||
List<HashMap> error = (List) savingsAccountHelperValidationError.holdAmountInSavingsAccount(savingsId, "1500", false,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR); // lien:false
|
||||
List<HashMap> error = (List) savingsAccountHelperValidationError.holdAmountInSavingsAccount(savingsId, "2000", false,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("validation.msg.savingsaccount.insufficient.balance", error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
assertEquals("validation.msg.savingsaccount.insufficient balance", error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer holdTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, "1500", true,
|
||||
Integer lienHoldTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, "2000", true,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||
|
||||
Float balance = Float.parseFloat("-500");
|
||||
Float balance = Float.parseFloat("-1000");
|
||||
|
||||
assertEquals(balance, summary.get("availableBalance"), "Verifying available Balance is -500");
|
||||
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1000",
|
||||
assertEquals(balance, summary.get("availableBalance"), "Verifying available Balance is -1000");
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1200",
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
|
||||
|
||||
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.withdrawalFromSavingsAccount(savingsId,
|
||||
"1000", TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||
"200", TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||
|
||||
assertEquals("error.msg.savingsaccount.transaction.insufficient.account.balance",
|
||||
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "500", TRANSACTION_DATE,
|
||||
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "100", TRANSACTION_DATE,
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
Assertions.assertNotNull(withdrawTransactionId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSavingsAccountLienAllowedAtProductLevelWithOverDraftLimit() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
SavingsAccountHelper savingsAccountHelperValidationError = new SavingsAccountHelper(this.requestSpec,
|
||||
new ResponseSpecBuilder().build());
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
|
||||
|
||||
final String minBalanceForInterestCalculation = null;
|
||||
final boolean enforceMinRequiredBalance = false;
|
||||
final boolean allowOverdraft = true;
|
||||
final boolean lienAllowed = true;
|
||||
|
||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||
minBalanceForInterestCalculation, enforceMinRequiredBalance, allowOverdraft, lienAllowed);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
|
||||
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||
|
||||
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||
|
||||
List<HashMap> error = (List) savingsAccountHelperValidationError.holdAmountInSavingsAccount(savingsId, "2000", false,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("validation.msg.savingsaccount.insufficient.balance", error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer lienHoldTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, "2000", true,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||
|
||||
Float balance = Float.parseFloat("-1000");
|
||||
|
||||
assertEquals(balance, summary.get("availableBalance"), "Verifying available Balance is -1000");
|
||||
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1200",
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
|
||||
|
||||
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.withdrawalFromSavingsAccount(savingsId,
|
||||
"300", TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||
|
||||
assertEquals("error.msg.savingsaccount.transaction.insufficient.account.balance",
|
||||
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "200", TRANSACTION_DATE,
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
Assertions.assertNotNull(withdrawTransactionId);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSavingsAccountLienAllowedAtProductLevelWithNoConfig() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
SavingsAccountHelper savingsAccountHelperValidationError = new SavingsAccountHelper(this.requestSpec,
|
||||
new ResponseSpecBuilder().build());
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
|
||||
|
||||
final String minBalanceForInterestCalculation = null;
|
||||
final boolean enforceMinRequiredBalance = false;
|
||||
final boolean allowOverdraft = false;
|
||||
final boolean lienAllowed = true;
|
||||
|
||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||
minBalanceForInterestCalculation, enforceMinRequiredBalance, allowOverdraft, lienAllowed);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
|
||||
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||
|
||||
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||
|
||||
List<HashMap> error = (List) savingsAccountHelperValidationError.holdAmountInSavingsAccount(savingsId, "2000", false,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("validation.msg.savingsaccount.insufficient.balance", error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer lienHoldTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, "2000", true,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||
|
||||
Float balance = Float.parseFloat("-1000");
|
||||
|
||||
assertEquals(balance, summary.get("availableBalance"), "Verifying available Balance is -1000");
|
||||
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "1100",
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
|
||||
|
||||
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.withdrawalFromSavingsAccount(savingsId,
|
||||
"200", TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);// withdrawable amount = 200;
|
||||
|
||||
assertEquals("error.msg.savingsaccount.transaction.insufficient.account.balance",
|
||||
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "100", TRANSACTION_DATE,
|
||||
CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
Assertions.assertNotNull(withdrawTransactionId);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSavingsAccountWithoutLienAllowed() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
SavingsAccountHelper savingsAccountHelperValidationError = new SavingsAccountHelper(this.requestSpec,
|
||||
new ResponseSpecBuilder().build());
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(403).build();
|
||||
final SavingsAccountHelper validationErrorHelper = new SavingsAccountHelper(this.requestSpec, errorResponse);
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
|
||||
|
||||
final String minBalanceForInterestCalculation = null;
|
||||
final boolean enforceMinRequiredBalance = false;
|
||||
final boolean allowOverdraft = true;
|
||||
final boolean lienAllowed = false;
|
||||
|
||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, this.responseSpec, MINIMUM_OPENING_BALANCE,
|
||||
minBalanceForInterestCalculation, enforceMinRequiredBalance, allowOverdraft, lienAllowed);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
final Integer savingsId = this.savingsAccountHelper.applyForSavingsApplication(clientID, savingsProductID, ACCOUNT_TYPE_INDIVIDUAL);
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
HashMap savingsStatusHashMap = SavingsStatusChecker.getStatusOfSavings(this.requestSpec, this.responseSpec, savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsPending(savingsStatusHashMap);
|
||||
|
||||
savingsStatusHashMap = this.savingsAccountHelper.approveSavings(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsApproved(savingsStatusHashMap);
|
||||
|
||||
savingsStatusHashMap = this.savingsAccountHelper.activateSavings(savingsId);
|
||||
SavingsStatusChecker.verifySavingsIsActive(savingsStatusHashMap);
|
||||
|
||||
List<HashMap> error = (List) savingsAccountHelperValidationError.holdAmountInSavingsAccount(savingsId, "2000", true,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);
|
||||
assertEquals("validation.msg.savingsaccount.lien.is.not.allowed.in.product.level",
|
||||
error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer lienHoldTransactionId = (Integer) this.savingsAccountHelper.holdAmountInSavingsAccount(savingsId, "1500", false,
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);// as per overdraft limit
|
||||
|
||||
HashMap summary = this.savingsAccountHelper.getSavingsSummary(savingsId);
|
||||
|
||||
Float balance = Float.parseFloat("-500"); // opening balance
|
||||
|
||||
assertEquals(balance, summary.get("availableBalance"), "Verifying available Balance is -500");
|
||||
|
||||
Integer depositTransactionId = (Integer) this.savingsAccountHelper.depositToSavingsAccount(savingsId, "2000", // available
|
||||
// to
|
||||
// use
|
||||
// 1100
|
||||
// and
|
||||
// another
|
||||
// 1000
|
||||
// on
|
||||
// transactional
|
||||
// hold
|
||||
|
||||
SavingsAccountHelper.TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
DateFormat dateFormat = new SimpleDateFormat("dd MMMM yyyy");
|
||||
Calendar todaysDate = Calendar.getInstance();
|
||||
final String TRANSACTION_DATE = dateFormat.format(todaysDate.getTime());
|
||||
|
||||
ArrayList<HashMap> savingsAccountErrorData = (ArrayList<HashMap>) validationErrorHelper.withdrawalFromSavingsAccount(savingsId,
|
||||
"1600", TRANSACTION_DATE, CommonConstants.RESPONSE_ERROR);// can not withdraw: amount on transactional
|
||||
// hold
|
||||
|
||||
assertEquals("error.msg.savingsaccount.transaction.insufficient.account.balance",
|
||||
savingsAccountErrorData.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
|
||||
Integer withdrawTransactionId = (Integer) this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "1500",
|
||||
TRANSACTION_DATE, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
Assertions.assertNotNull(withdrawTransactionId);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testSavingsAccountLienAllowedAtProductLevelWithOverDraftLimitGreaterThanLienLimit() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
final ResponseSpecification errorResponse = new ResponseSpecBuilder().expectStatusCode(400).build();
|
||||
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec);
|
||||
ClientHelper.verifyClientCreatedOnServer(this.requestSpec, this.responseSpec, clientID);
|
||||
|
||||
final String minBalanceForInterestCalculation = null;
|
||||
final boolean enforceMinRequiredBalance = false;
|
||||
final boolean allowOverdraft = true;
|
||||
final String overDraftLimit = "2000.0";
|
||||
final boolean lienAllowed = true;
|
||||
final String lineAllowedLimit = "1000.0";
|
||||
|
||||
final Integer savingsProductID = createSavingsProduct(this.requestSpec, errorResponse, MINIMUM_OPENING_BALANCE,
|
||||
minBalanceForInterestCalculation, enforceMinRequiredBalance, allowOverdraft, overDraftLimit, lienAllowed, lineAllowedLimit);
|
||||
Assertions.assertNull(savingsProductID);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* incorrect savings account balance when charge transaction is reversed during an overdraft recalculate Daily
|
||||
* Balances
|
||||
|
||||
+5
-4
@@ -377,11 +377,12 @@ public class SavingsAccountHelper {
|
||||
getActivatedSavingsAsJSON(), isBlock);
|
||||
}
|
||||
|
||||
public Object holdAmountInSavingsAccount(final Integer savingsID, final String amount, final Boolean lienStatus, String date,
|
||||
public Object holdAmountInSavingsAccount(final Integer savingsID, final String amount, final Boolean lienAllowed, String date,
|
||||
String jsonAttributeToGetback) {
|
||||
LOG.info("--------------------------------- SAVINGS TRANSACTION HOLD AMOUNT--------------------------------");
|
||||
|
||||
return performSavingActions(createSavingsTransactionURL(HOLD_AMOUNT_SAVINGS_COMMAND, savingsID),
|
||||
getLienSavingsTransactionJSON(amount, date, lienStatus), jsonAttributeToGetback);
|
||||
getLienSavingsTransactionJSON(amount, date, lienAllowed), jsonAttributeToGetback);
|
||||
}
|
||||
|
||||
public Integer releaseAmount(final Integer savingsId, final Integer transactionId) {
|
||||
@@ -459,13 +460,13 @@ public class SavingsAccountHelper {
|
||||
return savingsAccountWithdrawalJson;
|
||||
}
|
||||
|
||||
private String getLienSavingsTransactionJSON(final String amount, final String transactionDate, final Boolean lien) {
|
||||
private String getLienSavingsTransactionJSON(final String amount, final String transactionDate, final Boolean lienAllowed) {
|
||||
final HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("locale", CommonConstants.LOCALE);
|
||||
map.put("dateFormat", CommonConstants.DATE_FORMAT);
|
||||
map.put("transactionDate", transactionDate);
|
||||
map.put("transactionAmount", amount);
|
||||
map.put("lien", lien);
|
||||
map.put("lienAllowed", lienAllowed);
|
||||
map.put("reasonForBlock", "unUsualActivity");
|
||||
String savingsAccountWithdrawalJson = new Gson().toJson(map);
|
||||
LOG.info(savingsAccountWithdrawalJson);
|
||||
|
||||
+13
-3
@@ -86,6 +86,8 @@ public class SavingsProductHelper {
|
||||
private String overdraftLimit = null;
|
||||
private String minRequiredBalance = null;
|
||||
private String enforceMinRequiredBalance = "false";
|
||||
private String lienAllowed = "false";
|
||||
private String maxAllowedLienLimit = null;
|
||||
private Boolean withHoldTax = false;
|
||||
private String taxGroupId = null;
|
||||
private boolean isDormancyTrackingActive = false;
|
||||
@@ -129,6 +131,8 @@ public class SavingsProductHelper {
|
||||
map.put("overdraftLimit", this.overdraftLimit);
|
||||
map.put("minRequiredBalance", this.minRequiredBalance);
|
||||
map.put("enforceMinRequiredBalance", this.enforceMinRequiredBalance);
|
||||
map.put("lienAllowed", this.lienAllowed);
|
||||
map.put("maxAllowedLienLimit", this.maxAllowedLienLimit);
|
||||
map.put("withHoldTax", this.withHoldTax.toString());
|
||||
|
||||
if (withHoldTax) {
|
||||
@@ -216,16 +220,22 @@ public class SavingsProductHelper {
|
||||
return this;
|
||||
}
|
||||
|
||||
public SavingsProductHelper withMinRequiredBalance(String minBalance) {
|
||||
this.minRequiredBalance = minBalance;
|
||||
public SavingsProductHelper withMinRequiredBalance(final String minRequiredBalance) {
|
||||
this.minRequiredBalance = minRequiredBalance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SavingsProductHelper withEnforceMinRequiredBalance(String enforceMinRequiredBalance) {
|
||||
public SavingsProductHelper withEnforceMinRequiredBalance(final String enforceMinRequiredBalance) {
|
||||
this.enforceMinRequiredBalance = enforceMinRequiredBalance;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SavingsProductHelper withLienAllowed(final String maxAllowedLienLimit) {
|
||||
this.lienAllowed = "true";
|
||||
this.maxAllowedLienLimit = maxAllowedLienLimit;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SavingsProductHelper withOverDraft(final String overdraftLimit) {
|
||||
this.allowOverdraft = "true";
|
||||
this.overdraftLimit = overdraftLimit;
|
||||
|
||||
Reference in New Issue
Block a user