FINERACT-2232: Capitalized income - amortization in case of Preclose event
This commit is contained in:
committed by
Adam Saghy
parent
d1154c59ba
commit
e69378637d
+2
-1
@@ -34,7 +34,8 @@ public enum TransactionType {
|
||||
CHARGE_ADJUSTMENT("chargeAdjustment"), //
|
||||
INTEREST_PAYMENT_WAIVER("interestPaymentWaiver"), //
|
||||
REPAYMENT_AT_DISBURSEMENT("repaymentAtDisbursement"), //
|
||||
CAPITALIZED_INCOME("capitalizedIncome"),;
|
||||
CAPITALIZED_INCOME("capitalizedIncome"), //
|
||||
CAPITALIZED_INCOME_AMORTIZATION("capitalizedIncomeAmortization"),;
|
||||
|
||||
public final String value;
|
||||
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.test.messaging.event.loan.transaction;
|
||||
|
||||
public class LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent extends AbstractLoanTransactionEvent {
|
||||
|
||||
@Override
|
||||
public String getEventName() {
|
||||
return "LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent";
|
||||
}
|
||||
}
|
||||
+19
@@ -139,6 +139,7 @@ import org.apache.fineract.test.messaging.event.loan.transaction.BulkBusinessEve
|
||||
import org.apache.fineract.test.messaging.event.loan.transaction.LoanAccrualAdjustmentTransactionBusinessEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.transaction.LoanAccrualTransactionCreatedBusinessEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.transaction.LoanAdjustTransactionBusinessEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.transaction.LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.transaction.LoanChargeAdjustmentPostBusinessEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.transaction.LoanChargeOffEvent;
|
||||
import org.apache.fineract.test.messaging.event.loan.transaction.LoanChargeOffUndoEvent;
|
||||
@@ -4116,4 +4117,22 @@ public class LoanStepDef extends AbstractStepDef {
|
||||
.isEqualTo(ErrorMessageHelper.addCapitalizedIncomeExceedApprovedAmountFailure());
|
||||
}
|
||||
|
||||
@Then("LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent is raised on {string}")
|
||||
public void checkLoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent(final String date) throws IOException {
|
||||
Response<PostLoansResponse> loanCreateResponse = testContext().get(TestContextKey.LOAN_CREATE_RESPONSE);
|
||||
long loanId = loanCreateResponse.body().getLoanId();
|
||||
|
||||
Response<GetLoansLoanIdResponse> loanDetailsResponse = loansApi.retrieveLoan(loanId, false, "transactions", "", "").execute();
|
||||
ErrorHelper.checkSuccessfulApiCall(loanDetailsResponse);
|
||||
|
||||
List<GetLoansLoanIdTransactions> transactions = loanDetailsResponse.body().getTransactions();
|
||||
GetLoansLoanIdTransactions finalAmortizationTransaction = transactions.stream()
|
||||
.filter(t -> date.equals(FORMATTER.format(t.getDate())) && "Capitalized Income Amortization".equals(t.getType().getValue()))
|
||||
.findFirst().orElseThrow(
|
||||
() -> new IllegalStateException(String.format("No Capitalized Income Amortization transaction found on %s", date)));
|
||||
Long finalAmortizationTransactionId = finalAmortizationTransaction.getId();
|
||||
|
||||
eventAssertion.assertEventRaised(LoanCapitalizedIncomeAmortizationTransactionCreatedBusinessEvent.class,
|
||||
finalAmortizationTransactionId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user