FINERACT-1818-Additions-to-LoanAccount-Avro-data

This commit is contained in:
Ruchi Dhamankar
2022-12-28 16:14:06 +01:00
committed by Arnold Gálovics
parent fb1dbb078f
commit c260b045b8
2 changed files with 111 additions and 0 deletions
@@ -306,6 +306,110 @@
"null",
"string"
]
},
{
"default": null,
"name": "totalMerchantRefund",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalMerchantRefundReversed",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalPayoutRefund",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalPayoutRefundReversed",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalGoodwillCredit",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalGoodwillCreditReversed",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalChargeAdjustment",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalChargeAdjustmentReversed",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalChargeback",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalCreditBalanceRefund",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalCreditBalanceRefundReversed",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalRepaymentTransaction",
"type": [
"null",
"bigdecimal"
]
},
{
"default": null,
"name": "totalRepaymentTransactionReversed",
"type": [
"null",
"bigdecimal"
]
}
]
}
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.infrastructure.event.external.service.serialization.serializer.loan;
import java.util.Collection;
import lombok.RequiredArgsConstructor;
import org.apache.avro.generic.GenericContainer;
import org.apache.fineract.avro.generator.ByteBufferSerializable;
@@ -27,6 +28,8 @@ import org.apache.fineract.infrastructure.event.business.domain.loan.LoanBusines
import org.apache.fineract.infrastructure.event.external.service.serialization.mapper.loan.LoanAccountDataMapper;
import org.apache.fineract.infrastructure.event.external.service.serialization.serializer.AbstractBusinessEventSerializer;
import org.apache.fineract.portfolio.loanaccount.data.LoanAccountData;
import org.apache.fineract.portfolio.loanaccount.data.LoanSummaryData;
import org.apache.fineract.portfolio.loanaccount.data.LoanTransactionData;
import org.apache.fineract.portfolio.loanaccount.service.LoanReadPlatformService;
import org.springframework.stereotype.Component;
@@ -47,6 +50,10 @@ public class LoanBusinessEventSerializer extends AbstractBusinessEventSerializer
LoanBusinessEvent event = (LoanBusinessEvent) rawEvent;
LoanAccountData data = service.retrieveOne(event.get().getId());
data = service.fetchRepaymentScheduleData(data);
if (data.getSummary() != null) {
final Collection<LoanTransactionData> currentLoanTransactions = service.retrieveLoanTransactions(event.get().getId());
data.setSummary(LoanSummaryData.withTransactionAmountsSummary(data.getSummary(), currentLoanTransactions));
}
return mapper.map(data);
}