FINERACT-1724: Loan product delinquency bucket should not be mandatory
This commit is contained in:
committed by
Adam Saghy
parent
6526e101a1
commit
4e877451c3
+2
-2
@@ -343,8 +343,8 @@ public final class LoanProductDataValidator {
|
||||
if (this.fromApiJsonHelper.parameterExists(LoanProductConstants.DELINQUENCY_BUCKET_PARAM_NAME, element)) {
|
||||
final Long delinquencyBucketId = this.fromApiJsonHelper.extractLongNamed(LoanProductConstants.DELINQUENCY_BUCKET_PARAM_NAME,
|
||||
element);
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DELINQUENCY_BUCKET_PARAM_NAME).value(delinquencyBucketId).notNull()
|
||||
.integerGreaterThanZero();
|
||||
baseDataValidator.reset().parameter(LoanProductConstants.DELINQUENCY_BUCKET_PARAM_NAME).value(delinquencyBucketId)
|
||||
.ignoreIfNull().integerGreaterThanZero();
|
||||
}
|
||||
|
||||
// grace validation
|
||||
|
||||
+42
@@ -248,6 +248,48 @@ public class DelinquencyBucketsIntegrationTest {
|
||||
DelinquencyBucketsHelper.createDelinquencyBucket(requestSpec, response403Spec, jsonBucket);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoanProductCreationWithAndWithoutDelinquencyBucket() {
|
||||
// Given
|
||||
final LoanTransactionHelper loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec);
|
||||
|
||||
ArrayList<Integer> rangeIds = new ArrayList<>();
|
||||
// First Range
|
||||
String jsonRange = DelinquencyRangesHelper.getAsJSON(1, 3);
|
||||
PostDelinquencyRangeResponse delinquencyRangeResponse = DelinquencyRangesHelper.createDelinquencyRange(requestSpec, responseSpec,
|
||||
jsonRange);
|
||||
rangeIds.add(delinquencyRangeResponse.getResourceId());
|
||||
jsonRange = DelinquencyRangesHelper.getAsJSON(4, 60);
|
||||
|
||||
GetDelinquencyRangesResponse range = DelinquencyRangesHelper.getDelinquencyRange(requestSpec, responseSpec,
|
||||
delinquencyRangeResponse.getResourceId());
|
||||
|
||||
// Second Range
|
||||
delinquencyRangeResponse = DelinquencyRangesHelper.createDelinquencyRange(requestSpec, responseSpec, jsonRange);
|
||||
rangeIds.add(delinquencyRangeResponse.getResourceId());
|
||||
|
||||
range = DelinquencyRangesHelper.getDelinquencyRange(requestSpec, responseSpec, delinquencyRangeResponse.getResourceId());
|
||||
final String classificationExpected = range.getClassification();
|
||||
log.info("Expected Delinquency Range classification after Disbursement {}", classificationExpected);
|
||||
|
||||
String jsonBucket = DelinquencyBucketsHelper.getAsJSON(rangeIds);
|
||||
PostDelinquencyBucketResponse delinquencyBucketResponse = DelinquencyBucketsHelper.createDelinquencyBucket(requestSpec,
|
||||
responseSpec, jsonBucket);
|
||||
assertNotNull(delinquencyBucketResponse);
|
||||
final GetDelinquencyBucketsResponse delinquencyBucket = DelinquencyBucketsHelper.getDelinquencyBucket(requestSpec, responseSpec,
|
||||
delinquencyBucketResponse.getResourceId());
|
||||
|
||||
// Loan product creation without Delinquency bucket
|
||||
GetLoanProductsProductIdResponse getLoanProductResponse = createLoanProduct(loanTransactionHelper, null, null);
|
||||
assertNotNull(getLoanProductResponse);
|
||||
|
||||
// Loan product creation with Delinquency bucket
|
||||
getLoanProductResponse = createLoanProduct(loanTransactionHelper, Math.toIntExact(delinquencyBucket.getId()), null);
|
||||
assertNotNull(getLoanProductResponse);
|
||||
log.info("Loan Product Bucket Name: {}", getLoanProductResponse.getDelinquencyBucket().getName());
|
||||
assertEquals(getLoanProductResponse.getDelinquencyBucket().getName(), delinquencyBucket.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLoanClassificationRealtime() {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user