You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by ar...@apache.org on 2022/12/28 15:14:11 UTC
[fineract] branch develop updated: FINERACT-1818-Additions-to-LoanAccount-Avro-data
This is an automated email from the ASF dual-hosted git repository.
arnold pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new c260b045b FINERACT-1818-Additions-to-LoanAccount-Avro-data
c260b045b is described below
commit c260b045b81de453e1f1116434b61b4626b900f8
Author: Ruchi Dhamankar <ru...@gmail.com>
AuthorDate: Wed Dec 28 13:00:03 2022 +0530
FINERACT-1818-Additions-to-LoanAccount-Avro-data
---
.../src/main/avro/loan/v1/LoanSummaryDataV1.avsc | 104 +++++++++++++++++++++
.../loan/LoanBusinessEventSerializer.java | 7 ++
2 files changed, 111 insertions(+)
diff --git a/fineract-avro-schemas/src/main/avro/loan/v1/LoanSummaryDataV1.avsc b/fineract-avro-schemas/src/main/avro/loan/v1/LoanSummaryDataV1.avsc
index f19879e95..951d4cf78 100644
--- a/fineract-avro-schemas/src/main/avro/loan/v1/LoanSummaryDataV1.avsc
+++ b/fineract-avro-schemas/src/main/avro/loan/v1/LoanSummaryDataV1.avsc
@@ -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"
+ ]
}
]
}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanBusinessEventSerializer.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanBusinessEventSerializer.java
index b8742fc66..b87755523 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanBusinessEventSerializer.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/event/external/service/serialization/serializer/loan/LoanBusinessEventSerializer.java
@@ -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);
}