current account save api update
This commit is contained in:
+386
@@ -0,0 +1,386 @@
|
||||
/**
|
||||
* 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.currentaccount.domain;
|
||||
|
||||
import jakarta.persistence.CascadeType;
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.OneToMany;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableCustom;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
import org.apache.fineract.portfolio.client.domain.Client;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_current_account")
|
||||
@Getter
|
||||
@Setter
|
||||
public class CurrentAccount extends AbstractAuditableCustom {
|
||||
|
||||
@Column(name = "account_no", nullable = false, length = 20, unique = true)
|
||||
private String accountNo;
|
||||
|
||||
@Column(name = "external_id", length = 100)
|
||||
private String externalId;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "client_id")
|
||||
private Client client;
|
||||
|
||||
// Store product_id as plain column to avoid cross-module EclipseLink entity dependency
|
||||
@Column(name = "product_id", nullable = false)
|
||||
private Long productId;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "office_id", nullable = false)
|
||||
private Office office;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "staff_id")
|
||||
private Staff staff;
|
||||
|
||||
// Status: 100=Submitted, 200=Approved, 300=Active, 400=Withdrawn, 500=Rejected, 600=Closed
|
||||
@Column(name = "status_enum", nullable = false)
|
||||
private Integer statusEnum = 100;
|
||||
|
||||
// SubStatus: 0=None, 100=Inactive, 200=Dormant, 300=Block, 400=BlockDebit, 500=BlockCredit
|
||||
@Column(name = "sub_status_enum", nullable = false)
|
||||
private Integer subStatusEnum = 0;
|
||||
|
||||
// 1=Individual, 2=Group, 3=JLG
|
||||
@Column(name = "account_type_enum", nullable = false)
|
||||
private Integer accountTypeEnum = 1;
|
||||
|
||||
// Lifecycle dates
|
||||
@Column(name = "submittedon_date")
|
||||
private LocalDate submittedOnDate;
|
||||
|
||||
@Column(name = "approvedon_date")
|
||||
private LocalDate approvedOnDate;
|
||||
|
||||
@Column(name = "activatedon_date")
|
||||
private LocalDate activatedOnDate;
|
||||
|
||||
@Column(name = "rejectedon_date")
|
||||
private LocalDate rejectedOnDate;
|
||||
|
||||
@Column(name = "withdrawnon_date")
|
||||
private LocalDate withdrawnOnDate;
|
||||
|
||||
@Column(name = "closedon_date")
|
||||
private LocalDate closedOnDate;
|
||||
|
||||
// Currency (copied from product at account creation)
|
||||
@Column(name = "currency_code", nullable = false, length = 3)
|
||||
private String currencyCode;
|
||||
|
||||
@Column(name = "currency_digits", nullable = false)
|
||||
private Integer currencyDigits;
|
||||
|
||||
@Column(name = "currency_multiplesof")
|
||||
private Integer currencyMultiplesOf;
|
||||
|
||||
// Interest
|
||||
@Column(name = "nominal_annual_interest_rate", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal nominalAnnualInterestRate = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "interest_compounding_period_enum", nullable = false)
|
||||
private Integer interestCompoundingPeriodEnum;
|
||||
|
||||
@Column(name = "interest_posting_period_enum", nullable = false)
|
||||
private Integer interestPostingPeriodEnum;
|
||||
|
||||
@Column(name = "interest_calculation_type_enum", nullable = false)
|
||||
private Integer interestCalculationTypeEnum;
|
||||
|
||||
@Column(name = "interest_calculation_days_in_year_type_enum", nullable = false)
|
||||
private Integer interestCalculationDaysInYearTypeEnum;
|
||||
|
||||
@Column(name = "min_balance_for_interest_calculation", precision = 19, scale = 6)
|
||||
private BigDecimal minBalanceForInterestCalculation;
|
||||
|
||||
@Column(name = "start_interest_calculation_date")
|
||||
private LocalDate startInterestCalculationDate;
|
||||
|
||||
@Column(name = "accrued_till_date")
|
||||
private LocalDate accruedTillDate;
|
||||
|
||||
@Column(name = "last_interest_calculation_date")
|
||||
private LocalDate lastInterestCalculationDate;
|
||||
|
||||
@Column(name = "last_closed_business_date")
|
||||
private LocalDate lastClosedBusinessDate;
|
||||
|
||||
// Tax
|
||||
@Column(name = "withhold_tax", nullable = false)
|
||||
private boolean withholdTax = false;
|
||||
|
||||
// Balance rules
|
||||
@Column(name = "min_required_opening_balance", precision = 19, scale = 6)
|
||||
private BigDecimal minRequiredOpeningBalance;
|
||||
|
||||
@Column(name = "lockin_period_frequency")
|
||||
private Integer lockinPeriodFrequency;
|
||||
|
||||
@Column(name = "lockin_period_frequency_enum")
|
||||
private Integer lockinPeriodFrequencyEnum;
|
||||
|
||||
@Column(name = "lockedin_until_date_derived")
|
||||
private LocalDate lockedInUntilDate;
|
||||
|
||||
@Column(name = "enforce_min_required_balance", nullable = false)
|
||||
private boolean enforceMinRequiredBalance = false;
|
||||
|
||||
@Column(name = "min_required_balance", precision = 19, scale = 6)
|
||||
private BigDecimal minRequiredBalance;
|
||||
|
||||
// Overdraft
|
||||
@Column(name = "allow_overdraft", nullable = false)
|
||||
private boolean allowOverdraft = false;
|
||||
|
||||
@Column(name = "overdraft_limit", precision = 19, scale = 6)
|
||||
private BigDecimal overdraftLimit;
|
||||
|
||||
@Column(name = "nominal_annual_interest_rate_overdraft", precision = 19, scale = 6)
|
||||
private BigDecimal nominalAnnualInterestRateOverdraft;
|
||||
|
||||
@Column(name = "min_overdraft_for_interest_calculation", precision = 19, scale = 6)
|
||||
private BigDecimal minOverdraftForInterestCalculation;
|
||||
|
||||
// Lien
|
||||
@Column(name = "is_lien_allowed", nullable = false)
|
||||
private boolean lienAllowed = false;
|
||||
|
||||
@Column(name = "max_allowed_lien_limit", precision = 19, scale = 6)
|
||||
private BigDecimal maxAllowedLienLimit;
|
||||
|
||||
@Column(name = "on_hold_funds_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal onHoldFundsDerived = BigDecimal.ZERO;
|
||||
|
||||
// Running balance summary
|
||||
@Column(name = "account_balance_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal accountBalanceDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "total_deposits_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal totalDepositsDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "total_withdrawals_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal totalWithdrawalsDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "total_interest_earned_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal totalInterestEarnedDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "total_interest_posted_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal totalInterestPostedDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "total_overdraft_interest_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal totalOverdraftInterestDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "total_withhold_tax_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal totalWithholdTaxDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "total_savings_amount_on_hold", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal totalSavingsAmountOnHold = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "withdrawal_fee_for_transfer", nullable = false)
|
||||
private boolean withdrawalFeeForTransfer = false;
|
||||
|
||||
@Column(name = "reason_for_block", length = 500)
|
||||
private String reasonForBlock;
|
||||
|
||||
// Current-account-specific fields
|
||||
@Column(name = "msme", nullable = false)
|
||||
private boolean msme = false;
|
||||
|
||||
@Column(name = "auto_debit_facility", nullable = false)
|
||||
private boolean autoDebitFacility = false;
|
||||
|
||||
@Column(name = "balance_swap_option", nullable = false)
|
||||
private boolean balanceSwapOption = false;
|
||||
|
||||
@Column(name = "establishment_date")
|
||||
private LocalDate establishmentDate;
|
||||
|
||||
@Column(name = "start_operation_date")
|
||||
private LocalDate startOperationDate;
|
||||
|
||||
@Column(name = "is_non_individual_client", nullable = false)
|
||||
private boolean nonIndividualClient = false;
|
||||
|
||||
@Column(name = "signatory_rights", length = 100)
|
||||
private String signatoryRights;
|
||||
|
||||
// CBS classification
|
||||
@Column(name = "cbs_account_type", length = 100)
|
||||
private String cbsAccountType;
|
||||
|
||||
@Column(name = "customer_segment", length = 100)
|
||||
private String customerSegment;
|
||||
|
||||
@Column(name = "account_status", length = 50)
|
||||
private String accountStatus;
|
||||
|
||||
@Column(name = "mode_of_operation", length = 50)
|
||||
private String modeOfOperation;
|
||||
|
||||
@Column(name = "special_category", length = 100)
|
||||
private String specialCategory;
|
||||
|
||||
// Introducer
|
||||
@Column(name = "introducer_client_id")
|
||||
private Long introducerClientId;
|
||||
|
||||
@Column(name = "introducer_name", length = 200)
|
||||
private String introducerName;
|
||||
|
||||
@Column(name = "introducer_cif_number", length = 50)
|
||||
private String introducerCifNumber;
|
||||
|
||||
// Nominee JSON
|
||||
@Column(name = "nominee_data", columnDefinition = "TEXT")
|
||||
private String nomineeData;
|
||||
|
||||
// Interest calculation settings
|
||||
@Column(name = "interest_calculate_selector")
|
||||
private Integer interestCalculateSelector;
|
||||
|
||||
@Column(name = "average_period", length = 20)
|
||||
private String averagePeriod;
|
||||
|
||||
@Column(name = "auto_post", nullable = false)
|
||||
private boolean autoPost = false;
|
||||
|
||||
@Column(name = "frequency_fix_day")
|
||||
private Integer frequencyFixDay;
|
||||
|
||||
@Column(name = "enable_lockin_period", nullable = false)
|
||||
private boolean enableLockinPeriod = false;
|
||||
|
||||
@Column(name = "balance_frequency", length = 50)
|
||||
private String balanceFrequency;
|
||||
|
||||
@Column(name = "avg_balance_calc_period", length = 10)
|
||||
private String avgBalanceCalcPeriod;
|
||||
|
||||
// Relationships
|
||||
@OneToMany(mappedBy = "currentAccount", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
private List<CurrentAccountTransaction> transactions = new ArrayList<>();
|
||||
|
||||
@OneToMany(mappedBy = "currentAccount", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
private Set<CurrentAccountCharge> charges = new HashSet<>();
|
||||
|
||||
@OneToOne(mappedBy = "currentAccount", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
private CurrentAccountFacilityConfig facilityConfig;
|
||||
|
||||
@OneToMany(mappedBy = "currentAccount", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
private List<CurrentAccountJointHolder> jointHolders = new ArrayList<>();
|
||||
|
||||
@OneToMany(mappedBy = "currentAccount", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
private List<CurrentAccountPartner> partners = new ArrayList<>();
|
||||
|
||||
@OneToMany(mappedBy = "currentAccount", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY)
|
||||
private List<CurrentAccountOfficerHistory> officerHistory = new ArrayList<>();
|
||||
|
||||
protected CurrentAccount() {}
|
||||
|
||||
public static CurrentAccount createNew(Client client, Long productId, Office office,
|
||||
Staff staff, String accountNo, LocalDate submittedOnDate, Integer accountTypeEnum,
|
||||
String currencyCode, Integer currencyDigits, Integer currencyMultiplesOf,
|
||||
BigDecimal nominalAnnualInterestRate, Integer interestCompoundingPeriodEnum,
|
||||
Integer interestPostingPeriodEnum, Integer interestCalculationTypeEnum,
|
||||
Integer interestCalculationDaysInYearTypeEnum, boolean allowOverdraft,
|
||||
BigDecimal overdraftLimit, boolean msme, boolean autoDebitFacility,
|
||||
boolean balanceSwapOption, String customerSegment, boolean autoPost,
|
||||
Integer interestCalculateSelector, String averagePeriod, String avgBalanceCalcPeriod) {
|
||||
CurrentAccount account = new CurrentAccount();
|
||||
account.client = client;
|
||||
account.productId = productId;
|
||||
account.office = office;
|
||||
account.staff = staff;
|
||||
account.accountNo = accountNo;
|
||||
account.submittedOnDate = submittedOnDate;
|
||||
account.statusEnum = 100;
|
||||
account.subStatusEnum = 0;
|
||||
account.accountTypeEnum = accountTypeEnum != null ? accountTypeEnum : 1;
|
||||
account.currencyCode = currencyCode;
|
||||
account.currencyDigits = currencyDigits;
|
||||
account.currencyMultiplesOf = currencyMultiplesOf;
|
||||
account.nominalAnnualInterestRate = nominalAnnualInterestRate != null ? nominalAnnualInterestRate : BigDecimal.ZERO;
|
||||
account.interestCompoundingPeriodEnum = interestCompoundingPeriodEnum;
|
||||
account.interestPostingPeriodEnum = interestPostingPeriodEnum;
|
||||
account.interestCalculationTypeEnum = interestCalculationTypeEnum;
|
||||
account.interestCalculationDaysInYearTypeEnum = interestCalculationDaysInYearTypeEnum;
|
||||
account.allowOverdraft = allowOverdraft;
|
||||
account.overdraftLimit = overdraftLimit;
|
||||
account.msme = msme;
|
||||
account.autoDebitFacility = autoDebitFacility;
|
||||
account.balanceSwapOption = balanceSwapOption;
|
||||
account.customerSegment = customerSegment;
|
||||
account.autoPost = autoPost;
|
||||
account.interestCalculateSelector = interestCalculateSelector;
|
||||
account.averagePeriod = averagePeriod;
|
||||
account.avgBalanceCalcPeriod = avgBalanceCalcPeriod;
|
||||
return account;
|
||||
}
|
||||
|
||||
public boolean isActive() { return this.statusEnum != null && this.statusEnum == 300; }
|
||||
public boolean isSubmittedAndPendingApproval() { return this.statusEnum != null && this.statusEnum == 100; }
|
||||
public boolean isApproved() { return this.statusEnum != null && this.statusEnum == 200; }
|
||||
public boolean isClosed() { return this.statusEnum != null && this.statusEnum == 600; }
|
||||
|
||||
public void updateAccountNo(String accountNo) { this.accountNo = accountNo; }
|
||||
|
||||
public void approve(LocalDate approvedOnDate) {
|
||||
this.statusEnum = 200;
|
||||
this.approvedOnDate = approvedOnDate;
|
||||
}
|
||||
|
||||
public void activate(LocalDate activatedOnDate) {
|
||||
this.statusEnum = 300;
|
||||
this.activatedOnDate = activatedOnDate;
|
||||
}
|
||||
|
||||
public void reject(LocalDate rejectedOnDate) {
|
||||
this.statusEnum = 500;
|
||||
this.rejectedOnDate = rejectedOnDate;
|
||||
}
|
||||
|
||||
public void withdraw(LocalDate withdrawnOnDate) {
|
||||
this.statusEnum = 400;
|
||||
this.withdrawnOnDate = withdrawnOnDate;
|
||||
}
|
||||
|
||||
public void close(LocalDate closedOnDate) {
|
||||
this.statusEnum = 600;
|
||||
this.closedOnDate = closedOnDate;
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/**
|
||||
* 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.currentaccount.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.portfolio.charge.domain.Charge;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_current_account_charge")
|
||||
@Getter
|
||||
@Setter
|
||||
public class CurrentAccountCharge extends AbstractPersistableCustom<Long> {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "current_account_id", nullable = false)
|
||||
private CurrentAccount currentAccount;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "charge_id", nullable = false)
|
||||
private Charge charge;
|
||||
|
||||
@Column(name = "charge_time_enum", nullable = false)
|
||||
private Integer chargeTimeEnum;
|
||||
|
||||
@Column(name = "charge_due_date")
|
||||
private LocalDate chargeDueDate;
|
||||
|
||||
@Column(name = "fee_on_month")
|
||||
private Integer feeOnMonth;
|
||||
|
||||
@Column(name = "fee_on_day")
|
||||
private Integer feeOnDay;
|
||||
|
||||
@Column(name = "fee_interval")
|
||||
private Integer feeInterval;
|
||||
|
||||
@Column(name = "charge_calculation_enum", nullable = false)
|
||||
private Integer chargeCalculationEnum;
|
||||
|
||||
@Column(name = "calculation_percentage", precision = 19, scale = 6)
|
||||
private BigDecimal calculationPercentage;
|
||||
|
||||
@Column(name = "calculation_on_amount", precision = 19, scale = 6)
|
||||
private BigDecimal calculationOnAmount;
|
||||
|
||||
@Column(name = "amount", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "amount_paid_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal amountPaidDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "amount_waived_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal amountWaivedDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "amount_writtenoff_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal amountWrittenOffDerived = BigDecimal.ZERO;
|
||||
|
||||
@Column(name = "amount_outstanding_derived", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal amountOutstandingDerived;
|
||||
|
||||
@Column(name = "is_paid_derived", nullable = false)
|
||||
private boolean paid = false;
|
||||
|
||||
@Column(name = "waived", nullable = false)
|
||||
private boolean waived = false;
|
||||
|
||||
@Column(name = "is_penalty", nullable = false)
|
||||
private boolean penalty = false;
|
||||
|
||||
@Column(name = "is_active", nullable = false)
|
||||
private boolean active = true;
|
||||
|
||||
@Column(name = "inactivated_on_date")
|
||||
private LocalDate inactivatedOnDate;
|
||||
|
||||
@Column(name = "free_withdrawal_count")
|
||||
private Integer freeWithdrawalCount;
|
||||
|
||||
@Column(name = "charge_reset_date")
|
||||
private LocalDate chargeResetDate;
|
||||
|
||||
protected CurrentAccountCharge() {}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/**
|
||||
* 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.currentaccount.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.OneToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_current_account_facility_config")
|
||||
@Getter
|
||||
@Setter
|
||||
public class CurrentAccountFacilityConfig extends AbstractPersistableCustom<Long> {
|
||||
|
||||
@OneToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "current_account_id", nullable = false, unique = true)
|
||||
private CurrentAccount currentAccount;
|
||||
|
||||
@Column(name = "atm_facility", nullable = false)
|
||||
private boolean atmFacility = false;
|
||||
|
||||
@Column(name = "atm_withdrawal_facility", nullable = false)
|
||||
private boolean atmWithdrawalFacility = false;
|
||||
|
||||
@Column(name = "upi_facility", nullable = false)
|
||||
private boolean upiFacility = false;
|
||||
|
||||
@Column(name = "pos_transactions_facility", nullable = false)
|
||||
private boolean posTransactionsFacility = false;
|
||||
|
||||
@Column(name = "cheque_book", nullable = false)
|
||||
private boolean chequeBook = false;
|
||||
|
||||
@Column(name = "imps_facility", nullable = false)
|
||||
private boolean impsFacility = false;
|
||||
|
||||
@Column(name = "sms_alerts", nullable = false)
|
||||
private boolean smsAlerts = false;
|
||||
|
||||
@Column(name = "bbps_facility", nullable = false)
|
||||
private boolean bbpsFacility = false;
|
||||
|
||||
@Column(name = "insurance_cover", nullable = false)
|
||||
private boolean insuranceCover = false;
|
||||
|
||||
@Column(name = "bepg_facility", nullable = false)
|
||||
private boolean bepgFacility = false;
|
||||
|
||||
@Column(name = "neft_facility", nullable = false)
|
||||
private boolean neftFacility = false;
|
||||
|
||||
@Column(name = "rtgs_facility", nullable = false)
|
||||
private boolean rtgsFacility = false;
|
||||
|
||||
@Column(name = "inter_bank_total_cap_facility", nullable = false)
|
||||
private boolean interBankTotalCapFacility = false;
|
||||
|
||||
@Column(name = "withdrawal_facility", nullable = false)
|
||||
private boolean withdrawalFacility = false;
|
||||
|
||||
@Column(name = "deposit_facility_kyc", nullable = false)
|
||||
private boolean depositFacilityKyc = false;
|
||||
|
||||
@Column(name = "virtual_debit_card", nullable = false)
|
||||
private boolean virtualDebitCard = false;
|
||||
|
||||
@Column(name = "internet_banking", nullable = false)
|
||||
private boolean internetBanking = false;
|
||||
|
||||
@Column(name = "mobile_banking", nullable = false)
|
||||
private boolean mobileBanking = false;
|
||||
|
||||
protected CurrentAccountFacilityConfig() {}
|
||||
|
||||
public static CurrentAccountFacilityConfig createFor(CurrentAccount account) {
|
||||
CurrentAccountFacilityConfig cfg = new CurrentAccountFacilityConfig();
|
||||
cfg.currentAccount = account;
|
||||
return cfg;
|
||||
}
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
/**
|
||||
* 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.currentaccount.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_current_account_joint_holder")
|
||||
@Getter
|
||||
@Setter
|
||||
public class CurrentAccountJointHolder extends AbstractPersistableCustom<Long> {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "current_account_id", nullable = false)
|
||||
private CurrentAccount currentAccount;
|
||||
|
||||
@Column(name = "client_id")
|
||||
private Long clientId;
|
||||
|
||||
@Column(name = "cif_number", length = 50)
|
||||
private String cifNumber;
|
||||
|
||||
@Column(name = "display_name", length = 200)
|
||||
private String displayName;
|
||||
|
||||
@Column(name = "share_percentage", precision = 5, scale = 2)
|
||||
private BigDecimal sharePercentage;
|
||||
|
||||
@Column(name = "signing_authority", length = 100)
|
||||
private String signingAuthority;
|
||||
|
||||
@Column(name = "role", length = 100)
|
||||
private String role;
|
||||
|
||||
@Column(name = "is_primary", nullable = false)
|
||||
private boolean primary = false;
|
||||
|
||||
public CurrentAccountJointHolder() {}
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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.currentaccount.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.organisation.staff.domain.Staff;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_current_account_officer_history")
|
||||
@Getter
|
||||
@Setter
|
||||
public class CurrentAccountOfficerHistory extends AbstractPersistableCustom<Long> {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "current_account_id", nullable = false)
|
||||
private CurrentAccount currentAccount;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "staff_id")
|
||||
private Staff staff;
|
||||
|
||||
@Column(name = "start_date", nullable = false)
|
||||
private LocalDate startDate;
|
||||
|
||||
@Column(name = "end_date")
|
||||
private LocalDate endDate;
|
||||
|
||||
@Column(name = "created_by_id")
|
||||
private Long createdById;
|
||||
|
||||
protected CurrentAccountOfficerHistory() {}
|
||||
}
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/**
|
||||
* 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.currentaccount.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_current_account_partner")
|
||||
@Getter
|
||||
@Setter
|
||||
public class CurrentAccountPartner extends AbstractPersistableCustom<Long> {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "current_account_id", nullable = false)
|
||||
private CurrentAccount currentAccount;
|
||||
|
||||
@Column(name = "client_id")
|
||||
private Long clientId;
|
||||
|
||||
@Column(name = "client_cif", length = 50)
|
||||
private String clientCif;
|
||||
|
||||
@Column(name = "client_name", length = 200)
|
||||
private String clientName;
|
||||
|
||||
@Column(name = "share_percentage", precision = 5, scale = 2)
|
||||
private BigDecimal sharePercentage;
|
||||
|
||||
@Column(name = "is_mandatory", nullable = false)
|
||||
private boolean mandatory = false;
|
||||
|
||||
public CurrentAccountPartner() {}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* 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.currentaccount.domain;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
public interface CurrentAccountRepository extends JpaRepository<CurrentAccount, Long> {
|
||||
|
||||
Optional<CurrentAccount> findByAccountNo(String accountNo);
|
||||
|
||||
Optional<CurrentAccount> findByExternalId(String externalId);
|
||||
|
||||
List<CurrentAccount> findByClientId(Long clientId);
|
||||
|
||||
@Query("SELECT MAX(ca.id) FROM CurrentAccount ca")
|
||||
Optional<Long> findMaxId();
|
||||
|
||||
@Query("SELECT ca FROM CurrentAccount ca WHERE ca.client.id = :clientId AND ca.statusEnum != 600")
|
||||
List<CurrentAccount> findActiveByClientId(@Param("clientId") Long clientId);
|
||||
}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* 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.currentaccount.domain;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.FetchType;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.persistence.Table;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||
import org.apache.fineract.organisation.office.domain.Office;
|
||||
|
||||
@Entity
|
||||
@Table(name = "m_current_account_transaction")
|
||||
@Getter
|
||||
@Setter
|
||||
public class CurrentAccountTransaction extends AbstractPersistableCustom<Long> {
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "current_account_id", nullable = false)
|
||||
private CurrentAccount currentAccount;
|
||||
|
||||
@ManyToOne(fetch = FetchType.LAZY)
|
||||
@JoinColumn(name = "office_id", nullable = false)
|
||||
private Office office;
|
||||
|
||||
// 1=Deposit, 2=Withdrawal, 3=InterestPosting, 4=Charge, 5=ChargeWaiver, 6=Transfer, 7=Reversal
|
||||
@Column(name = "transaction_type_enum", nullable = false)
|
||||
private Integer transactionTypeEnum;
|
||||
|
||||
@Column(name = "transaction_date", nullable = false)
|
||||
private LocalDate transactionDate;
|
||||
|
||||
@Column(name = "amount", nullable = false, precision = 19, scale = 6)
|
||||
private BigDecimal amount;
|
||||
|
||||
@Column(name = "ref_no", length = 100)
|
||||
private String refNo;
|
||||
|
||||
@Column(name = "remarks", length = 500)
|
||||
private String remarks;
|
||||
|
||||
@Column(name = "is_reversed", nullable = false)
|
||||
private boolean reversed = false;
|
||||
|
||||
@Column(name = "is_reversal", nullable = false)
|
||||
private boolean reversal = false;
|
||||
|
||||
@Column(name = "original_transaction_id")
|
||||
private Long originalTransactionId;
|
||||
|
||||
@Column(name = "is_manual", nullable = false)
|
||||
private boolean manual = false;
|
||||
|
||||
@Column(name = "running_balance_derived", precision = 19, scale = 6)
|
||||
private BigDecimal runningBalanceDerived;
|
||||
|
||||
@Column(name = "cumulative_balance_derived", precision = 19, scale = 6)
|
||||
private BigDecimal cumulativeBalanceDerived;
|
||||
|
||||
@Column(name = "balance_end_date_derived")
|
||||
private LocalDate balanceEndDateDerived;
|
||||
|
||||
@Column(name = "balance_number_of_days_derived")
|
||||
private Integer balanceNumberOfDaysDerived;
|
||||
|
||||
@Column(name = "overdraft_amount_derived", precision = 19, scale = 6)
|
||||
private BigDecimal overdraftAmountDerived;
|
||||
|
||||
@Column(name = "is_lien_transaction", nullable = false)
|
||||
private boolean lienTransaction = false;
|
||||
|
||||
@Column(name = "release_id_of_hold_amount_transaction")
|
||||
private Long releaseIdOfHoldAmountTransaction;
|
||||
|
||||
@Column(name = "reason_for_block", length = 200)
|
||||
private String reasonForBlock;
|
||||
|
||||
@Column(name = "submitted_on_date")
|
||||
private LocalDate submittedOnDate;
|
||||
|
||||
@Column(name = "created_date")
|
||||
private LocalDateTime createdDate;
|
||||
|
||||
@Column(name = "created_by")
|
||||
private Long createdBy;
|
||||
|
||||
protected CurrentAccountTransaction() {}
|
||||
|
||||
public static CurrentAccountTransaction deposit(CurrentAccount account, Office office,
|
||||
BigDecimal amount, LocalDate transactionDate, String refNo) {
|
||||
CurrentAccountTransaction txn = new CurrentAccountTransaction();
|
||||
txn.currentAccount = account;
|
||||
txn.office = office;
|
||||
txn.transactionTypeEnum = 1;
|
||||
txn.amount = amount;
|
||||
txn.transactionDate = transactionDate;
|
||||
txn.refNo = refNo;
|
||||
txn.submittedOnDate = transactionDate;
|
||||
return txn;
|
||||
}
|
||||
|
||||
public static CurrentAccountTransaction withdrawal(CurrentAccount account, Office office,
|
||||
BigDecimal amount, LocalDate transactionDate, String refNo) {
|
||||
CurrentAccountTransaction txn = new CurrentAccountTransaction();
|
||||
txn.currentAccount = account;
|
||||
txn.office = office;
|
||||
txn.transactionTypeEnum = 2;
|
||||
txn.amount = amount;
|
||||
txn.transactionDate = transactionDate;
|
||||
txn.refNo = refNo;
|
||||
txn.submittedOnDate = transactionDate;
|
||||
return txn;
|
||||
}
|
||||
}
|
||||
+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.portfolio.currentaccount.domain;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface CurrentAccountTransactionRepository extends JpaRepository<CurrentAccountTransaction, Long> {
|
||||
|
||||
List<CurrentAccountTransaction> findByCurrentAccountIdOrderByTransactionDateDescIdDesc(Long currentAccountId);
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/**
|
||||
* 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.currentaccount.service;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.fineract.portfolio.currentaccount.domain.CurrentAccount;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Generates CBS account numbers for current accounts.
|
||||
* Format: 00 + GL_CODE(6 digits) + OFFICE_ID(2 digits) + ACCOUNT_ID(5 digits) = 15 digits
|
||||
* GL code is fetched from m_current_product.gl_account_id → m_acc_gl_account.gl_code
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class CurrentAccountNumberGenerator {
|
||||
|
||||
private static final String CBS_PREFIX = "00";
|
||||
|
||||
private final JdbcTemplate jdbcTemplate;
|
||||
|
||||
public String generate(CurrentAccount account) {
|
||||
Long productId = account.getProductId();
|
||||
|
||||
// Fetch gl_code directly from current product → gl account
|
||||
String glCode = jdbcTemplate.query(
|
||||
"SELECT ga.gl_code FROM m_current_product cp "
|
||||
+ "JOIN m_acc_gl_account ga ON ga.id = cp.gl_account_id "
|
||||
+ "WHERE cp.id = ?",
|
||||
rs -> rs.next() ? rs.getString("gl_code") : null,
|
||||
productId);
|
||||
|
||||
if (glCode == null || glCode.isBlank()) glCode = "000000";
|
||||
|
||||
// Pad/trim GL code to 6 digits
|
||||
glCode = glCode.length() > 6
|
||||
? glCode.substring(glCode.length() - 6)
|
||||
: StringUtils.leftPad(glCode, 6, '0');
|
||||
|
||||
// Office ID — 2 digits
|
||||
String officeId = StringUtils.leftPad(account.getOffice().getId().toString(), 2, '0');
|
||||
if (officeId.length() > 2) officeId = officeId.substring(officeId.length() - 2);
|
||||
|
||||
// Account ID — 5 digits
|
||||
String accountId = StringUtils.leftPad(account.getId().toString(), 5, '0');
|
||||
if (accountId.length() > 5) accountId = accountId.substring(accountId.length() - 5);
|
||||
|
||||
return CBS_PREFIX + glCode + officeId + accountId;
|
||||
}
|
||||
|
||||
public String preview(Long productId, Long officeId) {
|
||||
String glCode = jdbcTemplate.query(
|
||||
"SELECT ga.gl_code FROM m_current_product cp "
|
||||
+ "JOIN m_acc_gl_account ga ON ga.id = cp.gl_account_id "
|
||||
+ "WHERE cp.id = ?",
|
||||
rs -> rs.next() ? rs.getString("gl_code") : null,
|
||||
productId);
|
||||
|
||||
if (glCode == null || glCode.isBlank()) glCode = "000000";
|
||||
glCode = glCode.length() > 6 ? glCode.substring(glCode.length() - 6) : StringUtils.leftPad(glCode, 6, '0');
|
||||
|
||||
String officeStr = StringUtils.leftPad(officeId != null ? officeId.toString() : "0", 2, '0');
|
||||
if (officeStr.length() > 2) officeStr = officeStr.substring(officeStr.length() - 2);
|
||||
|
||||
// Next account ID estimate from m_current_account
|
||||
Long maxId = jdbcTemplate.query(
|
||||
"SELECT MAX(id) FROM m_current_account",
|
||||
rs -> rs.next() ? rs.getLong(1) : 0L);
|
||||
String nextSeq = StringUtils.leftPad(String.valueOf((maxId != null ? maxId : 0L) + 1), 5, '0');
|
||||
if (nextSeq.length() > 5) nextSeq = nextSeq.substring(nextSeq.length() - 5);
|
||||
|
||||
return CBS_PREFIX + glCode + officeStr + nextSeq;
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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.currentaccount.service;
|
||||
|
||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
||||
|
||||
public interface CurrentAccountWritePlatformService {
|
||||
|
||||
CommandProcessingResult submitApplication(JsonCommand command);
|
||||
|
||||
CommandProcessingResult approveApplication(Long accountId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult undoApproval(Long accountId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult activate(Long accountId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult rejectApplication(Long accountId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult withdrawApplication(Long accountId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult closeAccount(Long accountId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult modifyApplication(Long accountId, JsonCommand command);
|
||||
|
||||
CommandProcessingResult deleteApplication(Long accountId);
|
||||
}
|
||||
+9
@@ -817,6 +817,15 @@ public class CurrentProduct extends AbstractPersistableCustom<Long> {
|
||||
return actualChanges;
|
||||
}
|
||||
|
||||
public String getName() { return name; }
|
||||
public String getShortName() { return shortName; }
|
||||
public boolean isAllowOverdraft() { return allowOverdraft; }
|
||||
public BigDecimal getOverdraftLimit() { return overdraftLimit; }
|
||||
public Integer getInterestCompoundingPeriodType() { return interestCompoundingPeriodType; }
|
||||
public Integer getInterestPostingPeriodType() { return interestPostingPeriodType; }
|
||||
public Integer getInterestCalculationType() { return interestCalculationType; }
|
||||
public Integer getInterestCalculationDaysInYearType() { return interestCalculationDaysInYearType; }
|
||||
|
||||
// Dormancy/misc getters needed by validator
|
||||
public Boolean isDormancyTrackingActive() { return this.isDormancyTrackingActive; }
|
||||
public Long getDaysToInactive() { return this.daysToInactive; }
|
||||
|
||||
Reference in New Issue
Block a user