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
@@ -435,4 +435,29 @@
<include file="parts/0412_activate_outward_clearing_batch_job.xml" relativeToChangelogFile="true"/>
<include file="parts/0413_inward_item_verify_signature_permission.xml" relativeToChangelogFile="true"/>
<include file="parts/0414_inward_item_full_source_details.xml" relativeToChangelogFile="true"/>
<!-- NOTE: the numbers below (0341-0359) re-use prefixes already used above by the chequebook/CTS
clearing catchup migrations — these come from a long-diverged branch (uate) that assigned its own
sequence independently. Liquibase tracks changesets by filename + id + author, not by the numeric
prefix, so this causes no functional collision; the prefixes are just no longer strictly sequential
across the whole file. Left as-is rather than renumbering, since renumbering an already-created
migration risks Liquibase re-running it on any environment where it was already applied under its
original filename/id. -->
<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"/>
<include file="parts/0343_create_sponsor_bank_dd_tables.xml" relativeToChangelogFile="true"/>
<include file="parts/0344_create_sponsor_dd_issue_request_tables.xml" relativeToChangelogFile="true"/>
<include file="parts/0345_add_sponsor_dd_payable_gl_account_sbi.xml" relativeToChangelogFile="true"/>
<include file="parts/0347_add_sponsor_dd_walkin_cash_support.xml" relativeToChangelogFile="true"/>
<include file="parts/0348_add_sponsor_dd_cash_charges_gl_mapping.xml" relativeToChangelogFile="true"/>
<include file="parts/0349_replace_payment_type_with_sponsor_bank.xml" relativeToChangelogFile="true"/>
<include file="parts/0350_add_sponsor_dd_cash_receipt_suspense.xml" relativeToChangelogFile="true"/>
<include file="parts/0351_add_sponsor_dd_reprint_approval.xml" relativeToChangelogFile="true"/>
<include file="parts/0352_add_sponsor_dd_payable_at.xml" relativeToChangelogFile="true"/>
<include file="parts/0353_add_sponsor_dd_gst_on_charges.xml" relativeToChangelogFile="true"/>
<include file="parts/0354_add_sponsor_bank_identification_codes.xml" relativeToChangelogFile="true"/>
<include file="parts/0355_add_sponsor_dd_cashier_deposit_link.xml" relativeToChangelogFile="true"/>
<include file="parts/0356_add_dd_breakdown_to_cashier_deposit_request.xml" relativeToChangelogFile="true"/>
<include file="parts/0357_add_dd_limit_to_sponsor_dd_gl_mapping.xml" relativeToChangelogFile="true"/>
<include file="parts/0358_add_batch_id_to_sponsor_dd_issue_request.xml" relativeToChangelogFile="true"/>
<include file="parts/0359_reclassify_dd_gst_payable_as_income.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>
@@ -0,0 +1,143 @@
<?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">
<!-- Per sponsor-bank GL account configuration: which GL account is credited when a DD is
issued (liability owed to the sponsor bank), and which suspense GL account is debited
when the customer pays by cheque instead of an account debit. -->
<changeSet author="fineract" id="0344-1-create-gl-mapping">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="m_sponsor_dd_gl_mapping" />
</not>
</preConditions>
<createTable tableName="m_sponsor_dd_gl_mapping">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="payment_type_id" type="BIGINT">
<constraints nullable="false" unique="true" uniqueConstraintName="sdd_glmap_unq_payment_type"
foreignKeyName="fk_sdd_glmap_payment_type_id" references="m_payment_type(id)" />
</column>
<column name="dd_payable_gl_account_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_sdd_glmap_payable_gl_id" references="acc_gl_account(id)" />
</column>
<column name="cheque_clearing_gl_account_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_glmap_clearing_gl_id" references="acc_gl_account(id)" />
</column>
<column name="created_date" type="DATETIME" defaultValueComputed="now()">
<constraints nullable="false" />
</column>
</createTable>
</changeSet>
<!-- Maker-checker queue: clerk submits a PENDING request when a customer wants a DD issued
(either by debiting their own savings/current account, or by handing over a cheque);
a manager/head-cashier approval performs the actual GL posting and flips the leaflet
to ISSUED via the existing SponsorDDWritePlatformService.issueDemandDraft(). -->
<changeSet author="fineract" id="0344-2-create-issue-request">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="m_sponsor_dd_issue_request" />
</not>
</preConditions>
<createTable tableName="m_sponsor_dd_issue_request">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="leaflet_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_sdd_issuereq_leaflet_id" references="m_sponsor_dd_leaflet(id)" />
</column>
<column name="client_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_sdd_issuereq_client_id" references="m_client(id)" />
</column>
<column name="beneficiary_name" type="VARCHAR(150)">
<constraints nullable="false" />
</column>
<column name="face_value" type="DECIMAL(19,6)">
<constraints nullable="false" />
</column>
<column name="issuing_branch_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_sdd_issuereq_branch_id" references="m_office(id)" />
</column>
<column name="issued_date" type="DATE">
<constraints nullable="false" />
</column>
<!-- ACCOUNT_DEBIT or CHEQUE -->
<column name="payment_method" type="VARCHAR(20)">
<constraints nullable="false" />
</column>
<column name="savings_account_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_issuereq_savings_id" references="m_savings_account(id)" />
</column>
<column name="current_account_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_issuereq_current_id" references="m_current_account(id)" />
</column>
<column name="cheque_number" type="VARCHAR(30)">
<constraints nullable="true" />
</column>
<column name="cheque_bank_name" type="VARCHAR(100)">
<constraints nullable="true" />
</column>
<!-- PENDING, APPROVED, REJECTED -->
<column name="status" type="VARCHAR(20)" defaultValue="PENDING">
<constraints nullable="false" />
</column>
<column name="maker_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_sdd_issuereq_maker_id" references="m_appuser(id)" />
</column>
<column name="created_date" type="DATETIME" defaultValueComputed="now()">
<constraints nullable="false" />
</column>
<column name="checker_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_issuereq_checker_id" references="m_appuser(id)" />
</column>
<column name="checker_date" type="DATETIME">
<constraints nullable="true" />
</column>
<column name="rejection_reason" type="VARCHAR(255)">
<constraints nullable="true" />
</column>
<column name="resulting_savings_transaction_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_issuereq_result_savings_txn" references="m_savings_account_transaction(id)" />
</column>
<column name="resulting_current_transaction_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_issuereq_result_current_txn" references="m_current_account_transaction(id)" />
</column>
<column name="resulting_journal_entry_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_issuereq_result_journal" references="acc_gl_journal_entry(id)" />
</column>
</createTable>
</changeSet>
<changeSet author="fineract" id="0344-3-index-issue-request-status">
<preConditions onFail="MARK_RAN">
<not>
<indexExists tableName="m_sponsor_dd_issue_request" indexName="idx_sdd_issuereq_status" />
</not>
</preConditions>
<createIndex indexName="idx_sdd_issuereq_status" tableName="m_sponsor_dd_issue_request">
<column name="status" />
</createIndex>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,73 @@
<?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">
<!-- Dedicated liability GL account for the Sponsor DD Payable balance owed to SBI, as a child
of the existing "OTHER LIABILITY" account (gl_code 9), matching the pattern already used
by "INTEREST PAYABLE" (gl_code 9.2). -->
<changeSet author="fineract" id="0345-1-insert-sponsor-dd-payable-sbi-gl-account">
<preConditions onFail="MARK_RAN">
<not>
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '9.3'</sqlCheck>
</not>
</preConditions>
<insert tableName="acc_gl_account">
<column name="name" value="Sponsor DD Payable - SBI"/>
<column name="gl_code" value="9.3"/>
<column name="parent_id" valueNumeric="22"/>
<column name="hierarchy" value="."/>
<column name="account_usage" valueNumeric="1"/>
<column name="classification_enum" valueNumeric="2"/>
<column name="disabled" valueBoolean="false"/>
<column name="manual_journal_entries_allowed" valueBoolean="true"/>
<column name="description" value="Liability owed to SBI for sponsor bank demand drafts issued on their behalf, pending clearing."/>
</insert>
</changeSet>
<!-- Fineract's GL hierarchy path embeds the row's own auto-generated id, so it can only be
set after the insert above. -->
<changeSet author="fineract" id="0345-2-fix-sponsor-dd-payable-sbi-hierarchy">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '9.3' and hierarchy = '.'</sqlCheck>
</preConditions>
<sql>
UPDATE acc_gl_account SET hierarchy = CONCAT('.', id, '.') WHERE gl_code = '9.3' AND hierarchy = '.';
</sql>
</changeSet>
<!-- Wire the new GL account into the Sponsor DD GL mapping for the SBI payment type, so
DD issuance requests for SBI can be approved without manual configuration. -->
<changeSet author="fineract" id="0345-3-map-sponsor-dd-payable-sbi">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">
select count(*) from m_sponsor_dd_gl_mapping m join m_payment_type pt on pt.id = m.payment_type_id where pt.value = 'SBI'
</sqlCheck>
</preConditions>
<sql>
INSERT INTO m_sponsor_dd_gl_mapping (payment_type_id, dd_payable_gl_account_id, created_date)
SELECT pt.id, gl.id, CURRENT_TIMESTAMP
FROM m_payment_type pt, acc_gl_account gl
WHERE pt.value = 'SBI' AND gl.gl_code = '9.3';
</sql>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,97 @@
<?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">
<!-- Support DD issuance to a walk-in person paying cash who is not a bank client at all
(not just a different-branch customer). client_id becomes optional; when absent, the
walk-in purchaser's own KYC details are captured instead. Aadhaar is stored masked only
(last 4 digits) per UIDAI/RBI guidance — the full number is never persisted. -->
<changeSet author="fineract" id="0347-1-issue-request-client-id-nullable">
<preConditions onFail="MARK_RAN">
<columnExists tableName="m_sponsor_dd_issue_request" columnName="client_id" />
</preConditions>
<dropNotNullConstraint tableName="m_sponsor_dd_issue_request" columnName="client_id" columnDataType="BIGINT" />
</changeSet>
<changeSet author="fineract" id="0347-2-issue-request-add-walkin-fields">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="m_sponsor_dd_issue_request" columnName="walkin_purchaser_name" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_issue_request">
<column name="walkin_purchaser_name" type="VARCHAR(150)">
<constraints nullable="true" />
</column>
<column name="walkin_purchaser_address" type="VARCHAR(255)">
<constraints nullable="true" />
</column>
<column name="walkin_purchaser_aadhaar_masked" type="VARCHAR(20)">
<constraints nullable="true" />
</column>
<column name="charges_amount" type="DECIMAL(19,6)" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet author="fineract" id="0347-3-leaflet-add-walkin-fields">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="m_sponsor_dd_leaflet" columnName="walkin_purchaser_name" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_leaflet">
<column name="walkin_purchaser_name" type="VARCHAR(150)">
<constraints nullable="true" />
</column>
<column name="walkin_purchaser_address" type="VARCHAR(255)">
<constraints nullable="true" />
</column>
<column name="walkin_purchaser_aadhaar_masked" type="VARCHAR(20)">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
<!-- GL accounts for a CASH payment: Dr Cash-in-Hand (face value + charges) / Cr Sponsor DD
Payable (face value) / Cr Charges Income (charges, if any). Both optional — CASH issuance
is blocked with a clear error until these are configured, matching the existing pattern
for cheque_clearing_gl_account_id. -->
<changeSet author="fineract" id="0347-4-gl-mapping-add-cash-and-charges-accounts">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="m_sponsor_dd_gl_mapping" columnName="cash_gl_account_id" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_gl_mapping">
<column name="cash_gl_account_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_glmap_cash_gl_id" references="acc_gl_account(id)" />
</column>
<column name="charges_income_gl_account_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_glmap_charges_gl_id" references="acc_gl_account(id)" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,77 @@
<?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">
<!-- Dedicated income GL account for charges/commission collected on sponsor bank DD issuance,
as a child of the existing "INCOME HEAD" account (gl_code 10), matching the pattern
already used by "INCOME FROM LOAN" (gl_code 10.1) / "INCOME FROM ALL" (gl_code 10.2). -->
<changeSet author="fineract" id="0348-1-insert-dd-charges-income-gl-account">
<preConditions onFail="MARK_RAN">
<not>
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '10.3'</sqlCheck>
</not>
</preConditions>
<insert tableName="acc_gl_account">
<column name="name" value="DD Issuance Charges Income"/>
<column name="gl_code" value="10.3"/>
<column name="parent_id" valueNumeric="25"/>
<column name="hierarchy" value="."/>
<column name="account_usage" valueNumeric="1"/>
<column name="classification_enum" valueNumeric="4"/>
<column name="disabled" valueBoolean="false"/>
<column name="manual_journal_entries_allowed" valueBoolean="true"/>
<column name="description" value="Commission/charges income collected from customers and walk-in purchasers when issuing a sponsor bank demand draft."/>
</insert>
</changeSet>
<!-- Fineract's GL hierarchy path embeds the row's own auto-generated id, so it can only be
set after the insert above. -->
<changeSet author="fineract" id="0348-2-fix-dd-charges-income-hierarchy">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '10.3' and hierarchy = '.'</sqlCheck>
</preConditions>
<sql>
UPDATE acc_gl_account SET hierarchy = CONCAT('.', id, '.') WHERE gl_code = '10.3' AND hierarchy = '.';
</sql>
</changeSet>
<!-- Wire "Cash at Tellers" (the standard Fineract GL account for cash physically received at
the teller counter, gl_code 2) and the new charges income account into the existing
Sponsor DD GL mapping row(s), so CASH-method walk-in DD issuance can be approved without
further manual configuration. -->
<changeSet author="fineract" id="0348-3-map-dd-cash-and-charges-accounts">
<preConditions onFail="MARK_RAN">
<not>
<sqlCheck expectedResult="0">
select count(*) from m_sponsor_dd_gl_mapping where cash_gl_account_id is null or charges_income_gl_account_id is null
</sqlCheck>
</not>
</preConditions>
<sql>
UPDATE m_sponsor_dd_gl_mapping
SET cash_gl_account_id = (select id from acc_gl_account where gl_code = '2'),
charges_income_gl_account_id = (select id from acc_gl_account where gl_code = '10.3')
WHERE cash_gl_account_id is null or charges_income_gl_account_id is null;
</sql>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<changeSet author="fineract" id="0349-0-drop-old-sponsor-bank-table">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_bank" />
<not>
<columnExists tableName="m_sponsor_bank" columnName="createdby_id" />
</not>
</preConditions>
<sql>
DROP TABLE IF EXISTS m_sponsor_bank CASCADE;
</sql>
</changeSet>
<changeSet author="fineract" id="0349-1-create-sponsor-bank-table-v3">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="m_sponsor_bank" />
</not>
</preConditions>
<createTable tableName="m_sponsor_bank">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="name" type="VARCHAR(100)">
<constraints nullable="false" unique="true" uniqueConstraintName="sdd_bank_unq_name" />
</column>
<column name="description" type="VARCHAR(255)">
<constraints nullable="true" />
</column>
<column name="createdby_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_sdd_bank_maker_id" references="m_appuser(id)" />
</column>
<column name="created_date" type="DATETIME" defaultValueComputed="now()">
<constraints nullable="false" />
</column>
</createTable>
</changeSet>
<changeSet author="fineract" id="0349-2-migrate-existing-payment-types">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_bank" />
<tableExists tableName="m_payment_type" />
</preConditions>
<sql>
-- Insert unique sponsor banks from payment types into m_sponsor_bank
INSERT INTO m_sponsor_bank (name, description, createdby_id, created_date)
SELECT DISTINCT pt.value, pt.description, 1, CURRENT_TIMESTAMP
FROM m_payment_type pt
WHERE (pt.description = 'Sponsor Bank'
OR pt.id IN (SELECT DISTINCT payment_type_id FROM m_sponsor_dd_inventory))
AND pt.value NOT IN (SELECT name FROM m_sponsor_bank);
</sql>
</changeSet>
<changeSet author="fineract" id="0349-3-add-sponsor-bank-id-to-inventory">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_inventory" />
<not>
<columnExists tableName="m_sponsor_dd_inventory" columnName="sponsor_bank_id" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_inventory">
<column name="sponsor_bank_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_inv_sponsor_bank_id" references="m_sponsor_bank(id)" />
</column>
</addColumn>
</changeSet>
<changeSet author="fineract" id="0349-4-update-inventory-sponsor-bank-ids">
<preConditions onFail="MARK_RAN">
<columnExists tableName="m_sponsor_dd_inventory" columnName="sponsor_bank_id" />
<columnExists tableName="m_sponsor_dd_inventory" columnName="payment_type_id" />
</preConditions>
<sql>
-- Update sponsor_bank_id based on name matching from m_payment_type
UPDATE m_sponsor_dd_inventory
SET sponsor_bank_id = (
SELECT sb.id
FROM m_sponsor_bank sb
JOIN m_payment_type pt ON pt.value = sb.name
WHERE pt.id = m_sponsor_dd_inventory.payment_type_id
LIMIT 1
)
WHERE sponsor_bank_id IS NULL;
</sql>
</changeSet>
<changeSet author="fineract" id="0349-5-set-sponsor-bank-id-not-null">
<preConditions onFail="MARK_RAN">
<columnExists tableName="m_sponsor_dd_inventory" columnName="sponsor_bank_id" />
</preConditions>
<addNotNullConstraint tableName="m_sponsor_dd_inventory" columnName="sponsor_bank_id" columnDataType="BIGINT" />
</changeSet>
<changeSet author="fineract" id="0349-6-drop-payment-type-from-inventory">
<preConditions onFail="MARK_RAN">
<columnExists tableName="m_sponsor_dd_inventory" columnName="payment_type_id" />
</preConditions>
<dropForeignKeyConstraint baseTableName="m_sponsor_dd_inventory" constraintName="fk_sdd_inv_payment_type_id" />
<dropColumn tableName="m_sponsor_dd_inventory" columnName="payment_type_id" />
</changeSet>
<changeSet author="fineract" id="0349-7-decouple-gl-mapping-payment-type">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_gl_mapping" />
<columnExists tableName="m_sponsor_dd_gl_mapping" columnName="payment_type_id" />
</preConditions>
<dropForeignKeyConstraint baseTableName="m_sponsor_dd_gl_mapping" constraintName="fk_sdd_glmap_payment_type_id" />
<dropUniqueConstraint tableName="m_sponsor_dd_gl_mapping" constraintName="sdd_glmap_unq_payment_type" />
<dropColumn tableName="m_sponsor_dd_gl_mapping" columnName="payment_type_id" />
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,119 @@
<?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">
<!-- Interim liability GL account for cash physically received from a walk-in DD purchaser at
submission time, before the manager has approved the request. Real-world equivalent of
"advance received against demand draft application" - keeps the cash movement auditable
immediately (the teller's cash-in-hand balance is correct as soon as cash is taken),
without prematurely crediting the Sponsor DD Payable liability, which is only actually
owed to the sponsor bank once the draft is approved/issued. -->
<changeSet author="fineract" id="0350-1-insert-dd-cash-suspense-gl-account">
<preConditions onFail="MARK_RAN">
<not>
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '9.4'</sqlCheck>
</not>
</preConditions>
<insert tableName="acc_gl_account">
<column name="name" value="DD Cash Received - Pending Approval"/>
<column name="gl_code" value="9.4"/>
<column name="parent_id" valueNumeric="22"/>
<column name="hierarchy" value="."/>
<column name="account_usage" valueNumeric="1"/>
<column name="classification_enum" valueNumeric="2"/>
<column name="disabled" valueBoolean="false"/>
<column name="manual_journal_entries_allowed" valueBoolean="true"/>
<column name="description" value="Interim liability for cash physically received from a walk-in DD purchaser at submission time, pending manager approval of the issuance request. Cleared into Sponsor DD Payable + Charges Income on approval, or reversed back to Cash at Tellers on rejection."/>
</insert>
</changeSet>
<changeSet author="fineract" id="0350-2-fix-dd-cash-suspense-hierarchy">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '9.4' and hierarchy = '.'</sqlCheck>
</preConditions>
<sql>
UPDATE acc_gl_account SET hierarchy = CONCAT('.', id, '.') WHERE gl_code = '9.4' AND hierarchy = '.';
</sql>
</changeSet>
<changeSet author="fineract" id="0350-3-add-cash-suspense-to-gl-mapping">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_gl_mapping" />
<not>
<columnExists tableName="m_sponsor_dd_gl_mapping" columnName="cash_suspense_gl_account_id" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_gl_mapping">
<column name="cash_suspense_gl_account_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_glmap_cash_suspense_gl_id" references="acc_gl_account(id)" />
</column>
</addColumn>
</changeSet>
<changeSet author="fineract" id="0350-4-map-dd-cash-suspense-account">
<preConditions onFail="MARK_RAN">
<not>
<sqlCheck expectedResult="0">
select count(*) from m_sponsor_dd_gl_mapping where cash_suspense_gl_account_id is null
</sqlCheck>
</not>
</preConditions>
<sql>
UPDATE m_sponsor_dd_gl_mapping
SET cash_suspense_gl_account_id = (select id from acc_gl_account where gl_code = '9.4')
WHERE cash_suspense_gl_account_id is null;
</sql>
</changeSet>
<!-- Audit trail: which journal entry recorded the initial cash receipt (posted at submission),
and which one reversed it (posted only if the request is later rejected). Both are nullable
since ACCOUNT_DEBIT/CHEQUE requests never populate them, and an approved CASH request only
ever gets a receipt entry (never a refund one). -->
<changeSet author="fineract" id="0350-5-add-cash-receipt-journal-entry-column">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_issue_request" />
<not>
<columnExists tableName="m_sponsor_dd_issue_request" columnName="cash_receipt_journal_entry_id" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_issue_request">
<column name="cash_receipt_journal_entry_id" type="BIGINT">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
<changeSet author="fineract" id="0350-6-add-cash-refund-journal-entry-column">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_issue_request" />
<not>
<columnExists tableName="m_sponsor_dd_issue_request" columnName="cash_refund_journal_entry_id" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_issue_request">
<column name="cash_refund_journal_entry_id" type="BIGINT">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,84 @@
<?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">
<!-- A DD leaflet is a negotiable instrument - printing it a second time is a control risk
(duplicate physical drafts). The first print is free; any print after that requires a
reprint request approved by a higher authority (maker-checker), same pattern as issuance. -->
<changeSet author="fineract" id="0351-1-add-print-tracking-to-leaflet">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_leaflet" />
<not>
<columnExists tableName="m_sponsor_dd_leaflet" columnName="print_count" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_leaflet">
<column name="print_count" type="INT" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="last_printed_date" type="DATETIME">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
<changeSet author="fineract" id="0351-2-create-reprint-request-table">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="m_sponsor_dd_reprint_request" />
</not>
</preConditions>
<createTable tableName="m_sponsor_dd_reprint_request">
<column name="id" type="BIGINT" autoIncrement="true">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="leaflet_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_sdd_reprint_leaflet_id" references="m_sponsor_dd_leaflet(id)" />
</column>
<column name="reason" type="VARCHAR(500)">
<constraints nullable="false" />
</column>
<column name="status" type="VARCHAR(20)" defaultValue="PENDING">
<constraints nullable="false" />
</column>
<column name="consumed" type="BOOLEAN" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
<column name="maker_id" type="BIGINT">
<constraints nullable="false" foreignKeyName="fk_sdd_reprint_maker_id" references="m_appuser(id)" />
</column>
<column name="created_date" type="DATETIME" defaultValueComputed="now()">
<constraints nullable="false" />
</column>
<column name="checker_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_reprint_checker_id" references="m_appuser(id)" />
</column>
<column name="checker_date" type="DATETIME">
<constraints nullable="true" />
</column>
<column name="rejection_reason" type="VARCHAR(1000)">
<constraints nullable="true" />
</column>
</createTable>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,61 @@
<?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">
<!-- "Payable at [Branch], [City]" - standard field on a demand draft telling the beneficiary
where it can be encashed. Nullable at the DB level (existing rows have neither); the
write service enforces it as required for new submissions. -->
<changeSet author="fineract" id="0352-1-add-payable-at-to-issue-request">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_issue_request" />
<not>
<columnExists tableName="m_sponsor_dd_issue_request" columnName="payable_at_branch" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_issue_request">
<column name="payable_at_branch" type="VARCHAR(150)">
<constraints nullable="true" />
</column>
<column name="payable_at_city" type="VARCHAR(100)">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
<changeSet author="fineract" id="0352-2-add-payable-at-to-leaflet">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_leaflet" />
<not>
<columnExists tableName="m_sponsor_dd_leaflet" columnName="payable_at_branch" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_leaflet">
<column name="payable_at_branch" type="VARCHAR(150)">
<constraints nullable="true" />
</column>
<column name="payable_at_city" type="VARCHAR(100)">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,109 @@
<?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">
<!-- GST collected on DD issuance charges is money owed to the government, not bank income -
it gets its own liability GL account, separate from Charges Income. -->
<changeSet author="fineract" id="0353-1-insert-gst-payable-gl-account">
<preConditions onFail="MARK_RAN">
<not>
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '9.5'</sqlCheck>
</not>
</preConditions>
<insert tableName="acc_gl_account">
<column name="name" value="GST Payable on DD Charges"/>
<column name="gl_code" value="9.5"/>
<column name="parent_id" valueNumeric="22"/>
<column name="hierarchy" value="."/>
<column name="account_usage" valueNumeric="1"/>
<column name="classification_enum" valueNumeric="2"/>
<column name="disabled" valueBoolean="false"/>
<column name="manual_journal_entries_allowed" valueBoolean="true"/>
<column name="description" value="GST collected from customers/purchasers on Sponsor DD issuance charges, held pending remittance to the government - not bank income."/>
</insert>
</changeSet>
<changeSet author="fineract" id="0353-2-fix-gst-payable-hierarchy">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '9.5' and hierarchy = '.'</sqlCheck>
</preConditions>
<sql>
UPDATE acc_gl_account SET hierarchy = CONCAT('.', id, '.') WHERE gl_code = '9.5' AND hierarchy = '.';
</sql>
</changeSet>
<!-- gst_percentage is deliberately a configurable column, not a hardcoded constant in Java -
it can be changed at any time (e.g. when the government revises the GST rate) via the
existing GL mapping admin endpoint, without a code deployment. Defaults to 18.00 (the
current GST rate on Indian banking service charges) for existing/new rows. -->
<changeSet author="fineract" id="0353-3-add-gst-columns-to-gl-mapping">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_gl_mapping" />
<not>
<columnExists tableName="m_sponsor_dd_gl_mapping" columnName="gst_percentage" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_gl_mapping">
<column name="gst_percentage" type="DECIMAL(5,2)" defaultValueNumeric="18.00">
<constraints nullable="false" />
</column>
<column name="gst_payable_gl_account_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_glmap_gst_gl_id" references="acc_gl_account(id)" />
</column>
</addColumn>
</changeSet>
<changeSet author="fineract" id="0353-4-map-gst-payable-account">
<preConditions onFail="MARK_RAN">
<not>
<sqlCheck expectedResult="0">
select count(*) from m_sponsor_dd_gl_mapping where gst_payable_gl_account_id is null
</sqlCheck>
</not>
</preConditions>
<sql>
UPDATE m_sponsor_dd_gl_mapping
SET gst_payable_gl_account_id = (select id from acc_gl_account where gl_code = '9.5')
WHERE gst_payable_gl_account_id is null;
</sql>
</changeSet>
<!-- Locked in at submission time (not recomputed at approval), so a rate change between
submission and approval never silently alters a request already in flight. -->
<changeSet author="fineract" id="0353-5-add-gst-columns-to-issue-request">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_issue_request" />
<not>
<columnExists tableName="m_sponsor_dd_issue_request" columnName="gst_amount" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_issue_request">
<column name="gst_amount" type="DECIMAL(19,6)" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="gst_percentage_applied" type="DECIMAL(5,2)" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,48 @@
<?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">
<!-- Identification codes needed to route/reconcile settlement with the sponsor bank and
confirm its identity unambiguously - IFSC (settlement branch), RBI/NPCI bank code, and
SWIFT/BIC (only relevant if it's ever a foreign correspondent bank). All optional at the
DB level since existing rows have none, but the API validates IFSC format when supplied. -->
<changeSet author="fineract" id="0354-1-add-sponsor-bank-identification-codes">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_bank" />
<not>
<columnExists tableName="m_sponsor_bank" columnName="ifsc_code" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_bank">
<column name="ifsc_code" type="VARCHAR(11)">
<constraints nullable="true" />
</column>
<column name="bank_code" type="VARCHAR(20)">
<constraints nullable="true" />
</column>
<column name="swift_code" type="VARCHAR(11)">
<constraints nullable="true" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,63 @@
<?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">
<!-- CASH DD requests no longer post their own "cash received" GL entry - the cashier records
the physical cash intake themselves via Transaction Entry (AC.TP=GL, target = the DD Cash
Suspense GL account), which is the existing, real cashier-position-tracked mechanism
(m_cashier_deposit_request + m_savings_txn_denomination). This column links a sponsor DD
issue request to the specific approved cashier deposit request that received its cash, so
we can validate the amount/account match and prevent the same cash being reused twice. -->
<changeSet author="fineract" id="0355-1-add-cashier-deposit-request-link">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_issue_request" />
<tableExists tableName="m_cashier_deposit_request" />
<not>
<columnExists tableName="m_sponsor_dd_issue_request" columnName="cashier_deposit_request_id" />
</not>
</preConditions>
<addColumn tableName="m_sponsor_dd_issue_request">
<column name="cashier_deposit_request_id" type="BIGINT">
<constraints nullable="true" foreignKeyName="fk_sdd_issuereq_cashier_deposit_id"
references="m_cashier_deposit_request(id)" />
</column>
</addColumn>
</changeSet>
<!-- The cashier's Transaction Entry GL-deposit flow always contras cash against "Cash at Vault"
(gl_code 1), not "Cash at Teller" (gl_code 2) - see CashierDepositRequestApiResource's
executeGlJournalEntry / the frontend's loadCashVaultGl(). Repoint our cash_gl_account_id to
match, since the reject/refund leg (Dr DD Cash Suspense / Cr this account) must reverse
against the same account the cashier's approved deposit actually touched. -->
<changeSet author="fineract" id="0355-2-repoint-cash-account-to-vault">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_sponsor_dd_gl_mapping" />
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '1'</sqlCheck>
</preConditions>
<sql>
UPDATE m_sponsor_dd_gl_mapping
SET cash_gl_account_id = (select id from acc_gl_account where gl_code = '1')
WHERE cash_gl_account_id = (select id from acc_gl_account where gl_code = '2');
</sql>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,47 @@
<?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">
<!-- Transaction Entry's DD + Cash + GL row splits the single deposit amount into DD face value,
issuance charges and GST on those charges (Amount + Charges + GST, rounded up to the target
cash-collected total). Today m_cashier_deposit_request only stores that combined "amount" -
the breakdown is lost once the request is submitted, forcing whoever later issues the actual
DD leaflet in the Sponsor DD module to retype face value/charges from scratch. These columns
persist the breakdown at submit time (null for ordinary, non-DD deposit requests) so the DD
issuance screen can read it back via the linked cashier_deposit_request_id and pre-fill its
form instead of retyping. -->
<changeSet author="fineract" id="0356-1-add-dd-breakdown-to-cashier-deposit-request">
<preConditions onFail="MARK_RAN">
<tableExists tableName="m_cashier_deposit_request" />
<not>
<columnExists tableName="m_cashier_deposit_request" columnName="dd_face_value" />
</not>
</preConditions>
<addColumn tableName="m_cashier_deposit_request">
<column name="dd_face_value" type="DECIMAL(19,6)" />
<column name="dd_charges" type="DECIMAL(19,6)" />
<column name="dd_gst_percentage" type="DECIMAL(19,6)" />
<column name="dd_gst_amount" type="DECIMAL(19,6)" />
</addColumn>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,43 @@
<?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">
<!-- Admin-configurable ceiling for a single DD's face value, also used as the ceiling for the
combined face value of all DDs issued to the same beneficiary on the same day (structuring
control for walk-in/large-cash DD issuance). Null/unset means no limit is enforced. -->
<changeSet author="fineract" id="0357-1-add-dd-limit-amount">
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_sponsor_dd_gl_mapping"/>
<not>
<columnExists tableName="m_sponsor_dd_gl_mapping" columnName="dd_limit_amount"/>
</not>
</and>
</preConditions>
<addColumn tableName="m_sponsor_dd_gl_mapping">
<column name="dd_limit_amount" type="DECIMAL(19,6)">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,60 @@
<?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">
<!-- Groups several DD issue requests submitted together as one "DD slip" (one customer account
debited/one cheque, several drafts for different beneficiaries/amounts). Set to the id of the
first row inserted for the slip - every row in the slip, including that first row, carries the
same batch_id, so the group can be queried/approved/rejected as one unit. Null for an ordinary
single-DD request (unchanged behaviour). No FK - it's a grouping tag, not a relationship to a
separate header row. -->
<changeSet author="fineract" id="0358-1-add-batch-id">
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_sponsor_dd_issue_request"/>
<not>
<columnExists tableName="m_sponsor_dd_issue_request" columnName="batch_id"/>
</not>
</and>
</preConditions>
<addColumn tableName="m_sponsor_dd_issue_request">
<column name="batch_id" type="BIGINT">
<constraints nullable="true"/>
</column>
</addColumn>
</changeSet>
<changeSet author="fineract" id="0358-2-index-batch-id">
<preConditions onFail="MARK_RAN">
<and>
<tableExists tableName="m_sponsor_dd_issue_request"/>
<not>
<indexExists tableName="m_sponsor_dd_issue_request" indexName="idx_sdd_issue_req_batch_id"/>
</not>
</and>
</preConditions>
<createIndex tableName="m_sponsor_dd_issue_request" indexName="idx_sdd_issue_req_batch_id">
<column name="batch_id"/>
</createIndex>
</changeSet>
</databaseChangeLog>
@@ -0,0 +1,41 @@
<?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">
<!-- Bank's own choice: book GST collected on DD charges as income rather than tracking it as a
payable owed to the government. Same GL account (gl_code 9.5), same id, so
m_sponsor_dd_gl_mapping.gst_payable_gl_account_id and the DD-issuance GL posting code need no
change at all - this only re-tags how the account is classified/grouped for reporting.
parent_id=25 matches the parent already used by "DD Issuance Charges Income" (gl_code 10.3,
see 0348), so both DD-related income accounts group together under the same income parent. -->
<changeSet author="fineract" id="0359-1-reclassify-gst-payable-as-income">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="1">select count(*) from acc_gl_account where gl_code = '9.5' and classification_enum = 2</sqlCheck>
</preConditions>
<sql>
UPDATE acc_gl_account
SET classification_enum = 4, parent_id = 25
WHERE gl_code = '9.5';
</sql>
</changeSet>
</databaseChangeLog>