Skip to content

Commit 9cb6c33

Browse files
author
Jose Alberto Hernandez
committed
FINERACT-2311: Add Buy Down Fees transaction support
1 parent ba06234 commit 9cb6c33

File tree

20 files changed

+594
-9
lines changed

20 files changed

+594
-9
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.fineract.test.messaging.event.loan.transaction;
20+
21+
public class LoanTransactionBuyDownFeeAdjustmentPostBusinessEvent extends AbstractLoanTransactionEvent {
22+
23+
@Override
24+
public String getEventName() {
25+
return "LoanTransactionBuyDownFeeAdjustmentPostBusinessEvent";
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.fineract.test.messaging.event.loan.transaction;
20+
21+
public class LoanTransactionBuyDownFeePostBusinessEvent extends AbstractLoanTransactionEvent {
22+
23+
@Override
24+
public String getEventName() {
25+
return "LoanTransactionBuyDownFeePostBusinessEvent";
26+
}
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.fineract.infrastructure.event.business.domain.loan.transaction;
20+
21+
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
22+
23+
public class LoanTransactionBuyDownFeeAdjustmentPostBusinessEvent extends LoanTransactionBusinessEvent {
24+
25+
private static final String TYPE = "LoanTransactionBuyDownFeeAdjustmentPostBusinessEvent";
26+
27+
public LoanTransactionBuyDownFeeAdjustmentPostBusinessEvent(LoanTransaction value) {
28+
super(value);
29+
}
30+
31+
@Override
32+
public String getType() {
33+
return TYPE;
34+
}
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package org.apache.fineract.infrastructure.event.business.domain.loan.transaction;
20+
21+
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
22+
23+
public class LoanTransactionBuyDownFeePostBusinessEvent extends LoanTransactionBusinessEvent {
24+
25+
private static final String TYPE = "LoanTransactionBuyDownFeePostBusinessEvent";
26+
27+
public LoanTransactionBuyDownFeePostBusinessEvent(LoanTransaction value) {
28+
super(value);
29+
}
30+
31+
@Override
32+
public String getType() {
33+
return TYPE;
34+
}
35+
}

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/api/LoanApiConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ public interface LoanApiConstants {
181181
String CAPITALIZED_INCOME_ADJUSTMENT_TRANSACTION_COMMAND = "capitalizedIncomeAdjustment";
182182
String CONTRACT_TERMINATION_COMMAND = "contractTermination";
183183
String UNDO_CONTRACT_TERMINATION_COMMAND = "undoContractTermination";
184+
String BUY_DOWN_FEE_COMMAND = "buyDownFee";
185+
String BUY_DOWN_FEE_ADJUSTMENT_COMMAND = "buyDownFeeAdjustment";
184186

185187
// Data Validator names
186188
String LOAN_FRAUD_DATAVALIDATOR_PREFIX = "loans.fraud";

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/data/LoanTransactionEnumData.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public class LoanTransactionEnumData implements Serializable {
7272
private final boolean capitalizedIncomeAdjustment;
7373
private final boolean capitalizedIncomeAmortizationAdjustment;
7474
private final boolean contractTermination;
75+
private final boolean buyDownFee;
76+
private final boolean buyDownFeeAdjustment;
7577

7678
public LoanTransactionEnumData(final Long id, final String code, final String value) {
7779
this.id = id;
@@ -114,6 +116,8 @@ public LoanTransactionEnumData(final Long id, final String code, final String va
114116
this.capitalizedIncomeAmortizationAdjustment = Long
115117
.valueOf(LoanTransactionType.CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT.getValue()).equals(this.id);
116118
this.contractTermination = Long.valueOf(LoanTransactionType.CONTRACT_TERMINATION.getValue()).equals(this.id);
119+
this.buyDownFee = Long.valueOf(LoanTransactionType.BUY_DOWN_FEE.getValue()).equals(this.id);
120+
this.buyDownFeeAdjustment = Long.valueOf(LoanTransactionType.BUY_DOWN_FEE_ADJUSTMENT.getValue()).equals(this.id);
117121
}
118122

119123
public boolean isRepaymentType() {

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTransactionType.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,10 @@ public enum LoanTransactionType {
7070
CAPITALIZED_INCOME(35, "loanTransactionType.capitalizedIncome"), //
7171
CAPITALIZED_INCOME_AMORTIZATION(36, "loanTransactionType.capitalizedIncomeAmortization"), //
7272
CAPITALIZED_INCOME_ADJUSTMENT(37, "loanTransactionType.capitalizedIncomeAdjustment"), //
73-
CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT(39, "loanTransactionType.capitalizedIncomeAmortizationAdjustment"), //
74-
// Kind of Final Transactions
7573
CONTRACT_TERMINATION(38, "loanTransactionType.contractTermination"), //
74+
CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT(39, "loanTransactionType.capitalizedIncomeAmortizationAdjustment"), //
75+
BUY_DOWN_FEE(40, "loanTransactionType.buyDownFee"), //
76+
BUY_DOWN_FEE_ADJUSTMENT(41, "loanTransactionType.buyDownFeeAdjustment"), //
7677
;
7778

7879
private final Integer value;
@@ -128,6 +129,8 @@ public static LoanTransactionType fromInt(final Integer transactionType) {
128129
case 37 -> LoanTransactionType.CAPITALIZED_INCOME_ADJUSTMENT;
129130
case 38 -> LoanTransactionType.CONTRACT_TERMINATION;
130131
case 39 -> LoanTransactionType.CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT;
132+
case 40 -> LoanTransactionType.BUY_DOWN_FEE;
133+
case 41 -> LoanTransactionType.BUY_DOWN_FEE_ADJUSTMENT;
131134
default -> LoanTransactionType.INVALID;
132135
};
133136
}
@@ -256,4 +259,12 @@ public boolean isCapitalizedIncomeAdjustment() {
256259
public boolean isContractTermination() {
257260
return this == LoanTransactionType.CONTRACT_TERMINATION;
258261
}
262+
263+
public boolean isBuyDownFee() {
264+
return this == LoanTransactionType.BUY_DOWN_FEE;
265+
}
266+
267+
public boolean isBuyDownFeeAdjustment() {
268+
return this == LoanTransactionType.BUY_DOWN_FEE_ADJUSTMENT;
269+
}
259270
}

fineract-loan/src/main/java/org/apache/fineract/portfolio/loanproduct/service/LoanEnumerations.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ public static LoanTransactionEnumData transactionType(final LoanTransactionType
338338
case CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT -> new LoanTransactionEnumData(
339339
LoanTransactionType.CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT.getValue().longValue(),
340340
LoanTransactionType.CAPITALIZED_INCOME_AMORTIZATION_ADJUSTMENT.getCode(), "Capitalized Income Amortization Adjustment");
341+
case BUY_DOWN_FEE -> new LoanTransactionEnumData(LoanTransactionType.BUY_DOWN_FEE.getValue().longValue(),
342+
LoanTransactionType.BUY_DOWN_FEE.getCode(), "Buy Down Fee");
343+
case BUY_DOWN_FEE_ADJUSTMENT -> new LoanTransactionEnumData(LoanTransactionType.BUY_DOWN_FEE_ADJUSTMENT.getValue().longValue(),
344+
LoanTransactionType.BUY_DOWN_FEE_ADJUSTMENT.getCode(), "Buy Down Fee Adjustment");
341345
};
342346
}
343347

fineract-loan/src/main/resources/db/changelog/tenant/module/loan/module-changelog-master.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@
5353
<include relativeToChangelogFile="true" file="parts/1028_add_missing_indexes.xml"/>
5454
<include relativeToChangelogFile="true" file="parts/1029_add_installment_amount_in_multiples_of_to_loan.xml"/>
5555
<include relativeToChangelogFile="true" file="parts/1030_add_loan_undo_contract_termination_event.xml"/>
56+
<include relativeToChangelogFile="true" file="parts/1031_add_buy_down_transaction_type.xml"/>
5657
</databaseChangeLog>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
4+
Licensed to the Apache Software Foundation (ASF) under one
5+
or more contributor license agreements. See the NOTICE file
6+
distributed with this work for additional information
7+
regarding copyright ownership. The ASF licenses this file
8+
to you under the Apache License, Version 2.0 (the
9+
"License"); you may not use this file except in compliance
10+
with the License. You may obtain a copy of the License at
11+
12+
http://www.apache.org/licenses/LICENSE-2.0
13+
14+
Unless required by applicable law or agreed to in writing,
15+
software distributed under the License is distributed on an
16+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17+
KIND, either express or implied. See the License for the
18+
specific language governing permissions and limitations
19+
under the License.
20+
21+
-->
22+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.3.xsd">
25+
<changeSet author="fineract" id="1">
26+
<insert tableName="r_enum_value">
27+
<column name="enum_name" value="transaction_type_enum"/>
28+
<column name="enum_id" valueNumeric="40"/>
29+
<column name="enum_message_property" value="Buy Down Fee"/>
30+
<column name="enum_value" value="Buy Down Fee"/>
31+
<column name="enum_type" valueBoolean="false"/>
32+
</insert>
33+
</changeSet>
34+
<changeSet author="fineract" id="2">
35+
<insert tableName="r_enum_value">
36+
<column name="enum_name" value="transaction_type_enum"/>
37+
<column name="enum_id" valueNumeric="41"/>
38+
<column name="enum_message_property" value="Buy Down Fee Adjustment"/>
39+
<column name="enum_value" value="Buy Down Fee Adjustment"/>
40+
<column name="enum_type" valueBoolean="false"/>
41+
</insert>
42+
</changeSet>
43+
</databaseChangeLog>

0 commit comments

Comments
 (0)