FINERACT-2081: Update Loan data avro schemas with new delinquent fields

This commit is contained in:
Jose Alberto Hernandez
2024-07-18 10:33:41 +02:00
committed by Adam Saghy
parent eb06b40190
commit b3b14ba929
3 changed files with 62 additions and 0 deletions
@@ -104,6 +104,38 @@
"items": "org.apache.fineract.avro.loan.v1.LoanInstallmentDelinquencyBucketDataV1"
}
]
},
{
"default": null,
"name": "delinquentPrincipal",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "delinquentInterest",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "delinquentFee",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "delinquentPenalty",
"type": [
"null",
"bigdecimal"
]
}
]
}
@@ -426,6 +426,22 @@
"null",
"string"
]
},
{
"default": null,
"name": "totalUnpaidAccruedDueInterest",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalUnpaidAccruedNotDueInterest",
"type": [
"null",
"bigdecimal"
]
}
]
}
@@ -47,6 +47,7 @@ import org.junit.jupiter.api.extension.ExtendWith;
public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest {
private SchedulerJobHelper schedulerJobHelper = new SchedulerJobHelper(this.requestSpec);
private Gson gson = new Gson();
@Test
public void testSnapshotEventGenerationWhenLoanInstallmentIsNotPayed() {
@@ -92,6 +93,19 @@ public class CustomSnapshotEventIntegrationTest extends BaseLoanIntegrationTest
Assertions.assertEquals(1, allExternalEvents.size());
Assertions.assertEquals("LoanAccountCustomSnapshotBusinessEvent", allExternalEvents.get(0).getType());
Assertions.assertEquals(loanId, allExternalEvents.get(0).getAggregateRootId());
// Loan Delinquency data validation
final Map<String, Object> payLoad = (Map<String, Object>) allExternalEvents.get(0).getPayLoad().get("delinquent");
log.info("Payload: {}", payLoad.toString());
Assertions.assertNotNull(payLoad.get("delinquentPrincipal"));
Assertions.assertEquals(312.0, payLoad.get("delinquentPrincipal"));
Assertions.assertNotNull(payLoad.get("delinquentInterest"));
Assertions.assertEquals(0.0, payLoad.get("delinquentInterest"));
Assertions.assertNotNull(payLoad.get("delinquentFee"));
Assertions.assertEquals(0.0, payLoad.get("delinquentFee"));
Assertions.assertNotNull(payLoad.get("delinquentPenalty"));
Assertions.assertEquals(0.0, payLoad.get("delinquentPenalty"));
});
}