existing account saving and current add or remove nominee and digital & account features and also FE & RD nominee add or remove

This commit is contained in:
keshav898966
2026-07-10 18:40:16 +05:30
parent 9980310c9e
commit b064ee6307
35 changed files with 3439 additions and 23 deletions
@@ -368,4 +368,6 @@
<include file="parts/0338_add_soft_delete_to_tellers.xml" relativeToChangelogFile="true"/>
<include file="parts/0339_add_share_linking_enabled_to_current_account.xml" relativeToChangelogFile="true"/>
<include file="parts/0340_add_terminate_true_to_savings_and_current_account.xml" relativeToChangelogFile="true"/>
<include file="parts/0341_add_current_account_pending_edit_table.xml" relativeToChangelogFile="true"/>
<include file="parts/0342_add_current_account_edit_approval_permissions.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
@@ -0,0 +1,218 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<!--
Holds a pending edit request for an ACTIVE current account's Nominee + Digital & Account
Features, mirroring m_savings_account_pending_edit's maker-checker pattern: presence of a row
here with status=PENDING (enforced via the unique pending_lock_key) is itself the lock, and
nothing is applied to the real m_current_account_facility_config / m_client_nominee rows until
a checker approves (see CurrentAccountEditWritePlatformServiceJpaRepositoryImpl). One row per
request; only one nominee change (add/update/delete) can be proposed per request, so its fields
are kept as flat typed columns on this same table rather than a satellite table. Also carries a
full point-in-time "wide snapshot" of every business column on m_current_account at submission
time, for audit/UI display purposes only.
-->
<changeSet author="fineract" id="0341-1">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="m_current_account_pending_edit" />
</not>
</preConditions>
<createTable tableName="m_current_account_pending_edit">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="current_account_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_caoe_current_account_id" references="m_current_account(id)" />
</column>
<column name="createdby_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_caoe_maker_id" references="m_appuser(id)" />
</column>
<column name="lastmodifiedby_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_caoe_checker_id" references="m_appuser(id)" />
</column>
<column name="created_date" type="DATETIME">
<constraints nullable="false" />
</column>
<column name="lastmodified_date" type="DATETIME">
<constraints nullable="true" />
</column>
<column name="status" type="VARCHAR(20)" defaultValue="PENDING">
<constraints nullable="false" />
</column>
<column name="reject_reason" type="VARCHAR(500)" />
<column name="pending_lock_key" type="VARCHAR(40)">
<constraints nullable="true" unique="true" uniqueConstraintName="caoe_unq_pending_lock_key" />
</column>
<column name="command_source_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_caoe_command_source_id" references="m_portfolio_command_source(id)" />
</column>
<!-- Hold placed at submission time for the total charge of newly-enabled facilities; released
(no charge) on reject, released-then-converted-to-a-posted-charge on approve. -->
<column name="hold_transaction_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_caoe_hold_txn_id" references="m_current_account_transaction(id)" />
</column>
<column name="hold_amount" type="DECIMAL(19,6)" />
<!-- Digital & Account Features - same 18 columns/names as m_current_account_facility_config.
NULL = maker did not touch this toggle; facility_config_submitted tells approve()/UI
whether this block was submitted at all. -->
<column name="facility_config_submitted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
<column name="atm_facility" type="BOOLEAN" />
<column name="atm_withdrawal_facility" type="BOOLEAN" />
<column name="upi_facility" type="BOOLEAN" />
<column name="pos_transactions_facility" type="BOOLEAN" />
<column name="cheque_book" type="BOOLEAN" />
<column name="imps_facility" type="BOOLEAN" />
<column name="sms_alerts" type="BOOLEAN" />
<column name="bbps_facility" type="BOOLEAN" />
<column name="insurance_cover" type="BOOLEAN" />
<column name="bepg_facility" type="BOOLEAN" />
<column name="neft_facility" type="BOOLEAN" />
<column name="rtgs_facility" type="BOOLEAN" />
<column name="inter_bank_total_cap_facility" type="BOOLEAN" />
<column name="withdrawal_facility" type="BOOLEAN" />
<column name="deposit_facility_kyc" type="BOOLEAN" />
<column name="virtual_debit_card" type="BOOLEAN" />
<column name="internet_banking" type="BOOLEAN" />
<column name="mobile_banking" type="BOOLEAN" />
<!-- Nominee change - one per request (add / update / delete), same fields as m_client_nominee. -->
<column name="nominee_submitted" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
<column name="nominee_operation" type="VARCHAR(10)" />
<column name="nominee_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_caoe_nominee_id" references="m_client_nominee(id)" />
</column>
<column name="nominee_client_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_caoe_nominee_client_id" references="m_client(id)" />
</column>
<column name="relationship_cv_id" type="BIGINT" />
<column name="percentage_share" type="DECIMAL(5,2)" />
<column name="nominee_is_active" type="BOOLEAN" />
<column name="nominee_is_minor" type="BOOLEAN" />
<column name="guardian_client_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_caoe_guardian_client_id" references="m_client(id)" />
</column>
<column name="guardian_relationship_cv_id" type="BIGINT" />
<column name="effective_date" type="DATE" />
<column name="nominee_remarks" type="VARCHAR(500)" />
<!-- Wide point-in-time snapshot of every business column on m_current_account at submission
time (audit/UI display only - approve()/reject() logic reads the live account, not this).
All nullable, no unique constraints, no defaults - this is a frozen copy. -->
<column name="account_no" type="VARCHAR(20)" />
<column name="external_id" type="VARCHAR(100)" />
<column name="client_id" type="BIGINT" />
<column name="product_id" type="BIGINT" />
<column name="office_id" type="BIGINT" />
<column name="staff_id" type="BIGINT" />
<column name="status_enum" type="INTEGER" />
<column name="sub_status_enum" type="INTEGER" />
<column name="account_type_enum" type="INTEGER" />
<column name="submittedon_date" type="DATE" />
<column name="approvedon_date" type="DATE" />
<column name="activatedon_date" type="DATE" />
<column name="rejectedon_date" type="DATE" />
<column name="withdrawnon_date" type="DATE" />
<column name="closedon_date" type="DATE" />
<column name="submittedon_userid" type="BIGINT" />
<column name="approvedon_userid" type="BIGINT" />
<column name="activatedon_userid" type="BIGINT" />
<column name="rejectedon_userid" type="BIGINT" />
<column name="withdrawnon_userid" type="BIGINT" />
<column name="closedon_userid" type="BIGINT" />
<column name="currency_code" type="VARCHAR(3)" />
<column name="currency_digits" type="INTEGER" />
<column name="currency_multiplesof" type="INTEGER" />
<column name="nominal_annual_interest_rate" type="DECIMAL(19,6)" />
<column name="interest_compounding_period_enum" type="INTEGER" />
<column name="interest_posting_period_enum" type="INTEGER" />
<column name="interest_calculation_type_enum" type="INTEGER" />
<column name="interest_calculation_days_in_year_type_enum" type="INTEGER" />
<column name="min_balance_for_interest_calculation" type="DECIMAL(19,6)" />
<column name="start_interest_calculation_date" type="DATE" />
<column name="accrued_till_date" type="DATE" />
<column name="last_interest_calculation_date" type="DATE" />
<column name="last_closed_business_date" type="DATE" />
<column name="withhold_tax" type="BOOLEAN" />
<column name="min_required_opening_balance" type="DECIMAL(19,6)" />
<column name="lockin_period_frequency" type="INTEGER" />
<column name="lockin_period_frequency_enum" type="INTEGER" />
<column name="lockedin_until_date_derived" type="DATE" />
<column name="enforce_min_required_balance" type="BOOLEAN" />
<column name="min_required_balance" type="DECIMAL(19,6)" />
<column name="allow_overdraft" type="BOOLEAN" />
<column name="overdraft_limit" type="DECIMAL(19,6)" />
<column name="nominal_annual_interest_rate_overdraft" type="DECIMAL(19,6)" />
<column name="min_overdraft_for_interest_calculation" type="DECIMAL(19,6)" />
<column name="is_lien_allowed" type="BOOLEAN" />
<column name="max_allowed_lien_limit" type="DECIMAL(19,6)" />
<column name="on_hold_funds_derived" type="DECIMAL(19,6)" />
<column name="account_balance_derived" type="DECIMAL(19,6)" />
<column name="total_deposits_derived" type="DECIMAL(19,6)" />
<column name="total_withdrawals_derived" type="DECIMAL(19,6)" />
<column name="total_interest_earned_derived" type="DECIMAL(19,6)" />
<column name="total_interest_posted_derived" type="DECIMAL(19,6)" />
<column name="total_overdraft_interest_derived" type="DECIMAL(19,6)" />
<column name="total_withhold_tax_derived" type="DECIMAL(19,6)" />
<column name="total_savings_amount_on_hold" type="DECIMAL(19,6)" />
<column name="withdrawal_fee_for_transfer" type="BOOLEAN" />
<column name="reason_for_block" type="VARCHAR(500)" />
<column name="msme" type="BOOLEAN" />
<column name="auto_debit_facility" type="BOOLEAN" />
<column name="balance_swap_option" type="BOOLEAN" />
<column name="establishment_date" type="DATE" />
<column name="start_operation_date" type="DATE" />
<column name="is_non_individual_client" type="BOOLEAN" />
<column name="signatory_rights" type="VARCHAR(100)" />
<column name="cbs_account_type" type="VARCHAR(100)" />
<column name="customer_segment" type="VARCHAR(100)" />
<column name="account_status" type="VARCHAR(50)" />
<column name="mode_of_operation" type="VARCHAR(50)" />
<column name="special_category" type="VARCHAR(100)" />
<column name="introducer_client_id" type="BIGINT" />
<column name="introducer_name" type="VARCHAR(200)" />
<column name="introducer_cif_number" type="VARCHAR(50)" />
<column name="nominee_data" type="TEXT" />
<column name="interest_calculate_selector" type="INTEGER" />
<column name="average_period" type="VARCHAR(20)" />
<column name="auto_post" type="BOOLEAN" />
<column name="frequency_fix_day" type="INTEGER" />
<column name="enable_lockin_period" type="BOOLEAN" />
<column name="balance_frequency" type="VARCHAR(50)" />
<column name="avg_balance_calc_period" type="VARCHAR(10)" />
<column name="account_closed_zero_balance_in_day_closing" type="BOOLEAN" />
<column name="valid_for_period" type="VARCHAR(10)" />
<column name="od_account_closed_zero_balance_in_day_closing" type="BOOLEAN" />
<column name="is_linking_enable" type="BOOLEAN" />
<column name="terminate_true" type="BOOLEAN" />
</createTable>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.1.xsd">
<!--
Permissions gating the Nominee + Digital & Account Features maker-checker edit flow for
current accounts. SUBMITEDIT lets a maker propose the edit (this is the "Edit" action shown
on the account view); APPROVEEDIT/REJECTEDIT let a checker resolve it. The _CHECKER permission
follows the "<ACTION>_<ENTITY>_CHECKER" convention so the pending request also surfaces in the
generic Checker Inbox for limited checkers. Grouping matches the rest of CURRENTACCOUNT's
permissions in 0225_add_current_account_support.xml ("portfolio").
-->
<changeSet author="fineract" id="0342-1">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_permission WHERE code = 'SUBMITEDIT_CURRENTACCOUNT'</sqlCheck>
</preConditions>
<insert tableName="m_permission">
<column name="grouping" value="portfolio" />
<column name="code" value="SUBMITEDIT_CURRENTACCOUNT" />
<column name="entity_name" value="CURRENTACCOUNT" />
<column name="action_name" value="SUBMITEDIT" />
<column name="can_maker_checker" valueBoolean="false" />
</insert>
</changeSet>
<changeSet author="fineract" id="0342-2">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_permission WHERE code = 'APPROVEEDIT_CURRENTACCOUNT'</sqlCheck>
</preConditions>
<insert tableName="m_permission">
<column name="grouping" value="portfolio" />
<column name="code" value="APPROVEEDIT_CURRENTACCOUNT" />
<column name="entity_name" value="CURRENTACCOUNT" />
<column name="action_name" value="APPROVEEDIT" />
<column name="can_maker_checker" valueBoolean="false" />
</insert>
</changeSet>
<changeSet author="fineract" id="0342-3">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_permission WHERE code = 'REJECTEDIT_CURRENTACCOUNT'</sqlCheck>
</preConditions>
<insert tableName="m_permission">
<column name="grouping" value="portfolio" />
<column name="code" value="REJECTEDIT_CURRENTACCOUNT" />
<column name="entity_name" value="CURRENTACCOUNT" />
<column name="action_name" value="REJECTEDIT" />
<column name="can_maker_checker" valueBoolean="false" />
</insert>
</changeSet>
<changeSet author="fineract" id="0342-4">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM m_permission WHERE code = 'APPROVEEDIT_CURRENTACCOUNT_CHECKER'</sqlCheck>
</preConditions>
<insert tableName="m_permission">
<column name="grouping" value="portfolio" />
<column name="code" value="APPROVEEDIT_CURRENTACCOUNT_CHECKER" />
<column name="entity_name" value="CURRENTACCOUNT" />
<column name="action_name" value="APPROVEEDIT_CHECKER" />
<column name="can_maker_checker" valueBoolean="false" />
</insert>
</changeSet>
</databaseChangeLog>