FINERACT-1668: Adding Configuration for reversal transaction (#2454)
Co-authored-by: Dhaval Maniyar <dhavalmaniyar@Dhavals-MacBook-Pro.local>
This commit is contained in:
co-authored by
Dhaval Maniyar
parent
e15459c659
commit
4685e96c81
+64
@@ -2990,6 +2990,70 @@ public class ClientSavingsIntegrationTest {
|
||||
assertEquals("error.msg.savings.transaction.is.not.allowed", error.get(0).get(CommonConstants.RESPONSE_ERROR_MESSAGE_CODE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReversalEntriesAfterSystemReversingTransactionWithReversalConfigOn() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.savingsProductHelper = new SavingsProductHelper();
|
||||
this.scheduleJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec, "46", true);
|
||||
LocalDate transactionDate = LocalDate.now(Utils.getZoneIdOfTenant()).minusDays(5);
|
||||
LocalDate nextTransactionDate = transactionDate.plusDays(2);
|
||||
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy");
|
||||
String startDate = formatter.format(transactionDate);
|
||||
String nxtTransaction = formatter.format(nextTransactionDate);
|
||||
final String jobName = "Post Interest For Savings";
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, startDate);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
final Integer savingsId = createSavingsAccountDailyPostingOverdraft(clientID, startDate);
|
||||
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "100", startDate, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
this.scheduleJobHelper.executeAndAwaitJob(jobName);
|
||||
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "100", nxtTransaction, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
List<HashMap> transactions = this.savingsAccountHelper.getSavingsTransactions(savingsId);
|
||||
boolean reversalFlag = false;
|
||||
for (int i = 0; i < transactions.size(); i++) {
|
||||
boolean isReversal = (boolean) transactions.get(i).get("isReversal");
|
||||
if (isReversal) {
|
||||
reversalFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Assertions.assertTrue(reversalFlag);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReversalEntriesAfterSystemReversingTransactionWithReversalConfigOff() {
|
||||
this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, this.responseSpec);
|
||||
this.savingsProductHelper = new SavingsProductHelper();
|
||||
this.scheduleJobHelper = new SchedulerJobHelper(requestSpec);
|
||||
GlobalConfigurationHelper.updateEnabledFlagForGlobalConfiguration(this.requestSpec, this.responseSpec, "46", false);
|
||||
LocalDate transactionDate = LocalDate.now(Utils.getZoneIdOfTenant()).minusDays(5);
|
||||
LocalDate nextTransactionDate = transactionDate.plusDays(2);
|
||||
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMMM yyyy");
|
||||
String startDate = formatter.format(transactionDate);
|
||||
String nxtTransaction = formatter.format(nextTransactionDate);
|
||||
final String jobName = "Post Interest For Savings";
|
||||
final Integer clientID = ClientHelper.createClient(this.requestSpec, this.responseSpec, startDate);
|
||||
Assertions.assertNotNull(clientID);
|
||||
|
||||
final Integer savingsId = createSavingsAccountDailyPostingOverdraft(clientID, startDate);
|
||||
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "100", startDate, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
this.scheduleJobHelper.executeAndAwaitJob(jobName);
|
||||
this.savingsAccountHelper.withdrawalFromSavingsAccount(savingsId, "100", nxtTransaction, CommonConstants.RESPONSE_RESOURCE_ID);
|
||||
|
||||
List<HashMap> transactions = this.savingsAccountHelper.getSavingsTransactions(savingsId);
|
||||
boolean reversalFlag = false;
|
||||
for (int i = 0; i < transactions.size(); i++) {
|
||||
boolean isReversal = (boolean) transactions.get(i).get("isReversal");
|
||||
if (isReversal) {
|
||||
reversalFlag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Assertions.assertFalse(reversalFlag);
|
||||
}
|
||||
|
||||
private Integer createSavingsAccountDailyPostingOverdraft(final Integer clientID, final String startDate) {
|
||||
final Integer savingsProductID = createSavingsProductDailyPostingOverdraft();
|
||||
Assertions.assertNotNull(savingsProductID);
|
||||
|
||||
+10
-2
@@ -99,8 +99,8 @@ public class GlobalConfigurationHelper {
|
||||
ArrayList<HashMap> actualGlobalConfigurations = getAllGlobalConfigurations(requestSpec, responseSpec);
|
||||
|
||||
// There are currently 37 global configurations.
|
||||
Assertions.assertEquals(40, expectedGlobalConfigurations.size());
|
||||
Assertions.assertEquals(40, actualGlobalConfigurations.size());
|
||||
Assertions.assertEquals(41, expectedGlobalConfigurations.size());
|
||||
Assertions.assertEquals(41, actualGlobalConfigurations.size());
|
||||
|
||||
for (int i = 0; i < expectedGlobalConfigurations.size(); i++) {
|
||||
|
||||
@@ -456,6 +456,14 @@ public class GlobalConfigurationHelper {
|
||||
isAutomaticCOBDateAdjustmentEnabled.put("trapDoor", false);
|
||||
defaults.add(isAutomaticCOBDateAdjustmentEnabled);
|
||||
|
||||
HashMap<String, Object> isReversalTransactionAllowed = new HashMap<>();
|
||||
isReversalTransactionAllowed.put("id", 46);
|
||||
isReversalTransactionAllowed.put("name", "enable-post-reversal-txns-for-reverse-transactions");
|
||||
isReversalTransactionAllowed.put("value", 0);
|
||||
isReversalTransactionAllowed.put("enabled", false);
|
||||
isReversalTransactionAllowed.put("trapDoor", false);
|
||||
defaults.add(isReversalTransactionAllowed);
|
||||
|
||||
return defaults;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user