FINERACT-1806: Add charge-off reasons to loan product response

This commit is contained in:
Oleksii Novikov
2024-11-14 15:10:42 +01:00
committed by Adam Saghy
parent 6286d1f821
commit 628f27bf32
11 changed files with 197 additions and 5 deletions
@@ -1016,6 +1016,24 @@ final class LoanProductsApiResourceSwagger {
public String description;
}
static final class GetLoanProductsChargeOffReasonOptions {
private GetLoanProductsChargeOffReasonOptions() {}
@Schema(example = "2")
public Long id;
@Schema(example = "debit_card")
public String name;
@Schema(example = "2")
public Integer position;
@Schema(example = "Charge-Off reason description")
public String description;
@Schema(example = "true")
public Boolean active;
@Schema(example = "false")
public Boolean mandatory;
}
@Schema(example = "false")
public Boolean includeInBorrowerCycle;
@Schema(example = "false")
@@ -1068,6 +1086,7 @@ final class LoanProductsApiResourceSwagger {
public List<StringEnumOptionData> supportedInterestRefundTypes;
public List<StringEnumOptionData> supportedInterestRefundTypesOptions;
public List<GetLoanProductsChargeOffReasonOptions> chargeOffReasonOptions;
}
@Schema(description = "GetLoanProductsProductIdResponse")
@@ -1342,6 +1361,7 @@ final class LoanProductsApiResourceSwagger {
@Schema(example = "false")
public Boolean enableAccrualActivityPosting;
public List<StringEnumOptionData> supportedInterestRefundTypes;
public List<GetLoanProductsTemplateResponse.GetLoanProductsChargeOffReasonOptions> chargeOffReasonOptions;
}
@Schema(description = "PutLoanProductsProductIdRequest")
@@ -32,6 +32,7 @@ import org.apache.fineract.accounting.common.AccountingRuleType;
import org.apache.fineract.accounting.glaccount.data.GLAccountData;
import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper;
import org.apache.fineract.accounting.producttoaccountmapping.data.PaymentTypeToGLAccountMapper;
import org.apache.fineract.infrastructure.codes.data.CodeValueData;
import org.apache.fineract.infrastructure.core.data.EnumOptionData;
import org.apache.fineract.infrastructure.core.data.StringEnumOptionData;
import org.apache.fineract.organisation.monetary.data.CurrencyData;
@@ -212,6 +213,8 @@ public class LoanProductData implements Serializable {
private final boolean isEqualAmortization;
private final BigDecimal fixedPrincipalPercentagePerInstallment;
private final List<CodeValueData> chargeOffReasonOptions;
// Delinquency Buckets
private final Collection<DelinquencyBucketData> delinquencyBucketOptions;
private final DelinquencyBucketData delinquencyBucket;
@@ -913,6 +916,7 @@ public class LoanProductData implements Serializable {
this.enableAccrualActivityPosting = enableAccrualActivityPosting;
this.supportedInterestRefundTypes = supportedInterestRefundTypes;
this.supportedInterestRefundTypesOptions = null;
this.chargeOffReasonOptions = null;
}
public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions,
@@ -935,7 +939,7 @@ public class LoanProductData implements Serializable {
final List<EnumOptionData> advancedPaymentAllocationTypes, final List<EnumOptionData> loanScheduleTypeOptions,
final List<EnumOptionData> loanScheduleProcessingTypeOptions, final List<EnumOptionData> creditAllocationTransactionTypes,
final List<EnumOptionData> creditAllocationAllocationTypes,
final List<StringEnumOptionData> supportedInterestRefundTypesOptions) {
final List<StringEnumOptionData> supportedInterestRefundTypesOptions, final List<CodeValueData> chargeOffReasonOptions) {
this.id = productData.id;
this.name = productData.name;
@@ -1092,6 +1096,7 @@ public class LoanProductData implements Serializable {
this.enableAccrualActivityPosting = productData.enableAccrualActivityPosting;
this.supportedInterestRefundTypesOptions = supportedInterestRefundTypesOptions;
this.supportedInterestRefundTypes = productData.supportedInterestRefundTypes;
this.chargeOffReasonOptions = chargeOffReasonOptions;
}
private Collection<ChargeData> nullIfEmpty(final Collection<ChargeData> charges) {