Skip to content

Commit

Permalink
Revert "FINERACT-1932: Fineract modularization - fineract-savings"
Browse files Browse the repository at this point in the history
This reverts commit b9314d0.
  • Loading branch information
adamsaghy committed Dec 15, 2023
1 parent f981ffe commit 834cfb6
Show file tree
Hide file tree
Showing 213 changed files with 78 additions and 352 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ buildscript {
'fineract-provider',
'fineract-investor',
'fineract-loan',
'fineract-savings',
'integration-tests',
'twofactor-tests',
'oauth2-tests',
Expand All @@ -47,8 +46,7 @@ buildscript {
'fineract-core',
'fineract-provider',
'fineract-investor',
'fineract-loan',
'fineract-savings'
'fineract-loan'
].contains(it.name)
}
npmRepository = 'https://npm.pkg.github.com'
Expand Down
1 change: 0 additions & 1 deletion fineract-provider/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies {
implementation(project(path: ':fineract-core'))
implementation(project(path: ':fineract-investor'))
implementation(project(path: ':fineract-loan'))
implementation(project(path: ':fineract-savings'))
providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")

// Never use "compile" scope, but make all dependencies either 'implementation', 'runtimeOnly' or 'testCompile'.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,41 @@
import jakarta.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;
import lombok.Getter;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.service.MathUtil;
import org.apache.fineract.portfolio.note.domain.Note;
import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType;
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
import org.apache.fineract.portfolio.savings.domain.SavingsAccountChargePaidBy;
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;
import org.apache.fineract.portfolio.savings.service.SavingsEnumerations;

@Getter
public class InteropTransactionData extends CommandProcessingResult {

// private final SavingsAccountTransactionEnumData transactionType;
// private final PaymentDetailData paymentDetailData;
// private final BigDecimal outstandingChargeAmount;
// private final boolean reversed;
// private final AccountTransferData transfer;
// private final LocalDate submittedOnDate;
// private final boolean interestedPostedAsOn;
// private final String submittedByUsername;
// // templates
// final Collection<PaymentTypeData> paymentTypeOptions;
// //import fields
// private Long paymentTypeId;
// private String checkNumber;
// private String routingCode;
// private String receiptNumber;
// private String bankNumber;

// private String transactionReference;
// private String statementReference;
// private CreditDebitType creditDebit;
// private TransactionStatus status;
// private String transactionInformation;
// private String addressLine;

@NotNull
private final String accountId;
@NotNull
Expand All @@ -52,7 +75,7 @@ public class InteropTransactionData extends CommandProcessingResult {
@NotNull
private final LocalDate valueDateTime;

private String note;
private final String note;

public InteropTransactionData(Long entityId, String accountId, String transactionId, SavingsAccountTransactionType transactionType,
BigDecimal amount, BigDecimal chargeAmount, String currency, BigDecimal accountBalance, LocalDate bookingDateTime,
Expand Down Expand Up @@ -94,14 +117,33 @@ public static InteropTransactionData build(SavingsAccountTransaction transaction
LocalDate valueDateTime = endOfBalanceLocalDate == null ? bookingDateTime : endOfBalanceLocalDate;

StringBuilder sb = new StringBuilder();
sb.append(SavingsEnumerations.transactionType(transactionType).getValue());
int currLength = 0;
for (Note note : transaction.getNotes()) {
String s = note.getNote();
if (s == null) {
continue;
}

int availableLength = 500 - currLength;
if (availableLength <= 1) {
break;
}

if (currLength > 0) {
sb.append(' ');
availableLength--;
}
if (s.length() > availableLength) {
s = s.substring(availableLength);
}
sb.append(s);
currLength = sb.length();
}
if (currLength == 0) {
sb.append(SavingsEnumerations.transactionType(transactionType).getValue());
}

return new InteropTransactionData(savingsAccount.getId(), savingsAccount.getExternalId().getValue(), transactionId, transactionType,
amount, chargeAmount, currency, runningBalance, bookingDateTime, valueDateTime, sb.toString());
}

public void updateNote(String note) {
this.note = note;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import lombok.Getter;
import lombok.Setter;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.infrastructure.core.service.DateUtils;
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
import org.apache.fineract.portfolio.savings.domain.SavingsAccountTransaction;

@Getter
@Setter
public class InteropTransactionsData extends CommandProcessingResult {

List<InteropTransactionData> transactions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import org.apache.fineract.interoperation.data.InteropQuoteRequestData;
import org.apache.fineract.interoperation.data.InteropQuoteResponseData;
import org.apache.fineract.interoperation.data.InteropRequestData;
import org.apache.fineract.interoperation.data.InteropTransactionData;
import org.apache.fineract.interoperation.data.InteropTransactionRequestData;
import org.apache.fineract.interoperation.data.InteropTransactionRequestResponseData;
import org.apache.fineract.interoperation.data.InteropTransactionsData;
Expand Down Expand Up @@ -219,27 +218,7 @@ public InteropTransactionsData getAccountTransactions(@NotNull String accountId,
return (transactionsTo == null || transactionsTo.compareTo(transactionDate) > 0) && (transactionsFrom == null
|| transactionsFrom.compareTo(transactionDate.withHour(23).withMinute(59).withSecond(59)) <= 0);
};
InteropTransactionsData interopTransactionsData = InteropTransactionsData.build(savingsAccount, transFilter);
for (InteropTransactionData interopTransactionData : interopTransactionsData.getTransactions()) {
final List<Note> transactionNotes = noteRepository
.findBySavingsTransactionId(Long.valueOf(interopTransactionData.getTransactionId()));
StringBuilder sb = new StringBuilder();
for (final Note note : transactionNotes) {
String s = note.getNote();
if (s == null) {
continue;
}
sb.append(s + " ");
}
if (sb.toString().length() > 0) {
String text = interopTransactionData.getNote() + " " + sb.toString();
if (text.length() > 500) {
text = text.substring(0, 500);
}
interopTransactionData.updateNote(text);
}
}
return interopTransactionsData;
return InteropTransactionsData.build(savingsAccount, transFilter);
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import org.apache.fineract.organisation.holiday.domain.Holiday;
import org.apache.fineract.organisation.holiday.domain.HolidayRepository;
import org.apache.fineract.organisation.holiday.domain.HolidayStatusType;
import org.apache.fineract.organisation.monetary.exception.InvalidCurrencyException;
import org.apache.fineract.organisation.staff.domain.Staff;
import org.apache.fineract.organisation.staff.domain.StaffRepository;
import org.apache.fineract.organisation.staff.exception.StaffNotFoundException;
Expand Down Expand Up @@ -82,6 +81,7 @@
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRelatedDetail;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository;
import org.apache.fineract.portfolio.loanproduct.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.loanproduct.exception.LinkedAccountRequiredException;
import org.apache.fineract.portfolio.loanproduct.exception.LoanProductNotFoundException;
import org.apache.fineract.portfolio.rate.domain.Rate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.organisation.monetary.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.account.PortfolioAccountType;
import org.apache.fineract.portfolio.account.data.AccountTransferDTO;
import org.apache.fineract.portfolio.account.data.PortfolioAccountData;
Expand Down Expand Up @@ -126,6 +125,7 @@
import org.apache.fineract.portfolio.loanaccount.loanschedule.domain.ScheduledDateGenerator;
import org.apache.fineract.portfolio.loanaccount.serialization.LoanChargeApiJsonValidator;
import org.apache.fineract.portfolio.loanproduct.data.LoanOverdueDTO;
import org.apache.fineract.portfolio.loanproduct.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.loanproduct.exception.LinkedAccountRequiredException;
import org.apache.fineract.portfolio.note.domain.Note;
import org.apache.fineract.portfolio.note.domain.NoteRepository;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.fineract.organisation.monetary.exception;
package org.apache.fineract.portfolio.loanproduct.exception;

import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.apache.fineract.infrastructure.event.business.domain.loan.product.LoanProductCreateBusinessEvent;
import org.apache.fineract.infrastructure.event.business.service.BusinessEventNotifierService;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.monetary.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.charge.domain.Charge;
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
import org.apache.fineract.portfolio.delinquency.domain.DelinquencyBucket;
Expand All @@ -58,6 +57,7 @@
import org.apache.fineract.portfolio.loanproduct.domain.LoanProduct;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductPaymentAllocationRule;
import org.apache.fineract.portfolio.loanproduct.domain.LoanProductRepository;
import org.apache.fineract.portfolio.loanproduct.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.loanproduct.exception.LoanProductCannotBeModifiedDueToNonClosedLoansException;
import org.apache.fineract.portfolio.loanproduct.exception.LoanProductDateException;
import org.apache.fineract.portfolio.loanproduct.exception.LoanProductNotFoundException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface NoteRepository extends JpaRepository<Note, Long>, JpaSpecificationExecutor<Note> {

Expand All @@ -48,8 +46,4 @@ public interface NoteRepository extends JpaRepository<Note, Long>, JpaSpecificat
List<Note> findBySavingsAccount(SavingsAccount savingAccount);

Note findBySavingsAccountAndId(SavingsAccount savingAccount, Long id);

@Query("select note from Note note where note.savingsTransaction.id = :savingsTransactionId")
List<Note> findBySavingsTransactionId(@Param("savingsTransactionId") Long savingsTransactionId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

import static org.apache.fineract.infrastructure.core.service.DateUtils.getSystemZoneId;

import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToOne;
import jakarta.persistence.Table;
import java.math.BigDecimal;
import java.time.LocalDate;
Expand All @@ -33,6 +35,7 @@
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.portfolio.loanaccount.guarantor.domain.GuarantorFundingTransaction;
import org.apache.fineract.portfolio.savings.DepositAccountOnHoldTransactionType;

@Entity
Expand All @@ -59,6 +62,9 @@ public class DepositAccountOnHoldTransaction extends AbstractAuditableWithUTCDat
@Column(name = "created_date", nullable = true)
private LocalDateTime createdDateToRemove;

@OneToOne(cascade = CascadeType.ALL, mappedBy = "depositAccountOnHoldTransaction", optional = true, orphanRemoval = true)
private GuarantorFundingTransaction guarantorFundingTransaction;

protected DepositAccountOnHoldTransaction() {}

private DepositAccountOnHoldTransaction(final SavingsAccount savingsAccount, final BigDecimal amount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@
import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.charge.domain.Charge;
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
import org.apache.fineract.portfolio.charge.exception.ChargeCannotBeAppliedToException;
import org.apache.fineract.portfolio.interestratechart.domain.InterestRateChart;
import org.apache.fineract.portfolio.interestratechart.service.InterestRateChartAssembler;
import org.apache.fineract.portfolio.loanproduct.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.savings.PreClosurePenalInterestOnType;
import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.organisation.office.domain.Office;
import org.apache.fineract.portfolio.note.domain.Note;
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionEnumData;
Expand Down Expand Up @@ -126,6 +127,10 @@ public final class SavingsAccountTransaction extends AbstractAuditableWithUTCDat
@Column(name = "reason_for_block", nullable = true)
private String reasonForBlock;

@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "savings_account_transaction_id", referencedColumnName = "id")
private List<Note> notes = new ArrayList<>();

@Column(name = "is_reversal", nullable = false)
private boolean reversalTransaction;

Expand Down Expand Up @@ -423,6 +428,10 @@ public List<SavingsAccountTransactionTaxDetails> getTaxDetails() {
return this.taxDetails;
}

public List<Note> getNotes() {
return notes;
}

public Integer getTypeOf() {
return this.typeOf;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@
import org.apache.fineract.accounting.common.AccountingRuleType;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.charge.domain.Charge;
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
import org.apache.fineract.portfolio.charge.exception.ChargeCannotBeAppliedToException;
import org.apache.fineract.portfolio.loanproduct.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType;
import org.apache.fineract.portfolio.savings.SavingsInterestCalculationType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import org.apache.fineract.infrastructure.dataqueries.data.EntityTables;
import org.apache.fineract.infrastructure.dataqueries.data.ResultsetColumnHeaderData;
import org.apache.fineract.infrastructure.dataqueries.service.GenericDataService;
import org.apache.fineract.infrastructure.dataqueries.service.ReadWriteNonCoreDataService;
import org.apache.fineract.infrastructure.dataqueries.service.ReadWriteNonCoreDataServiceImpl;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.portfolio.savings.SavingsAccountTransactionType;
import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData;
Expand All @@ -66,7 +66,7 @@ public class SavingsAccountTransactionsSearchServiceImpl implements SavingsAccou
private final PlatformSecurityContext context;
private final GenericDataService genericDataService;
private final DatabaseSpecificSQLGenerator sqlGenerator;
private final ReadWriteNonCoreDataService datatableService;
private final ReadWriteNonCoreDataServiceImpl datatableService;
private final DataTableValidator dataTableValidator;
private final JdbcTemplate jdbcTemplate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.domain.Money;
import org.apache.fineract.organisation.monetary.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.accounts.constants.ShareAccountApiConstants;
import org.apache.fineract.portfolio.charge.domain.Charge;
import org.apache.fineract.portfolio.charge.domain.ChargeCalculationType;
Expand All @@ -55,6 +54,7 @@
import org.apache.fineract.portfolio.client.domain.Client;
import org.apache.fineract.portfolio.client.domain.ClientRepositoryWrapper;
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
import org.apache.fineract.portfolio.loanproduct.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.savings.DepositAccountType;
import org.apache.fineract.portfolio.savings.domain.SavingsAccount;
import org.apache.fineract.portfolio.savings.domain.SavingsAccountRepositoryWrapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
import org.apache.fineract.organisation.monetary.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.charge.domain.Charge;
import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
import org.apache.fineract.portfolio.common.domain.PeriodFrequencyType;
import org.apache.fineract.portfolio.loanproduct.exception.InvalidCurrencyException;
import org.apache.fineract.portfolio.shareproducts.constants.ShareProductApiConstants;
import org.apache.fineract.portfolio.shareproducts.data.ShareProductMarketPriceData;
import org.apache.fineract.portfolio.shareproducts.domain.ShareProduct;
Expand Down
Loading

0 comments on commit 834cfb6

Please sign in to comment.