Merge remote-tracking branch 'nexora/uate' into merge-uate-into-dev
Fineract Build & Cucumber tests (without E2E tests) / verify (main, cucumber) (push) Canceled after 0s
Fineract Build & Cucumber tests (without E2E tests) / verify (progressive-loan, build-progressive-loan) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 1 of 10) (push) Canceled after 0s
Fineract Docker Builds / build (true, docker-compose.yml, mariadb) (push) Canceled after 0s
Fineract Documentation build / build (push) Canceled after 0s
Fineract Build & Cucumber tests (without E2E tests) / verify (main, build-core) (push) Canceled after 0s
Fineract Docker Builds / build (false, docker-compose-postgresql.yml, postgresql) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 10 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 2 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 3 of 10) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-1) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 4 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 5 of 10) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-3) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 6 of 10) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 7 of 10) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-5) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 9 of 10) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-1) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-3) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-3) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-5) (push) Canceled after 0s
Fineract Messaging Smoke Tests / Smoke Test with Kafka (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MariaDB / test (test-core-4) (push) Canceled after 0s
Fineract E2E Tests / E2E Tests (Shard 8 of 10) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-1) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-2) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-4) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - MySQL / test (test-core-4) (push) Canceled after 0s
Fineract Cargo & Unit- & Integration tests - PostgreSQL / test (test-core-5) (push) Canceled after 0s
Fineract Liquibase Only mode - PostgreSQL / test (push) Canceled after 0s
Fineract Messaging Smoke Tests / Smoke Test with ActiveMQ (push) Canceled after 0s

