You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "Mk9894 (via GitHub)" <gi...@apache.org> on 2023/06/02 19:14:14 UTC

[GitHub] [fineract] Mk9894 commented on a diff in pull request #3192: FINERACT-1912 Support Pagination, sorting and filtering for Savings account transactions

Mk9894 commented on code in PR #3192:
URL: https://github.com/apache/fineract/pull/3192#discussion_r1214731701


##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/data/SavingsTransactionSearchResult.java:
##########
@@ -0,0 +1,152 @@
+/**
+ * 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.portfolio.savings.data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+import org.apache.fineract.organisation.monetary.data.CurrencyData;
+import org.apache.fineract.organisation.monetary.domain.ApplicationCurrency;
+import org.apache.fineract.portfolio.account.data.AccountTransferData;
+import org.apache.fineract.portfolio.account.domain.AccountTransferTransaction;
+import org.apache.fineract.portfolio.paymentdetail.data.PaymentDetailData;
+import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
+import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
+import org.apache.fineract.portfolio.savings.data.search.SavingsAccountTransactionSearchData;
+import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
+import org.apache.fineract.portfolio.savings.domain.SavingsAccountChargesPaidByData;
+import org.apache.fineract.portfolio.savings.service.SavingsEnumerations;
+import org.apache.fineract.useradministration.domain.AppUser;
+
+@Getter
+@AllArgsConstructor
+public class SavingsTransactionSearchResult {
+
+    private Long transactionId;
+    private Integer transactionType;
+    private LocalDate transactionDate;
+    private BigDecimal transactionAmount;
+    private Long releaseIdOfHoldAmountTransaction;
+    private String reasonForBlock;
+    private LocalDateTime createdDate;
+    private AppUser appUser;
+    private String note;
+    private BigDecimal runningBalance;
+    private boolean reversed;
+    private boolean reversalTransaction;
+    private Long originalTxnId;
+    private Boolean lienTransaction;
+    private boolean isManualTransaction;
+    private AccountTransferTransaction fromSavingsTransaction;
+    private AccountTransferTransaction toSavingsTransaction;
+    private SavingsAccount savingsAccount;
+    private PaymentDetail paymentDetail;
+    private ApplicationCurrency currency;
+
+    public static final SavingsAccountTransactionSearchData toSavingsAccountTransactionSearchData(SavingsTransactionSearchResult dto) {
+        final Long id = dto.getTransactionId();
+        final int transactionTypeInt = dto.getTransactionType();
+
+        final SavingsAccountTransactionEnumData transactionType = SavingsEnumerations.transactionType(transactionTypeInt);
+
+        final LocalDate date = dto.getTransactionDate();
+        final LocalDate submittedOnDate = Optional.ofNullable(dto.getCreatedDate()).map(LocalDateTime::toLocalDate).orElse(null);
+        final BigDecimal amount = Optional.ofNullable(dto.getTransactionAmount()).orElse(BigDecimal.ZERO);
+        final Long releaseTransactionId = Optional.ofNullable(dto.getReleaseIdOfHoldAmountTransaction()).orElse(0L);

Review Comment:
   @galovics I can return a null value if getReleaseIdOfHoldAmountTransaction is null . But The existing implementation of SavingsAccountTransactions returns a 0 value.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org