# Conflicts:
#	.gitignore
#	fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml
#	fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/service/FacilityChargeAutoApplyService.java
This commit is contained in:
2026-07-23 17:36:10 +05:30
96 changed files with 11486 additions and 1304 deletions
@@ -99,4 +99,31 @@ public class CurrentAccountFacilityConfig extends AbstractPersistableCustom<Long
cfg.currentAccount = account;
return cfg;
}
/**
* Partial update: only overwrites fields present (non-null) in the given JSON, leaving all others untouched.
* Mirrors {@code SavingsAccountFacilityConfig.updateFrom(JsonObject)}. Used by the Nominee/Digital-Feature
* edit-approval flow, which only ever submits the toggles the maker actually touched.
*/
public void updateFrom(com.google.gson.JsonObject config) {
if (config == null) return;
if (config.has("atmFacility")) setAtmFacility(config.get("atmFacility").getAsBoolean());
if (config.has("atmWithdrawalFacility")) setAtmWithdrawalFacility(config.get("atmWithdrawalFacility").getAsBoolean());
if (config.has("upiFacility")) setUpiFacility(config.get("upiFacility").getAsBoolean());
if (config.has("posTransactionsFacility")) setPosTransactionsFacility(config.get("posTransactionsFacility").getAsBoolean());
if (config.has("chequeBook")) setChequeBook(config.get("chequeBook").getAsBoolean());
if (config.has("impsFacility")) setImpsFacility(config.get("impsFacility").getAsBoolean());
if (config.has("smsAlerts")) setSmsAlerts(config.get("smsAlerts").getAsBoolean());
if (config.has("bbpsFacility")) setBbpsFacility(config.get("bbpsFacility").getAsBoolean());
if (config.has("insuranceCover")) setInsuranceCover(config.get("insuranceCover").getAsBoolean());
if (config.has("bepgFacility")) setBepgFacility(config.get("bepgFacility").getAsBoolean());
if (config.has("neftFacility")) setNeftFacility(config.get("neftFacility").getAsBoolean());
if (config.has("rtgsFacility")) setRtgsFacility(config.get("rtgsFacility").getAsBoolean());
if (config.has("interBankTotalCapFacility")) setInterBankTotalCapFacility(config.get("interBankTotalCapFacility").getAsBoolean());
if (config.has("withdrawalFacility")) setWithdrawalFacility(config.get("withdrawalFacility").getAsBoolean());
if (config.has("depositFacilityKyc")) setDepositFacilityKyc(config.get("depositFacilityKyc").getAsBoolean());
if (config.has("virtualDebitCard")) setVirtualDebitCard(config.get("virtualDebitCard").getAsBoolean());
if (config.has("internetBanking")) setInternetBanking(config.get("internetBanking").getAsBoolean());
if (config.has("mobileBanking")) setMobileBanking(config.get("mobileBanking").getAsBoolean());
}
}
@@ -0,0 +1,35 @@
/**
* 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.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* This repository did not previously exist - {@link CurrentAccountFacilityConfig} rows were only ever persisted via
* cascade from {@link CurrentAccountRepository} (see {@code CurrentAccount#facilityConfig}, {@code cascade = ALL}).
* Added so the Nominee/Digital-Feature edit-approval flow can save the config row directly, mirroring
* {@code SavingsAccountFacilityConfigRepository}.
*/
@Repository
public interface CurrentAccountFacilityConfigRepository extends JpaRepository<CurrentAccountFacilityConfig, Long> {
Optional<CurrentAccountFacilityConfig> findByCurrentAccountId(Long currentAccountId);
}
@@ -0,0 +1,596 @@
/**
* 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.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.useradministration.domain.AppUser;
/**
* Holds a pending edit request for an ACTIVE current account's Nominee + Digital & Account Features.
* Presence of a row here with {@code status = PENDING} (enforced via the unique {@link #pendingLockKey}) is itself
* the lock - nothing is applied to the real {@code m_current_account_facility_config} / {@code m_client_nominee}
* rows until a checker approves (see CurrentAccountEditWritePlatformServiceJpaRepositoryImpl). Mirrors
* {@code SavingsAccountPendingEdit} but additionally carries a full point-in-time "wide snapshot" of every business
* column on {@link CurrentAccount} at submission time, for audit/UI display purposes only (not used to drive
* approve/reject logic, which reads the live account).
*/
@Entity
@Table(name = "m_current_account_pending_edit")
@Getter
@Setter
public class CurrentAccountPendingEdit extends AbstractPersistableCustom<Long> {
public static final String STATUS_PENDING = "PENDING";
public static final String STATUS_APPROVED = "APPROVED";
public static final String STATUS_REJECTED = "REJECTED";
public static final String NOMINEE_OP_ADD = "ADD";
public static final String NOMINEE_OP_UPDATE = "UPDATE";
public static final String NOMINEE_OP_DELETE = "DELETE";
@ManyToOne
@JoinColumn(name = "current_account_id", nullable = false)
private CurrentAccount currentAccount;
@ManyToOne
@JoinColumn(name = "createdby_id", nullable = false)
private AppUser maker;
@ManyToOne
@JoinColumn(name = "lastmodifiedby_id")
private AppUser checker;
@Column(name = "created_date", nullable = false)
private LocalDateTime createdOn;
@Column(name = "lastmodified_date")
private LocalDateTime checkedOn;
@Column(name = "status", nullable = false, length = 20)
private String status;
@Column(name = "reject_reason", length = 500)
private String rejectReason;
/** "CURRENT_ACCOUNT_EDIT:<currentAccountId>" while PENDING, NULL otherwise - the real DB-level lock. */
@Column(name = "pending_lock_key", length = 40)
private String pendingLockKey;
/** Links to the audit-only m_portfolio_command_source row created for this edit's submit/approve/reject. */
@Column(name = "command_source_id")
private Long commandSourceId;
@Column(name = "hold_transaction_id")
private Long holdTransactionId;
@Column(name = "hold_amount", precision = 19, scale = 6)
private BigDecimal holdAmount;
// ── Digital & Account Features (same names as m_current_account_facility_config) ──
@Column(name = "facility_config_submitted", nullable = false)
private boolean facilityConfigSubmitted = false;
@Column(name = "atm_facility")
private Boolean atmFacility;
@Column(name = "atm_withdrawal_facility")
private Boolean atmWithdrawalFacility;
@Column(name = "upi_facility")
private Boolean upiFacility;
@Column(name = "pos_transactions_facility")
private Boolean posTransactionsFacility;
@Column(name = "cheque_book")
private Boolean chequeBook;
@Column(name = "imps_facility")
private Boolean impsFacility;
@Column(name = "sms_alerts")
private Boolean smsAlerts;
@Column(name = "bbps_facility")
private Boolean bbpsFacility;
@Column(name = "insurance_cover")
private Boolean insuranceCover;
@Column(name = "bepg_facility")
private Boolean bepgFacility;
@Column(name = "neft_facility")
private Boolean neftFacility;
@Column(name = "rtgs_facility")
private Boolean rtgsFacility;
@Column(name = "inter_bank_total_cap_facility")
private Boolean interBankTotalCapFacility;
@Column(name = "withdrawal_facility")
private Boolean withdrawalFacility;
@Column(name = "deposit_facility_kyc")
private Boolean depositFacilityKyc;
@Column(name = "virtual_debit_card")
private Boolean virtualDebitCard;
@Column(name = "internet_banking")
private Boolean internetBanking;
@Column(name = "mobile_banking")
private Boolean mobileBanking;
// ── Nominee change - one per request (add / update / delete) ──
@Column(name = "nominee_submitted", nullable = false)
private boolean nomineeSubmitted = false;
@Column(name = "nominee_operation", length = 10)
private String nomineeOperation;
@Column(name = "nominee_id")
private Long nomineeId;
@Column(name = "nominee_client_id")
private Long nomineeClientId;
@Column(name = "relationship_cv_id")
private Long relationshipCvId;
@Column(name = "percentage_share", precision = 5, scale = 2)
private BigDecimal percentageShare;
@Column(name = "nominee_is_active")
private Boolean nomineeIsActive;
@Column(name = "nominee_is_minor")
private Boolean nomineeIsMinor;
@Column(name = "guardian_client_id")
private Long guardianClientId;
@Column(name = "guardian_relationship_cv_id")
private Long guardianRelationshipCvId;
@Column(name = "effective_date")
private LocalDate effectiveDate;
@Column(name = "nominee_remarks", length = 500)
private String nomineeRemarks;
// ── Wide point-in-time snapshot of every business column on CurrentAccount at submission time ──
// (audit/UI display only - approve()/reject() logic never reads these, it reads the live account)
@Column(name = "account_no", length = 20)
private String snapshotAccountNo;
@Column(name = "external_id", length = 100)
private String snapshotExternalId;
@Column(name = "client_id")
private Long snapshotClientId;
@Column(name = "product_id")
private Long snapshotProductId;
@Column(name = "office_id")
private Long snapshotOfficeId;
@Column(name = "staff_id")
private Long snapshotStaffId;
@Column(name = "status_enum")
private Integer snapshotStatusEnum;
@Column(name = "sub_status_enum")
private Integer snapshotSubStatusEnum;
@Column(name = "account_type_enum")
private Integer snapshotAccountTypeEnum;
@Column(name = "submittedon_date")
private LocalDate snapshotSubmittedOnDate;
@Column(name = "approvedon_date")
private LocalDate snapshotApprovedOnDate;
@Column(name = "activatedon_date")
private LocalDate snapshotActivatedOnDate;
@Column(name = "rejectedon_date")
private LocalDate snapshotRejectedOnDate;
@Column(name = "withdrawnon_date")
private LocalDate snapshotWithdrawnOnDate;
@Column(name = "closedon_date")
private LocalDate snapshotClosedOnDate;
@Column(name = "submittedon_userid")
private Long snapshotSubmittedOnUserId;
@Column(name = "approvedon_userid")
private Long snapshotApprovedOnUserId;
@Column(name = "activatedon_userid")
private Long snapshotActivatedOnUserId;
@Column(name = "rejectedon_userid")
private Long snapshotRejectedOnUserId;
@Column(name = "withdrawnon_userid")
private Long snapshotWithdrawnOnUserId;
@Column(name = "closedon_userid")
private Long snapshotClosedOnUserId;
@Column(name = "currency_code", length = 3)
private String snapshotCurrencyCode;
@Column(name = "currency_digits")
private Integer snapshotCurrencyDigits;
@Column(name = "currency_multiplesof")
private Integer snapshotCurrencyMultiplesOf;
@Column(name = "nominal_annual_interest_rate", precision = 19, scale = 6)
private BigDecimal snapshotNominalAnnualInterestRate;
@Column(name = "interest_compounding_period_enum")
private Integer snapshotInterestCompoundingPeriodEnum;
@Column(name = "interest_posting_period_enum")
private Integer snapshotInterestPostingPeriodEnum;
@Column(name = "interest_calculation_type_enum")
private Integer snapshotInterestCalculationTypeEnum;
@Column(name = "interest_calculation_days_in_year_type_enum")
private Integer snapshotInterestCalculationDaysInYearTypeEnum;
@Column(name = "min_balance_for_interest_calculation", precision = 19, scale = 6)
private BigDecimal snapshotMinBalanceForInterestCalculation;
@Column(name = "start_interest_calculation_date")
private LocalDate snapshotStartInterestCalculationDate;
@Column(name = "accrued_till_date")
private LocalDate snapshotAccruedTillDate;
@Column(name = "last_interest_calculation_date")
private LocalDate snapshotLastInterestCalculationDate;
@Column(name = "last_closed_business_date")
private LocalDate snapshotLastClosedBusinessDate;
@Column(name = "withhold_tax")
private Boolean snapshotWithholdTax;
@Column(name = "min_required_opening_balance", precision = 19, scale = 6)
private BigDecimal snapshotMinRequiredOpeningBalance;
@Column(name = "lockin_period_frequency")
private Integer snapshotLockinPeriodFrequency;
@Column(name = "lockin_period_frequency_enum")
private Integer snapshotLockinPeriodFrequencyEnum;
@Column(name = "lockedin_until_date_derived")
private LocalDate snapshotLockedInUntilDate;
@Column(name = "enforce_min_required_balance")
private Boolean snapshotEnforceMinRequiredBalance;
@Column(name = "min_required_balance", precision = 19, scale = 6)
private BigDecimal snapshotMinRequiredBalance;
@Column(name = "allow_overdraft")
private Boolean snapshotAllowOverdraft;
@Column(name = "overdraft_limit", precision = 19, scale = 6)
private BigDecimal snapshotOverdraftLimit;
@Column(name = "nominal_annual_interest_rate_overdraft", precision = 19, scale = 6)
private BigDecimal snapshotNominalAnnualInterestRateOverdraft;
@Column(name = "min_overdraft_for_interest_calculation", precision = 19, scale = 6)
private BigDecimal snapshotMinOverdraftForInterestCalculation;
@Column(name = "is_lien_allowed")
private Boolean snapshotLienAllowed;
@Column(name = "max_allowed_lien_limit", precision = 19, scale = 6)
private BigDecimal snapshotMaxAllowedLienLimit;
@Column(name = "on_hold_funds_derived", precision = 19, scale = 6)
private BigDecimal snapshotOnHoldFundsDerived;
@Column(name = "account_balance_derived", precision = 19, scale = 6)
private BigDecimal snapshotAccountBalanceDerived;
@Column(name = "total_deposits_derived", precision = 19, scale = 6)
private BigDecimal snapshotTotalDepositsDerived;
@Column(name = "total_withdrawals_derived", precision = 19, scale = 6)
private BigDecimal snapshotTotalWithdrawalsDerived;
@Column(name = "total_interest_earned_derived", precision = 19, scale = 6)
private BigDecimal snapshotTotalInterestEarnedDerived;
@Column(name = "total_interest_posted_derived", precision = 19, scale = 6)
private BigDecimal snapshotTotalInterestPostedDerived;
@Column(name = "total_overdraft_interest_derived", precision = 19, scale = 6)
private BigDecimal snapshotTotalOverdraftInterestDerived;
@Column(name = "total_withhold_tax_derived", precision = 19, scale = 6)
private BigDecimal snapshotTotalWithholdTaxDerived;
@Column(name = "total_savings_amount_on_hold", precision = 19, scale = 6)
private BigDecimal snapshotTotalSavingsAmountOnHold;
@Column(name = "withdrawal_fee_for_transfer")
private Boolean snapshotWithdrawalFeeForTransfer;
@Column(name = "reason_for_block", length = 500)
private String snapshotReasonForBlock;
@Column(name = "msme")
private Boolean snapshotMsme;
@Column(name = "auto_debit_facility")
private Boolean snapshotAutoDebitFacility;
@Column(name = "balance_swap_option")
private Boolean snapshotBalanceSwapOption;
@Column(name = "establishment_date")
private LocalDate snapshotEstablishmentDate;
@Column(name = "start_operation_date")
private LocalDate snapshotStartOperationDate;
@Column(name = "is_non_individual_client")
private Boolean snapshotNonIndividualClient;
@Column(name = "signatory_rights", length = 100)
private String snapshotSignatoryRights;
@Column(name = "cbs_account_type", length = 100)
private String snapshotCbsAccountType;
@Column(name = "customer_segment", length = 100)
private String snapshotCustomerSegment;
@Column(name = "account_status", length = 50)
private String snapshotAccountStatus;
@Column(name = "mode_of_operation", length = 50)
private String snapshotModeOfOperation;
@Column(name = "special_category", length = 100)
private String snapshotSpecialCategory;
@Column(name = "introducer_client_id")
private Long snapshotIntroducerClientId;
@Column(name = "introducer_name", length = 200)
private String snapshotIntroducerName;
@Column(name = "introducer_cif_number", length = 50)
private String snapshotIntroducerCifNumber;
@Column(name = "nominee_data", columnDefinition = "TEXT")
private String snapshotNomineeData;
@Column(name = "interest_calculate_selector")
private Integer snapshotInterestCalculateSelector;
@Column(name = "average_period", length = 20)
private String snapshotAveragePeriod;
@Column(name = "auto_post")
private Boolean snapshotAutoPost;
@Column(name = "frequency_fix_day")
private Integer snapshotFrequencyFixDay;
@Column(name = "enable_lockin_period")
private Boolean snapshotEnableLockinPeriod;
@Column(name = "balance_frequency", length = 50)
private String snapshotBalanceFrequency;
@Column(name = "avg_balance_calc_period", length = 10)
private String snapshotAvgBalanceCalcPeriod;
@Column(name = "account_closed_zero_balance_in_day_closing")
private Boolean snapshotAccountClosedZeroBalanceInDayClosing;
@Column(name = "valid_for_period", length = 10)
private String snapshotValidForPeriod;
@Column(name = "od_account_closed_zero_balance_in_day_closing")
private Boolean snapshotOdAccountClosedZeroBalanceInDayClosing;
@Column(name = "is_linking_enable")
private Boolean snapshotShareLinkingEnabled;
@Column(name = "terminate_true")
private Boolean snapshotTerminateTrue;
protected CurrentAccountPendingEdit() {}
public CurrentAccountPendingEdit(final CurrentAccount currentAccount, final AppUser maker) {
this.currentAccount = currentAccount;
this.maker = maker;
this.createdOn = LocalDateTime.now();
this.status = STATUS_PENDING;
this.pendingLockKey = lockKeyFor(currentAccount.getId());
}
public static String lockKeyFor(final Long currentAccountId) {
return "CURRENT_ACCOUNT_EDIT:" + currentAccountId;
}
/**
* Builds a new pending-edit row and copies every business column off the live {@code account} onto this
* request's wide snapshot fields, for audit/UI display purposes only.
*/
public static CurrentAccountPendingEdit snapshotOf(final CurrentAccount account, final AppUser maker) {
final CurrentAccountPendingEdit p = new CurrentAccountPendingEdit(account, maker);
p.snapshotAccountNo = account.getAccountNo();
p.snapshotExternalId = account.getExternalId();
p.snapshotClientId = account.getClient() != null ? account.getClient().getId() : null;
p.snapshotProductId = account.getProductId();
p.snapshotOfficeId = account.getOffice() != null ? account.getOffice().getId() : null;
p.snapshotStaffId = account.getStaff() != null ? account.getStaff().getId() : null;
p.snapshotStatusEnum = account.getStatusEnum();
p.snapshotSubStatusEnum = account.getSubStatusEnum();
p.snapshotAccountTypeEnum = account.getAccountTypeEnum();
p.snapshotSubmittedOnDate = account.getSubmittedOnDate();
p.snapshotApprovedOnDate = account.getApprovedOnDate();
p.snapshotActivatedOnDate = account.getActivatedOnDate();
p.snapshotRejectedOnDate = account.getRejectedOnDate();
p.snapshotWithdrawnOnDate = account.getWithdrawnOnDate();
p.snapshotClosedOnDate = account.getClosedOnDate();
p.snapshotSubmittedOnUserId = account.getSubmittedOnByUser() != null ? account.getSubmittedOnByUser().getId() : null;
p.snapshotApprovedOnUserId = account.getApprovedOnByUser() != null ? account.getApprovedOnByUser().getId() : null;
p.snapshotActivatedOnUserId = account.getActivatedOnByUser() != null ? account.getActivatedOnByUser().getId() : null;
p.snapshotRejectedOnUserId = account.getRejectedOnByUser() != null ? account.getRejectedOnByUser().getId() : null;
p.snapshotWithdrawnOnUserId = account.getWithdrawnOnByUser() != null ? account.getWithdrawnOnByUser().getId() : null;
p.snapshotClosedOnUserId = account.getClosedOnByUser() != null ? account.getClosedOnByUser().getId() : null;
p.snapshotCurrencyCode = account.getCurrencyCode();
p.snapshotCurrencyDigits = account.getCurrencyDigits();
p.snapshotCurrencyMultiplesOf = account.getCurrencyMultiplesOf();
p.snapshotNominalAnnualInterestRate = account.getNominalAnnualInterestRate();
p.snapshotInterestCompoundingPeriodEnum = account.getInterestCompoundingPeriodEnum();
p.snapshotInterestPostingPeriodEnum = account.getInterestPostingPeriodEnum();
p.snapshotInterestCalculationTypeEnum = account.getInterestCalculationTypeEnum();
p.snapshotInterestCalculationDaysInYearTypeEnum = account.getInterestCalculationDaysInYearTypeEnum();
p.snapshotMinBalanceForInterestCalculation = account.getMinBalanceForInterestCalculation();
p.snapshotStartInterestCalculationDate = account.getStartInterestCalculationDate();
p.snapshotAccruedTillDate = account.getAccruedTillDate();
p.snapshotLastInterestCalculationDate = account.getLastInterestCalculationDate();
p.snapshotLastClosedBusinessDate = account.getLastClosedBusinessDate();
p.snapshotWithholdTax = account.isWithholdTax();
p.snapshotMinRequiredOpeningBalance = account.getMinRequiredOpeningBalance();
p.snapshotLockinPeriodFrequency = account.getLockinPeriodFrequency();
p.snapshotLockinPeriodFrequencyEnum = account.getLockinPeriodFrequencyEnum();
p.snapshotLockedInUntilDate = account.getLockedInUntilDate();
p.snapshotEnforceMinRequiredBalance = account.isEnforceMinRequiredBalance();
p.snapshotMinRequiredBalance = account.getMinRequiredBalance();
p.snapshotAllowOverdraft = account.isAllowOverdraft();
p.snapshotOverdraftLimit = account.getOverdraftLimit();
p.snapshotNominalAnnualInterestRateOverdraft = account.getNominalAnnualInterestRateOverdraft();
p.snapshotMinOverdraftForInterestCalculation = account.getMinOverdraftForInterestCalculation();
p.snapshotLienAllowed = account.isLienAllowed();
p.snapshotMaxAllowedLienLimit = account.getMaxAllowedLienLimit();
p.snapshotOnHoldFundsDerived = account.getOnHoldFundsDerived();
p.snapshotAccountBalanceDerived = account.getAccountBalanceDerived();
p.snapshotTotalDepositsDerived = account.getTotalDepositsDerived();
p.snapshotTotalWithdrawalsDerived = account.getTotalWithdrawalsDerived();
p.snapshotTotalInterestEarnedDerived = account.getTotalInterestEarnedDerived();
p.snapshotTotalInterestPostedDerived = account.getTotalInterestPostedDerived();
p.snapshotTotalOverdraftInterestDerived = account.getTotalOverdraftInterestDerived();
p.snapshotTotalWithholdTaxDerived = account.getTotalWithholdTaxDerived();
p.snapshotTotalSavingsAmountOnHold = account.getTotalSavingsAmountOnHold();
p.snapshotWithdrawalFeeForTransfer = account.isWithdrawalFeeForTransfer();
p.snapshotReasonForBlock = account.getReasonForBlock();
p.snapshotMsme = account.isMsme();
p.snapshotAutoDebitFacility = account.isAutoDebitFacility();
p.snapshotBalanceSwapOption = account.isBalanceSwapOption();
p.snapshotEstablishmentDate = account.getEstablishmentDate();
p.snapshotStartOperationDate = account.getStartOperationDate();
p.snapshotNonIndividualClient = account.isNonIndividualClient();
p.snapshotSignatoryRights = account.getSignatoryRights();
p.snapshotCbsAccountType = account.getCbsAccountType();
p.snapshotCustomerSegment = account.getCustomerSegment();
p.snapshotAccountStatus = account.getAccountStatus();
p.snapshotModeOfOperation = account.getModeOfOperation();
p.snapshotSpecialCategory = account.getSpecialCategory();
p.snapshotIntroducerClientId = account.getIntroducerClientId();
p.snapshotIntroducerName = account.getIntroducerName();
p.snapshotIntroducerCifNumber = account.getIntroducerCifNumber();
p.snapshotNomineeData = account.getNomineeData();
p.snapshotInterestCalculateSelector = account.getInterestCalculateSelector();
p.snapshotAveragePeriod = account.getAveragePeriod();
p.snapshotAutoPost = account.isAutoPost();
p.snapshotFrequencyFixDay = account.getFrequencyFixDay();
p.snapshotEnableLockinPeriod = account.isEnableLockinPeriod();
p.snapshotBalanceFrequency = account.getBalanceFrequency();
p.snapshotAvgBalanceCalcPeriod = account.getAvgBalanceCalcPeriod();
p.snapshotAccountClosedZeroBalanceInDayClosing = account.getAccountClosedZeroBalanceInDayClosing();
p.snapshotValidForPeriod = account.getValidForPeriod();
p.snapshotOdAccountClosedZeroBalanceInDayClosing = account.isOdAccountClosedZeroBalanceInDayClosing();
p.snapshotShareLinkingEnabled = account.isShareLinkingEnabled();
p.snapshotTerminateTrue = account.isTerminateTrue();
return p;
}
public boolean isPending() {
return STATUS_PENDING.equals(this.status);
}
public void markApproved(final AppUser checker) {
this.status = STATUS_APPROVED;
this.checker = checker;
this.checkedOn = LocalDateTime.now();
this.pendingLockKey = null;
}
public void markRejected(final AppUser checker, final String reason) {
this.status = STATUS_REJECTED;
this.checker = checker;
this.checkedOn = LocalDateTime.now();
this.rejectReason = reason;
this.pendingLockKey = null;
}
}
@@ -0,0 +1,32 @@
/**
* 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.stereotype.Repository;
@Repository
public interface CurrentAccountPendingEditRepository extends JpaRepository<CurrentAccountPendingEdit, Long> {
Optional<CurrentAccountPendingEdit> findByCurrentAccountIdAndStatus(Long currentAccountId, String status);
List<CurrentAccountPendingEdit> findByStatus(String status);
}
@@ -0,0 +1,37 @@
/**
* 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.exception;
import java.math.BigDecimal;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
/**
* Thrown at edit-submission time when the account's available balance cannot cover the charge for
* the digital/account feature(s) the maker is requesting to enable.
*/
public class CurrentAccountEditInsufficientBalanceException extends AbstractPlatformDomainRuleException {
public CurrentAccountEditInsufficientBalanceException(final Long currentAccountId, final BigDecimal availableBalance,
final BigDecimal requiredAmount) {
super("error.msg.currentaccount.edit.insufficient.balance",
"Account balance is insufficient for the requested feature(s). Available balance: " + availableBalance
+ ", required: " + requiredAmount,
currentAccountId, availableBalance, requiredAmount);
}
}
@@ -0,0 +1,30 @@
/**
* 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.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
public class CurrentAccountEditPendingApprovalException extends AbstractPlatformDomainRuleException {
public CurrentAccountEditPendingApprovalException(final Long currentAccountId) {
super("error.msg.currentaccount.edit.pending.approval.exists",
"Current account with identifier " + currentAccountId + " already has a Nominee/Digital-Feature edit pending approval",
currentAccountId);
}
}
@@ -0,0 +1,31 @@
/**
* 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.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
public class CurrentAccountEditSelfApprovalNotAllowedException extends AbstractPlatformDomainRuleException {
public CurrentAccountEditSelfApprovalNotAllowedException(final Long currentAccountId) {
super("error.msg.currentaccount.edit.self.approval.not.allowed",
"The maker of the pending Nominee/Digital-Feature edit for current account " + currentAccountId
+ " cannot also approve or reject it",
currentAccountId);
}
}
@@ -0,0 +1,30 @@
/**
* 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.exception;
import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException;
public class CurrentAccountNoPendingEditException extends AbstractPlatformDomainRuleException {
public CurrentAccountNoPendingEditException(final Long currentAccountId) {
super("error.msg.currentaccount.no.pending.edit",
"Current account with identifier " + currentAccountId + " has no Nominee/Digital-Feature edit awaiting approval",
currentAccountId);
}
}
@@ -0,0 +1,37 @@
/**
* 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 java.util.Collection;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
import org.apache.fineract.portfolio.currentaccount.data.CurrentAccountPendingEditData;
public interface CurrentAccountEditWritePlatformService {
CommandProcessingResult submitEditForApproval(Long currentAccountId, JsonCommand command);
CommandProcessingResult approveEdit(Long currentAccountId);
CommandProcessingResult rejectEdit(Long currentAccountId, String rejectReason);
CurrentAccountPendingEditData retrievePendingEdit(Long currentAccountId);
Collection<CurrentAccountPendingEditData> retrieveAllPendingEdits();
}
@@ -18,6 +18,7 @@
*/
package org.apache.fineract.portfolio.currentaccount.service;
import java.util.Set;
import org.apache.fineract.infrastructure.core.api.JsonCommand;
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
@@ -42,4 +43,13 @@ public interface CurrentAccountWritePlatformService {
CommandProcessingResult deleteApplication(Long accountId);
CommandProcessingResult terminateAccount(Long accountId, JsonCommand command);
/**
* Resolves each of the given (newly-enabled) facility types to its mapped charge via
* {@code m_facility_charge_mapping}, creates a {@code CurrentAccountCharge} for it (skipping any facility type
* for which the account already has a paid, non-waived charge for the same mapped {@code Charge}), collects it
* from the account's running balance as of today, and posts the corresponding GL journal entries. Reuses the
* same private charge-creation-and-collection helper that {@code activate()} uses for activation-time charges.
*/
void applyAndCollectFacilityCharges(Long currentAccountId, Set<String> newlyEnabledFacilityTypes);
}