Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1de1aab93 |
+10
-1
@@ -37,4 +37,13 @@ gradleExp/
|
|||||||
.windsurf/
|
.windsurf/
|
||||||
|
|
||||||
# Application logs
|
# Application logs
|
||||||
fineract-provider/logs/
|
fineract-provider/logs/
|
||||||
|
logs/
|
||||||
|
|
||||||
|
# Output of a local `gradlew devRun`
|
||||||
|
devrun.log
|
||||||
|
|
||||||
|
# JVM crash dumps. The dev setup runs Fineract, the Angular dev server and Gradle on one
|
||||||
|
# machine, so an out-of-memory kill drops these in the repo root.
|
||||||
|
hs_err_pid*.log
|
||||||
|
replay_pid*.log
|
||||||
+1
-1
@@ -154,7 +154,7 @@ gitVersioning.apply {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
rev {
|
rev {
|
||||||
version = '1.15.0-SNAPSHOT'
|
version = '${describe.tag.version.major}.${describe.tag.version.minor.next}.0-SNAPSHOT'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,68 +0,0 @@
|
|||||||
-- Removes the duplicate vouchers left behind by the double-count bug.
|
|
||||||
--
|
|
||||||
-- Until 2026-09-03 the cashier deposit and clerk withdrawal registers did not wrap their inner
|
|
||||||
-- savings command in VoucherService.withOwnVoucher(...), so one counter transaction raised two
|
|
||||||
-- vouchers over the same money: the register's own (CASHIER_DEPOSIT_REQUEST / CLERK_WITHDRAWAL_
|
|
||||||
-- REQUEST) and a second one from the savings command (SAVINGS_TRANSACTION). The cashier's Received
|
|
||||||
-- and Payment reports counted both, doubling the day's cash.
|
|
||||||
--
|
|
||||||
-- The code is fixed, so no new duplicates are created. This clears the ones already recorded.
|
|
||||||
--
|
|
||||||
-- WHICH ONE IS DELETED: the SAVINGS_TRANSACTION voucher. The register's voucher is the keeper --
|
|
||||||
-- it is the one the register owns, attaches its DR/CR lines to, and stamps onto
|
|
||||||
-- m_savings_account_transaction.voucher_no. Deleting the register's voucher instead would break
|
|
||||||
-- that link and orphan the request row.
|
|
||||||
--
|
|
||||||
-- Run: psql -h localhost -U postgres -d fineract_default -v ON_ERROR_STOP=1 -f cleanup_duplicate_vouchers.sql
|
|
||||||
|
|
||||||
BEGIN;
|
|
||||||
|
|
||||||
-- The duplicates: a SAVINGS_TRANSACTION voucher whose transaction is already claimed by a
|
|
||||||
-- register voucher. Matching through savings_txn_id rather than by date or amount so that two
|
|
||||||
-- genuinely separate transactions of the same value on the same day are never confused.
|
|
||||||
CREATE TEMP TABLE dup_vouchers ON COMMIT DROP AS
|
|
||||||
SELECT sav.voucher_no
|
|
||||||
FROM m_voucher sav
|
|
||||||
JOIN m_voucher reg
|
|
||||||
ON reg.savings_txn_id = sav.reference_id
|
|
||||||
AND reg.reference_type IN ('CLERK_WITHDRAWAL_REQUEST', 'CASHIER_DEPOSIT_REQUEST')
|
|
||||||
WHERE sav.reference_type = 'SAVINGS_TRANSACTION'
|
|
||||||
AND sav.voucher_type IN ('DEPOSIT', 'WITHDRAWAL');
|
|
||||||
|
|
||||||
-- Refuse to run if anything else has attached itself to a voucher about to be deleted: a
|
|
||||||
-- verification or an attachment means someone acted on that slip, and it must be looked at by hand
|
|
||||||
-- rather than removed silently.
|
|
||||||
DO $$
|
|
||||||
DECLARE
|
|
||||||
blocked INT;
|
|
||||||
BEGIN
|
|
||||||
SELECT COUNT(*) INTO blocked
|
|
||||||
FROM (SELECT voucher_no FROM m_voucher_verification
|
|
||||||
WHERE voucher_no IN (SELECT voucher_no FROM dup_vouchers)
|
|
||||||
UNION ALL
|
|
||||||
SELECT voucher_no FROM m_voucher_attachment
|
|
||||||
WHERE voucher_no IN (SELECT voucher_no FROM dup_vouchers)) x;
|
|
||||||
IF blocked > 0 THEN
|
|
||||||
RAISE EXCEPTION 'Aborting: % duplicate voucher(s) carry a verification or attachment. Review these by hand.', blocked;
|
|
||||||
END IF;
|
|
||||||
END $$;
|
|
||||||
|
|
||||||
-- Likewise refuse if a savings transaction is stamped with a voucher about to be deleted. It should
|
|
||||||
-- carry the register's number, not the duplicate's; if it does not, the pair needs looking at.
|
|
||||||
DO $$
|
|
||||||
DECLARE
|
|
||||||
stamped INT;
|
|
||||||
BEGIN
|
|
||||||
SELECT COUNT(*) INTO stamped FROM m_savings_account_transaction
|
|
||||||
WHERE voucher_no IN (SELECT voucher_no FROM dup_vouchers);
|
|
||||||
IF stamped > 0 THEN
|
|
||||||
RAISE EXCEPTION 'Aborting: % savings transaction(s) are stamped with a duplicate voucher number.', stamped;
|
|
||||||
END IF;
|
|
||||||
END $$;
|
|
||||||
|
|
||||||
SELECT voucher_no AS "about to delete" FROM dup_vouchers ORDER BY voucher_no;
|
|
||||||
|
|
||||||
DELETE FROM m_voucher_line WHERE voucher_no IN (SELECT voucher_no FROM dup_vouchers);
|
|
||||||
DELETE FROM m_voucher WHERE voucher_no IN (SELECT voucher_no FROM dup_vouchers);
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
@@ -127,6 +127,14 @@ SELECT 'Inter-Bank Cap Charge', 'INR', 0.00, 2, 3, 1, 0, 1, 0, 0, 0,
|
|||||||
(SELECT id FROM acc_gl_account WHERE classification_enum = 4 AND usage_enum = 1 AND disabled = 0 ORDER BY id LIMIT 1)
|
(SELECT id FROM acc_gl_account WHERE classification_enum = 4 AND usage_enum = 1 AND disabled = 0 ORDER BY id LIMIT 1)
|
||||||
WHERE NOT EXISTS (SELECT 1 FROM m_charge WHERE name = 'Inter-Bank Cap Charge' AND is_deleted = 0);
|
WHERE NOT EXISTS (SELECT 1 FROM m_charge WHERE name = 'Inter-Bank Cap Charge' AND is_deleted = 0);
|
||||||
|
|
||||||
|
INSERT IGNORE INTO m_charge
|
||||||
|
(name, currency_code, amount, charge_applies_to_enum, charge_time_enum,
|
||||||
|
charge_calculation_enum, is_penalty, is_active, is_deleted,
|
||||||
|
is_free_withdrawal, is_payment_type, income_or_liability_account_id)
|
||||||
|
SELECT 'Withdrawal Facility Charge', 'INR', 5.00, 2, 3, 1, 0, 1, 0, 0, 0,
|
||||||
|
(SELECT id FROM acc_gl_account WHERE classification_enum = 4 AND usage_enum = 1 AND disabled = 0 ORDER BY id LIMIT 1)
|
||||||
|
WHERE NOT EXISTS (SELECT 1 FROM m_charge WHERE name = 'Withdrawal Facility Charge' AND is_deleted = 0);
|
||||||
|
|
||||||
INSERT IGNORE INTO m_charge
|
INSERT IGNORE INTO m_charge
|
||||||
(name, currency_code, amount, charge_applies_to_enum, charge_time_enum,
|
(name, currency_code, amount, charge_applies_to_enum, charge_time_enum,
|
||||||
charge_calculation_enum, is_penalty, is_active, is_deleted,
|
charge_calculation_enum, is_penalty, is_active, is_deleted,
|
||||||
@@ -160,5 +168,6 @@ VALUES
|
|||||||
('NEFT_FACILITY', 'NEFT Facility Charge', 5.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'NEFT Facility Charge' AND is_deleted = 0 LIMIT 1)),
|
('NEFT_FACILITY', 'NEFT Facility Charge', 5.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'NEFT Facility Charge' AND is_deleted = 0 LIMIT 1)),
|
||||||
('RTGS_FACILITY', 'RTGS Facility Charge', 25.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'RTGS Facility Charge' AND is_deleted = 0 LIMIT 1)),
|
('RTGS_FACILITY', 'RTGS Facility Charge', 25.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'RTGS Facility Charge' AND is_deleted = 0 LIMIT 1)),
|
||||||
('INTER_BANK_TOTAL_CAP','Inter-Bank Cap Charge', 0.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'Inter-Bank Cap Charge' AND is_deleted = 0 LIMIT 1)),
|
('INTER_BANK_TOTAL_CAP','Inter-Bank Cap Charge', 0.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'Inter-Bank Cap Charge' AND is_deleted = 0 LIMIT 1)),
|
||||||
|
('WITHDRAWAL_FACILITY', 'Withdrawal Facility Charge', 5.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'Withdrawal Facility Charge' AND is_deleted = 0 LIMIT 1)),
|
||||||
('DEPOSIT_FACILITY_KYC','Deposit KYC Charge', 5.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'Deposit KYC Charge' AND is_deleted = 0 LIMIT 1)),
|
('DEPOSIT_FACILITY_KYC','Deposit KYC Charge', 5.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'Deposit KYC Charge' AND is_deleted = 0 LIMIT 1)),
|
||||||
('VIRTUAL_DEBIT_CARD', 'Virtual Debit Card Charge', 199.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'Virtual Debit Card Charge' AND is_deleted = 0 LIMIT 1));
|
('VIRTUAL_DEBIT_CARD', 'Virtual Debit Card Charge', 199.00, 3, 2, (SELECT id FROM m_charge WHERE name = 'Virtual Debit Card Charge' AND is_deleted = 0 LIMIT 1));
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ ALTER TABLE m_current_product_facility_config
|
|||||||
ADD COLUMN IF NOT EXISTS neft_facility_charge_id BIGINT NULL,
|
ADD COLUMN IF NOT EXISTS neft_facility_charge_id BIGINT NULL,
|
||||||
ADD COLUMN IF NOT EXISTS rtgs_facility_charge_id BIGINT NULL,
|
ADD COLUMN IF NOT EXISTS rtgs_facility_charge_id BIGINT NULL,
|
||||||
ADD COLUMN IF NOT EXISTS inter_bank_total_cap_charge_id BIGINT NULL,
|
ADD COLUMN IF NOT EXISTS inter_bank_total_cap_charge_id BIGINT NULL,
|
||||||
|
ADD COLUMN IF NOT EXISTS withdrawal_facility_charge_id BIGINT NULL,
|
||||||
ADD COLUMN IF NOT EXISTS deposit_facility_kyc_charge_id BIGINT NULL,
|
ADD COLUMN IF NOT EXISTS deposit_facility_kyc_charge_id BIGINT NULL,
|
||||||
ADD COLUMN IF NOT EXISTS virtual_debit_card_charge_id BIGINT NULL;
|
ADD COLUMN IF NOT EXISTS virtual_debit_card_charge_id BIGINT NULL;
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ ALTER TABLE m_current_product_facility_config
|
|||||||
ADD CONSTRAINT fk_cpfc_neft_charge FOREIGN KEY (neft_facility_charge_id) REFERENCES m_charge(id),
|
ADD CONSTRAINT fk_cpfc_neft_charge FOREIGN KEY (neft_facility_charge_id) REFERENCES m_charge(id),
|
||||||
ADD CONSTRAINT fk_cpfc_rtgs_charge FOREIGN KEY (rtgs_facility_charge_id) REFERENCES m_charge(id),
|
ADD CONSTRAINT fk_cpfc_rtgs_charge FOREIGN KEY (rtgs_facility_charge_id) REFERENCES m_charge(id),
|
||||||
ADD CONSTRAINT fk_cpfc_ibtc_charge FOREIGN KEY (inter_bank_total_cap_charge_id) REFERENCES m_charge(id),
|
ADD CONSTRAINT fk_cpfc_ibtc_charge FOREIGN KEY (inter_bank_total_cap_charge_id) REFERENCES m_charge(id),
|
||||||
|
ADD CONSTRAINT fk_cpfc_wd_charge FOREIGN KEY (withdrawal_facility_charge_id) REFERENCES m_charge(id),
|
||||||
ADD CONSTRAINT fk_cpfc_dep_charge FOREIGN KEY (deposit_facility_kyc_charge_id) REFERENCES m_charge(id),
|
ADD CONSTRAINT fk_cpfc_dep_charge FOREIGN KEY (deposit_facility_kyc_charge_id) REFERENCES m_charge(id),
|
||||||
ADD CONSTRAINT fk_cpfc_vdc_charge FOREIGN KEY (virtual_debit_card_charge_id) REFERENCES m_charge(id);
|
ADD CONSTRAINT fk_cpfc_vdc_charge FOREIGN KEY (virtual_debit_card_charge_id) REFERENCES m_charge(id);
|
||||||
|
|
||||||
@@ -53,6 +55,7 @@ ALTER TABLE m_savings_product_facility_config
|
|||||||
ADD COLUMN IF NOT EXISTS neft_facility_charge_id BIGINT NULL,
|
ADD COLUMN IF NOT EXISTS neft_facility_charge_id BIGINT NULL,
|
||||||
ADD COLUMN IF NOT EXISTS rtgs_facility_charge_id BIGINT NULL,
|
ADD COLUMN IF NOT EXISTS rtgs_facility_charge_id BIGINT NULL,
|
||||||
ADD COLUMN IF NOT EXISTS inter_bank_total_cap_charge_id BIGINT NULL,
|
ADD COLUMN IF NOT EXISTS inter_bank_total_cap_charge_id BIGINT NULL,
|
||||||
|
ADD COLUMN IF NOT EXISTS withdrawal_facility_charge_id BIGINT NULL,
|
||||||
ADD COLUMN IF NOT EXISTS deposit_facility_kyc_charge_id BIGINT NULL,
|
ADD COLUMN IF NOT EXISTS deposit_facility_kyc_charge_id BIGINT NULL,
|
||||||
ADD COLUMN IF NOT EXISTS virtual_debit_card_charge_id BIGINT NULL;
|
ADD COLUMN IF NOT EXISTS virtual_debit_card_charge_id BIGINT NULL;
|
||||||
|
|
||||||
@@ -71,5 +74,6 @@ ALTER TABLE m_savings_product_facility_config
|
|||||||
ADD CONSTRAINT fk_spfc_neft_charge FOREIGN KEY (neft_facility_charge_id) REFERENCES m_charge(id),
|
ADD CONSTRAINT fk_spfc_neft_charge FOREIGN KEY (neft_facility_charge_id) REFERENCES m_charge(id),
|
||||||
ADD CONSTRAINT fk_spfc_rtgs_charge FOREIGN KEY (rtgs_facility_charge_id) REFERENCES m_charge(id),
|
ADD CONSTRAINT fk_spfc_rtgs_charge FOREIGN KEY (rtgs_facility_charge_id) REFERENCES m_charge(id),
|
||||||
ADD CONSTRAINT fk_spfc_ibtc_charge FOREIGN KEY (inter_bank_total_cap_charge_id) REFERENCES m_charge(id),
|
ADD CONSTRAINT fk_spfc_ibtc_charge FOREIGN KEY (inter_bank_total_cap_charge_id) REFERENCES m_charge(id),
|
||||||
|
ADD CONSTRAINT fk_spfc_wd_charge FOREIGN KEY (withdrawal_facility_charge_id) REFERENCES m_charge(id),
|
||||||
ADD CONSTRAINT fk_spfc_dep_charge FOREIGN KEY (deposit_facility_kyc_charge_id) REFERENCES m_charge(id),
|
ADD CONSTRAINT fk_spfc_dep_charge FOREIGN KEY (deposit_facility_kyc_charge_id) REFERENCES m_charge(id),
|
||||||
ADD CONSTRAINT fk_spfc_vdc_charge FOREIGN KEY (virtual_debit_card_charge_id) REFERENCES m_charge(id);
|
ADD CONSTRAINT fk_spfc_vdc_charge FOREIGN KEY (virtual_debit_card_charge_id) REFERENCES m_charge(id);
|
||||||
|
|||||||
+9
-20
@@ -45,22 +45,6 @@ public final class FinancialActivityAccountDataValidator {
|
|||||||
*/
|
*/
|
||||||
private final Set<String> supportedParameters = FinancialActivityAccountsJsonInputParams.getAllValues();
|
private final Set<String> supportedParameters = FinancialActivityAccountsJsonInputParams.getAllValues();
|
||||||
|
|
||||||
/**
|
|
||||||
* Activities an administrator may map from the Financial Activity Mappings screen.
|
|
||||||
*
|
|
||||||
* Held in one place because create and update both validate against it, and the two lists had already drifted -
|
|
||||||
* update omitted the two cash activities, and neither offered the dividend activities beyond PAYABLE_DIVIDENDS even
|
|
||||||
* though the accounting code reads them. An activity the posting code resolves but this list omits can only ever be
|
|
||||||
* seeded by a migration, which is how DIVIDEND_PAID and RESERVE_FOR_DIVIDEND came to exist without being editable.
|
|
||||||
*/
|
|
||||||
private static final Object[] MAPPABLE_FINANCIAL_ACTIVITIES = { FinancialActivity.ASSET_TRANSFER.getValue(),
|
|
||||||
FinancialActivity.LIABILITY_TRANSFER.getValue(), FinancialActivity.CASH_AT_MAINVAULT.getValue(),
|
|
||||||
FinancialActivity.CASH_AT_TELLER.getValue(), FinancialActivity.OPENING_BALANCES_TRANSFER_CONTRA.getValue(),
|
|
||||||
FinancialActivity.ASSET_FUND_SOURCE.getValue(), FinancialActivity.PAYABLE_DIVIDENDS.getValue(),
|
|
||||||
FinancialActivity.DIVIDEND_PAID.getValue(), FinancialActivity.RESERVE_FOR_DIVIDEND.getValue(),
|
|
||||||
FinancialActivity.DIVIDEND_FORFEITED_INCOME.getValue(), FinancialActivity.DISTRIBUTABLE_PROFIT.getValue(),
|
|
||||||
FinancialActivity.RETAINED_PROFIT.getValue(), FinancialActivity.DIVIDEND_ROUND_OFF.getValue() };
|
|
||||||
|
|
||||||
private final String paramNameForFinancialActivity = FinancialActivityAccountsJsonInputParams.FINANCIAL_ACTIVITY_ID.getValue();
|
private final String paramNameForFinancialActivity = FinancialActivityAccountsJsonInputParams.FINANCIAL_ACTIVITY_ID.getValue();
|
||||||
private final String paramNameForGLAccount = FinancialActivityAccountsJsonInputParams.GL_ACCOUNT_ID.getValue();
|
private final String paramNameForGLAccount = FinancialActivityAccountsJsonInputParams.GL_ACCOUNT_ID.getValue();
|
||||||
|
|
||||||
@@ -75,8 +59,11 @@ public final class FinancialActivityAccountDataValidator {
|
|||||||
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
final JsonElement element = this.fromApiJsonHelper.parse(json);
|
||||||
|
|
||||||
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
|
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity, element);
|
||||||
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).notNull()
|
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).notNull().isOneOfTheseValues(
|
||||||
.isOneOfTheseValues(MAPPABLE_FINANCIAL_ACTIVITIES);
|
FinancialActivity.ASSET_TRANSFER.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||||
|
FinancialActivity.CASH_AT_MAINVAULT.getValue(), FinancialActivity.CASH_AT_TELLER.getValue(),
|
||||||
|
FinancialActivity.OPENING_BALANCES_TRANSFER_CONTRA.getValue(), FinancialActivity.ASSET_FUND_SOURCE.getValue(),
|
||||||
|
FinancialActivity.PAYABLE_DIVIDENDS.getValue());
|
||||||
|
|
||||||
final Long glAccountId = this.fromApiJsonHelper.extractLongNamed(paramNameForGLAccount, element);
|
final Long glAccountId = this.fromApiJsonHelper.extractLongNamed(paramNameForGLAccount, element);
|
||||||
baseDataValidator.reset().parameter(paramNameForGLAccount).value(glAccountId).notNull().integerGreaterThanZero();
|
baseDataValidator.reset().parameter(paramNameForGLAccount).value(glAccountId).notNull().integerGreaterThanZero();
|
||||||
@@ -99,8 +86,10 @@ public final class FinancialActivityAccountDataValidator {
|
|||||||
if (this.fromApiJsonHelper.parameterExists(paramNameForFinancialActivity, element)) {
|
if (this.fromApiJsonHelper.parameterExists(paramNameForFinancialActivity, element)) {
|
||||||
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity,
|
final Integer financialActivityId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(paramNameForFinancialActivity,
|
||||||
element);
|
element);
|
||||||
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).ignoreIfNull()
|
baseDataValidator.reset().parameter(paramNameForFinancialActivity).value(financialActivityId).ignoreIfNull().isOneOfTheseValues(
|
||||||
.isOneOfTheseValues(MAPPABLE_FINANCIAL_ACTIVITIES);
|
FinancialActivity.ASSET_TRANSFER.getValue(), FinancialActivity.LIABILITY_TRANSFER.getValue(),
|
||||||
|
FinancialActivity.OPENING_BALANCES_TRANSFER_CONTRA.getValue(), FinancialActivity.ASSET_FUND_SOURCE.getValue(),
|
||||||
|
FinancialActivity.PAYABLE_DIVIDENDS.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(paramNameForGLAccount, element)) {
|
if (this.fromApiJsonHelper.parameterExists(paramNameForGLAccount, element)) {
|
||||||
|
|||||||
-5
@@ -37,7 +37,6 @@ public class JournalEntryInvalidException extends AbstractPlatformDomainRuleExce
|
|||||||
DEBIT_CREDIT_ACCOUNT_OR_AMOUNT_EMPTY, //
|
DEBIT_CREDIT_ACCOUNT_OR_AMOUNT_EMPTY, //
|
||||||
GL_ACCOUNT_DISABLED, //
|
GL_ACCOUNT_DISABLED, //
|
||||||
GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED, //
|
GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED, //
|
||||||
GL_ACCOUNT_IS_HEADER, //
|
|
||||||
INVALID_DEBIT_OR_CREDIT_ACCOUNTS; //
|
INVALID_DEBIT_OR_CREDIT_ACCOUNTS; //
|
||||||
|
|
||||||
public String errorMessage() {
|
public String errorMessage() {
|
||||||
@@ -59,8 +58,6 @@ public class JournalEntryInvalidException extends AbstractPlatformDomainRuleExce
|
|||||||
return "Invalid debit or credit accounts are passed";
|
return "Invalid debit or credit accounts are passed";
|
||||||
} else if (name().equalsIgnoreCase("GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED")) {
|
} else if (name().equalsIgnoreCase("GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED")) {
|
||||||
return "Target account does not allow manual adjustments";
|
return "Target account does not allow manual adjustments";
|
||||||
} else if (name().equalsIgnoreCase("GL_ACCOUNT_IS_HEADER")) {
|
|
||||||
return "Target account is a Header account (a chart-of-accounts grouping node) and cannot receive a transaction directly";
|
|
||||||
}
|
}
|
||||||
return name();
|
return name();
|
||||||
}
|
}
|
||||||
@@ -82,8 +79,6 @@ public class JournalEntryInvalidException extends AbstractPlatformDomainRuleExce
|
|||||||
return "error.msg.glJournalEntry.invalid.debit.or.credit.accounts";
|
return "error.msg.glJournalEntry.invalid.debit.or.credit.accounts";
|
||||||
} else if (name().equalsIgnoreCase("GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED")) {
|
} else if (name().equalsIgnoreCase("GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED")) {
|
||||||
return "error.msg.glJournalEntry.invalid.account.manual.adjustments.not.permitted";
|
return "error.msg.glJournalEntry.invalid.account.manual.adjustments.not.permitted";
|
||||||
} else if (name().equalsIgnoreCase("GL_ACCOUNT_IS_HEADER")) {
|
|
||||||
return "error.msg.glJournalEntry.invalid.account.is.header";
|
|
||||||
}
|
}
|
||||||
return name();
|
return name();
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-36
@@ -181,14 +181,10 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
|||||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue()).value(savingsReferenceAccountId)
|
baseDataValidator.reset().parameter(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue()).value(savingsReferenceAccountId)
|
||||||
.notNull().integerGreaterThanZero();
|
.notNull().integerGreaterThanZero();
|
||||||
|
|
||||||
// Transfers In Suspense is not offered by every savings product UI, so it is validated only
|
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper
|
||||||
// when the client actually sends it. Omitting it leaves the mapping unset rather than failing.
|
.extractLongNamed(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
||||||
if (this.fromApiJsonHelper.parameterExists(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element)) {
|
baseDataValidator.reset().parameter(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
||||||
final Long transfersInSuspenseAccountId = this.fromApiJsonHelper
|
.value(transfersInSuspenseAccountId).notNull().integerGreaterThanZero();
|
||||||
.extractLongNamed(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), element);
|
|
||||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue())
|
|
||||||
.value(transfersInSuspenseAccountId).notNull().integerGreaterThanZero();
|
|
||||||
}
|
|
||||||
|
|
||||||
final Long interestOnSavingsAccountId = this.fromApiJsonHelper
|
final Long interestOnSavingsAccountId = this.fromApiJsonHelper
|
||||||
.extractLongNamed(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), element);
|
.extractLongNamed(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), element);
|
||||||
@@ -214,29 +210,20 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
|
if (!accountType.equals(DepositAccountType.RECURRING_DEPOSIT) && !accountType.equals(DepositAccountType.FIXED_DEPOSIT)) {
|
||||||
// Overdraft Control / Income From Interest / Write Off apply to overdraft-capable products
|
final Long overdraftAccount = this.fromApiJsonHelper
|
||||||
// only, so they are validated when supplied rather than demanded from every savings product.
|
.extractLongNamed(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
||||||
if (this.fromApiJsonHelper.parameterExists(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(),
|
baseDataValidator.reset().parameter(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue())
|
||||||
element)) {
|
.value(overdraftAccount).notNull().integerGreaterThanZero();
|
||||||
final Long overdraftAccount = this.fromApiJsonHelper
|
|
||||||
.extractLongNamed(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), element);
|
|
||||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue())
|
|
||||||
.value(overdraftAccount).notNull().integerGreaterThanZero();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), element)) {
|
final Long incomeFromInterest = this.fromApiJsonHelper
|
||||||
final Long incomeFromInterest = this.fromApiJsonHelper
|
.extractLongNamed(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), element);
|
||||||
.extractLongNamed(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), element);
|
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue()).value(incomeFromInterest)
|
||||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue())
|
.notNull().integerGreaterThanZero();
|
||||||
.value(incomeFromInterest).notNull().integerGreaterThanZero();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), element)) {
|
final Long writtenOff = this.fromApiJsonHelper.extractLongNamed(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(),
|
||||||
final Long writtenOff = this.fromApiJsonHelper
|
element);
|
||||||
.extractLongNamed(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), element);
|
baseDataValidator.reset().parameter(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue()).value(writtenOff).notNull()
|
||||||
baseDataValidator.reset().parameter(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue()).value(writtenOff)
|
.integerGreaterThanZero();
|
||||||
.notNull().integerGreaterThanZero();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -279,15 +266,9 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer {
|
|||||||
|
|
||||||
if (AccountingValidations.isCashBasedAccounting(accountingRuleType)) {
|
if (AccountingValidations.isCashBasedAccounting(accountingRuleType)) {
|
||||||
|
|
||||||
// Optional, not mandatory like the three below: it names an account for cash physically
|
|
||||||
// received at the counter for a share purchase, which every register in this bank now
|
|
||||||
// books against the account the money actually reached instead. Left absent, a product
|
|
||||||
// simply carries no such mapping, and any code path that still needs one (a genuine
|
|
||||||
// over-the-counter collection) fails with a named "GL not mapped" error rather than
|
|
||||||
// silently assuming the till.
|
|
||||||
final Long shareReferenceId = this.fromApiJsonHelper.extractLongNamed(SharesProductAccountingParams.SHARES_REFERENCE.getValue(),
|
final Long shareReferenceId = this.fromApiJsonHelper.extractLongNamed(SharesProductAccountingParams.SHARES_REFERENCE.getValue(),
|
||||||
element);
|
element);
|
||||||
baseDataValidator.reset().parameter(SharesProductAccountingParams.SHARES_REFERENCE.getValue()).value(shareReferenceId)
|
baseDataValidator.reset().parameter(SharesProductAccountingParams.SHARES_REFERENCE.getValue()).value(shareReferenceId).notNull()
|
||||||
.integerGreaterThanZero();
|
.integerGreaterThanZero();
|
||||||
|
|
||||||
final Long shareSuspenseId = this.fromApiJsonHelper.extractLongNamed(SharesProductAccountingParams.SHARES_SUSPENSE.getValue(),
|
final Long shareSuspenseId = this.fromApiJsonHelper.extractLongNamed(SharesProductAccountingParams.SHARES_SUSPENSE.getValue(),
|
||||||
|
|||||||
-2
@@ -38,8 +38,6 @@ public interface ProductToGLAccountMappingReadPlatformService {
|
|||||||
|
|
||||||
Map<String, Object> fetchAccountMappingDetailsForSavingsProduct(Long savingsProductId, Integer accountingType);
|
Map<String, Object> fetchAccountMappingDetailsForSavingsProduct(Long savingsProductId, Integer accountingType);
|
||||||
|
|
||||||
Map<String, Object> fetchAccountMappingDetailsForCurrentProduct(Long currentProductId, Integer accountingType);
|
|
||||||
|
|
||||||
List<PaymentTypeToGLAccountMapper> fetchPaymentTypeToFundSourceMappingsForSavingsProduct(Long savingsProductId);
|
List<PaymentTypeToGLAccountMapper> fetchPaymentTypeToFundSourceMappingsForSavingsProduct(Long savingsProductId);
|
||||||
|
|
||||||
List<ChargeToGLAccountMapper> fetchFeeToIncomeAccountMappingsForSavingsProduct(Long savingsProductId);
|
List<ChargeToGLAccountMapper> fetchFeeToIncomeAccountMappingsForSavingsProduct(Long savingsProductId);
|
||||||
|
|||||||
-20
@@ -202,20 +202,6 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
|||||||
return accountMappingDetails;
|
return accountMappingDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A current product's mappings, which live under their own CURRENT product type, laid out as a savings product's. */
|
|
||||||
@Override
|
|
||||||
public Map<String, Object> fetchAccountMappingDetailsForCurrentProduct(final Long currentProductId, final Integer accountingType) {
|
|
||||||
final List<ProductToGLAccountMapping> mappings = productToGLAccountMappingRepository.findAllRegularMappings(currentProductId,
|
|
||||||
PortfolioProductType.CURRENT.getValue());
|
|
||||||
if (AccountingValidations.isCashBasedAccounting(accountingType)) {
|
|
||||||
return setCashSavingsProductToGLAccountMaps(mappings);
|
|
||||||
}
|
|
||||||
if (AccountingValidations.isAccrualPeriodicBasedAccounting(accountingType)) {
|
|
||||||
return setAccrualPeriodicSavingsProductToGLAccountMaps(mappings);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<PaymentTypeToGLAccountMapper> fetchPaymentTypeToFundSourceMappingsForLoanProduct(final Long loanProductId) {
|
public List<PaymentTypeToGLAccountMapper> fetchPaymentTypeToFundSourceMappingsForLoanProduct(final Long loanProductId) {
|
||||||
return fetchPaymentTypeToFundSourceMappings(PortfolioProductType.LOAN, loanProductId);
|
return fetchPaymentTypeToFundSourceMappings(PortfolioProductType.LOAN, loanProductId);
|
||||||
@@ -440,8 +426,6 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
|||||||
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_INTEREST.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_INTEREST.getValue(), glAccountData);
|
||||||
} else if (glAccountForSavings.equals(AccrualAccountsForSavings.ESCHEAT_LIABILITY)) {
|
} else if (glAccountForSavings.equals(AccrualAccountsForSavings.ESCHEAT_LIABILITY)) {
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.ESCHEAT_LIABILITY.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.ESCHEAT_LIABILITY.getValue(), glAccountData);
|
||||||
} else if (glAccountForSavings.equals(AccrualAccountsForSavings.ROUNDING_ADJUSTMENT)) {
|
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.ROUNDING_ADJUSTMENT.getValue(), glAccountData);
|
|
||||||
// Expense
|
// Expense
|
||||||
} else if (glAccountForSavings.equals(AccrualAccountsForSavings.INTEREST_ON_SAVINGS)) {
|
} else if (glAccountForSavings.equals(AccrualAccountsForSavings.INTEREST_ON_SAVINGS)) {
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.INTEREST_ON_SAVINGS.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.INTEREST_ON_SAVINGS.getValue(), glAccountData);
|
||||||
@@ -477,8 +461,6 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
|||||||
accountMappingDetails.put(SavingProductAccountingDataParams.SAVINGS_CONTROL.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.SAVINGS_CONTROL.getValue(), glAccountData);
|
||||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.TRANSFERS_SUSPENSE)) {
|
} else if (glAccountForSavings.equals(CashAccountsForSavings.TRANSFERS_SUSPENSE)) {
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.TRANSFERS_SUSPENSE.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.TRANSFERS_SUSPENSE.getValue(), glAccountData);
|
||||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.INTEREST_PAYABLE)) {
|
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.INTEREST_PAYABLE.getValue(), glAccountData);
|
|
||||||
// Income
|
// Income
|
||||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.INCOME_FROM_FEES)) {
|
} else if (glAccountForSavings.equals(CashAccountsForSavings.INCOME_FROM_FEES)) {
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_FEES.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_FEES.getValue(), glAccountData);
|
||||||
@@ -488,8 +470,6 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product
|
|||||||
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_INTEREST.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.INCOME_FROM_INTEREST.getValue(), glAccountData);
|
||||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.ESCHEAT_LIABILITY)) {
|
} else if (glAccountForSavings.equals(CashAccountsForSavings.ESCHEAT_LIABILITY)) {
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.ESCHEAT_LIABILITY.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.ESCHEAT_LIABILITY.getValue(), glAccountData);
|
||||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.ROUNDING_ADJUSTMENT)) {
|
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.ROUNDING_ADJUSTMENT.getValue(), glAccountData);
|
|
||||||
// Expense
|
// Expense
|
||||||
} else if (glAccountForSavings.equals(CashAccountsForSavings.INTEREST_ON_SAVINGS)) {
|
} else if (glAccountForSavings.equals(CashAccountsForSavings.INTEREST_ON_SAVINGS)) {
|
||||||
accountMappingDetails.put(SavingProductAccountingDataParams.INTEREST_ON_SAVINGS.getValue(), glAccountData);
|
accountMappingDetails.put(SavingProductAccountingDataParams.INTEREST_ON_SAVINGS.getValue(), glAccountData);
|
||||||
|
|||||||
-25
@@ -106,20 +106,6 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
|||||||
PortfolioProductType.SAVING);
|
PortfolioProductType.SAVING);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create-or-merge, for an expense row a product may not have yet.
|
|
||||||
*
|
|
||||||
* The plain merge variant assumes the mapping already exists, which is true of every expense
|
|
||||||
* row that shipped with the product screen. A row added later — the rounding adjustment — is
|
|
||||||
* absent on every product created before it, so editing one of those has to create the
|
|
||||||
* mapping rather than fail looking for it.
|
|
||||||
*/
|
|
||||||
public void createOrmergeSavingsToExpenseAccountMappingChanges(final JsonElement element, final String paramName,
|
|
||||||
final Long productId, final int accountTypeId, final Map<String, Object> changes) {
|
|
||||||
createOrmergeProductToAccountMappingChanges(element, paramName, productId, accountTypeId, changes, GLAccountType.EXPENSE,
|
|
||||||
PortfolioProductType.SAVING);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** Abstractions for payments channel related to savings products ***/
|
/*** Abstractions for payments channel related to savings products ***/
|
||||||
|
|
||||||
public void savePaymentChannelToFundSourceMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
public void savePaymentChannelToFundSourceMappings(final JsonCommand command, final JsonElement element, final Long productId,
|
||||||
@@ -262,15 +248,6 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
|||||||
CashAccountsForSavings.TRANSFERS_SUSPENSE.toString(), changes);
|
CashAccountsForSavings.TRANSFERS_SUSPENSE.toString(), changes);
|
||||||
createOrmergeSavingsToLiabilityAccountMappingChanges(element, SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(),
|
createOrmergeSavingsToLiabilityAccountMappingChanges(element, SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(),
|
||||||
savingsProductId, CashAccountsForSavings.ESCHEAT_LIABILITY.getValue(), changes);
|
savingsProductId, CashAccountsForSavings.ESCHEAT_LIABILITY.getValue(), changes);
|
||||||
createOrmergeSavingsToExpenseAccountMappingChanges(element, SavingProductAccountingParams.ROUNDING_ADJUSTMENT.getValue(),
|
|
||||||
savingsProductId, CashAccountsForSavings.ROUNDING_ADJUSTMENT.getValue(), changes);
|
|
||||||
// Interest Payable is editable on cash too, and optional. Interest posting routes
|
|
||||||
// through it on either basis, so a product can name one to carry interest declared
|
|
||||||
// but not yet credited; a product that names none still posts straight to Savings
|
|
||||||
// Control. Created-or-merged because a product configured before this row existed
|
|
||||||
// has no mapping to merge into.
|
|
||||||
createOrmergeSavingsToLiabilityAccountMappingChanges(element, SavingProductAccountingParams.INTEREST_PAYABLE.getValue(),
|
|
||||||
savingsProductId, AccrualAccountsForSavings.INTEREST_PAYABLE.getValue(), changes);
|
|
||||||
break;
|
break;
|
||||||
case ACCRUAL_PERIODIC:
|
case ACCRUAL_PERIODIC:
|
||||||
// asset
|
// asset
|
||||||
@@ -331,8 +308,6 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa
|
|||||||
|
|
||||||
createOrmergeSavingsToLiabilityAccountMappingChanges(element, SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(),
|
createOrmergeSavingsToLiabilityAccountMappingChanges(element, SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(),
|
||||||
savingsProductId, AccrualAccountsForSavings.ESCHEAT_LIABILITY.getValue(), changes);
|
savingsProductId, AccrualAccountsForSavings.ESCHEAT_LIABILITY.getValue(), changes);
|
||||||
createOrmergeSavingsToExpenseAccountMappingChanges(element, SavingProductAccountingParams.ROUNDING_ADJUSTMENT.getValue(),
|
|
||||||
savingsProductId, AccrualAccountsForSavings.ROUNDING_ADJUSTMENT.getValue(), changes);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ACCRUAL_UPFRONT:
|
case ACCRUAL_UPFRONT:
|
||||||
|
|||||||
+3
-35
@@ -27,7 +27,6 @@ import org.apache.fineract.accounting.common.AccountingRuleType;
|
|||||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
|
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
|
||||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepositoryWrapper;
|
import org.apache.fineract.accounting.glaccount.domain.GLAccountRepositoryWrapper;
|
||||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
import org.apache.fineract.accounting.glaccount.domain.GLAccountType;
|
||||||
import org.apache.fineract.accounting.producttoaccountmapping.domain.ProductToGLAccountMapping;
|
|
||||||
import org.apache.fineract.accounting.producttoaccountmapping.domain.ProductToGLAccountMappingRepository;
|
import org.apache.fineract.accounting.producttoaccountmapping.domain.ProductToGLAccountMappingRepository;
|
||||||
import org.apache.fineract.infrastructure.codes.domain.CodeValueRepository;
|
import org.apache.fineract.infrastructure.codes.domain.CodeValueRepository;
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
||||||
@@ -167,9 +166,9 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
|
|||||||
case NONE:
|
case NONE:
|
||||||
break;
|
break;
|
||||||
case CASH_BASED:
|
case CASH_BASED:
|
||||||
// asset -- the one optional mapping here, so unlike the three below it needs its own
|
// asset
|
||||||
// handling for the case the field is now absent (see mergeOrRemoveSharesReferenceMapping).
|
mergeSharesToAssetAccountMappingChanges(element, SharesProductAccountingParams.SHARES_REFERENCE.getValue(), sharesProductId,
|
||||||
mergeOrRemoveSharesReferenceMapping(element, sharesProductId, changes);
|
CashAccountsForShares.SHARES_REFERENCE.getValue(), CashAccountsForShares.SHARES_REFERENCE.toString(), changes);
|
||||||
|
|
||||||
// income
|
// income
|
||||||
mergeSharesToIncomeAccountMappingChanges(element, SharesProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
mergeSharesToIncomeAccountMappingChanges(element, SharesProductAccountingParams.INCOME_FROM_FEES.getValue(),
|
||||||
@@ -195,35 +194,4 @@ public class ShareProductToGLAccountMappingHelper extends ProductToGLAccountMapp
|
|||||||
public void deleteSharesProductToGLAccountMapping(final Long sharesProductId) {
|
public void deleteSharesProductToGLAccountMapping(final Long sharesProductId) {
|
||||||
deleteProductToGLAccountMapping(sharesProductId, PortfolioProductType.SHARES);
|
deleteProductToGLAccountMapping(sharesProductId, PortfolioProductType.SHARES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles the one optional share-product mapping, Shares Reference, on an edit that does not change
|
|
||||||
* the accounting rule.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The other three mappings (Suspense, Income From Fees, Equity) are mandatory, so
|
|
||||||
* {@code mergeProductToAccountMappingChanges} only ever needs to handle "present and possibly
|
|
||||||
* changed" for them -- a null value there cannot happen without failing validation first. Shares
|
|
||||||
* Reference can legitimately be absent, and the shared merge helper (used across loan, savings and
|
|
||||||
* share products alike) only handles "present": it silently leaves an existing mapping row alone
|
|
||||||
* when the incoming value is null, rather than clearing it. Editing this one field out of an
|
|
||||||
* existing product would otherwise leave the product still carrying its old GL underneath, invisible
|
|
||||||
* on the edit form but still resolvable by any code path that looks it up directly.
|
|
||||||
*/
|
|
||||||
private void mergeOrRemoveSharesReferenceMapping(final JsonElement element, final Long sharesProductId,
|
|
||||||
final Map<String, Object> changes) {
|
|
||||||
final Long shareReferenceId = this.fromApiJsonHelper.extractLongNamed(SharesProductAccountingParams.SHARES_REFERENCE.getValue(),
|
|
||||||
element);
|
|
||||||
if (shareReferenceId != null) {
|
|
||||||
mergeSharesToAssetAccountMappingChanges(element, SharesProductAccountingParams.SHARES_REFERENCE.getValue(), sharesProductId,
|
|
||||||
CashAccountsForShares.SHARES_REFERENCE.getValue(), CashAccountsForShares.SHARES_REFERENCE.toString(), changes);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final ProductToGLAccountMapping existing = this.accountMappingRepository.findCoreProductToFinAccountMapping(sharesProductId,
|
|
||||||
PortfolioProductType.SHARES.getValue(), CashAccountsForShares.SHARES_REFERENCE.getValue());
|
|
||||||
if (existing != null) {
|
|
||||||
this.accountMappingRepository.delete(existing);
|
|
||||||
changes.put(SharesProductAccountingParams.SHARES_REFERENCE.getValue(), null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -33,6 +33,4 @@ public interface TellerRepository extends JpaRepository<Teller, Long>, JpaSpecif
|
|||||||
Collection<Teller> findTellerByOfficeId(Long officeId);
|
Collection<Teller> findTellerByOfficeId(Long officeId);
|
||||||
|
|
||||||
long countByDeletedFalse();
|
long countByDeletedFalse();
|
||||||
|
|
||||||
long countByOfficeIdAndDeletedFalse(Long officeId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -58,9 +58,4 @@ public class TellerRepositoryWrapper {
|
|||||||
public boolean existsAny() {
|
public boolean existsAny() {
|
||||||
return this.repository.countByDeletedFalse() > 0;
|
return this.repository.countByDeletedFalse() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Whether the branch already has a (not deleted) teller — each branch keeps one vault of its own. */
|
|
||||||
public boolean existsInOffice(final Long officeId) {
|
|
||||||
return this.repository.countByOfficeIdAndDeletedFalse(officeId) > 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-5
@@ -28,9 +28,4 @@ public class TellerAlreadyExistsException extends AbstractPlatformDomainRuleExce
|
|||||||
public TellerAlreadyExistsException() {
|
public TellerAlreadyExistsException() {
|
||||||
super(ERROR_MESSAGE_CODE, DEFAULT_ERROR_MESSAGE);
|
super(ERROR_MESSAGE_CODE, DEFAULT_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public TellerAlreadyExistsException(final String officeName) {
|
|
||||||
super(ERROR_MESSAGE_CODE, "Cannot create teller: " + officeName + " already has a teller. Each branch has one teller.",
|
|
||||||
officeName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-44
@@ -269,16 +269,7 @@ public final class AccountingConstants {
|
|||||||
OVERDRAFT_PORTFOLIO_CONTROL(11), //
|
OVERDRAFT_PORTFOLIO_CONTROL(11), //
|
||||||
INCOME_FROM_INTEREST(12), //
|
INCOME_FROM_INTEREST(12), //
|
||||||
LOSSES_WRITTEN_OFF(13), //
|
LOSSES_WRITTEN_OFF(13), //
|
||||||
ESCHEAT_LIABILITY(14), //
|
ESCHEAT_LIABILITY(14); //
|
||||||
INTEREST_PAYABLE(17), //
|
|
||||||
/**
|
|
||||||
* Where the paise dropped from a cash closure are absorbed.
|
|
||||||
*
|
|
||||||
* Cash has no paise in circulation, so a closing balance of 9,883.79 is handed over as
|
|
||||||
* 9,883 and the 0.79 has to land somewhere other than the member's own ledger. Numbered
|
|
||||||
* well clear of the accrual slots so the two sets never collide as either grows.
|
|
||||||
*/
|
|
||||||
ROUNDING_ADJUSTMENT(26); //
|
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
|
|
||||||
@@ -326,9 +317,7 @@ public final class AccountingConstants {
|
|||||||
FEES_RECEIVABLE(15), //
|
FEES_RECEIVABLE(15), //
|
||||||
PENALTIES_RECEIVABLE(16), //
|
PENALTIES_RECEIVABLE(16), //
|
||||||
INTEREST_PAYABLE(17), //
|
INTEREST_PAYABLE(17), //
|
||||||
INTEREST_RECEIVABLE(18), //
|
INTEREST_RECEIVABLE(18);
|
||||||
/** Where the paise dropped from a cash closure are absorbed — see the cash enum. */
|
|
||||||
ROUNDING_ADJUSTMENT(26);
|
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
|
|
||||||
@@ -383,8 +372,7 @@ public final class AccountingConstants {
|
|||||||
PENALTIES_RECEIVABLE("penaltiesReceivableAccountId"), //
|
PENALTIES_RECEIVABLE("penaltiesReceivableAccountId"), //
|
||||||
INTEREST_RECEIVABLE("interestReceivableAccountId"), //
|
INTEREST_RECEIVABLE("interestReceivableAccountId"), //
|
||||||
FEES_RECEIVABLE("feesReceivableAccountId"), //
|
FEES_RECEIVABLE("feesReceivableAccountId"), //
|
||||||
INTEREST_PAYABLE("interestPayableAccountId"), //
|
INTEREST_PAYABLE("interestPayableAccountId");
|
||||||
ROUNDING_ADJUSTMENT("roundingAdjustmentAccountId");
|
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
@@ -422,8 +410,7 @@ public final class AccountingConstants {
|
|||||||
FEES_RECEIVABLE("feeReceivableAccount"), //
|
FEES_RECEIVABLE("feeReceivableAccount"), //
|
||||||
PENALTIES_RECEIVABLE("penaltyReceivableAccount"), //
|
PENALTIES_RECEIVABLE("penaltyReceivableAccount"), //
|
||||||
INTEREST_PAYABLE("interestPayableAccount"), //
|
INTEREST_PAYABLE("interestPayableAccount"), //
|
||||||
INTEREST_RECEIVABLE("interestReceivableAccount"), //
|
INTEREST_RECEIVABLE("interestReceivableAccount"); //
|
||||||
ROUNDING_ADJUSTMENT("roundingAdjustmentAccount"); //
|
|
||||||
|
|
||||||
private final String value;
|
private final String value;
|
||||||
|
|
||||||
@@ -450,34 +437,8 @@ public final class AccountingConstants {
|
|||||||
OPENING_BALANCES_TRANSFER_CONTRA(300, "openingBalancesTransferContra", GLAccountType.EQUITY), //
|
OPENING_BALANCES_TRANSFER_CONTRA(300, "openingBalancesTransferContra", GLAccountType.EQUITY), //
|
||||||
ASSET_FUND_SOURCE(103, "fundSource", GLAccountType.ASSET), //
|
ASSET_FUND_SOURCE(103, "fundSource", GLAccountType.ASSET), //
|
||||||
PAYABLE_DIVIDENDS(201, "payableDividends", GLAccountType.LIABILITY), //
|
PAYABLE_DIVIDENDS(201, "payableDividends", GLAccountType.LIABILITY), //
|
||||||
DIVIDEND_PAID(202, "dividendPaid", GLAccountType.LIABILITY), //
|
|
||||||
RESERVE_FOR_DIVIDEND(301, "reserveForDividend", GLAccountType.EQUITY), //
|
RESERVE_FOR_DIVIDEND(301, "reserveForDividend", GLAccountType.EQUITY), //
|
||||||
DIVIDEND_FORFEITED_INCOME(400, "dividendForfeitedIncome", GLAccountType.INCOME), //
|
DIVIDEND_FORFEITED_INCOME(400, "dividendForfeitedIncome", GLAccountType.INCOME); //
|
||||||
/**
|
|
||||||
* The year's closed-out profit a dividend is declared against.
|
|
||||||
*
|
|
||||||
* Kept apart from {@link #RETAINED_PROFIT} on purpose: a declaration is sized on this balance, so anything that
|
|
||||||
* has already been through a distribution decision must not sit here, or the same money would be offered for
|
|
||||||
* distribution a second time.
|
|
||||||
*/
|
|
||||||
DISTRIBUTABLE_PROFIT(302, "distributableProfit", GLAccountType.EQUITY), //
|
|
||||||
/**
|
|
||||||
* Where profit settles once it is no longer distributable - the remainder left after an approved declaration
|
|
||||||
* and dividends forfeited after the three-year claim window. Nothing here ever enters a later dividend
|
|
||||||
* calculation.
|
|
||||||
*/
|
|
||||||
RETAINED_PROFIT(303, "retainedProfit", GLAccountType.EQUITY), //
|
|
||||||
/**
|
|
||||||
* Where the paise a dividend cannot divide evenly are collected.
|
|
||||||
*
|
|
||||||
* A declaration of 1,538.91 that allocates 1,538 to members leaves 0.91 that belongs to nobody. It used to be
|
|
||||||
* swept into retained profit along with the undistributed remainder, which buried an arithmetic artefact inside
|
|
||||||
* a figure the society reads as a real business result. Given its own account it stays separately readable -
|
|
||||||
* and an auditor asking why members received less than was declared can be answered from the ledger.
|
|
||||||
*
|
|
||||||
* Optional: a society that has not mapped it has the residue swept to retained profit exactly as before.
|
|
||||||
*/
|
|
||||||
DIVIDEND_ROUND_OFF(304, "dividendRoundOff", GLAccountType.EQUITY); //
|
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|||||||
+1
-23
@@ -137,7 +137,7 @@ public class CommandSourceService {
|
|||||||
String permission = commandSource.getPermissionCode();
|
String permission = commandSource.getPermissionCode();
|
||||||
boolean isMakerChecker = configurationDomainService.isMakerCheckerEnabledForTask(permission);
|
boolean isMakerChecker = configurationDomainService.isMakerCheckerEnabledForTask(permission);
|
||||||
if (isMakerChecker || result.isRollbackTransaction()) {
|
if (isMakerChecker || result.isRollbackTransaction()) {
|
||||||
if (isApprovedByChecker || isSuperUserBypassAllowed(commandSource, user)) {
|
if (isApprovedByChecker || user.isCheckerSuperUser()) {
|
||||||
commandSource.markAsChecked(user);
|
commandSource.markAsChecked(user);
|
||||||
} else {
|
} else {
|
||||||
if (commandSource.isSanitized()) {
|
if (commandSource.isSanitized()) {
|
||||||
@@ -151,28 +151,6 @@ public class CommandSourceService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isSuperUserBypassAllowed(CommandSource commandSource, AppUser user) {
|
|
||||||
if (!user.isCheckerSuperUser()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ("GLACCOUNT".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "CBSBASEINTERESTRATE".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "LOANBASEINTERESTRATE".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "DELINQUENCY_BUCKET".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "DELINQUENCY_RANGE".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "CHARGE".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "LOANPRODUCT".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "SAVINGSPRODUCT".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "CURRENTPRODUCT".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "SHAREPRODUCT".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "FIXEDDEPOSITPRODUCT".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "USER".equalsIgnoreCase(commandSource.getEntityName())
|
|
||||||
|| "ROLE".equalsIgnoreCase(commandSource.getEntityName())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sanitizeJson(@NonNull CommandSource commandSource, Set<String> sanitizeKeys) {
|
private void sanitizeJson(@NonNull CommandSource commandSource, Set<String> sanitizeKeys) {
|
||||||
if (sanitizeKeys == null || sanitizeKeys.isEmpty()) {
|
if (sanitizeKeys == null || sanitizeKeys.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
-152
@@ -664,14 +664,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandWrapperBuilder deleteOffice(final Long officeId) {
|
|
||||||
this.actionName = "DELETE";
|
|
||||||
this.entityName = "OFFICE";
|
|
||||||
this.entityId = officeId;
|
|
||||||
this.href = "/offices/" + officeId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder createOfficeTransaction() {
|
public CommandWrapperBuilder createOfficeTransaction() {
|
||||||
this.actionName = "CREATE";
|
this.actionName = "CREATE";
|
||||||
this.entityName = "OFFICETRANSACTION";
|
this.entityName = "OFFICETRANSACTION";
|
||||||
@@ -756,14 +748,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandWrapperBuilder deleteFund(final Long fundId) {
|
|
||||||
this.actionName = "DELETE";
|
|
||||||
this.entityName = "FUND";
|
|
||||||
this.entityId = fundId;
|
|
||||||
this.href = "/funds/" + fundId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder createReport() {
|
public CommandWrapperBuilder createReport() {
|
||||||
this.actionName = "CREATE";
|
this.actionName = "CREATE";
|
||||||
this.entityName = "REPORT";
|
this.entityName = "REPORT";
|
||||||
@@ -892,70 +876,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandWrapperBuilder createPaymentType() {
|
|
||||||
this.actionName = "CREATE";
|
|
||||||
this.entityName = "PAYMENTTYPE";
|
|
||||||
this.entityId = null;
|
|
||||||
this.href = "/paymenttypes/template";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder updatePaymentType(final Long paymentTypeId) {
|
|
||||||
this.actionName = "UPDATE";
|
|
||||||
this.entityName = "PAYMENTTYPE";
|
|
||||||
this.entityId = paymentTypeId;
|
|
||||||
this.href = "/paymenttypes/" + paymentTypeId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder deletePaymentType(final Long paymentTypeId) {
|
|
||||||
this.actionName = "DELETE";
|
|
||||||
this.entityName = "PAYMENTTYPE";
|
|
||||||
this.entityId = paymentTypeId;
|
|
||||||
this.href = "/paymenttypes/" + paymentTypeId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder createSponsorBank() {
|
|
||||||
this.actionName = "CREATE";
|
|
||||||
this.entityName = "SPONSORBANK";
|
|
||||||
this.entityId = null;
|
|
||||||
this.href = "/sponsorbanks";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder updateSponsorBank(final Long sponsorBankId) {
|
|
||||||
this.actionName = "UPDATE";
|
|
||||||
this.entityName = "SPONSORBANK";
|
|
||||||
this.entityId = sponsorBankId;
|
|
||||||
this.href = "/sponsorbanks/" + sponsorBankId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder updateSponsorDdGlMapping() {
|
|
||||||
this.actionName = "UPDATE";
|
|
||||||
this.entityName = "SPONSORDDGLMAPPING";
|
|
||||||
this.entityId = null;
|
|
||||||
this.href = "/sponsordd/gl-mapping";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder updateInstitutionProfile() {
|
|
||||||
this.actionName = "UPDATE";
|
|
||||||
this.entityName = "INSTITUTIONPROFILE";
|
|
||||||
this.entityId = null;
|
|
||||||
this.href = "/institutionprofile";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder updateBranchProfile(final Long officeId) {
|
|
||||||
this.actionName = "UPDATE";
|
|
||||||
this.entityName = "BRANCHPROFILE";
|
|
||||||
this.entityId = officeId;
|
|
||||||
this.href = "/branchprofile/" + officeId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder createLoanProduct() {
|
public CommandWrapperBuilder createLoanProduct() {
|
||||||
this.actionName = "CREATE";
|
this.actionName = "CREATE";
|
||||||
this.entityName = "LOANPRODUCT";
|
this.entityName = "LOANPRODUCT";
|
||||||
@@ -2291,22 +2211,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandWrapperBuilder createCbsBaseInterestRate() {
|
|
||||||
this.actionName = "CREATE";
|
|
||||||
this.entityName = "CBSBASEINTERESTRATE";
|
|
||||||
this.entityId = null;
|
|
||||||
this.href = "/fixeddepositproducts/baseinterestrates";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder createLoanBaseInterestRate() {
|
|
||||||
this.actionName = "CREATE";
|
|
||||||
this.entityName = "LOANBASEINTERESTRATE";
|
|
||||||
this.entityId = null;
|
|
||||||
this.href = "/loanproducts/baseinterestrates";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder updateFixedDepositProduct(final Long productId) {
|
public CommandWrapperBuilder updateFixedDepositProduct(final Long productId) {
|
||||||
this.actionName = "UPDATE";
|
this.actionName = "UPDATE";
|
||||||
this.entityName = "FIXEDDEPOSITPRODUCT";
|
this.entityName = "FIXEDDEPOSITPRODUCT";
|
||||||
@@ -2993,15 +2897,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandWrapperBuilder paymentFixedDepositAccount(final Long accountId) {
|
|
||||||
this.actionName = "PAYMENT";
|
|
||||||
this.entityName = "FIXEDDEPOSITACCOUNT";
|
|
||||||
this.entityId = accountId;
|
|
||||||
this.savingsId = accountId;
|
|
||||||
this.href = "/fixeddepositaccounts/" + accountId + "?command=payment";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder fixedDepositAccountInterestCalculation(final Long accountId) {
|
public CommandWrapperBuilder fixedDepositAccountInterestCalculation(final Long accountId) {
|
||||||
this.actionName = "CALCULATEINTEREST";
|
this.actionName = "CALCULATEINTEREST";
|
||||||
this.entityName = "FIXEDDEPOSITACCOUNT";
|
this.entityName = "FIXEDDEPOSITACCOUNT";
|
||||||
@@ -3208,14 +3103,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandWrapperBuilder updateFacilityChargeMapping(final Long mappingId) {
|
|
||||||
this.actionName = "UPDATE";
|
|
||||||
this.entityName = "FACILITYCHARGEMAPPING";
|
|
||||||
this.entityId = mappingId;
|
|
||||||
this.href = "/facilitychargemappings/" + mappingId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder deleteOfficeToGLAccountMapping(final Long mappingId) {
|
public CommandWrapperBuilder deleteOfficeToGLAccountMapping(final Long mappingId) {
|
||||||
this.actionName = "DELETE";
|
this.actionName = "DELETE";
|
||||||
this.entityName = "FINANCIALACTIVITYACCOUNT";
|
this.entityName = "FINANCIALACTIVITYACCOUNT";
|
||||||
@@ -3470,13 +3357,6 @@ public class CommandWrapperBuilder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandWrapperBuilder updateCurrency() {
|
|
||||||
this.actionName = "UPDATE";
|
|
||||||
this.entityName = "CURRENCY";
|
|
||||||
this.href = "/currencies";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder updateExternalServiceProperties(final String externalServiceName) {
|
public CommandWrapperBuilder updateExternalServiceProperties(final String externalServiceName) {
|
||||||
this.actionName = "UPDATE";
|
this.actionName = "UPDATE";
|
||||||
this.entityName = "EXTERNALSERVICES";
|
this.entityName = "EXTERNALSERVICES";
|
||||||
@@ -4817,36 +4697,4 @@ public class CommandWrapperBuilder {
|
|||||||
this.href = "/loans/" + loanId + "/originators/" + originatorId;
|
this.href = "/loans/" + loanId + "/originators/" + originatorId;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommandWrapperBuilder createSurvey() {
|
|
||||||
this.actionName = "CREATE";
|
|
||||||
this.entityName = "SURVEY";
|
|
||||||
this.entityId = null;
|
|
||||||
this.href = "/surveys";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder updateSurvey(final Long surveyId) {
|
|
||||||
this.actionName = "UPDATE";
|
|
||||||
this.entityName = "SURVEY";
|
|
||||||
this.entityId = surveyId;
|
|
||||||
this.href = "/surveys/" + surveyId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder activateSurvey(final Long surveyId) {
|
|
||||||
this.actionName = "ACTIVATE";
|
|
||||||
this.entityName = "SURVEY";
|
|
||||||
this.entityId = surveyId;
|
|
||||||
this.href = "/surveys/" + surveyId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandWrapperBuilder deactivateSurvey(final Long surveyId) {
|
|
||||||
this.actionName = "DEACTIVATE";
|
|
||||||
this.entityName = "SURVEY";
|
|
||||||
this.entityId = surveyId;
|
|
||||||
this.href = "/surveys/" + surveyId;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-2
@@ -26,8 +26,6 @@ public interface ConfigurationDomainService {
|
|||||||
|
|
||||||
boolean isMakerCheckerEnabledForTask(String taskPermissionCode);
|
boolean isMakerCheckerEnabledForTask(String taskPermissionCode);
|
||||||
|
|
||||||
boolean isMakerCheckerEnabled();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Global kill-switch for MFA-factor-backed login enforcement. When true, users with at least
|
* Global kill-switch for MFA-factor-backed login enforcement. When true, users with at least
|
||||||
* one verified, non-disabled row in {@code m_user_mfa_factor} must complete a 2FA challenge
|
* one verified, non-disabled row in {@code m_user_mfa_factor} must complete a 2FA challenge
|
||||||
|
|||||||
-1
@@ -505,7 +505,6 @@ public class FineractProperties {
|
|||||||
private FineractTransactionProcessorItemProperties heavensFamily;
|
private FineractTransactionProcessorItemProperties heavensFamily;
|
||||||
private FineractTransactionProcessorItemProperties interestPrincipalPenaltiesFees;
|
private FineractTransactionProcessorItemProperties interestPrincipalPenaltiesFees;
|
||||||
private FineractTransactionProcessorItemProperties principalInterestPenaltiesFees;
|
private FineractTransactionProcessorItemProperties principalInterestPenaltiesFees;
|
||||||
private FineractTransactionProcessorItemProperties feesPenaltiesInterestPrincipal;
|
|
||||||
private FineractTransactionProcessorItemProperties rbiIndia;
|
private FineractTransactionProcessorItemProperties rbiIndia;
|
||||||
private FineractTransactionProcessorItemProperties duePenaltyFeeInterestPrincipalInAdvancePrincipalPenaltyFeeInterest;
|
private FineractTransactionProcessorItemProperties duePenaltyFeeInterestPrincipalInAdvancePrincipalPenaltyFeeInterest;
|
||||||
private FineractTransactionProcessorItemProperties duePenaltyInterestPrincipalFeeInAdvancePenaltyInterestPrincipalFee;
|
private FineractTransactionProcessorItemProperties duePenaltyInterestPrincipalFeeInAdvancePenaltyInterestPrincipalFee;
|
||||||
|
|||||||
-7
@@ -39,11 +39,7 @@ public enum JobName {
|
|||||||
GENERATE_LOANLOSS_PROVISIONING("Generate Loan Loss Provisioning"), //
|
GENERATE_LOANLOSS_PROVISIONING("Generate Loan Loss Provisioning"), //
|
||||||
POST_DIVIDENTS_FOR_SHARES("Post Dividends For Shares"), //
|
POST_DIVIDENTS_FOR_SHARES("Post Dividends For Shares"), //
|
||||||
FORFEIT_UNCLAIMED_DIVIDENDS("Forfeit Unclaimed Dividends"), //
|
FORFEIT_UNCLAIMED_DIVIDENDS("Forfeit Unclaimed Dividends"), //
|
||||||
POST_SHARE_ENTRY_FEE_TO_PROFIT("Post Share Entry Fee To Profit"), //
|
|
||||||
UPDATE_SAVINGS_DORMANT_ACCOUNTS("Update Savings Dormant Accounts"), //
|
UPDATE_SAVINGS_DORMANT_ACCOUNTS("Update Savings Dormant Accounts"), //
|
||||||
APPLY_KYC_EXPIRY_RESTRICTIONS("Apply KYC Expiry Restrictions"), //
|
|
||||||
SAVINGS_DAILY_INTEREST("Savings Daily Interest Accrual And Posting"), //
|
|
||||||
SAVINGS_INTEREST_POSTING_REPORT("Generate Savings Interest Posting Report"), //
|
|
||||||
ADD_PERIODIC_ACCRUAL_ENTRIES_FOR_LOANS_WITH_INCOME_POSTED_AS_TRANSACTIONS(
|
ADD_PERIODIC_ACCRUAL_ENTRIES_FOR_LOANS_WITH_INCOME_POSTED_AS_TRANSACTIONS(
|
||||||
"Add Accrual Transactions For Loans With Income Posted As Transactions"), //
|
"Add Accrual Transactions For Loans With Income Posted As Transactions"), //
|
||||||
EXECUTE_REPORT_MAILING_JOBS("Execute Report Mailing Jobs"), //
|
EXECUTE_REPORT_MAILING_JOBS("Execute Report Mailing Jobs"), //
|
||||||
@@ -57,7 +53,6 @@ public enum JobName {
|
|||||||
EXECUTE_DIRTY_JOBS("Execute All Dirty Jobs"), //
|
EXECUTE_DIRTY_JOBS("Execute All Dirty Jobs"), //
|
||||||
INCREASE_BUSINESS_DATE_BY_1_DAY("Increase Business Date by 1 day"), //
|
INCREASE_BUSINESS_DATE_BY_1_DAY("Increase Business Date by 1 day"), //
|
||||||
INCREASE_COB_DATE_BY_1_DAY("Increase COB Date by 1 day"), //
|
INCREASE_COB_DATE_BY_1_DAY("Increase COB Date by 1 day"), //
|
||||||
SYNC_BUSINESS_DATE_TO_SYSTEM_DATE("Sync Business Date To System Date"), //
|
|
||||||
LOAN_COB("Loan COB"), //
|
LOAN_COB("Loan COB"), //
|
||||||
LOAN_DELINQUENCY_CLASSIFICATION("Loan Delinquency Classification"), //
|
LOAN_DELINQUENCY_CLASSIFICATION("Loan Delinquency Classification"), //
|
||||||
SEND_ASYNCHRONOUS_EVENTS("Send Asynchronous Events"), //
|
SEND_ASYNCHRONOUS_EVENTS("Send Asynchronous Events"), //
|
||||||
@@ -73,8 +68,6 @@ public enum JobName {
|
|||||||
OUTWARD_CLEARING_BATCH_SEND("CTS Outward Clearing Batch Send"), //
|
OUTWARD_CLEARING_BATCH_SEND("CTS Outward Clearing Batch Send"), //
|
||||||
CTR_REPORT_GENERATION("AML Monthly CTR Report Generation"), //
|
CTR_REPORT_GENERATION("AML Monthly CTR Report Generation"), //
|
||||||
AML_STR_WEEKLY_DIGEST("AML STR Weekly Digest"), //
|
AML_STR_WEEKLY_DIGEST("AML STR Weekly Digest"), //
|
||||||
CLIENT_BEHAVIOUR_WINDOW("Client Behaviour Window Computation"), //
|
|
||||||
SAVE_RBI_FORM_A_RETURN("Save RBI Form A Return"), //
|
|
||||||
; //
|
; //
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|||||||
+11
-12
@@ -27,14 +27,13 @@ import jakarta.ws.rs.PUT;
|
|||||||
import jakarta.ws.rs.Path;
|
import jakarta.ws.rs.Path;
|
||||||
import jakarta.ws.rs.Produces;
|
import jakarta.ws.rs.Produces;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
|
import java.util.function.Supplier;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
import org.apache.fineract.command.core.CommandPipeline;
|
||||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
import org.apache.fineract.organisation.monetary.command.CurrencyUpdateCommand;
|
||||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
|
||||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
|
||||||
import org.apache.fineract.organisation.monetary.data.CurrencyConfigurationData;
|
import org.apache.fineract.organisation.monetary.data.CurrencyConfigurationData;
|
||||||
import org.apache.fineract.organisation.monetary.data.CurrencyUpdateRequest;
|
import org.apache.fineract.organisation.monetary.data.CurrencyUpdateRequest;
|
||||||
|
import org.apache.fineract.organisation.monetary.data.CurrencyUpdateResponse;
|
||||||
import org.apache.fineract.organisation.monetary.service.OrganisationCurrencyReadPlatformService;
|
import org.apache.fineract.organisation.monetary.service.OrganisationCurrencyReadPlatformService;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -45,8 +44,7 @@ import org.springframework.stereotype.Component;
|
|||||||
public class CurrenciesApiResource {
|
public class CurrenciesApiResource {
|
||||||
|
|
||||||
private final OrganisationCurrencyReadPlatformService readPlatformService;
|
private final OrganisationCurrencyReadPlatformService readPlatformService;
|
||||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
private final CommandPipeline commandPipeline;
|
||||||
private final DefaultToApiJsonSerializer<CurrencyUpdateRequest> toApiJsonSerializer;
|
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@@ -67,12 +65,13 @@ public class CurrenciesApiResource {
|
|||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Operation(summary = "Update Currency Configuration", description = "Updates the list of currencies permitted for use.")
|
@Operation(summary = "Update Currency Configuration", description = "Updates the list of currencies permitted for use.")
|
||||||
public String updateCurrencies(@Valid final CurrencyUpdateRequest request) {
|
public CurrencyUpdateResponse updateCurrencies(@Valid CurrencyUpdateRequest request) {
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCurrency()
|
final var command = new CurrencyUpdateCommand();
|
||||||
.withJson(toApiJsonSerializer.serialize(request)).build();
|
|
||||||
|
|
||||||
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
command.setPayload(request);
|
||||||
|
|
||||||
return toApiJsonSerializer.serialize(result);
|
final Supplier<CurrencyUpdateResponse> response = commandPipeline.send(command);
|
||||||
|
|
||||||
|
return response.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-63
@@ -1,63 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.organisation.monetary.handler;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import org.apache.fineract.commands.annotation.CommandType;
|
|
||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
|
||||||
import org.apache.fineract.organisation.monetary.data.CurrencyUpdateRequest;
|
|
||||||
import org.apache.fineract.organisation.monetary.data.CurrencyUpdateResponse;
|
|
||||||
import org.apache.fineract.organisation.monetary.service.CurrencyWritePlatformService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@CommandType(entity = "CURRENCY", action = "UPDATE")
|
|
||||||
public class UpdateCurrencyCommandHandler implements NewCommandSourceHandler {
|
|
||||||
|
|
||||||
private final CurrencyWritePlatformService writePlatformService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
public UpdateCurrencyCommandHandler(final CurrencyWritePlatformService writePlatformService) {
|
|
||||||
this.writePlatformService = writePlatformService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
|
||||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
|
||||||
|
|
||||||
final String[] currencyCodes = command.arrayValueOfParameterNamed("currencies");
|
|
||||||
final List<String> currencies = currencyCodes == null ? List.of() : Arrays.asList(currencyCodes);
|
|
||||||
|
|
||||||
final CurrencyUpdateRequest request = CurrencyUpdateRequest.builder().currencies(currencies).build();
|
|
||||||
|
|
||||||
final CurrencyUpdateResponse response = this.writePlatformService.updateAllowedCurrencies(request);
|
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
|
||||||
.withCommandId(command.commandId()) //
|
|
||||||
.with(Map.of("currencies", response.getCurrencies())) //
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-11
@@ -61,15 +61,4 @@ public class OfficeRepositoryWrapper {
|
|||||||
public void delete(final Office entity) {
|
public void delete(final Office entity) {
|
||||||
this.repository.delete(entity);
|
this.repository.delete(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deletes and flushes in the same call, so a foreign-key violation the caller did not already check
|
|
||||||
* for (a savings transaction, a GL journal entry, a teller position -- anything on m_office's long
|
|
||||||
* tail of referencing tables) surfaces synchronously here, inside the caller's own try/catch, rather
|
|
||||||
* than at transaction-commit time where it can no longer be turned into a clean error message.
|
|
||||||
*/
|
|
||||||
public void deleteAndFlush(final Office entity) {
|
|
||||||
this.repository.delete(entity);
|
|
||||||
this.repository.flush();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-16
@@ -24,10 +24,7 @@ public enum PortfolioProductType {
|
|||||||
SAVING(2, "productType.saving"), //
|
SAVING(2, "productType.saving"), //
|
||||||
CLIENT(5, "productType.client"), //
|
CLIENT(5, "productType.client"), //
|
||||||
PROVISIONING(3, "productType.provisioning"), //
|
PROVISIONING(3, "productType.provisioning"), //
|
||||||
SHARES(4, "productType.shares"), //
|
SHARES(4, "productType.shares"); //
|
||||||
// Current products map their GLs under their own type: sharing SAVING with savings products let a savings
|
|
||||||
// product and a current product with the same id read each other's GL rows.
|
|
||||||
CURRENT(6, "productType.current"); //
|
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String code;
|
private final String code;
|
||||||
@@ -55,25 +52,17 @@ public enum PortfolioProductType {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Matched against each constant's own declared value above, not its declaration position --
|
|
||||||
// those two orderings diverge (CLIENT is declared 3rd but its value is 5), so a switch written
|
|
||||||
// by position silently mapped every id past SAVING to the wrong type: 3 (really PROVISIONING)
|
|
||||||
// returned CLIENT, 4 (really SHARES) returned PROVISIONING, 5 (really CLIENT) returned SHARES,
|
|
||||||
// and 6 (CURRENT) fell through to null -- a live NPE the moment a Current-product GL entry
|
|
||||||
// (entity_type_enum=6) reached this on the Journal Entries screen.
|
|
||||||
switch (v) {
|
switch (v) {
|
||||||
case 1:
|
case 1:
|
||||||
return LOAN;
|
return LOAN;
|
||||||
case 2:
|
case 2:
|
||||||
return SAVING;
|
return SAVING;
|
||||||
case 3:
|
case 3:
|
||||||
return PROVISIONING;
|
|
||||||
case 4:
|
|
||||||
return SHARES;
|
|
||||||
case 5:
|
|
||||||
return CLIENT;
|
return CLIENT;
|
||||||
case 6:
|
case 4:
|
||||||
return CURRENT;
|
return PROVISIONING;
|
||||||
|
case 5:
|
||||||
|
return SHARES;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-16
@@ -72,26 +72,11 @@ public class SavingsAccountSummaryData {
|
|||||||
// differentiate deposit accounts Savings, FD and RD accounts
|
// differentiate deposit accounts Savings, FD and RD accounts
|
||||||
private final EnumOptionData depositType;
|
private final EnumOptionData depositType;
|
||||||
|
|
||||||
/**
|
|
||||||
* For a Fixed Deposit, the stable customer-facing FD number: the account number of the first account in the renewal
|
|
||||||
* chain, which stays the same across every renewal even though each term is its own account row. Equals accountNo
|
|
||||||
* for an FD that has never been renewed, and is null for non-deposit accounts.
|
|
||||||
*/
|
|
||||||
private final String fdAccountNumber;
|
|
||||||
/**
|
|
||||||
* Which renewal cycle of that FD this row is: 0 for the originally opened account, 1 for the first renewal, and so
|
|
||||||
* on. Lets a client's account list collapse a renewal chain into one FD instead of listing each term separately.
|
|
||||||
*/
|
|
||||||
private final Integer renewalCycleNo;
|
|
||||||
|
|
||||||
public SavingsAccountSummaryData(final Long id, final String accountNo, final String externalId, final Long productId,
|
public SavingsAccountSummaryData(final Long id, final String accountNo, final String externalId, final Long productId,
|
||||||
final String productName, final String shortProductName, final SavingsAccountStatusEnumData status, final CurrencyData currency,
|
final String productName, final String shortProductName, final SavingsAccountStatusEnumData status, final CurrencyData currency,
|
||||||
final BigDecimal accountBalance, final BigDecimal onHoldFunds, final BigDecimal savingsAmountOnHold,
|
final BigDecimal accountBalance, final BigDecimal onHoldFunds, final BigDecimal savingsAmountOnHold,
|
||||||
final BigDecimal availableBalance, final EnumOptionData accountType, final SavingsAccountApplicationTimelineData timeline,
|
final BigDecimal availableBalance, final EnumOptionData accountType, final SavingsAccountApplicationTimelineData timeline,
|
||||||
final EnumOptionData depositType, final SavingsAccountSubStatusEnumData subStatus, final LocalDate lastActiveTransactionDate,
|
final EnumOptionData depositType, final SavingsAccountSubStatusEnumData subStatus, final LocalDate lastActiveTransactionDate) {
|
||||||
final String fdAccountNumber, final Integer renewalCycleNo) {
|
|
||||||
this.fdAccountNumber = fdAccountNumber;
|
|
||||||
this.renewalCycleNo = renewalCycleNo;
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.accountNo = accountNo;
|
this.accountNo = accountNo;
|
||||||
this.externalId = externalId;
|
this.externalId = externalId;
|
||||||
|
|||||||
@@ -78,30 +78,6 @@ public class AmlAlert extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
@Column(name = "disposition", length = 20)
|
@Column(name = "disposition", length = 20)
|
||||||
private String disposition;
|
private String disposition;
|
||||||
|
|
||||||
/**
|
|
||||||
* The other rules this same transaction matched, comma-separated.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* One transaction raises one alert, under the rule that most warrants attention - otherwise a
|
|
||||||
* single deposit arrives as several alerts and an officer has to dispose of each, with nothing
|
|
||||||
* stopping them clearing one while escalating another. The rules that did not win are kept here
|
|
||||||
* so the case file still shows everything that fired.
|
|
||||||
*/
|
|
||||||
@Column(name = "also_matched_rules", length = 500)
|
|
||||||
private String alsoMatchedRules;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The worst severity band across every rule this transaction matched — 1 Low, 2 Medium, 3 High.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Not the same as the governing rule's own severity. A statutory CTR outranks everything when
|
|
||||||
* the alert is raised, so a high-severity rule can end up recorded in {@link #alsoMatchedRules}
|
|
||||||
* and vanish from the screen. An officer disposing of low and medium alerts in a batch would
|
|
||||||
* then be handed a transaction that had tripped a high-severity rule with nothing to show it.
|
|
||||||
*/
|
|
||||||
@Column(name = "highest_severity")
|
|
||||||
private Integer highestSeverity;
|
|
||||||
|
|
||||||
protected AmlAlert() {}
|
protected AmlAlert() {}
|
||||||
|
|
||||||
public static AmlAlert raise(AmlTransactionType transactionType, Long transactionId, Client client, AmlTransactionRule rule,
|
public static AmlAlert raise(AmlTransactionType transactionType, Long transactionId, Client client, AmlTransactionRule rule,
|
||||||
@@ -118,58 +94,6 @@ public class AmlAlert extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
return alert;
|
return alert;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAlsoMatchedRules() {
|
|
||||||
return this.alsoMatchedRules;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getHighestSeverity() {
|
|
||||||
return this.highestSeverity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void recordHighestSeverity(final Integer severity) {
|
|
||||||
this.highestSeverity = severity;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Truncated to the column width: the record is a convenience, never a reason to fail a save. */
|
|
||||||
public void recordAlsoMatchedRules(final String ruleCodes) {
|
|
||||||
this.alsoMatchedRules = ruleCodes == null || ruleCodes.isBlank() ? null
|
|
||||||
: (ruleCodes.length() > 500 ? ruleCodes.substring(0, 500) : ruleCodes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether this alert is being worked by somebody other than the given officer.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* An alert under review belongs to whoever opened it until they decide it or hand it back. A second officer
|
|
||||||
* reading the same case and reaching their own verdict is the failure this exists to prevent: the transaction
|
|
||||||
* would carry two reviews, and whichever was written last would be the one on file.
|
|
||||||
*/
|
|
||||||
public boolean isHeldByAnother(final AppUser officer) {
|
|
||||||
return AmlAlertStatus.UNDER_REVIEW.name().equals(this.status) && this.reviewedBy != null && officer != null
|
|
||||||
&& !this.reviewedBy.getId().equals(officer.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Brings the alert into line with the Principal Officer's conclusion on the case it opened.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* An escalation is a referral, not a verdict: it says the AML Officer wanted the case looked at. The verdict is
|
|
||||||
* the Principal Officer's, and when they conclude the case clear the alert has to say so too. Left as ESCALATED,
|
|
||||||
* the feed would go on showing a transaction as suspicious after the bank had decided it was not - and the officer
|
|
||||||
* who cleared it would have no way to see their own conclusion reflected where the alert is worked.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Distinct from {@link #whitelist}: this does not pass the alert's own immutability guard, because it is not a
|
|
||||||
* second officer overturning a decision. It is the case this alert was referred into, coming back with its answer.
|
|
||||||
*/
|
|
||||||
public void applyStrConclusion(final boolean suspicious, final AppUser principalOfficer, final String notes) {
|
|
||||||
this.reviewedBy = principalOfficer;
|
|
||||||
this.reviewedOn = LocalDateTime.now();
|
|
||||||
this.reviewNotes = notes;
|
|
||||||
this.disposition = (suspicious ? AmlAlertDisposition.ESCALATE : AmlAlertDisposition.WHITELIST).name();
|
|
||||||
this.status = (suspicious ? AmlAlertStatus.ESCALATED : AmlAlertStatus.WHITELISTED).name();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void whitelist(AppUser reviewer, String notes) {
|
public void whitelist(AppUser reviewer, String notes) {
|
||||||
this.reviewedBy = reviewer;
|
this.reviewedBy = reviewer;
|
||||||
this.reviewedOn = LocalDateTime.now();
|
this.reviewedOn = LocalDateTime.now();
|
||||||
|
|||||||
-14
@@ -44,18 +44,4 @@ public interface AmlAlertRepository extends JpaRepository<AmlAlert, Long> {
|
|||||||
* twice, which would put two STR cases in front of the Principal Officer for a single transaction.
|
* twice, which would put two STR cases in front of the Principal Officer for a single transaction.
|
||||||
*/
|
*/
|
||||||
List<AmlAlert> findByRule_IdAndTransactionId(Long ruleId, Long transactionId);
|
List<AmlAlert> findByRule_IdAndTransactionId(Long ruleId, Long transactionId);
|
||||||
|
|
||||||
/**
|
|
||||||
* A customer's still-open alerts inside the observation window, oldest first.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* What a recurring-behaviour review acts on. Open is defined as not yet decided rather than by naming the statuses
|
|
||||||
* that are open, so a status this query does not know about is still treated as work: an alert wrongly included
|
|
||||||
* costs a reviewer a glance, one wrongly excluded is a pattern the bank never looked at. A decision about the
|
|
||||||
* customer's pattern must not reopen alerts an officer has already disposed of individually - and oldest first so
|
|
||||||
* that a partial failure leaves the longest-standing ones dealt with.
|
|
||||||
*/
|
|
||||||
@Query("SELECT a FROM AmlAlert a WHERE a.client.id = :clientId AND a.raisedOn >= :since "
|
|
||||||
+ "AND a.status NOT IN ('WHITELISTED', 'ESCALATED') ORDER BY a.raisedOn ASC")
|
|
||||||
List<AmlAlert> findOpenAlertsForClientSince(@Param("clientId") Long clientId, @Param("since") LocalDateTime since);
|
|
||||||
}
|
}
|
||||||
|
|||||||
-163
@@ -1,163 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.aml.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.JoinColumn;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import org.apache.fineract.useradministration.domain.AppUser;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* One rule a transaction matched, and what the officer decided about that rule.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The alert is the case; this is a finding within it. A single deposit can trip six rules where five are explained by
|
|
||||||
* the customer's declared business and the sixth is not - one verdict over the whole alert either loses that sixth
|
|
||||||
* observation or sends the other five to an STR they do not belong in.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The rule is held by code rather than by a foreign key to {@link AmlTransactionRule}, and the severity is copied in
|
|
||||||
* rather than read back through it. An alert records what was detected at the time; re-banding or retiring a rule
|
|
||||||
* afterwards must not rewrite what the officer was looking at when they decided.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "m_aml_alert_rule")
|
|
||||||
public class AmlAlertRule {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "alert_id", nullable = false)
|
|
||||||
private AmlAlert alert;
|
|
||||||
|
|
||||||
@Column(name = "rule_code", nullable = false, length = 100)
|
|
||||||
private String ruleCode;
|
|
||||||
|
|
||||||
@Column(name = "risk_category")
|
|
||||||
private Integer riskCategory;
|
|
||||||
|
|
||||||
@Column(name = "is_governing", nullable = false)
|
|
||||||
private boolean governing;
|
|
||||||
|
|
||||||
@Column(name = "disposition", length = 20)
|
|
||||||
private String disposition;
|
|
||||||
|
|
||||||
@ManyToOne
|
|
||||||
@JoinColumn(name = "reviewed_by")
|
|
||||||
private AppUser reviewedBy;
|
|
||||||
|
|
||||||
@Column(name = "reviewed_on")
|
|
||||||
private LocalDateTime reviewedOn;
|
|
||||||
|
|
||||||
@Column(name = "review_notes", length = 1000)
|
|
||||||
private String reviewNotes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the officer named this rule, as against it being closed to keep the case consistent.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Marking one rule suspicious escalates the transaction and closes every other rule under the same escalation -
|
|
||||||
* nothing may stay open behind a filed STR. Without this the record would read as though all of them had been
|
|
||||||
* examined and condemned, and on a transaction that tripped six rules, which one the officer put their name to is
|
|
||||||
* the substance of the finding.
|
|
||||||
*/
|
|
||||||
@Column(name = "directly_decided", nullable = false)
|
|
||||||
private boolean directlyDecided;
|
|
||||||
|
|
||||||
protected AmlAlertRule() {}
|
|
||||||
|
|
||||||
public static AmlAlertRule of(final AmlAlert alert, final String ruleCode, final Integer riskCategory,
|
|
||||||
final boolean governing) {
|
|
||||||
final AmlAlertRule finding = new AmlAlertRule();
|
|
||||||
finding.alert = alert;
|
|
||||||
finding.ruleCode = ruleCode;
|
|
||||||
finding.riskCategory = riskCategory;
|
|
||||||
finding.governing = governing;
|
|
||||||
return finding;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param directlyDecided
|
|
||||||
* true when the officer named this rule; false when it was closed alongside one they named
|
|
||||||
*/
|
|
||||||
public void decide(final AmlAlertDisposition disposition, final AppUser reviewer, final String notes,
|
|
||||||
final boolean directlyDecided) {
|
|
||||||
this.disposition = disposition.name();
|
|
||||||
this.reviewedBy = reviewer;
|
|
||||||
this.reviewedOn = LocalDateTime.now();
|
|
||||||
this.reviewNotes = notes;
|
|
||||||
this.directlyDecided = directlyDecided;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDirectlyDecided() {
|
|
||||||
return this.directlyDecided;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDecided() {
|
|
||||||
return this.disposition != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isEscalated() {
|
|
||||||
return AmlAlertDisposition.ESCALATE.name().equals(this.disposition);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return this.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmlAlert getAlert() {
|
|
||||||
return this.alert;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRuleCode() {
|
|
||||||
return this.ruleCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getRiskCategory() {
|
|
||||||
return this.riskCategory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGoverning() {
|
|
||||||
return this.governing;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDisposition() {
|
|
||||||
return this.disposition;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AppUser getReviewedBy() {
|
|
||||||
return this.reviewedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getReviewedOn() {
|
|
||||||
return this.reviewedOn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReviewNotes() {
|
|
||||||
return this.reviewNotes;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-31
@@ -1,31 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.aml.domain;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
public interface AmlAlertRuleRepository extends JpaRepository<AmlAlertRule, Long> {
|
|
||||||
|
|
||||||
List<AmlAlertRule> findByAlertId(Long alertId);
|
|
||||||
|
|
||||||
/** Every finding across a page of alerts, in one read rather than one query per alert. */
|
|
||||||
List<AmlAlertRule> findByAlertIdIn(Collection<Long> alertIds);
|
|
||||||
}
|
|
||||||
-106
@@ -1,106 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.aml.domain;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How far a customer's repetition has gone, and what the bank's answer to it has to be.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A customer who surfaces once is a question; one who surfaces for the fortieth time is an answer the bank has not
|
|
||||||
* acted on. Without a ladder every review looked the same - same screen, same three buttons, same outcome - so the
|
|
||||||
* fortieth review cost an officer the same effort as the first and changed as little.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Each tier does two things: it sets how long a review holds the customer out of the queue, and it says what the
|
|
||||||
* reviewer is expected to do. The windows shorten as the tier rises, because a customer the bank is more worried
|
|
||||||
* about should come back sooner, not later.
|
|
||||||
*/
|
|
||||||
public enum AmlRecurringEscalationTier {
|
|
||||||
|
|
||||||
/** Ordinary repetition. A review stands for a quarter unless the count climbs into the next tier. */
|
|
||||||
ROUTINE(0, 90),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enough repetition that the customer's risk rating is no longer just a KYC-time judgement. Reviewed monthly, and
|
|
||||||
* the reviewer is asked to consider whether the rating still fits.
|
|
||||||
*/
|
|
||||||
ELEVATED(7, 30),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Beyond what a branch officer should be closing on their own. Reviewed fortnightly, and the review is expected
|
|
||||||
* to be taken by someone senior.
|
|
||||||
*/
|
|
||||||
SENIOR(15, 14),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Repetition at a level that is itself the suspicion. An STR is the expected outcome, and clearing at this tier
|
|
||||||
* is a decision that has to be defensible on its own - so the review stands for a week only.
|
|
||||||
*/
|
|
||||||
MANDATORY_STR(30, 7);
|
|
||||||
|
|
||||||
private final int minimumAlertCount;
|
|
||||||
private final int reviewValidityDays;
|
|
||||||
|
|
||||||
AmlRecurringEscalationTier(final int minimumAlertCount, final int reviewValidityDays) {
|
|
||||||
this.minimumAlertCount = minimumAlertCount;
|
|
||||||
this.reviewValidityDays = reviewValidityDays;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The tier a customer sitting on this many alerts falls into. */
|
|
||||||
public static AmlRecurringEscalationTier forAlertCount(final int alertCount) {
|
|
||||||
AmlRecurringEscalationTier tier = ROUTINE;
|
|
||||||
for (final AmlRecurringEscalationTier candidate : values()) {
|
|
||||||
if (alertCount >= candidate.minimumAlertCount) {
|
|
||||||
tier = candidate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMinimumAlertCount() {
|
|
||||||
return minimumAlertCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getReviewValidityDays() {
|
|
||||||
return reviewValidityDays;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How far the alert count may climb before a standing review is set aside and the customer returns early.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A validity window alone would hold a customer out while their behaviour changed underneath it: reviewed at four
|
|
||||||
* alerts and then trips forty more the same week, the review would still stand for the full quarter. Allowing the
|
|
||||||
* count to grow by the tier's own span before forcing a return keeps ordinary repetition quiet while letting a
|
|
||||||
* genuine change in behaviour break through. Tighter at the higher tiers, where less change should be tolerated.
|
|
||||||
*/
|
|
||||||
public int alertGrowthBeforeEarlyReturn() {
|
|
||||||
return switch (this) {
|
|
||||||
case ROUTINE -> 5;
|
|
||||||
case ELEVATED -> 4;
|
|
||||||
case SENIOR -> 3;
|
|
||||||
case MANDATORY_STR -> 2;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Whether a review at this tier is expected to raise an STR rather than close the customer off. */
|
|
||||||
public boolean expectsStr() {
|
|
||||||
return this == MANDATORY_STR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-59
@@ -26,7 +26,6 @@ import jakarta.persistence.Id;
|
|||||||
import jakarta.persistence.JoinColumn;
|
import jakarta.persistence.JoinColumn;
|
||||||
import jakarta.persistence.ManyToOne;
|
import jakarta.persistence.ManyToOne;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import org.apache.fineract.portfolio.client.domain.Client;
|
import org.apache.fineract.portfolio.client.domain.Client;
|
||||||
import org.apache.fineract.useradministration.domain.AppUser;
|
import org.apache.fineract.useradministration.domain.AppUser;
|
||||||
@@ -66,20 +65,6 @@ public class AmlRecurringReview {
|
|||||||
@Column(name = "reviewed_on", nullable = false)
|
@Column(name = "reviewed_on", nullable = false)
|
||||||
private LocalDateTime reviewedOn;
|
private LocalDateTime reviewedOn;
|
||||||
|
|
||||||
/**
|
|
||||||
* The date this review stops standing. Null on reviews taken before validity existed, which keep the older
|
|
||||||
* behaviour of lapsing the moment one more alert lands.
|
|
||||||
*/
|
|
||||||
@Column(name = "valid_until")
|
|
||||||
private LocalDate validUntil;
|
|
||||||
|
|
||||||
@Column(name = "escalation_tier", length = 20)
|
|
||||||
private String escalationTier;
|
|
||||||
|
|
||||||
/** How many of the customer's open alerts this review actually disposed of. */
|
|
||||||
@Column(name = "alerts_actioned")
|
|
||||||
private Integer alertsActioned;
|
|
||||||
|
|
||||||
protected AmlRecurringReview() {}
|
protected AmlRecurringReview() {}
|
||||||
|
|
||||||
public static AmlRecurringReview record(final Client client, final int alertCountAtReview,
|
public static AmlRecurringReview record(final Client client, final int alertCountAtReview,
|
||||||
@@ -91,22 +76,9 @@ public class AmlRecurringReview {
|
|||||||
review.notes = notes;
|
review.notes = notes;
|
||||||
review.reviewedBy = reviewedBy;
|
review.reviewedBy = reviewedBy;
|
||||||
review.reviewedOn = LocalDateTime.now();
|
review.reviewedOn = LocalDateTime.now();
|
||||||
|
|
||||||
// The tier follows from the count, not from what the reviewer picked: how often a customer has surfaced is a
|
|
||||||
// fact about them, and letting the outcome set it would let a customer be held at ROUTINE indefinitely by
|
|
||||||
// always being cleared.
|
|
||||||
final AmlRecurringEscalationTier tier = AmlRecurringEscalationTier.forAlertCount(alertCountAtReview);
|
|
||||||
review.escalationTier = tier.name();
|
|
||||||
review.validUntil = LocalDate.now().plusDays(tier.getReviewValidityDays());
|
|
||||||
review.alertsActioned = 0;
|
|
||||||
return review;
|
return review;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Records how many open alerts the review disposed of, once the caller has acted on them. */
|
|
||||||
public void recordAlertsActioned(final int count) {
|
|
||||||
this.alertsActioned = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
public Long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -134,35 +106,4 @@ public class AmlRecurringReview {
|
|||||||
public LocalDateTime getReviewedOn() {
|
public LocalDateTime getReviewedOn() {
|
||||||
return reviewedOn;
|
return reviewedOn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LocalDate getValidUntil() {
|
|
||||||
return validUntil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmlRecurringEscalationTier getEscalationTier() {
|
|
||||||
return escalationTier == null ? AmlRecurringEscalationTier.ROUTINE : AmlRecurringEscalationTier.valueOf(escalationTier);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getAlertsActioned() {
|
|
||||||
return alertsActioned;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether this review still holds the customer out of the review queue.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Two ways it stops standing. Its window runs out, or the customer's behaviour moves on far enough that the
|
|
||||||
* review no longer describes them - judged by how much the alert count has grown since, against the allowance for
|
|
||||||
* the tier it was taken at. A review with no window at all is a pre-existing one, and keeps the original rule of
|
|
||||||
* lapsing as soon as one more alert arrives.
|
|
||||||
*/
|
|
||||||
public boolean stillStands(final int currentAlertCount) {
|
|
||||||
if (validUntil == null) {
|
|
||||||
return currentAlertCount <= alertCountAtReview;
|
|
||||||
}
|
|
||||||
if (LocalDate.now().isAfter(validUntil)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return currentAlertCount - alertCountAtReview < getEscalationTier().alertGrowthBeforeEarlyReturn();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
-83
@@ -1,83 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.aml.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.JoinColumn;
|
|
||||||
import jakarta.persistence.ManyToOne;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* One alert covered by an STR case.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A case escalated from a single transaction covers that one alert. A case raised off a customer's repeated behaviour
|
|
||||||
* covers all the alerts that make up the pattern - which is what an STR to FIU-IND actually describes, and what the
|
|
||||||
* Principal Officer has to be able to read in one place.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "m_aml_str_case_alert")
|
|
||||||
public class AmlStrCaseAlert {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
@JoinColumn(name = "str_case_id", nullable = false)
|
|
||||||
private AmlStrCase strCase;
|
|
||||||
|
|
||||||
@ManyToOne(optional = false)
|
|
||||||
@JoinColumn(name = "alert_id", nullable = false)
|
|
||||||
private AmlAlert alert;
|
|
||||||
|
|
||||||
@Column(name = "added_on_utc", nullable = false)
|
|
||||||
private LocalDateTime addedOn;
|
|
||||||
|
|
||||||
protected AmlStrCaseAlert() {}
|
|
||||||
|
|
||||||
public static AmlStrCaseAlert link(final AmlStrCase strCase, final AmlAlert alert) {
|
|
||||||
final AmlStrCaseAlert link = new AmlStrCaseAlert();
|
|
||||||
link.strCase = strCase;
|
|
||||||
link.alert = alert;
|
|
||||||
link.addedOn = LocalDateTime.now();
|
|
||||||
return link;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmlStrCase getStrCase() {
|
|
||||||
return strCase;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AmlAlert getAlert() {
|
|
||||||
return alert;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDateTime getAddedOn() {
|
|
||||||
return addedOn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-40
@@ -1,40 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.aml.domain;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
public interface AmlStrCaseAlertRepository extends JpaRepository<AmlStrCaseAlert, Long> {
|
|
||||||
|
|
||||||
/** The alerts one case covers, oldest first - the order the pattern happened in. */
|
|
||||||
List<AmlStrCaseAlert> findByStrCase_IdOrderByAlert_RaisedOnAsc(Long strCaseId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The case already covering an alert, if any.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* What stops a transaction reaching FIU-IND twice: an alert already inside a case is not attached to a second
|
|
||||||
* one, however it comes to be escalated again.
|
|
||||||
*/
|
|
||||||
Optional<AmlStrCaseAlert> findByAlert_Id(Long alertId);
|
|
||||||
|
|
||||||
long countByStrCase_Id(Long strCaseId);
|
|
||||||
}
|
|
||||||
-4
@@ -20,7 +20,6 @@ package org.apache.fineract.portfolio.aml.domain;
|
|||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
@@ -29,9 +28,6 @@ public interface AmlStrCaseRepository extends JpaRepository<AmlStrCase, Long> {
|
|||||||
|
|
||||||
long countByClient_Id(Long clientId);
|
long countByClient_Id(Long clientId);
|
||||||
|
|
||||||
/** The case already open for a transaction, so escalating it again does not open a second one. */
|
|
||||||
Optional<AmlStrCase> findByAlertId(Long alertId);
|
|
||||||
|
|
||||||
List<AmlStrCase> findByStatus(String status);
|
List<AmlStrCase> findByStatus(String status);
|
||||||
|
|
||||||
@Query("SELECT c FROM AmlStrCase c WHERE c.status = 'CONCLUDED_SUSPICIOUS' AND c.concludedOn BETWEEN :from AND :to")
|
@Query("SELECT c FROM AmlStrCase c WHERE c.status = 'CONCLUDED_SUSPICIOUS' AND c.concludedOn BETWEEN :from AND :to")
|
||||||
|
|||||||
-43
@@ -84,49 +84,6 @@ public class AmlTransactionRule {
|
|||||||
@Column(name = "is_active", nullable = false)
|
@Column(name = "is_active", nullable = false)
|
||||||
private boolean active;
|
private boolean active;
|
||||||
|
|
||||||
/**
|
|
||||||
* CREDIT or DEBIT for a rule written about one direction only; null where either way qualifies.
|
|
||||||
* A rule named for withdrawals must not fire on a deposit.
|
|
||||||
*/
|
|
||||||
@Column(name = "direction", length = 10)
|
|
||||||
private String direction;
|
|
||||||
|
|
||||||
/** True where only physical cash qualifies — a cash-reporting rule is not about transfers. */
|
|
||||||
@Column(name = "cash_only", nullable = false)
|
|
||||||
private boolean cashOnly;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How many transactions must make up the window before a pattern rule fires. Structuring is
|
|
||||||
* many small transactions; without this floor a single large one satisfies the window total and
|
|
||||||
* reads as a pattern it is not.
|
|
||||||
*/
|
|
||||||
@Column(name = "min_transaction_count")
|
|
||||||
private Integer minTransactionCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Which customers a rule is about, where the rule is about the customer rather than the
|
|
||||||
* transaction: PEP, CHARITABLE_ORG, HIGH_RISK_BUSINESS, NEW_ACCOUNT. Null means the rule is
|
|
||||||
* about the transaction alone and so applies to everyone.
|
|
||||||
*/
|
|
||||||
@Column(name = "subject_scope", length = 30)
|
|
||||||
private String subjectScope;
|
|
||||||
|
|
||||||
public String getSubjectScope() {
|
|
||||||
return subjectScope;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDirection() {
|
|
||||||
return direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCashOnly() {
|
|
||||||
return cashOnly;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getMinTransactionCount() {
|
|
||||||
return minTransactionCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected AmlTransactionRule() {}
|
protected AmlTransactionRule() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
-7
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.aml.domain;
|
package org.apache.fineract.portfolio.aml.domain;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
@@ -33,10 +32,4 @@ public interface AmlTransactionRuleRepository extends JpaRepository<AmlTransacti
|
|||||||
* by hand from the ledger.
|
* by hand from the ledger.
|
||||||
*/
|
*/
|
||||||
Optional<AmlTransactionRule> findByRuleCode(String ruleCode);
|
Optional<AmlTransactionRule> findByRuleCode(String ruleCode);
|
||||||
|
|
||||||
/**
|
|
||||||
* Every rule named in the given codes, in one read. The alert screen resolves the rules each transaction matched
|
|
||||||
* into descriptions and severities; doing that a code at a time would be one query per rule per alert.
|
|
||||||
*/
|
|
||||||
List<AmlTransactionRule> findByRuleCodeIn(Collection<String> ruleCodes);
|
|
||||||
}
|
}
|
||||||
|
|||||||
-9
@@ -162,15 +162,6 @@ public class ClientApiConstants {
|
|||||||
public static final String ageDaysParamName = "ageDays";
|
public static final String ageDaysParamName = "ageDays";
|
||||||
public static final String nationalityIdParamName = "nationalityId";
|
public static final String nationalityIdParamName = "nationalityId";
|
||||||
public static final String isMinorParamName = "isMinor";
|
public static final String isMinorParamName = "isMinor";
|
||||||
/**
|
|
||||||
* Below this age a client is treated as a minor: guardian mapping required and a restricted KYC/OVD
|
|
||||||
* document set. Must stay in step with MINOR_AGE_THRESHOLD in the web app's client-age util -- the
|
|
||||||
* KYC template endpoint is authoritative for the document list, so a mismatch would serve an adult
|
|
||||||
* list (with mandatory PAN) for a client the UI classifies as a minor.
|
|
||||||
*/
|
|
||||||
public static final int MINOR_AGE_THRESHOLD = 10;
|
|
||||||
/** At or above this age a client qualifies for senior-citizen deposit rates. */
|
|
||||||
public static final int SENIOR_CITIZEN_AGE_THRESHOLD = 60;
|
|
||||||
public static final String guardianClientIdParamName = "guardianClientId";
|
public static final String guardianClientIdParamName = "guardianClientId";
|
||||||
public static final String guardianClientDisplayNameParamName = "guardianClientDisplayName";
|
public static final String guardianClientDisplayNameParamName = "guardianClientDisplayName";
|
||||||
public static final String guardianRelationParamName = "guardianRelation";
|
public static final String guardianRelationParamName = "guardianRelation";
|
||||||
|
|||||||
-219
@@ -1,219 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.client.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* What one customer's money actually did over a period, and what that says about their rating.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A risk rating describes behaviour, and behaviour is a period rather than an event. Judging it from the alert feed
|
|
||||||
* meant a customer appeared the moment one transaction tripped a rule and was recommended for re-rating on that alone
|
|
||||||
* - a single shop purchase could argue for lowering a High rating, and a single large deposit for raising a Low one.
|
|
||||||
* Neither is a pattern.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* One row is one window for one customer, computed nightly. Upgrades and downgrades read different windows, because
|
|
||||||
* the questions are not symmetric: a concern is about what the customer is doing now, and confidence needs a year of
|
|
||||||
* it. The suggestion is stored with the figures it was drawn from, so an officer reviewing it months later sees what
|
|
||||||
* the system was looking at rather than a conclusion with no working.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "m_client_behaviour_window")
|
|
||||||
public class ClientBehaviourWindow {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Column(name = "client_id", nullable = false)
|
|
||||||
private Long clientId;
|
|
||||||
|
|
||||||
@Column(name = "window_from", nullable = false)
|
|
||||||
private LocalDate windowFrom;
|
|
||||||
|
|
||||||
@Column(name = "window_to", nullable = false)
|
|
||||||
private LocalDate windowTo;
|
|
||||||
|
|
||||||
@Column(name = "txn_count")
|
|
||||||
private Integer txnCount;
|
|
||||||
|
|
||||||
@Column(name = "distinct_months")
|
|
||||||
private Integer distinctMonths;
|
|
||||||
|
|
||||||
@Column(name = "credit_total", precision = 19, scale = 6)
|
|
||||||
private BigDecimal creditTotal;
|
|
||||||
|
|
||||||
@Column(name = "debit_total", precision = 19, scale = 6)
|
|
||||||
private BigDecimal debitTotal;
|
|
||||||
|
|
||||||
@Column(name = "largest_txn", precision = 19, scale = 6)
|
|
||||||
private BigDecimal largestTxn;
|
|
||||||
|
|
||||||
@Column(name = "cash_txn_count")
|
|
||||||
private Integer cashTxnCount;
|
|
||||||
|
|
||||||
@Column(name = "cash_total", precision = 19, scale = 6)
|
|
||||||
private BigDecimal cashTotal;
|
|
||||||
|
|
||||||
@Column(name = "large_txn_count")
|
|
||||||
private Integer largeTxnCount;
|
|
||||||
|
|
||||||
@Column(name = "declared_annual_income", precision = 19, scale = 6)
|
|
||||||
private BigDecimal declaredAnnualIncome;
|
|
||||||
|
|
||||||
@Column(name = "declared_annual_turnover", precision = 19, scale = 6)
|
|
||||||
private BigDecimal declaredAnnualTurnover;
|
|
||||||
|
|
||||||
@Column(name = "income_ratio", precision = 19, scale = 6)
|
|
||||||
private BigDecimal incomeRatio;
|
|
||||||
|
|
||||||
@Column(name = "alert_count")
|
|
||||||
private Integer alertCount;
|
|
||||||
|
|
||||||
@Column(name = "str_case_count")
|
|
||||||
private Integer strCaseCount;
|
|
||||||
|
|
||||||
@Column(name = "risk_category_at_review")
|
|
||||||
private Integer riskCategoryAtReview;
|
|
||||||
|
|
||||||
/** UP, DOWN or HOLD. */
|
|
||||||
@Column(name = "suggested_direction", length = 10)
|
|
||||||
private String suggestedDirection;
|
|
||||||
|
|
||||||
@Column(name = "suggested_category")
|
|
||||||
private Integer suggestedCategory;
|
|
||||||
|
|
||||||
@Column(name = "suggestion_reason", length = 500)
|
|
||||||
private String suggestionReason;
|
|
||||||
|
|
||||||
@Column(name = "computed_on")
|
|
||||||
private LocalDateTime computedOn;
|
|
||||||
|
|
||||||
protected ClientBehaviourWindow() {}
|
|
||||||
|
|
||||||
public static ClientBehaviourWindow of(final Long clientId, final LocalDate windowFrom, final LocalDate windowTo) {
|
|
||||||
final ClientBehaviourWindow window = new ClientBehaviourWindow();
|
|
||||||
window.clientId = clientId;
|
|
||||||
window.windowFrom = windowFrom;
|
|
||||||
window.windowTo = windowTo;
|
|
||||||
window.computedOn = LocalDateTime.now();
|
|
||||||
return window;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void recordDistinctMonths(final Integer months) {
|
|
||||||
this.distinctMonths = months;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getDistinctMonths() {
|
|
||||||
return this.distinctMonths;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void recordActivity(final Integer txnCount, final BigDecimal creditTotal, final BigDecimal debitTotal,
|
|
||||||
final BigDecimal largestTxn, final Integer cashTxnCount, final BigDecimal cashTotal, final Integer largeTxnCount) {
|
|
||||||
this.txnCount = txnCount;
|
|
||||||
this.creditTotal = creditTotal;
|
|
||||||
this.debitTotal = debitTotal;
|
|
||||||
this.largestTxn = largestTxn;
|
|
||||||
this.cashTxnCount = cashTxnCount;
|
|
||||||
this.cashTotal = cashTotal;
|
|
||||||
this.largeTxnCount = largeTxnCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void recordMonitoring(final Integer alertCount, final Integer strCaseCount, final Integer riskCategoryAtReview) {
|
|
||||||
this.alertCount = alertCount;
|
|
||||||
this.strCaseCount = strCaseCount;
|
|
||||||
this.riskCategoryAtReview = riskCategoryAtReview;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Turnover measured against what the customer said to expect.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Null rather than zero when no income was declared: the ratio is unknown, not nil, and a rule that treats an
|
|
||||||
* unknown as a benign zero would clear every customer the bank never asked.
|
|
||||||
*/
|
|
||||||
public void recordDeclared(final BigDecimal income, final BigDecimal turnover, final BigDecimal periodTurnover) {
|
|
||||||
this.declaredAnnualIncome = income;
|
|
||||||
this.declaredAnnualTurnover = turnover;
|
|
||||||
final BigDecimal basis = income != null && income.signum() > 0 ? income
|
|
||||||
: (turnover != null && turnover.signum() > 0 ? turnover : null);
|
|
||||||
this.incomeRatio = basis == null || periodTurnover == null ? null
|
|
||||||
: periodTurnover.divide(basis, 6, java.math.RoundingMode.HALF_UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void recordSuggestion(final String direction, final Integer category, final String reason) {
|
|
||||||
this.suggestedDirection = direction;
|
|
||||||
this.suggestedCategory = category;
|
|
||||||
this.suggestionReason = reason == null || reason.length() <= 500 ? reason : reason.substring(0, 500);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getClientId() {
|
|
||||||
return this.clientId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getWindowFrom() {
|
|
||||||
return this.windowFrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LocalDate getWindowTo() {
|
|
||||||
return this.windowTo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getTxnCount() {
|
|
||||||
return this.txnCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getCashTotal() {
|
|
||||||
return this.cashTotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getLargeTxnCount() {
|
|
||||||
return this.largeTxnCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getAlertCount() {
|
|
||||||
return this.alertCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getStrCaseCount() {
|
|
||||||
return this.strCaseCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getRiskCategoryAtReview() {
|
|
||||||
return this.riskCategoryAtReview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSuggestedDirection() {
|
|
||||||
return this.suggestedDirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSuggestedCategory() {
|
|
||||||
return this.suggestedCategory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-43
@@ -1,43 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.client.domain;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
import org.springframework.data.jpa.repository.Modifying;
|
|
||||||
import org.springframework.data.jpa.repository.Query;
|
|
||||||
import org.springframework.data.repository.query.Param;
|
|
||||||
|
|
||||||
public interface ClientBehaviourWindowRepository extends JpaRepository<ClientBehaviourWindow, Long> {
|
|
||||||
|
|
||||||
List<ClientBehaviourWindow> findByClientId(Long clientId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the windows computed for a given day before the job writes that day's.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The job is a recomputation, not an append. Re-running it - after a failure, or twice in a night - must leave one
|
|
||||||
* set of windows rather than a customer appearing several times on the review screen with slightly different
|
|
||||||
* figures.
|
|
||||||
*/
|
|
||||||
@Modifying
|
|
||||||
@Query("DELETE FROM ClientBehaviourWindow w WHERE w.windowTo = :windowTo")
|
|
||||||
void deleteByWindowTo(@Param("windowTo") LocalDate windowTo);
|
|
||||||
}
|
|
||||||
+15
-171
@@ -291,31 +291,6 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
@Column(name = "form15_fy", length = 10)
|
@Column(name = "form15_fy", length = 10)
|
||||||
private String form15Fy;
|
private String form15Fy;
|
||||||
|
|
||||||
// ── Risk profile ─────────────────────────────────────────────────────────
|
|
||||||
/**
|
|
||||||
* Customer facts the risk re-rating policy tests against, as against anything the customer transacted.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A politically exposed person is not downgraded because their activity looks ordinary — that is precisely the
|
|
||||||
* risk — and the same holds for a sanctions or adverse-media match. False means "not recorded as such", which is
|
|
||||||
* the correct reading for a book where nobody was ever asked; it is not an assertion that the customer is clean.
|
|
||||||
*/
|
|
||||||
@Column(name = "is_pep", nullable = false)
|
|
||||||
private boolean isPep;
|
|
||||||
|
|
||||||
@Column(name = "sanctions_match", nullable = false)
|
|
||||||
private boolean sanctionsMatch;
|
|
||||||
|
|
||||||
@Column(name = "adverse_media_match", nullable = false)
|
|
||||||
private boolean adverseMediaMatch;
|
|
||||||
|
|
||||||
/** What the customer told the bank to expect, which their actual turnover is measured against. */
|
|
||||||
@Column(name = "declared_annual_income", precision = 19, scale = 6)
|
|
||||||
private BigDecimal declaredAnnualIncome;
|
|
||||||
|
|
||||||
@Column(name = "declared_annual_turnover", precision = 19, scale = 6)
|
|
||||||
private BigDecimal declaredAnnualTurnover;
|
|
||||||
|
|
||||||
// ── CKYCRR ───────────────────────────────────────────────────────────────
|
// ── CKYCRR ───────────────────────────────────────────────────────────────
|
||||||
/** Central KYC Records Registry number issued by CERSAI */
|
/** Central KYC Records Registry number issued by CERSAI */
|
||||||
@Column(name = "ckyc_number", length = 14)
|
@Column(name = "ckyc_number", length = 14)
|
||||||
@@ -380,7 +355,7 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
this.dinVerified = false;
|
this.dinVerified = false;
|
||||||
this.isException = false;
|
this.isException = false;
|
||||||
this.exceptionResolved = false;
|
this.exceptionResolved = false;
|
||||||
this.initiatedOn = DateUtils.getBusinessLocalDate();
|
this.initiatedOn = DateUtils.getLocalDateOfTenant();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ClientKyc initiateKyc(final Client client, final JsonCommand command) {
|
public static ClientKyc initiateKyc(final Client client, final JsonCommand command) {
|
||||||
@@ -509,14 +484,6 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
actualChanges.put(riskParam, newValue);
|
actualChanges.put(riskParam, newValue);
|
||||||
recordOverwrite(riskParam, this.riskCategory);
|
recordOverwrite(riskParam, this.riskCategory);
|
||||||
this.riskCategory = newValue;
|
this.riskCategory = newValue;
|
||||||
|
|
||||||
// The re-KYC cycle is a property of the risk category, so moving the category moves the
|
|
||||||
// due date with it — otherwise a customer raised to High keeps a Low customer's ten-year
|
|
||||||
// renewal and is never called back in for the two-yearly review the rating requires.
|
|
||||||
final LocalDate newExpiry = recalculateExpiryForRiskCategory();
|
|
||||||
if (newExpiry != null) {
|
|
||||||
actualChanges.put("expiryDate", newExpiry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// remarks is the audit justification itself, so a change to it is deliberately not recorded
|
// remarks is the audit justification itself, so a change to it is deliberately not recorded
|
||||||
@@ -552,19 +519,6 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
v -> this.aadhaarReceiptRemarks = v);
|
v -> this.aadhaarReceiptRemarks = v);
|
||||||
updateDateField(command, "aadhaarReceiptTakenOn", this.aadhaarReceiptTakenOn, actualChanges,
|
updateDateField(command, "aadhaarReceiptTakenOn", this.aadhaarReceiptTakenOn, actualChanges,
|
||||||
v -> this.aadhaarReceiptTakenOn = v);
|
v -> this.aadhaarReceiptTakenOn = v);
|
||||||
// Risk profile. These are determinations about the customer rather than about a transaction, and the
|
|
||||||
// re-rating policy reads them directly: a PEP or a sanctions match holds a rating at High however ordinary the
|
|
||||||
// period's activity looks.
|
|
||||||
updateBooleanField(command, "isPep", this.isPep, actualChanges, v -> this.isPep = v != null ? v : false);
|
|
||||||
updateBooleanField(command, "sanctionsMatch", this.sanctionsMatch, actualChanges,
|
|
||||||
v -> this.sanctionsMatch = v != null ? v : false);
|
|
||||||
updateBooleanField(command, "adverseMediaMatch", this.adverseMediaMatch, actualChanges,
|
|
||||||
v -> this.adverseMediaMatch = v != null ? v : false);
|
|
||||||
updateBigDecimalField(command, "declaredAnnualIncome", this.declaredAnnualIncome, actualChanges,
|
|
||||||
v -> this.declaredAnnualIncome = v);
|
|
||||||
updateBigDecimalField(command, "declaredAnnualTurnover", this.declaredAnnualTurnover, actualChanges,
|
|
||||||
v -> this.declaredAnnualTurnover = v);
|
|
||||||
|
|
||||||
updateStringField(command, "enterprisePan", this.enterprisePan, actualChanges, v -> this.enterprisePan = v);
|
updateStringField(command, "enterprisePan", this.enterprisePan, actualChanges, v -> this.enterprisePan = v);
|
||||||
updateStringField(command, "cinNumber", this.cinNumber, actualChanges, v -> this.cinNumber = v);
|
updateStringField(command, "cinNumber", this.cinNumber, actualChanges, v -> this.cinNumber = v);
|
||||||
updateStringField(command, "dinNumber", this.dinNumber, actualChanges, v -> this.dinNumber = v);
|
updateStringField(command, "dinNumber", this.dinNumber, actualChanges, v -> this.dinNumber = v);
|
||||||
@@ -600,21 +554,10 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
v -> this.form15Applicable = v);
|
v -> this.form15Applicable = v);
|
||||||
updateStringField(command, "form15Type", this.form15Type, actualChanges, v -> this.form15Type = v);
|
updateStringField(command, "form15Type", this.form15Type, actualChanges, v -> this.form15Type = v);
|
||||||
updateStringField(command, "form15FY", this.form15Fy, actualChanges, v -> this.form15Fy = v);
|
updateStringField(command, "form15FY", this.form15Fy, actualChanges, v -> this.form15Fy = v);
|
||||||
// The four exception columns are derived from whether the identity checks have passed, not
|
updateBooleanField(command, "isException", this.isException, actualChanges, v -> this.isException = v != null ? v : false);
|
||||||
// data an officer types, so they are updated without recording an overwrite. A verified
|
updateStringField(command, "exceptionReason", this.exceptionReason, actualChanges, v -> this.exceptionReason = v);
|
||||||
// record demands remarks for any field it already held (see
|
updateBooleanField(command, "exceptionResolved", this.exceptionResolved, actualChanges, v -> this.exceptionResolved = v != null ? v : false);
|
||||||
// getFieldsOverwrittenByLastUpdate), and is_exception is never null once written — so
|
updateDateField(command, "exceptionResolvedOn", this.exceptionResolvedOn, actualChanges, v -> this.exceptionResolvedOn = v);
|
||||||
// counting these would make closing a settled exception impossible without a justification
|
|
||||||
// for something nobody chose. That is what left clients verified on the KYC tab while the
|
|
||||||
// exceptions register still listed them as Pending.
|
|
||||||
updateDerivedBooleanField(command, "isException", this.isException, actualChanges,
|
|
||||||
v -> this.isException = v != null ? v : false);
|
|
||||||
updateDerivedStringField(command, "exceptionReason", this.exceptionReason, actualChanges,
|
|
||||||
v -> this.exceptionReason = v);
|
|
||||||
updateDerivedBooleanField(command, "exceptionResolved", this.exceptionResolved, actualChanges,
|
|
||||||
v -> this.exceptionResolved = v != null ? v : false);
|
|
||||||
updateDerivedDateField(command, "exceptionResolvedOn", this.exceptionResolvedOn, actualChanges,
|
|
||||||
v -> this.exceptionResolvedOn = v);
|
|
||||||
updateBooleanField(command, "panVerified", this.panVerified, actualChanges, v -> this.panVerified = v != null ? v : false);
|
updateBooleanField(command, "panVerified", this.panVerified, actualChanges, v -> this.panVerified = v != null ? v : false);
|
||||||
updateBooleanField(command, "aadhaarVerified", this.aadhaarVerified, actualChanges, v -> this.aadhaarVerified = v != null ? v : false);
|
updateBooleanField(command, "aadhaarVerified", this.aadhaarVerified, actualChanges, v -> this.aadhaarVerified = v != null ? v : false);
|
||||||
updateBooleanField(command, "gstinVerified", this.gstinVerified, actualChanges, v -> this.gstinVerified = v != null ? v : false);
|
updateBooleanField(command, "gstinVerified", this.gstinVerified, actualChanges, v -> this.gstinVerified = v != null ? v : false);
|
||||||
@@ -669,44 +612,6 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
* populated is the record being completed rather than altered, so it is deliberately not
|
* populated is the record being completed rather than altered, so it is deliberately not
|
||||||
* recorded — see {@link #getFieldsOverwrittenByLastUpdate()}.
|
* recorded — see {@link #getFieldsOverwrittenByLastUpdate()}.
|
||||||
*/
|
*/
|
||||||
/*
|
|
||||||
* Derived-field variants of the update helpers above.
|
|
||||||
*
|
|
||||||
* Identical, minus the recordOverwrite call: these columns are computed from whether the
|
|
||||||
* identity checks have passed rather than entered by an officer, so replacing one is not the
|
|
||||||
* kind of change a verified record demands a justification for. They still report into
|
|
||||||
* `changes`, so the update is persisted and audited like any other.
|
|
||||||
*/
|
|
||||||
|
|
||||||
private void updateDerivedBooleanField(final JsonCommand command, final String param, final Boolean current,
|
|
||||||
final Map<String, Object> changes, final java.util.function.Consumer<Boolean> setter) {
|
|
||||||
if (command.parameterExists(param)) {
|
|
||||||
final Boolean newValue = command.booleanObjectValueOfParameterNamed(param);
|
|
||||||
if ((newValue == null && current != null) || (newValue != null && !newValue.equals(current))) {
|
|
||||||
changes.put(param, newValue);
|
|
||||||
setter.accept(newValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDerivedStringField(final JsonCommand command, final String param, final String current,
|
|
||||||
final Map<String, Object> changes, final java.util.function.Consumer<String> setter) {
|
|
||||||
if (command.isChangeInStringParameterNamed(param, current)) {
|
|
||||||
final String newValue = command.stringValueOfParameterNamed(param);
|
|
||||||
changes.put(param, newValue);
|
|
||||||
setter.accept(StringUtils.defaultIfEmpty(newValue, null));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDerivedDateField(final JsonCommand command, final String param, final LocalDate current,
|
|
||||||
final Map<String, Object> changes, final java.util.function.Consumer<LocalDate> setter) {
|
|
||||||
if (command.isChangeInLocalDateParameterNamed(param, current)) {
|
|
||||||
final LocalDate newValue = command.localDateValueOfParameterNamed(param);
|
|
||||||
changes.put(param, newValue);
|
|
||||||
setter.accept(newValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void recordOverwrite(final String param, final Object currentValue) {
|
private void recordOverwrite(final String param, final Object currentValue) {
|
||||||
final boolean wasPopulated = currentValue instanceof String text
|
final boolean wasPopulated = currentValue instanceof String text
|
||||||
? StringUtils.isNotBlank(text)
|
? StringUtils.isNotBlank(text)
|
||||||
@@ -757,13 +662,13 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
public void markCkycUploaded(final String ckycNumber, final String batchId) {
|
public void markCkycUploaded(final String ckycNumber, final String batchId) {
|
||||||
this.ckycNumber = StringUtils.defaultIfEmpty(ckycNumber, null);
|
this.ckycNumber = StringUtils.defaultIfEmpty(ckycNumber, null);
|
||||||
this.ckycBatchId = StringUtils.defaultIfEmpty(batchId, null);
|
this.ckycBatchId = StringUtils.defaultIfEmpty(batchId, null);
|
||||||
this.ckycUploadedOn = DateUtils.getBusinessLocalDate();
|
this.ckycUploadedOn = DateUtils.getLocalDateOfTenant();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Called after successful 3rd-party verification of all required documents. */
|
/** Called after successful 3rd-party verification of all required documents. */
|
||||||
public void markVerified(final String ckycNumber) {
|
public void markVerified(final String ckycNumber) {
|
||||||
this.kycStatus = ClientKycStatus.VERIFIED.getValue();
|
this.kycStatus = ClientKycStatus.VERIFIED.getValue();
|
||||||
this.verifiedOn = DateUtils.getBusinessLocalDate();
|
this.verifiedOn = DateUtils.getLocalDateOfTenant();
|
||||||
this.ckycNumber = StringUtils.defaultIfEmpty(ckycNumber, null);
|
this.ckycNumber = StringUtils.defaultIfEmpty(ckycNumber, null);
|
||||||
|
|
||||||
final KycRiskCategory risk = KycRiskCategory.fromInt(this.riskCategory);
|
final KycRiskCategory risk = KycRiskCategory.fromInt(this.riskCategory);
|
||||||
@@ -772,45 +677,17 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Re-dates the re-KYC due date after the risk category moves.
|
|
||||||
*
|
|
||||||
* The cycle length belongs to the category the customer is in <em>now</em> (Low 10, Medium 8,
|
|
||||||
* High 2), and it is counted from the day of the change rather than from the original
|
|
||||||
* verification. A customer moved to High in year two of a Low rating is then due in two years'
|
|
||||||
* time, not immediately — dating it from {@code verifiedOn} would push most of the book into
|
|
||||||
* an overdue queue the moment a re-rating ran.
|
|
||||||
*
|
|
||||||
* <p>Only a verified KYC carries an expiry: an unverified record has nothing to renew, and
|
|
||||||
* {@link #markVerified} sets the date when it is first verified.
|
|
||||||
*
|
|
||||||
* @return the new expiry date, or {@code null} if the record carries no expiry
|
|
||||||
*/
|
|
||||||
private LocalDate recalculateExpiryForRiskCategory() {
|
|
||||||
if (this.verifiedOn == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
final KycRiskCategory risk = KycRiskCategory.fromInt(this.riskCategory);
|
|
||||||
if (risk.getReKycYears() <= 0) {
|
|
||||||
return this.expiryDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.expiryDate = DateUtils.getBusinessLocalDate().plusYears(risk.getReKycYears());
|
|
||||||
return this.expiryDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Called when verification fails. */
|
/** Called when verification fails. */
|
||||||
public void markRejected(final String remarks) {
|
public void markRejected(final String remarks) {
|
||||||
this.kycStatus = ClientKycStatus.REJECTED.getValue();
|
this.kycStatus = ClientKycStatus.REJECTED.getValue();
|
||||||
this.rejectedOn = DateUtils.getBusinessLocalDate();
|
this.rejectedOn = DateUtils.getLocalDateOfTenant();
|
||||||
this.remarks = StringUtils.defaultIfEmpty(remarks, this.remarks);
|
this.remarks = StringUtils.defaultIfEmpty(remarks, this.remarks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markPanVerified(final String fullName, final String firstName, final String lastName,
|
public void markPanVerified(final String fullName, final String firstName, final String lastName,
|
||||||
final String aadhaarSeedingStatus, final String category, final String status) {
|
final String aadhaarSeedingStatus, final String category, final String status) {
|
||||||
this.panVerified = true;
|
this.panVerified = true;
|
||||||
this.panVerifiedOn = DateUtils.getBusinessLocalDate();
|
this.panVerifiedOn = DateUtils.getLocalDateOfTenant();
|
||||||
this.panFullName = StringUtils.defaultIfEmpty(fullName, null);
|
this.panFullName = StringUtils.defaultIfEmpty(fullName, null);
|
||||||
this.panFirstName = StringUtils.defaultIfEmpty(firstName, null);
|
this.panFirstName = StringUtils.defaultIfEmpty(firstName, null);
|
||||||
this.panLastName = StringUtils.defaultIfEmpty(lastName, null);
|
this.panLastName = StringUtils.defaultIfEmpty(lastName, null);
|
||||||
@@ -836,28 +713,28 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
|
|
||||||
public void markAadhaarVerified() {
|
public void markAadhaarVerified() {
|
||||||
this.aadhaarVerified = true;
|
this.aadhaarVerified = true;
|
||||||
this.aadhaarVerifiedOn = DateUtils.getBusinessLocalDate();
|
this.aadhaarVerifiedOn = DateUtils.getLocalDateOfTenant();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markGstinVerified() {
|
public void markGstinVerified() {
|
||||||
this.gstinVerified = true;
|
this.gstinVerified = true;
|
||||||
this.gstinVerifiedOn = DateUtils.getBusinessLocalDate();
|
this.gstinVerifiedOn = DateUtils.getLocalDateOfTenant();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markCinVerified() {
|
public void markCinVerified() {
|
||||||
this.cinVerified = true;
|
this.cinVerified = true;
|
||||||
this.cinVerifiedOn = DateUtils.getBusinessLocalDate();
|
this.cinVerifiedOn = DateUtils.getLocalDateOfTenant();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markDinVerified() {
|
public void markDinVerified() {
|
||||||
this.dinVerified = true;
|
this.dinVerified = true;
|
||||||
this.dinVerifiedOn = DateUtils.getBusinessLocalDate();
|
this.dinVerifiedOn = DateUtils.getLocalDateOfTenant();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void markDinVerified(final String dinNumber, final String mcaResponseJson) {
|
public void markDinVerified(final String dinNumber, final String mcaResponseJson) {
|
||||||
this.dinNumber = dinNumber;
|
this.dinNumber = dinNumber;
|
||||||
this.dinVerified = true;
|
this.dinVerified = true;
|
||||||
this.dinVerifiedOn = DateUtils.getBusinessLocalDate();
|
this.dinVerifiedOn = DateUtils.getLocalDateOfTenant();
|
||||||
this.isDirector = true;
|
this.isDirector = true;
|
||||||
this.dinMcaResponse = mcaResponseJson;
|
this.dinMcaResponse = mcaResponseJson;
|
||||||
}
|
}
|
||||||
@@ -878,17 +755,7 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
} else if (type != null && type.isNonIndividual()) {
|
} else if (type != null && type.isNonIndividual()) {
|
||||||
allDone = this.panVerified && this.gstinVerified;
|
allDone = this.panVerified && this.gstinVerified;
|
||||||
}
|
}
|
||||||
// Re-stamped even when the record already reads VERIFIED, because that is exactly what a
|
if (allDone && !getKycStatus().isVerified()) {
|
||||||
// periodic re-KYC is: an already-verified customer verified afresh.
|
|
||||||
//
|
|
||||||
// Skipping it there left verifiedOn — and with it the expiry date, and the dormancy clock
|
|
||||||
// that now measures from it — frozen at the original onboarding. An officer who re-verified
|
|
||||||
// both PAN and Aadhaar at the counter saw both rows stamped with today's date and the
|
|
||||||
// account still sitting on the inactive report, with nothing to say what was missing.
|
|
||||||
//
|
|
||||||
// Guarded on the verifications rather than the status, so this only fires when the checks
|
|
||||||
// that constitute a verification have actually been done again.
|
|
||||||
if (allDone) {
|
|
||||||
markVerified(this.ckycNumber);
|
markVerified(this.ckycNumber);
|
||||||
}
|
}
|
||||||
return allDone;
|
return allDone;
|
||||||
@@ -931,29 +798,6 @@ public class ClientKyc extends AbstractAuditableWithUTCDateTimeCustom<Long> {
|
|||||||
*/
|
*/
|
||||||
public void escalateRiskCategory(Integer newCategory) {
|
public void escalateRiskCategory(Integer newCategory) {
|
||||||
this.riskCategory = newCategory;
|
this.riskCategory = newCategory;
|
||||||
// An auto-escalation moves the rating for the same reason an officer would, so it moves the
|
|
||||||
// re-KYC due date on the same terms — see recalculateExpiryForRiskCategory().
|
|
||||||
recalculateExpiryForRiskCategory();
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPep() {
|
|
||||||
return this.isPep;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSanctionsMatch() {
|
|
||||||
return this.sanctionsMatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAdverseMediaMatch() {
|
|
||||||
return this.adverseMediaMatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getDeclaredAnnualIncome() {
|
|
||||||
return this.declaredAnnualIncome;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getDeclaredAnnualTurnover() {
|
|
||||||
return this.declaredAnnualTurnover;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPanNumber() {
|
public String getPanNumber() {
|
||||||
|
|||||||
-13
@@ -18,7 +18,6 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.client.domain;
|
package org.apache.fineract.portfolio.client.domain;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
@@ -49,18 +48,6 @@ public interface ClientKycRepository extends JpaRepository<ClientKyc, Long> {
|
|||||||
@Query("SELECT k FROM ClientKyc k WHERE k.kycStatus = :status")
|
@Query("SELECT k FROM ClientKyc k WHERE k.kycStatus = :status")
|
||||||
List<ClientKyc> findAllByStatus(@Param("status") Integer status);
|
List<ClientKyc> findAllByStatus(@Param("status") Integer status);
|
||||||
|
|
||||||
/**
|
|
||||||
* KYC records whose periodic re-KYC due date has passed, oldest first.
|
|
||||||
*
|
|
||||||
* <p>Only records that carry an expiry are considered: an expiry is set when the KYC is first
|
|
||||||
* verified, so one without a date has never been verified and has no renewal cycle to lapse.
|
|
||||||
* A rejected record is excluded for the same reason — it is not a lapsed KYC, it is one that
|
|
||||||
* never took effect, and restricting an account over it would punish the wrong thing.
|
|
||||||
*/
|
|
||||||
@Query("SELECT k FROM ClientKyc k WHERE k.expiryDate IS NOT NULL AND k.expiryDate <= :asOn "
|
|
||||||
+ "AND k.kycStatus <> :rejectedStatus ORDER BY k.expiryDate ASC")
|
|
||||||
List<ClientKyc> findLapsedAsOn(@Param("asOn") LocalDate asOn, @Param("rejectedStatus") Integer rejectedStatus);
|
|
||||||
|
|
||||||
// ── Pre-KYC uniqueness probes ───────────────────────────────────────────
|
// ── Pre-KYC uniqueness probes ───────────────────────────────────────────
|
||||||
// Why: stop a second client from being created with the same PAN / Aadhaar / GSTIN BEFORE the
|
// Why: stop a second client from being created with the same PAN / Aadhaar / GSTIN BEFORE the
|
||||||
// external KYC API is called, so we don't burn vendor calls on duplicate-identity records. PAN
|
// external KYC API is called, so we don't burn vendor calls on duplicate-identity records. PAN
|
||||||
|
|||||||
+1
-35
@@ -93,26 +93,6 @@ public class ClientRiskRule {
|
|||||||
@Column(name = "order_position", nullable = false)
|
@Column(name = "order_position", nullable = false)
|
||||||
private Integer orderPosition;
|
private Integer orderPosition;
|
||||||
|
|
||||||
/**
|
|
||||||
* Which of the two rule families this row belongs to - {@link #KIND_KYC} or {@link #KIND_AML}.
|
|
||||||
*
|
|
||||||
* This table carries both, and they are not interchangeable. A KYC rule is profile-driven: it
|
|
||||||
* reads occupation / income / turnover to categorise a customer at onboarding (RBI Master
|
|
||||||
* Direction on KYC, Section 12). An AML rule is behaviour-driven: it describes a transaction
|
|
||||||
* pattern and may only fire against posted transactions, surfacing in {@code m_aml_alert}
|
|
||||||
* (Section 13).
|
|
||||||
*
|
|
||||||
* The distinction used to be inferred from "has no criteria set", which migration 0448 erased
|
|
||||||
* by writing 0.0 over the NULLs - after which transaction-monitoring rules began matching
|
|
||||||
* ordinary customers at onboarding and pre-flagging them for AML. Recording the kind means a
|
|
||||||
* rule states what it is; nothing has to guess from the shape of its other columns.
|
|
||||||
*/
|
|
||||||
@Column(name = "rule_kind", length = 10)
|
|
||||||
private String ruleKind;
|
|
||||||
|
|
||||||
public static final String KIND_KYC = "KYC";
|
|
||||||
public static final String KIND_AML = "AML";
|
|
||||||
|
|
||||||
protected ClientRiskRule() {}
|
protected ClientRiskRule() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,9 +104,8 @@ public class ClientRiskRule {
|
|||||||
final BigDecimal maxMonthlyIncome, final BigDecimal minAnnualIncome, final BigDecimal maxAnnualIncome,
|
final BigDecimal maxMonthlyIncome, final BigDecimal minAnnualIncome, final BigDecimal maxAnnualIncome,
|
||||||
final BigDecimal minAnnualTurnover, final BigDecimal maxAnnualTurnover, final String amlCheckStatus,
|
final BigDecimal minAnnualTurnover, final BigDecimal maxAnnualTurnover, final String amlCheckStatus,
|
||||||
final String bannedEntityMatch, final String willfulDefaulter, final String ecgcSalFlag,
|
final String bannedEntityMatch, final String willfulDefaulter, final String ecgcSalFlag,
|
||||||
final String dormantFlag, final String ruleKind) {
|
final String dormantFlag) {
|
||||||
final ClientRiskRule rule = new ClientRiskRule();
|
final ClientRiskRule rule = new ClientRiskRule();
|
||||||
rule.ruleKind = ruleKind;
|
|
||||||
rule.ruleName = ruleName;
|
rule.ruleName = ruleName;
|
||||||
rule.reason = reason;
|
rule.reason = reason;
|
||||||
rule.riskCategory = riskCategory;
|
rule.riskCategory = riskCategory;
|
||||||
@@ -158,19 +137,6 @@ public class ClientRiskRule {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRuleKind() {
|
|
||||||
return ruleKind;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* True when this rule may take part in onboarding risk categorisation. Rows predating the
|
|
||||||
* rule_kind column are treated as KYC, matching how they behaved before AML rules were seeded
|
|
||||||
* into the same table.
|
|
||||||
*/
|
|
||||||
public boolean isKycRule() {
|
|
||||||
return !KIND_AML.equalsIgnoreCase(this.ruleKind);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getRuleName() {
|
public String getRuleName() {
|
||||||
return ruleName;
|
return ruleName;
|
||||||
}
|
}
|
||||||
|
|||||||
-106
@@ -1,106 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.client.domain;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* How far an account has travelled down the restriction ladder after its periodic re-KYC lapsed.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* RBI's Master Direction on KYC does not treat an overdue re-KYC as grounds to shut a customer out.
|
|
||||||
* The 2021 amendment (DOR.AML.REC.13/14.01.001/2021-22) is explicit that an account is not to be
|
|
||||||
* closed merely because periodic KYC is pending, and that any restriction follows notice and a fair
|
|
||||||
* opportunity to comply. The ladder therefore leaves the account untouched for a grace period,
|
|
||||||
* stops debits before it stops anything else, and never reaches closure on its own — closure stays
|
|
||||||
* a manual decision with its own notice.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The day counts are bank policy rather than a regulatory figure — the Direction requires "adequate
|
|
||||||
* notice" without fixing a number — so they are declared here once and read from here everywhere.
|
|
||||||
*/
|
|
||||||
public enum KycExpiryStage {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Inside the grace window. Nothing is restricted; the customer is being chased.
|
|
||||||
*/
|
|
||||||
GRACE(0),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debits stopped, credits still accepted. The first actual restriction, and the one that brings
|
|
||||||
* the customer into the branch without putting their incoming money at risk.
|
|
||||||
*/
|
|
||||||
PARTIAL_FREEZE(90),
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Both directions restricted, barring the credits that must always be let through.
|
|
||||||
*/
|
|
||||||
INOPERATIVE(180);
|
|
||||||
|
|
||||||
/** Days past the expiry date at which this stage begins. */
|
|
||||||
private final int fromDaysOverdue;
|
|
||||||
|
|
||||||
KycExpiryStage(final int fromDaysOverdue) {
|
|
||||||
this.fromDaysOverdue = fromDaysOverdue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFromDaysOverdue() {
|
|
||||||
return fromDaysOverdue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The stage an account sits at, given how far past its re-KYC due date it is.
|
|
||||||
*
|
|
||||||
* @param daysOverdue
|
|
||||||
* days since the expiry date; zero or negative means the KYC has not lapsed
|
|
||||||
* @return the stage, or {@code null} where the KYC is still current and nothing applies
|
|
||||||
*/
|
|
||||||
public static KycExpiryStage fromDaysOverdue(final long daysOverdue) {
|
|
||||||
if (daysOverdue < 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (daysOverdue >= INOPERATIVE.fromDaysOverdue) {
|
|
||||||
return INOPERATIVE;
|
|
||||||
}
|
|
||||||
if (daysOverdue >= PARTIAL_FREEZE.fromDaysOverdue) {
|
|
||||||
return PARTIAL_FREEZE;
|
|
||||||
}
|
|
||||||
return GRACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isGrace() {
|
|
||||||
return this == GRACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPartialFreeze() {
|
|
||||||
return this == PARTIAL_FREEZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInoperative() {
|
|
||||||
return this == INOPERATIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Whether debits should be stopped at this stage. */
|
|
||||||
public boolean blocksDebits() {
|
|
||||||
return this == PARTIAL_FREEZE || this == INOPERATIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Whether ordinary credits should be stopped at this stage. */
|
|
||||||
public boolean blocksCredits() {
|
|
||||||
return this == INOPERATIVE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-74
@@ -1,74 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.client.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* One number the risk re-rating policy is made of - a window length, a minimum transaction count, a cash threshold.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Held as data because these are the bank's risk appetite rather than engineering constants. How long a customer must
|
|
||||||
* behave before a High rating comes down is a compliance judgement, and a co-operative bank whose members transact
|
|
||||||
* three times a month needs different figures from one lending to traders.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "m_risk_policy_parameter")
|
|
||||||
public class RiskPolicyParameter {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Column(name = "parameter_key", nullable = false, length = 80)
|
|
||||||
private String parameterKey;
|
|
||||||
|
|
||||||
@Column(name = "parameter_value", nullable = false, precision = 19, scale = 2)
|
|
||||||
private BigDecimal parameterValue;
|
|
||||||
|
|
||||||
@Column(name = "description", length = 500)
|
|
||||||
private String description;
|
|
||||||
|
|
||||||
@Column(name = "last_modified_by")
|
|
||||||
private Long lastModifiedBy;
|
|
||||||
|
|
||||||
@Column(name = "last_modified_on")
|
|
||||||
private LocalDateTime lastModifiedOn;
|
|
||||||
|
|
||||||
protected RiskPolicyParameter() {}
|
|
||||||
|
|
||||||
public String getParameterKey() {
|
|
||||||
return this.parameterKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getParameterValue() {
|
|
||||||
return this.parameterValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDescription() {
|
|
||||||
return this.description;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-23
@@ -1,23 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.client.domain;
|
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
public interface RiskPolicyParameterRepository extends JpaRepository<RiskPolicyParameter, Long> {}
|
|
||||||
+29
-19
@@ -31,15 +31,20 @@ import jakarta.ws.rs.Produces;
|
|||||||
import jakarta.ws.rs.QueryParam;
|
import jakarta.ws.rs.QueryParam;
|
||||||
import jakarta.ws.rs.core.MediaType;
|
import jakarta.ws.rs.core.MediaType;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.commands.domain.CommandWrapper;
|
import org.apache.fineract.command.core.CommandPipeline;
|
||||||
import org.apache.fineract.commands.service.CommandWrapperBuilder;
|
|
||||||
import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
|
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
|
||||||
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
|
||||||
|
import org.apache.fineract.portfolio.paymenttype.command.PaymentTypeCreateCommand;
|
||||||
|
import org.apache.fineract.portfolio.paymenttype.command.PaymentTypeDeleteCommand;
|
||||||
|
import org.apache.fineract.portfolio.paymenttype.command.PaymentTypeUpdateCommand;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
|
||||||
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateResponse;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData;
|
||||||
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteRequest;
|
||||||
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteResponse;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
|
||||||
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateResponse;
|
||||||
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
|
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@@ -50,7 +55,7 @@ import org.springframework.stereotype.Component;
|
|||||||
public class PaymentTypeApiResource {
|
public class PaymentTypeApiResource {
|
||||||
|
|
||||||
private final PaymentTypeReadService readPlatformService;
|
private final PaymentTypeReadService readPlatformService;
|
||||||
private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
|
private final CommandPipeline commandPipeline;
|
||||||
private final DefaultToApiJsonSerializer<PaymentTypeData> jsonSerializer;
|
private final DefaultToApiJsonSerializer<PaymentTypeData> jsonSerializer;
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@@ -74,13 +79,14 @@ public class PaymentTypeApiResource {
|
|||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Operation(summary = "Create a Payment Type", description = "Creates a new Payment type")
|
@Operation(summary = "Create a Payment Type", description = "Creates a new Payment type")
|
||||||
public String createPaymentType(final PaymentTypeCreateRequest request) {
|
public PaymentTypeCreateResponse createPaymentType(PaymentTypeCreateRequest request) {
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().createPaymentType()
|
final var command = new PaymentTypeCreateCommand();
|
||||||
.withJson(jsonSerializer.serialize(request)).build();
|
|
||||||
|
|
||||||
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
command.setPayload(request);
|
||||||
|
|
||||||
return jsonSerializer.serialize(result);
|
final Supplier<PaymentTypeCreateResponse> response = commandPipeline.send(command);
|
||||||
|
|
||||||
|
return response.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@@ -88,16 +94,18 @@ public class PaymentTypeApiResource {
|
|||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Operation(summary = "Update a Payment Type", description = "Updates a Payment Type")
|
@Operation(summary = "Update a Payment Type", description = "Updates a Payment Type")
|
||||||
public String updatePaymentType(@PathParam("paymentTypeId") final Long paymentTypeId, final PaymentTypeUpdateRequest request) {
|
public PaymentTypeUpdateResponse updatePaymentType(@PathParam("paymentTypeId") final Long paymentTypeId,
|
||||||
|
final PaymentTypeUpdateRequest request) {
|
||||||
|
|
||||||
request.setId(paymentTypeId);
|
request.setId(paymentTypeId);
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().updatePaymentType(paymentTypeId)
|
final var command = new PaymentTypeUpdateCommand();
|
||||||
.withJson(jsonSerializer.serialize(request)).build();
|
|
||||||
|
|
||||||
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
command.setPayload(request);
|
||||||
|
|
||||||
return jsonSerializer.serialize(result);
|
final Supplier<PaymentTypeUpdateResponse> response = commandPipeline.send(command);
|
||||||
|
|
||||||
|
return response.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@@ -105,12 +113,14 @@ public class PaymentTypeApiResource {
|
|||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
@Consumes({ MediaType.APPLICATION_JSON })
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
@Produces({ MediaType.APPLICATION_JSON })
|
||||||
@Operation(summary = "Delete a Payment Type", description = "Deletes payment type")
|
@Operation(summary = "Delete a Payment Type", description = "Deletes payment type")
|
||||||
public String deleteCode(@PathParam("paymentTypeId") final Long paymentTypeId) {
|
public PaymentTypeDeleteResponse deleteCode(@PathParam("paymentTypeId") final Long paymentTypeId) {
|
||||||
|
|
||||||
final CommandWrapper commandRequest = new CommandWrapperBuilder().deletePaymentType(paymentTypeId).build();
|
final var command = new PaymentTypeDeleteCommand();
|
||||||
|
|
||||||
final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest);
|
command.setPayload(PaymentTypeDeleteRequest.builder().id(paymentTypeId).build());
|
||||||
|
|
||||||
return jsonSerializer.serialize(result);
|
final Supplier<PaymentTypeDeleteResponse> response = commandPipeline.send(command);
|
||||||
|
|
||||||
|
return response.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-35
@@ -18,50 +18,33 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.paymenttype.handler;
|
package org.apache.fineract.portfolio.paymenttype.handler;
|
||||||
|
|
||||||
import org.apache.fineract.commands.annotation.CommandType;
|
import io.github.resilience4j.retry.annotation.Retry;
|
||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
import org.apache.fineract.command.core.Command;
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
import org.apache.fineract.command.core.CommandHandler;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateRequest;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateResponse;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeCreateResponse;
|
||||||
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
|
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Slf4j
|
||||||
@CommandType(entity = "PAYMENTTYPE", action = "CREATE")
|
@Component
|
||||||
public class PaymentTypeCreateCommandHandler implements NewCommandSourceHandler {
|
@RequiredArgsConstructor
|
||||||
|
public class PaymentTypeCreateCommandHandler implements CommandHandler<PaymentTypeCreateRequest, PaymentTypeCreateResponse> {
|
||||||
|
|
||||||
private final PaymentTypeWriteService paymentTypeWriteService;
|
private final PaymentTypeWriteService paymentTypeWriteService;
|
||||||
|
|
||||||
@Autowired
|
@Retry(name = "commandPaymentTypeCreate", fallbackMethod = "fallback")
|
||||||
public PaymentTypeCreateCommandHandler(final PaymentTypeWriteService paymentTypeWriteService) {
|
|
||||||
this.paymentTypeWriteService = paymentTypeWriteService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
@Transactional
|
||||||
|
public PaymentTypeCreateResponse handle(Command<PaymentTypeCreateRequest> command) {
|
||||||
final Boolean isSystemDefined = command.booleanObjectValueOfParameterNamed("isSystemDefined");
|
return paymentTypeWriteService.createPaymentType(command.getPayload());
|
||||||
|
|
||||||
final PaymentTypeCreateRequest request = PaymentTypeCreateRequest.builder()
|
|
||||||
.name(command.stringValueOfParameterNamed("name"))
|
|
||||||
.description(command.stringValueOfParameterNamed("description"))
|
|
||||||
.isCashPayment(command.booleanObjectValueOfParameterNamed("isCashPayment"))
|
|
||||||
.position(command.longValueOfParameterNamed("position"))
|
|
||||||
.codeName(command.stringValueOfParameterNamed("codeName"))
|
|
||||||
.isSystemDefined(isSystemDefined != null ? isSystemDefined : Boolean.FALSE)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
final PaymentTypeCreateResponse response = this.paymentTypeWriteService.createPaymentType(request);
|
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
|
||||||
.withCommandId(command.commandId()) //
|
|
||||||
.withEntityId(response.getResourceId()) //
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PaymentTypeCreateResponse fallback(Command<PaymentTypeCreateRequest> command, Throwable t) {
|
||||||
|
return CommandHandler.super.fallback(command, t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-26
@@ -18,41 +18,33 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.paymenttype.handler;
|
package org.apache.fineract.portfolio.paymenttype.handler;
|
||||||
|
|
||||||
import org.apache.fineract.commands.annotation.CommandType;
|
import io.github.resilience4j.retry.annotation.Retry;
|
||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
import org.apache.fineract.command.core.Command;
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
import org.apache.fineract.command.core.CommandHandler;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteRequest;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteRequest;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteResponse;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeDeleteResponse;
|
||||||
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
|
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Slf4j
|
||||||
@CommandType(entity = "PAYMENTTYPE", action = "DELETE")
|
@Component
|
||||||
public class PaymentTypeDeleteCommandHandler implements NewCommandSourceHandler {
|
@RequiredArgsConstructor
|
||||||
|
public class PaymentTypeDeleteCommandHandler implements CommandHandler<PaymentTypeDeleteRequest, PaymentTypeDeleteResponse> {
|
||||||
|
|
||||||
private final PaymentTypeWriteService paymentTypeWriteService;
|
private final PaymentTypeWriteService paymentTypeWriteService;
|
||||||
|
|
||||||
@Autowired
|
@Retry(name = "commandPaymentTypeDelete", fallbackMethod = "fallback")
|
||||||
public PaymentTypeDeleteCommandHandler(final PaymentTypeWriteService paymentTypeWriteService) {
|
|
||||||
this.paymentTypeWriteService = paymentTypeWriteService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
@Transactional
|
||||||
|
public PaymentTypeDeleteResponse handle(Command<PaymentTypeDeleteRequest> command) {
|
||||||
final PaymentTypeDeleteRequest request = PaymentTypeDeleteRequest.builder().id(command.entityId()).build();
|
return paymentTypeWriteService.deletePaymentType(command.getPayload());
|
||||||
|
|
||||||
final PaymentTypeDeleteResponse response = this.paymentTypeWriteService.deletePaymentType(request);
|
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
|
||||||
.withCommandId(command.commandId()) //
|
|
||||||
.withEntityId(response.getResourceId()) //
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PaymentTypeDeleteResponse fallback(Command<PaymentTypeDeleteRequest> command, Throwable t) {
|
||||||
|
return CommandHandler.super.fallback(command, t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-36
@@ -18,51 +18,33 @@
|
|||||||
*/
|
*/
|
||||||
package org.apache.fineract.portfolio.paymenttype.handler;
|
package org.apache.fineract.portfolio.paymenttype.handler;
|
||||||
|
|
||||||
import org.apache.fineract.commands.annotation.CommandType;
|
import io.github.resilience4j.retry.annotation.Retry;
|
||||||
import org.apache.fineract.commands.handler.NewCommandSourceHandler;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
|
import org.apache.fineract.command.core.Command;
|
||||||
import org.apache.fineract.infrastructure.core.data.CommandProcessingResultBuilder;
|
import org.apache.fineract.command.core.CommandHandler;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateRequest;
|
||||||
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateResponse;
|
import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeUpdateResponse;
|
||||||
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
|
import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeWriteService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@Service
|
@Slf4j
|
||||||
@CommandType(entity = "PAYMENTTYPE", action = "UPDATE")
|
@Component
|
||||||
public class PaymentTypeUpdateCommandHandler implements NewCommandSourceHandler {
|
@RequiredArgsConstructor
|
||||||
|
public class PaymentTypeUpdateCommandHandler implements CommandHandler<PaymentTypeUpdateRequest, PaymentTypeUpdateResponse> {
|
||||||
|
|
||||||
private final PaymentTypeWriteService paymentTypeWriteService;
|
private final PaymentTypeWriteService paymentTypeWriteService;
|
||||||
|
|
||||||
@Autowired
|
@Retry(name = "commandPaymentTypeUpdate", fallbackMethod = "fallback")
|
||||||
public PaymentTypeUpdateCommandHandler(final PaymentTypeWriteService paymentTypeWriteService) {
|
|
||||||
this.paymentTypeWriteService = paymentTypeWriteService;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Transactional
|
|
||||||
@Override
|
@Override
|
||||||
public CommandProcessingResult processCommand(final JsonCommand command) {
|
@Transactional
|
||||||
|
public PaymentTypeUpdateResponse handle(Command<PaymentTypeUpdateRequest> command) {
|
||||||
final Boolean isSystemDefined = command.booleanObjectValueOfParameterNamed("isSystemDefined");
|
return paymentTypeWriteService.updatePaymentType(command.getPayload());
|
||||||
|
|
||||||
final PaymentTypeUpdateRequest request = PaymentTypeUpdateRequest.builder()
|
|
||||||
.id(command.entityId())
|
|
||||||
.name(command.stringValueOfParameterNamed("name"))
|
|
||||||
.description(command.stringValueOfParameterNamed("description"))
|
|
||||||
.isCashPayment(command.booleanObjectValueOfParameterNamed("isCashPayment"))
|
|
||||||
.position(command.longValueOfParameterNamed("position"))
|
|
||||||
.codeName(command.stringValueOfParameterNamed("codeName"))
|
|
||||||
.isSystemDefined(isSystemDefined != null ? isSystemDefined : Boolean.FALSE)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
final PaymentTypeUpdateResponse response = this.paymentTypeWriteService.updatePaymentType(request);
|
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
|
||||||
.withCommandId(command.commandId()) //
|
|
||||||
.withEntityId(response.getResourceId()) //
|
|
||||||
.build();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PaymentTypeUpdateResponse fallback(Command<PaymentTypeUpdateRequest> command, Throwable t) {
|
||||||
|
return CommandHandler.super.fallback(command, t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-20
@@ -31,9 +31,7 @@ public enum DepositAccountOnClosureType {
|
|||||||
WITHDRAW_DEPOSIT(100, "depositAccountClosureType.withdrawDeposit"), //
|
WITHDRAW_DEPOSIT(100, "depositAccountClosureType.withdrawDeposit"), //
|
||||||
TRANSFER_TO_SAVINGS(200, "depositAccountClosureType.transferToSavings"), //
|
TRANSFER_TO_SAVINGS(200, "depositAccountClosureType.transferToSavings"), //
|
||||||
REINVEST_PRINCIPAL_AND_INTEREST(300, "depositAccountClosureType.reinvestPrincipalAndInterest"), //
|
REINVEST_PRINCIPAL_AND_INTEREST(300, "depositAccountClosureType.reinvestPrincipalAndInterest"), //
|
||||||
REINVEST_PRINCIPAL_ONLY(400, "depositAccountClosureType.reinvestPrincipalOnly"), //
|
REINVEST_PRINCIPAL_ONLY(400, "depositAccountClosureType.reinvestPrincipalOnly"); //
|
||||||
PARTIAL_REINVEST(500, "depositAccountClosureType.partialReinvest"), //
|
|
||||||
TRANSFER_TO_GL(600, "depositAccountClosureType.transferToGl"); //
|
|
||||||
|
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String code;
|
private final String code;
|
||||||
@@ -53,8 +51,6 @@ public enum DepositAccountOnClosureType {
|
|||||||
case 200 -> TRANSFER_TO_SAVINGS;
|
case 200 -> TRANSFER_TO_SAVINGS;
|
||||||
case 300 -> REINVEST_PRINCIPAL_AND_INTEREST;
|
case 300 -> REINVEST_PRINCIPAL_AND_INTEREST;
|
||||||
case 400 -> REINVEST_PRINCIPAL_ONLY;
|
case 400 -> REINVEST_PRINCIPAL_ONLY;
|
||||||
case 500 -> PARTIAL_REINVEST;
|
|
||||||
case 600 -> TRANSFER_TO_GL;
|
|
||||||
default -> INVALID;
|
default -> INVALID;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -89,21 +85,6 @@ public enum DepositAccountOnClosureType {
|
|||||||
return this.equals(INVALID);
|
return this.equals(INVALID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPartialReinvest() {
|
|
||||||
return this.equals(PARTIAL_REINVEST);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pays the closure proceeds into a GL account the maker picks, instead of a savings account or cash.
|
|
||||||
* Only the fixed-deposit premature-closure handler implements it -- see
|
|
||||||
* DepositAccountDomainServiceJpa#handleFDAccountPreMatureClosure; every other closure path rejects it
|
|
||||||
* in DepositAccountTransactionDataValidator#validateClosing rather than falling through to the
|
|
||||||
* terminal "pay the balance out in cash" branch.
|
|
||||||
*/
|
|
||||||
public boolean isTransferToGl() {
|
|
||||||
return this.equals(TRANSFER_TO_GL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: do we really need this?!?
|
// TODO: do we really need this?!?
|
||||||
public static Object[] integerValues() {
|
public static Object[] integerValues() {
|
||||||
return Arrays.stream(values()).filter(value -> !INVALID.equals(value)).map(value -> value.value).toList().toArray();
|
return Arrays.stream(values()).filter(value -> !INVALID.equals(value)).map(value -> value.value).toList().toArray();
|
||||||
|
|||||||
+3
-30
@@ -123,7 +123,6 @@ public final class DepositsApiConstants {
|
|||||||
public static final String isSeniorCitizenParamName = "isSeniorCitizen";
|
public static final String isSeniorCitizenParamName = "isSeniorCitizen";
|
||||||
public static final String seniorCitizenInterestRateParamName = "seniorCitizenInterestRate";
|
public static final String seniorCitizenInterestRateParamName = "seniorCitizenInterestRate";
|
||||||
public static final String tenureInMonthsParamName = "tenureInMonths";
|
public static final String tenureInMonthsParamName = "tenureInMonths";
|
||||||
public static final String tenureInDaysParamName = "tenureInDays";
|
|
||||||
public static final String interestCompoundingPeriodInMonthsParamName = "interestCompoundingPeriodInMonths";
|
public static final String interestCompoundingPeriodInMonthsParamName = "interestCompoundingPeriodInMonths";
|
||||||
|
|
||||||
// Preclosure parameters
|
// Preclosure parameters
|
||||||
@@ -143,9 +142,6 @@ public final class DepositsApiConstants {
|
|||||||
public static final String inMultiplesOfDepositTermParamName = "inMultiplesOfDepositTerm";
|
public static final String inMultiplesOfDepositTermParamName = "inMultiplesOfDepositTerm";
|
||||||
public static final String inMultiplesOfDepositTermTypeIdParamName = "inMultiplesOfDepositTermTypeId";
|
public static final String inMultiplesOfDepositTermTypeIdParamName = "inMultiplesOfDepositTermTypeId";
|
||||||
public static final String inMultiplesOfDepositTermType = "inMultiplesOfDepositTermType";
|
public static final String inMultiplesOfDepositTermType = "inMultiplesOfDepositTermType";
|
||||||
// Days after maturity a depositor still has to walk in and renew at the original maturity date --
|
|
||||||
// null/0 means this product keeps the instant, same-night auto-renewal every FD product had before.
|
|
||||||
public static final String renewalGracePeriodDaysParamName = "renewalGracePeriodDays";
|
|
||||||
|
|
||||||
public static final String depositAmountParamName = "depositAmount";
|
public static final String depositAmountParamName = "depositAmount";
|
||||||
public static final String depositMinAmountParamName = "minDepositAmount";
|
public static final String depositMinAmountParamName = "minDepositAmount";
|
||||||
@@ -212,18 +208,6 @@ public final class DepositsApiConstants {
|
|||||||
public static final String onAccountClosureIdParamName = "onAccountClosureId";
|
public static final String onAccountClosureIdParamName = "onAccountClosureId";
|
||||||
public static final String transferDescriptionParamName = "transferDescription";
|
public static final String transferDescriptionParamName = "transferDescription";
|
||||||
public static final String toSavingsAccountIdParamName = "toSavingsAccountId";
|
public static final String toSavingsAccountIdParamName = "toSavingsAccountId";
|
||||||
// Destination GL account for DepositAccountOnClosureType.TRANSFER_TO_GL -- the closure proceeds are
|
|
||||||
// credited straight to this GL instead of a savings account or cash.
|
|
||||||
public static final String toGlAccountIdParamName = "toGlAccountId";
|
|
||||||
public static final String reinvestAmountParamName = "reinvestAmount";
|
|
||||||
// Lets a maker waive the product's configured pre-closure penalty for one premature closure --
|
|
||||||
// see FixedDepositAccount#waivePreClosurePenaltyForThisRequest for why this is a transient
|
|
||||||
// per-request flag rather than a stored account field.
|
|
||||||
public static final String waivePreClosurePenaltyParamName = "waivePreClosurePenalty";
|
|
||||||
// Why the deposit was closed before maturity -- see PrematureClosureReasonType. Persisted (unlike
|
|
||||||
// waivePreClosurePenaltyParamName above) as the RBI audit trail of which closures waived their
|
|
||||||
// penalty and why.
|
|
||||||
public static final String prematureClosureReasonIdParamName = "prematureClosureReasonId";
|
|
||||||
public static final String savingsAccounts = "savingsAccounts";
|
public static final String savingsAccounts = "savingsAccounts";
|
||||||
public static final String maturityInstructionIdParamName = "maturityInstructionId";
|
public static final String maturityInstructionIdParamName = "maturityInstructionId";
|
||||||
public static final String transferToSavingsIdParamName = "transferToSavingsId";
|
public static final String transferToSavingsIdParamName = "transferToSavingsId";
|
||||||
@@ -252,7 +236,7 @@ public final class DepositsApiConstants {
|
|||||||
SavingProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
|
SavingProductAccountingParams.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(),
|
||||||
SavingProductAccountingParams.INTEREST_PAYABLE.getValue(), SavingProductAccountingParams.PENALTIES_RECEIVABLE.getValue(),
|
SavingProductAccountingParams.INTEREST_PAYABLE.getValue(), SavingProductAccountingParams.PENALTIES_RECEIVABLE.getValue(),
|
||||||
SavingProductAccountingParams.FEES_RECEIVABLE.getValue(), chartsParamName, SavingsApiConstants.withHoldTaxParamName,
|
SavingProductAccountingParams.FEES_RECEIVABLE.getValue(), chartsParamName, SavingsApiConstants.withHoldTaxParamName,
|
||||||
SavingsApiConstants.taxGroupIdParamName, SavingsApiConstants.otherGlMappingsParamName));
|
SavingsApiConstants.taxGroupIdParamName));
|
||||||
|
|
||||||
private static final Set<String> PRECLOSURE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
private static final Set<String> PRECLOSURE_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList(preClosurePenalApplicableParamName, preClosurePenalInterestParamName, preClosurePenalInterestOnTypeIdParamName));
|
Arrays.asList(preClosurePenalApplicableParamName, preClosurePenalInterestParamName, preClosurePenalInterestOnTypeIdParamName));
|
||||||
@@ -262,13 +246,11 @@ public final class DepositsApiConstants {
|
|||||||
|
|
||||||
private static final Set<String> DEPOSIT_TERM_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(minDepositTermParamName,
|
private static final Set<String> DEPOSIT_TERM_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(minDepositTermParamName,
|
||||||
maxDepositTermParamName, minDepositTermTypeIdParamName, maxDepositTermTypeIdParamName, inMultiplesOfDepositTermParamName,
|
maxDepositTermParamName, minDepositTermTypeIdParamName, maxDepositTermTypeIdParamName, inMultiplesOfDepositTermParamName,
|
||||||
inMultiplesOfDepositTermTypeIdParamName, depositAmountParamName, depositMinAmountParamName, depositMaxAmountParamName,
|
inMultiplesOfDepositTermTypeIdParamName, depositAmountParamName, depositMinAmountParamName, depositMaxAmountParamName));
|
||||||
renewalGracePeriodDaysParamName));
|
|
||||||
|
|
||||||
private static final Set<String> DEPOSIT_TERM_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(minDepositTermParamName,
|
private static final Set<String> DEPOSIT_TERM_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(minDepositTermParamName,
|
||||||
maxDepositTermParamName, minDepositTermType, maxDepositTermType, inMultiplesOfDepositTermParamName,
|
maxDepositTermParamName, minDepositTermType, maxDepositTermType, inMultiplesOfDepositTermParamName,
|
||||||
inMultiplesOfDepositTermType, depositAmountParamName, depositMinAmountParamName, depositMaxAmountParamName,
|
inMultiplesOfDepositTermType, depositAmountParamName, depositMinAmountParamName, depositMaxAmountParamName));
|
||||||
renewalGracePeriodDaysParamName));
|
|
||||||
|
|
||||||
private static final Set<String> RECURRING_DETAILS_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
private static final Set<String> RECURRING_DETAILS_REQUEST_DATA_PARAMETERS = new HashSet<>(
|
||||||
Arrays.asList(mandatoryRecommendedDepositAmountParamName, isMandatoryDepositParamName, allowWithdrawalParamName,
|
Arrays.asList(mandatoryRecommendedDepositAmountParamName, isMandatoryDepositParamName, allowWithdrawalParamName,
|
||||||
@@ -390,8 +372,6 @@ public final class DepositsApiConstants {
|
|||||||
fixedDepositRequestData.add("paymentChannelToFundSourceMappings");
|
fixedDepositRequestData.add("paymentChannelToFundSourceMappings");
|
||||||
fixedDepositRequestData.add("feeToIncomeAccountMappings");
|
fixedDepositRequestData.add("feeToIncomeAccountMappings");
|
||||||
fixedDepositRequestData.add("penaltyToIncomeAccountMappings");
|
fixedDepositRequestData.add("penaltyToIncomeAccountMappings");
|
||||||
fixedDepositRequestData.add(SavingsApiConstants.otherGlMappingsParamName);
|
|
||||||
fixedDepositRequestData.add("otherGlMappingsMap");
|
|
||||||
return fixedDepositRequestData;
|
return fixedDepositRequestData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -503,8 +483,6 @@ public final class DepositsApiConstants {
|
|||||||
recurringDepositRequestData.add("paymentChannelToFundSourceMappings");
|
recurringDepositRequestData.add("paymentChannelToFundSourceMappings");
|
||||||
recurringDepositRequestData.add("feeToIncomeAccountMappings");
|
recurringDepositRequestData.add("feeToIncomeAccountMappings");
|
||||||
recurringDepositRequestData.add("penaltyToIncomeAccountMappings");
|
recurringDepositRequestData.add("penaltyToIncomeAccountMappings");
|
||||||
recurringDepositRequestData.add(SavingsApiConstants.otherGlMappingsParamName);
|
|
||||||
recurringDepositRequestData.add("otherGlMappingsMap");
|
|
||||||
return recurringDepositRequestData;
|
return recurringDepositRequestData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +510,6 @@ public final class DepositsApiConstants {
|
|||||||
fixedDepositInterestCalculationData.add(principalAmountParamName);
|
fixedDepositInterestCalculationData.add(principalAmountParamName);
|
||||||
fixedDepositInterestCalculationData.add(annualInterestRateParamName);
|
fixedDepositInterestCalculationData.add(annualInterestRateParamName);
|
||||||
fixedDepositInterestCalculationData.add(tenureInMonthsParamName);
|
fixedDepositInterestCalculationData.add(tenureInMonthsParamName);
|
||||||
fixedDepositInterestCalculationData.add(tenureInDaysParamName);
|
|
||||||
fixedDepositInterestCalculationData.add(interestPostingPeriodInMonthsParamName);
|
fixedDepositInterestCalculationData.add(interestPostingPeriodInMonthsParamName);
|
||||||
fixedDepositInterestCalculationData.add(interestCompoundingPeriodInMonthsParamName);
|
fixedDepositInterestCalculationData.add(interestCompoundingPeriodInMonthsParamName);
|
||||||
// Exact calendar-based calculation params
|
// Exact calendar-based calculation params
|
||||||
@@ -611,10 +588,6 @@ public final class DepositsApiConstants {
|
|||||||
fixedDepositResponseData.add(SavingsApiConstants.jointHoldersParamName);
|
fixedDepositResponseData.add(SavingsApiConstants.jointHoldersParamName);
|
||||||
fixedDepositResponseData.add(SavingsApiConstants.nominationFacilityParamName);
|
fixedDepositResponseData.add(SavingsApiConstants.nominationFacilityParamName);
|
||||||
fixedDepositResponseData.add(SavingsApiConstants.autoDebitFacilityParamName);
|
fixedDepositResponseData.add(SavingsApiConstants.autoDebitFacilityParamName);
|
||||||
// FD Special's engine-computed monthly interest schedule (see FixedDepositAccountsApiResource#retrieveOne)
|
|
||||||
fixedDepositResponseData.add("projectedInterestSchedule");
|
|
||||||
fixedDepositResponseData.add("totalProjectedInterest");
|
|
||||||
fixedDepositResponseData.add("totalValueAtMaturity");
|
|
||||||
return fixedDepositResponseData;
|
return fixedDepositResponseData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
-70
@@ -1,70 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.savings;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Why a Fixed/Recurring Deposit was closed before maturity -- captured on every premature closure, not
|
|
||||||
* just the ones that waive the penalty, so the audit trail always shows a reason rather than only
|
|
||||||
* recording one when it happens to matter. {@link #isAutoWaived()} is the RBI-driven business rule this
|
|
||||||
* type exists to encode: a maker cannot leave the platform's own penalty-waiver decision to memory or a
|
|
||||||
* free-text note for these four reasons -- picking the reason IS the waiver decision, enforced on the
|
|
||||||
* server regardless of what a client happened to also send for the plain waive-penalty flag.
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
public enum PrematureClosureReasonType {
|
|
||||||
|
|
||||||
INVALID(0, "prematureClosureReasonType.invalid", false), //
|
|
||||||
NORMAL(100, "prematureClosureReasonType.normal", false), //
|
|
||||||
PREMATURE_EXTENSION(200, "prematureClosureReasonType.prematureExtension", true), //
|
|
||||||
CONVERSION_TO_ANOTHER_TD(300, "prematureClosureReasonType.conversionToAnotherTd", true), //
|
|
||||||
DECEASED_SETTLEMENT(400, "prematureClosureReasonType.deceasedSettlement", true), //
|
|
||||||
NOMINEE_LEGAL_HEIR_CLOSURE(500, "prematureClosureReasonType.nomineeLegalHeirClosure", true); //
|
|
||||||
|
|
||||||
private final Integer value;
|
|
||||||
private final String code;
|
|
||||||
/** True when this reason, by itself, waives the pre-closure penalty regardless of any manual
|
|
||||||
* waive-penalty flag also sent -- see the class javadoc. */
|
|
||||||
private final boolean autoWaived;
|
|
||||||
|
|
||||||
PrematureClosureReasonType(final Integer value, final String code, final boolean autoWaived) {
|
|
||||||
this.value = value;
|
|
||||||
this.code = code;
|
|
||||||
this.autoWaived = autoWaived;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PrematureClosureReasonType fromInt(final Integer v) {
|
|
||||||
if (v == null) {
|
|
||||||
return INVALID;
|
|
||||||
}
|
|
||||||
return switch (v) {
|
|
||||||
case 100 -> NORMAL;
|
|
||||||
case 200 -> PREMATURE_EXTENSION;
|
|
||||||
case 300 -> CONVERSION_TO_ANOTHER_TD;
|
|
||||||
case 400 -> DECEASED_SETTLEMENT;
|
|
||||||
case 500 -> NOMINEE_LEGAL_HEIR_CLOSURE;
|
|
||||||
default -> INVALID;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isInvalid() {
|
|
||||||
return this.equals(INVALID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-13
@@ -92,9 +92,6 @@ public class SavingsApiConstants {
|
|||||||
public static final String statusParamName = "status";
|
public static final String statusParamName = "status";
|
||||||
public static final String subStatusParamName = "subStatus";
|
public static final String subStatusParamName = "subStatus";
|
||||||
public static final String reasonForBlockParamName = "reasonForBlock";
|
public static final String reasonForBlockParamName = "reasonForBlock";
|
||||||
/** "CASH" (default, a manual/staff-placed lien) or "CLEARING" (money still moving through the
|
|
||||||
* clearing process — a not-yet-realized cheque/DD deposit, or a presented cheque not yet settled). */
|
|
||||||
public static final String holdCategoryParamName = "holdCategory";
|
|
||||||
public static final String clientIdParamName = "clientId";
|
public static final String clientIdParamName = "clientId";
|
||||||
public static final String isRetailAccountParamName = "isRetailAccount";
|
public static final String isRetailAccountParamName = "isRetailAccount";
|
||||||
public static final String autogenerateTransactionIdParamName = "autogenerateTransactionId";
|
public static final String autogenerateTransactionIdParamName = "autogenerateTransactionId";
|
||||||
@@ -229,7 +226,6 @@ public class SavingsApiConstants {
|
|||||||
public static final String endDateParamName = "endDate";
|
public static final String endDateParamName = "endDate";
|
||||||
public static final String introducerRequiredParamName = "introducerRequired";
|
public static final String introducerRequiredParamName = "introducerRequired";
|
||||||
public static final String shareLinkingEnabledParamName = "shareLinkingEnabled";
|
public static final String shareLinkingEnabledParamName = "shareLinkingEnabled";
|
||||||
public static final String shareAccountIdParamName = "shareAccountId";
|
|
||||||
public static final String nominationFacilityParamName = "nominationFacility";
|
public static final String nominationFacilityParamName = "nominationFacility";
|
||||||
public static final String dormancyAlertParamName = "dormancyAlert";
|
public static final String dormancyAlertParamName = "dormancyAlert";
|
||||||
public static final String interestCalculateSelectorParamName = "interestCalculateSelector";
|
public static final String interestCalculateSelectorParamName = "interestCalculateSelector";
|
||||||
@@ -258,6 +254,7 @@ public class SavingsApiConstants {
|
|||||||
public static final String neftFacilityParamName = "neftFacility";
|
public static final String neftFacilityParamName = "neftFacility";
|
||||||
public static final String rtgsFacilityParamName = "rtgsFacility";
|
public static final String rtgsFacilityParamName = "rtgsFacility";
|
||||||
public static final String interBankTotalCapFacilityParamName = "interBankTotalCapFacility";
|
public static final String interBankTotalCapFacilityParamName = "interBankTotalCapFacility";
|
||||||
|
public static final String withdrawalFacilityParamName = "withdrawalFacility";
|
||||||
public static final String depositFacilityKycParamName = "depositFacilityKyc";
|
public static final String depositFacilityKycParamName = "depositFacilityKyc";
|
||||||
public static final String virtualDebitCardParamName = "virtualDebitCard";
|
public static final String virtualDebitCardParamName = "virtualDebitCard";
|
||||||
|
|
||||||
@@ -286,15 +283,6 @@ public class SavingsApiConstants {
|
|||||||
public static final String avgBalanceCalcPeriodParamName = "avgBalanceCalcPeriod";
|
public static final String avgBalanceCalcPeriodParamName = "avgBalanceCalcPeriod";
|
||||||
public static final String validForPeriodParamName = "validForPeriod";
|
public static final String validForPeriodParamName = "validForPeriod";
|
||||||
public static final String odAccountClosedZeroBalanceInDayClosingParamName = "odAccountClosedZeroBalanceInDayClosing";
|
public static final String odAccountClosedZeroBalanceInDayClosingParamName = "odAccountClosedZeroBalanceInDayClosing";
|
||||||
// Overdraft scheme rules a sanction on an account is held to: overdraftLimit is the ceiling (an
|
|
||||||
// amount), odMinLimit the floor, odSecurityType whether the limit may be clean, secured, or either.
|
|
||||||
public static final String odMinLimitParamName = "odMinLimit";
|
|
||||||
public static final String odSecurityTypeParamName = "odSecurityType";
|
|
||||||
// Excess drawing: whether an account may go past its sanctioned limit, by how much (a percentage of the
|
|
||||||
// limit), and the penal charge (% p.a.) levied on the excess alone for the days it stays excess.
|
|
||||||
public static final String odExcessAllowedParamName = "odExcessAllowed";
|
|
||||||
public static final String odExcessLimitPercentParamName = "odExcessLimitPercent";
|
|
||||||
public static final String odPenalRateParamName = "odPenalRate";
|
|
||||||
|
|
||||||
// Status of Account fields
|
// Status of Account fields
|
||||||
public static final String accountStatusParamName = "accountStatus";
|
public static final String accountStatusParamName = "accountStatus";
|
||||||
|
|||||||
-17
@@ -157,8 +157,6 @@ public final class SavingsAccountData implements Serializable {
|
|||||||
private LocalDate endDate;
|
private LocalDate endDate;
|
||||||
private Boolean introducerRequired;
|
private Boolean introducerRequired;
|
||||||
private Boolean shareLinkingEnabled;
|
private Boolean shareLinkingEnabled;
|
||||||
private Long shareAccountId;
|
|
||||||
private String shareAccountNo;
|
|
||||||
private Boolean nominationFacility;
|
private Boolean nominationFacility;
|
||||||
private Boolean dormancyAlert;
|
private Boolean dormancyAlert;
|
||||||
private Boolean isDormancyTrackingActiveFromProduct;
|
private Boolean isDormancyTrackingActiveFromProduct;
|
||||||
@@ -219,21 +217,6 @@ public final class SavingsAccountData implements Serializable {
|
|||||||
private BigDecimal interestPosting;
|
private BigDecimal interestPosting;
|
||||||
private BigDecimal overdraftPosting;
|
private BigDecimal overdraftPosting;
|
||||||
|
|
||||||
/**
|
|
||||||
* True when this deposit pays its interest out to a linked savings account every period (FD Special).
|
|
||||||
* Such interest never stays in the account, so it must never compound -- every period earns on the
|
|
||||||
* principal alone. Transient because it is only read by the batch interest-posting engine.
|
|
||||||
*/
|
|
||||||
private transient boolean transferInterestToLinkedAccount;
|
|
||||||
|
|
||||||
public void setTransferInterestToLinkedAccount(final boolean transferInterestToLinkedAccount) {
|
|
||||||
this.transferInterestToLinkedAccount = transferInterestToLinkedAccount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isTransferInterestToLinkedAccount() {
|
|
||||||
return this.transferInterestToLinkedAccount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SavingsAccountData importInstanceIndividual(Long clientId, Long productId, Long fieldOfficerId, LocalDate submittedOnDate,
|
public static SavingsAccountData importInstanceIndividual(Long clientId, Long productId, Long fieldOfficerId, LocalDate submittedOnDate,
|
||||||
BigDecimal nominalAnnualInterestRate, EnumOptionData interestCompoundingPeriodTypeEnum,
|
BigDecimal nominalAnnualInterestRate, EnumOptionData interestCompoundingPeriodTypeEnum,
|
||||||
EnumOptionData interestPostingPeriodTypeEnum, EnumOptionData interestCalculationTypeEnum,
|
EnumOptionData interestPostingPeriodTypeEnum, EnumOptionData interestCalculationTypeEnum,
|
||||||
|
|||||||
-10
@@ -152,11 +152,6 @@ public final class SavingsProductData implements Serializable {
|
|||||||
@Getter @Setter private String avgBalanceCalcPeriod;
|
@Getter @Setter private String avgBalanceCalcPeriod;
|
||||||
@Getter @Setter private String validForPeriod;
|
@Getter @Setter private String validForPeriod;
|
||||||
@Getter @Setter private Boolean odAccountClosedZeroBalanceInDayClosing;
|
@Getter @Setter private Boolean odAccountClosedZeroBalanceInDayClosing;
|
||||||
@Getter @Setter private BigDecimal odMinLimit;
|
|
||||||
@Getter @Setter private String odSecurityType;
|
|
||||||
@Getter @Setter private Boolean odExcessAllowed;
|
|
||||||
@Getter @Setter private BigDecimal odExcessLimitPercent;
|
|
||||||
@Getter @Setter private BigDecimal odPenalRate;
|
|
||||||
|
|
||||||
// Complex objects wrapped as Maps/Lists so Jackson converts them into the exact JSON your UI expects
|
// Complex objects wrapped as Maps/Lists so Jackson converts them into the exact JSON your UI expects
|
||||||
@Getter @Setter private Map<String, Object> accountFacilityConfig;
|
@Getter @Setter private Map<String, Object> accountFacilityConfig;
|
||||||
@@ -387,11 +382,6 @@ public final class SavingsProductData implements Serializable {
|
|||||||
target.setAvgBalanceCalcPeriod(source.getAvgBalanceCalcPeriod());
|
target.setAvgBalanceCalcPeriod(source.getAvgBalanceCalcPeriod());
|
||||||
target.setValidForPeriod(source.getValidForPeriod());
|
target.setValidForPeriod(source.getValidForPeriod());
|
||||||
target.setOdAccountClosedZeroBalanceInDayClosing(source.getOdAccountClosedZeroBalanceInDayClosing());
|
target.setOdAccountClosedZeroBalanceInDayClosing(source.getOdAccountClosedZeroBalanceInDayClosing());
|
||||||
target.setOdMinLimit(source.getOdMinLimit());
|
|
||||||
target.setOdSecurityType(source.getOdSecurityType());
|
|
||||||
target.setOdExcessAllowed(source.getOdExcessAllowed());
|
|
||||||
target.setOdExcessLimitPercent(source.getOdExcessLimitPercent());
|
|
||||||
target.setOdPenalRate(source.getOdPenalRate());
|
|
||||||
target.setOtherGlMappingsMap(source.getOtherGlMappingsMap());
|
target.setOtherGlMappingsMap(source.getOtherGlMappingsMap());
|
||||||
target.setAccountFacilityConfig(source.getAccountFacilityConfig());
|
target.setAccountFacilityConfig(source.getAccountFacilityConfig());
|
||||||
target.setAccountFacilityLimits(source.getAccountFacilityLimits());
|
target.setAccountFacilityLimits(source.getAccountFacilityLimits());
|
||||||
|
|||||||
+1
-10
@@ -256,16 +256,7 @@ public final class PostingPeriod {
|
|||||||
this.daysInYear = daysInYear;
|
this.daysInYear = daysInYear;
|
||||||
this.compoundingPeriods = compoundingPeriods;
|
this.compoundingPeriods = compoundingPeriods;
|
||||||
|
|
||||||
if (isUserPosting) {
|
if (isSavingsInterestPostingAtCurrentPeriodEnd) {
|
||||||
// "Post interest as on D" — a closure, or the same action from the account screen. The
|
|
||||||
// period it covers ends at D-1, because interest is earned up to but not including the
|
|
||||||
// day it is paid, and SavingsHelper closes the period there. The transaction itself
|
|
||||||
// still belongs on D: that is the day the member was credited, the day the branch did
|
|
||||||
// the work, and the day the cash is handed over. Dating it to the period end instead
|
|
||||||
// stamps it a day before the account was even closed, and the ledger then disagrees with
|
|
||||||
// the closure request, the voucher and the passbook — all of which carry D.
|
|
||||||
this.dateOfPostingTransaction = periodInterval.endDate().plusDays(1);
|
|
||||||
} else if (isSavingsInterestPostingAtCurrentPeriodEnd) {
|
|
||||||
this.dateOfPostingTransaction = periodInterval.endDate();
|
this.dateOfPostingTransaction = periodInterval.endDate();
|
||||||
} else {
|
} else {
|
||||||
this.dateOfPostingTransaction = periodInterval.endDate().plusDays(1);
|
this.dateOfPostingTransaction = periodInterval.endDate().plusDays(1);
|
||||||
|
|||||||
-8
@@ -797,14 +797,6 @@ public final class SavingsEnumerations {
|
|||||||
optionData = new EnumOptionData(DepositAccountOnClosureType.REINVEST_PRINCIPAL_ONLY.getValue().longValue(),
|
optionData = new EnumOptionData(DepositAccountOnClosureType.REINVEST_PRINCIPAL_ONLY.getValue().longValue(),
|
||||||
DepositAccountOnClosureType.REINVEST_PRINCIPAL_ONLY.getCode(), "Re-Invest Principal Only");
|
DepositAccountOnClosureType.REINVEST_PRINCIPAL_ONLY.getCode(), "Re-Invest Principal Only");
|
||||||
break;
|
break;
|
||||||
case PARTIAL_REINVEST:
|
|
||||||
optionData = new EnumOptionData(DepositAccountOnClosureType.PARTIAL_REINVEST.getValue().longValue(),
|
|
||||||
DepositAccountOnClosureType.PARTIAL_REINVEST.getCode(), "Partial Re-Invest");
|
|
||||||
break;
|
|
||||||
case TRANSFER_TO_GL:
|
|
||||||
optionData = new EnumOptionData(DepositAccountOnClosureType.TRANSFER_TO_GL.getValue().longValue(),
|
|
||||||
DepositAccountOnClosureType.TRANSFER_TO_GL.getCode(), "Transfer to GL Account");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return optionData;
|
return optionData;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-2
@@ -76,8 +76,7 @@ public class CurrentAccount extends AbstractAuditableCustom {
|
|||||||
@Column(name = "status_enum", nullable = false)
|
@Column(name = "status_enum", nullable = false)
|
||||||
private Integer statusEnum = 100;
|
private Integer statusEnum = 100;
|
||||||
|
|
||||||
// SubStatus, same codes as savings: 0=None, 100=Inactive, 200=Dormant, 300=Escheat, 400=Block, 500=BlockCredit,
|
// SubStatus: 0=None, 100=Inactive, 200=Dormant, 300=Block, 400=BlockDebit, 500=BlockCredit
|
||||||
// 600=BlockDebit
|
|
||||||
@Column(name = "sub_status_enum", nullable = false)
|
@Column(name = "sub_status_enum", nullable = false)
|
||||||
private Integer subStatusEnum = 0;
|
private Integer subStatusEnum = 0;
|
||||||
|
|
||||||
|
|||||||
+4
@@ -77,6 +77,9 @@ public class CurrentAccountFacilityConfig extends AbstractPersistableCustom<Long
|
|||||||
@Column(name = "inter_bank_total_cap_facility", nullable = false)
|
@Column(name = "inter_bank_total_cap_facility", nullable = false)
|
||||||
private boolean interBankTotalCapFacility = false;
|
private boolean interBankTotalCapFacility = false;
|
||||||
|
|
||||||
|
@Column(name = "withdrawal_facility", nullable = false)
|
||||||
|
private boolean withdrawalFacility = false;
|
||||||
|
|
||||||
@Column(name = "deposit_facility_kyc", nullable = false)
|
@Column(name = "deposit_facility_kyc", nullable = false)
|
||||||
private boolean depositFacilityKyc = false;
|
private boolean depositFacilityKyc = false;
|
||||||
|
|
||||||
@@ -117,6 +120,7 @@ public class CurrentAccountFacilityConfig extends AbstractPersistableCustom<Long
|
|||||||
if (config.has("neftFacility")) setNeftFacility(config.get("neftFacility").getAsBoolean());
|
if (config.has("neftFacility")) setNeftFacility(config.get("neftFacility").getAsBoolean());
|
||||||
if (config.has("rtgsFacility")) setRtgsFacility(config.get("rtgsFacility").getAsBoolean());
|
if (config.has("rtgsFacility")) setRtgsFacility(config.get("rtgsFacility").getAsBoolean());
|
||||||
if (config.has("interBankTotalCapFacility")) setInterBankTotalCapFacility(config.get("interBankTotalCapFacility").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("depositFacilityKyc")) setDepositFacilityKyc(config.get("depositFacilityKyc").getAsBoolean());
|
||||||
if (config.has("virtualDebitCard")) setVirtualDebitCard(config.get("virtualDebitCard").getAsBoolean());
|
if (config.has("virtualDebitCard")) setVirtualDebitCard(config.get("virtualDebitCard").getAsBoolean());
|
||||||
if (config.has("internetBanking")) setInternetBanking(config.get("internetBanking").getAsBoolean());
|
if (config.has("internetBanking")) setInternetBanking(config.get("internetBanking").getAsBoolean());
|
||||||
|
|||||||
+3
@@ -136,6 +136,9 @@ public class CurrentAccountPendingEdit extends AbstractPersistableCustom<Long> {
|
|||||||
@Column(name = "inter_bank_total_cap_facility")
|
@Column(name = "inter_bank_total_cap_facility")
|
||||||
private Boolean interBankTotalCapFacility;
|
private Boolean interBankTotalCapFacility;
|
||||||
|
|
||||||
|
@Column(name = "withdrawal_facility")
|
||||||
|
private Boolean withdrawalFacility;
|
||||||
|
|
||||||
@Column(name = "deposit_facility_kyc")
|
@Column(name = "deposit_facility_kyc")
|
||||||
private Boolean depositFacilityKyc;
|
private Boolean depositFacilityKyc;
|
||||||
|
|
||||||
|
|||||||
+1
-7
@@ -38,12 +38,6 @@ public interface CurrentAccountRepository extends JpaRepository<CurrentAccount,
|
|||||||
@Query("SELECT ca FROM CurrentAccount ca WHERE ca.client.id = :clientId AND ca.statusEnum != 600")
|
@Query("SELECT ca FROM CurrentAccount ca WHERE ca.client.id = :clientId AND ca.statusEnum != 600")
|
||||||
List<CurrentAccount> findActiveByClientId(@Param("clientId") Long clientId);
|
List<CurrentAccount> findActiveByClientId(@Param("clientId") Long clientId);
|
||||||
|
|
||||||
// statusEnum != 600 (CLOSED) let a client re-apply for the same product only once every prior
|
@Query("SELECT COUNT(ca) FROM CurrentAccount ca WHERE ca.client.id = :clientId AND ca.productId = :productId AND ca.statusEnum != 600")
|
||||||
// account on it was closed -- but 400 (WITHDRAWN) and 500 (REJECTED), see CurrentAccount.withdraw()
|
|
||||||
// /.reject(), are equally terminal and were still being counted as "still has one", blocking a
|
|
||||||
// fresh application the client should have been free to make. 100/200/300 (submitted, approved,
|
|
||||||
// active) are the only statuses a second application on the same product should actually collide
|
|
||||||
// with.
|
|
||||||
@Query("SELECT COUNT(ca) FROM CurrentAccount ca WHERE ca.client.id = :clientId AND ca.productId = :productId AND ca.statusEnum IN (100, 200, 300)")
|
|
||||||
long countActiveByClientAndProduct(@Param("clientId") Long clientId, @Param("productId") Long productId);
|
long countActiveByClientAndProduct(@Param("clientId") Long clientId, @Param("productId") Long productId);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-15
@@ -46,7 +46,7 @@ public class CurrentAccountTransaction extends AbstractPersistableCustom<Long> {
|
|||||||
@JoinColumn(name = "office_id", nullable = false)
|
@JoinColumn(name = "office_id", nullable = false)
|
||||||
private Office office;
|
private Office office;
|
||||||
|
|
||||||
// 1=Deposit, 2=Withdrawal, 3=InterestPosting, 4=Charge, 5=ChargeWaiver, 6=Transfer, 7=Reversal, 19=Escheat
|
// 1=Deposit, 2=Withdrawal, 3=InterestPosting, 4=Charge, 5=ChargeWaiver, 6=Transfer, 7=Reversal
|
||||||
@Column(name = "transaction_type_enum", nullable = false)
|
@Column(name = "transaction_type_enum", nullable = false)
|
||||||
private Integer transactionTypeEnum;
|
private Integer transactionTypeEnum;
|
||||||
|
|
||||||
@@ -176,20 +176,6 @@ public class CurrentAccountTransaction extends AbstractPersistableCustom<Long> {
|
|||||||
return txn;
|
return txn;
|
||||||
}
|
}
|
||||||
|
|
||||||
// transactionTypeEnum = 19 (Escheat) -- the whole balance moved to the escheat liability, same code as savings
|
|
||||||
public static CurrentAccountTransaction escheat(CurrentAccount account, Office office,
|
|
||||||
BigDecimal amount, LocalDate transactionDate) {
|
|
||||||
CurrentAccountTransaction txn = new CurrentAccountTransaction();
|
|
||||||
txn.currentAccount = account;
|
|
||||||
txn.office = office;
|
|
||||||
txn.transactionTypeEnum = 19;
|
|
||||||
txn.amount = amount;
|
|
||||||
txn.transactionDate = transactionDate;
|
|
||||||
txn.remarks = "Escheat: dormant for the product's escheat period, balance moved to the escheat liability";
|
|
||||||
txn.submittedOnDate = transactionDate;
|
|
||||||
return txn;
|
|
||||||
}
|
|
||||||
|
|
||||||
// transactionTypeEnum = 7 (Reversal / Undo)
|
// transactionTypeEnum = 7 (Reversal / Undo)
|
||||||
public static CurrentAccountTransaction reversal(CurrentAccount account, Office office,
|
public static CurrentAccountTransaction reversal(CurrentAccount account, Office office,
|
||||||
BigDecimal amount, LocalDate transactionDate, Long originalTransactionId) {
|
BigDecimal amount, LocalDate transactionDate, Long originalTransactionId) {
|
||||||
|
|||||||
-6
@@ -36,10 +36,4 @@ public interface CurrentAccountTransactionWritePlatformService {
|
|||||||
CommandProcessingResult reverseTransaction(Long accountId, Long transactionId, boolean isReversal, JsonCommand command);
|
CommandProcessingResult reverseTransaction(Long accountId, Long transactionId, boolean isReversal, JsonCommand command);
|
||||||
|
|
||||||
CommandProcessingResult adjustTransaction(Long accountId, Long transactionId, JsonCommand command);
|
CommandProcessingResult adjustTransaction(Long accountId, Long transactionId, JsonCommand command);
|
||||||
|
|
||||||
/**
|
|
||||||
* Escheats a dormant current account: moves its whole balance to the escheat liability and closes it. Run by the
|
|
||||||
* nightly dormancy job; returns false, leaving the account untouched, where it cannot safely be done.
|
|
||||||
*/
|
|
||||||
boolean escheat(Long accountId);
|
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-112
@@ -44,13 +44,7 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.minRequi
|
|||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.nameParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.nameParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.nominalAnnualInterestRateOverdraftParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.nominalAnnualInterestRateOverdraftParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.nominalAnnualInterestRateParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.nominalAnnualInterestRateParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odExcessAllowedParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odExcessLimitPercentParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odMinLimitParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odPenalRateParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odSecurityTypeParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.overdraftLimitParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.overdraftLimitParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.validForPeriodParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.shortNameParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.shortNameParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.taxGroupIdParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.taxGroupIdParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.withHoldTaxParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.withHoldTaxParamName;
|
||||||
@@ -142,17 +136,7 @@ public class CurrentProductDataValidator {
|
|||||||
SavingsApiConstants.balanceSwapOptionParamName, SavingsApiConstants.msmeParamName,
|
SavingsApiConstants.balanceSwapOptionParamName, SavingsApiConstants.msmeParamName,
|
||||||
SavingsApiConstants.autoDebitFacilityParamName, SavingsApiConstants.avgBalanceCalcPeriodParamName,
|
SavingsApiConstants.autoDebitFacilityParamName, SavingsApiConstants.avgBalanceCalcPeriodParamName,
|
||||||
SavingsApiConstants.validForPeriodParamName, SavingsApiConstants.odAccountClosedZeroBalanceInDayClosingParamName,
|
SavingsApiConstants.validForPeriodParamName, SavingsApiConstants.odAccountClosedZeroBalanceInDayClosingParamName,
|
||||||
odMinLimitParamName, odSecurityTypeParamName, odExcessAllowedParamName, odExcessLimitPercentParamName,
|
SavingsApiConstants.glAccountIdParamName));
|
||||||
odPenalRateParamName, SavingsApiConstants.glAccountIdParamName));
|
|
||||||
|
|
||||||
/** How long an OD sanction on this scheme runs before it has to be renewed. */
|
|
||||||
private static final List<String> OD_VALIDITY_PERIODS = List.of("3M", "6M", "1Y", "2Y", "3Y");
|
|
||||||
/** CLEAN: no security needed; SECURED: backed by FD lien, property etc.; BOTH: decided per sanction. */
|
|
||||||
private static final List<String> OD_SECURITY_TYPES = List.of("CLEAN", "SECURED", "BOTH");
|
|
||||||
/** A sanity ceiling on the OD rate, catching a limit keyed into the rate field. */
|
|
||||||
private static final BigDecimal MAX_OVERDRAFT_RATE = new BigDecimal("50");
|
|
||||||
/** Excess drawing is a small tolerance over the limit, never a second limit. */
|
|
||||||
private static final BigDecimal MAX_EXCESS_PERCENT = new BigDecimal("25");
|
|
||||||
|
|
||||||
public void validateForCreate(final String json) {
|
public void validateForCreate(final String json) {
|
||||||
if (StringUtils.isBlank(json)) {
|
if (StringUtils.isBlank(json)) {
|
||||||
@@ -276,10 +260,10 @@ public class CurrentProductDataValidator {
|
|||||||
if (AccountingValidations.isCashBasedAccounting(accountingRuleType)
|
if (AccountingValidations.isCashBasedAccounting(accountingRuleType)
|
||||||
|| AccountingValidations.isAccrualPeriodicBasedAccounting(accountingRuleType)) {
|
|| AccountingValidations.isAccrualPeriodicBasedAccounting(accountingRuleType)) {
|
||||||
savingsProductAccountingDataValidator.evaluateProductAccountingData(accountingRuleType, isDormancyActive, element,
|
savingsProductAccountingDataValidator.evaluateProductAccountingData(accountingRuleType, isDormancyActive, element,
|
||||||
baseDataValidator, DepositAccountType.CURRENT_DEPOSIT, true);
|
baseDataValidator, DepositAccountType.SAVINGS_DEPOSIT, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
validateOverdraftParams(baseDataValidator, element, null);
|
validateOverdraftParams(baseDataValidator, element);
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(minBalanceForInterestCalculationParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(minBalanceForInterestCalculationParamName, element)) {
|
||||||
final BigDecimal minBalanceForInterestCalculation = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(minBalanceForInterestCalculationParamName, element);
|
final BigDecimal minBalanceForInterestCalculation = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(minBalanceForInterestCalculationParamName, element);
|
||||||
@@ -374,7 +358,7 @@ public class CurrentProductDataValidator {
|
|||||||
if (AccountingValidations.isCashBasedAccounting(accountingRuleType)
|
if (AccountingValidations.isCashBasedAccounting(accountingRuleType)
|
||||||
|| AccountingValidations.isAccrualPeriodicBasedAccounting(accountingRuleType)) {
|
|| AccountingValidations.isAccrualPeriodicBasedAccounting(accountingRuleType)) {
|
||||||
savingsProductAccountingDataValidator.evaluateProductAccountingData(accountingRuleType, isDormancyActive, element,
|
savingsProductAccountingDataValidator.evaluateProductAccountingData(accountingRuleType, isDormancyActive, element,
|
||||||
baseDataValidator, DepositAccountType.CURRENT_DEPOSIT, false);
|
baseDataValidator, DepositAccountType.SAVINGS_DEPOSIT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != isDormancyActive && isDormancyActive) {
|
if (null != isDormancyActive && isDormancyActive) {
|
||||||
@@ -396,7 +380,7 @@ public class CurrentProductDataValidator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
validateOverdraftParams(baseDataValidator, element, product);
|
validateOverdraftParams(baseDataValidator, element);
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(minBalanceForInterestCalculationParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(minBalanceForInterestCalculationParamName, element)) {
|
||||||
final BigDecimal minBalanceForInterestCalculation = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(minBalanceForInterestCalculationParamName, element);
|
final BigDecimal minBalanceForInterestCalculation = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(minBalanceForInterestCalculationParamName, element);
|
||||||
@@ -414,103 +398,23 @@ public class CurrentProductDataValidator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void validateOverdraftParams(final DataValidatorBuilder baseDataValidator, final JsonElement element) {
|
||||||
* The overdraft section of a current product is the scheme every account's OD sanction is held to, so when OD is
|
|
||||||
* allowed it has to be complete: a ceiling (overdraftLimit, an amount, not a percentage), an optional floor, a rate,
|
|
||||||
* a sanction validity and whether the limit may be clean or must be secured. Interest on an OD is applied monthly,
|
|
||||||
* as RBI requires for advances, or at most quarterly.
|
|
||||||
*
|
|
||||||
* On update, product is the stored product and fills in any value the request leaves out, so a partial edit is
|
|
||||||
* checked against the scheme it will produce; on create it is null.
|
|
||||||
*/
|
|
||||||
private void validateOverdraftParams(final DataValidatorBuilder baseDataValidator, final JsonElement element,
|
|
||||||
final CurrentProduct product) {
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(allowOverdraftParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(allowOverdraftParamName, element)) {
|
||||||
final Boolean allowOverdraft = this.fromApiJsonHelper.extractBooleanNamed(allowOverdraftParamName, element);
|
final Boolean allowOverdraft = this.fromApiJsonHelper.extractBooleanNamed(allowOverdraftParamName, element);
|
||||||
baseDataValidator.reset().parameter(allowOverdraftParamName).value(allowOverdraft).ignoreIfNull().validateForBooleanValue();
|
baseDataValidator.reset().parameter(allowOverdraftParamName).value(allowOverdraft).ignoreIfNull().validateForBooleanValue();
|
||||||
}
|
}
|
||||||
final boolean allowOverdraft = this.fromApiJsonHelper.parameterExists(allowOverdraftParamName, element)
|
if (this.fromApiJsonHelper.parameterExists(overdraftLimitParamName, element)) {
|
||||||
? BooleanUtils.isTrue(this.fromApiJsonHelper.extractBooleanNamed(allowOverdraftParamName, element))
|
final BigDecimal overdraftLimit = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(overdraftLimitParamName, element);
|
||||||
: product != null && product.isAllowOverdraft();
|
baseDataValidator.reset().parameter(overdraftLimitParamName).value(overdraftLimit).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
|
|
||||||
final BigDecimal maxLimit = bigDecimalOrStored(element, overdraftLimitParamName,
|
|
||||||
product == null ? null : product.getOverdraftLimit());
|
|
||||||
final BigDecimal minLimit = bigDecimalOrStored(element, odMinLimitParamName, product == null ? null : product.getOdMinLimit());
|
|
||||||
final BigDecimal rate = bigDecimalOrStored(element, nominalAnnualInterestRateOverdraftParamName,
|
|
||||||
product == null ? null : product.getNominalAnnualInterestRateOverdraft());
|
|
||||||
final BigDecimal minOdForInterest = bigDecimalOrStored(element, minOverdraftForInterestCalculationParamName,
|
|
||||||
product == null ? null : product.getMinOverdraftForInterestCalculation());
|
|
||||||
|
|
||||||
if (!allowOverdraft) {
|
|
||||||
baseDataValidator.reset().parameter(overdraftLimitParamName).value(maxLimit).ignoreIfNull().zeroOrPositiveAmount();
|
|
||||||
baseDataValidator.reset().parameter(nominalAnnualInterestRateOverdraftParamName).value(rate).ignoreIfNull()
|
|
||||||
.zeroOrPositiveAmount();
|
|
||||||
baseDataValidator.reset().parameter(minOverdraftForInterestCalculationParamName).value(minOdForInterest).ignoreIfNull()
|
|
||||||
.zeroOrPositiveAmount();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
if (this.fromApiJsonHelper.parameterExists(nominalAnnualInterestRateOverdraftParamName, element)) {
|
||||||
baseDataValidator.reset().parameter(overdraftLimitParamName).value(maxLimit).notNull().positiveAmount();
|
final BigDecimal nominalAnnualInterestRateOverdraft = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(nominalAnnualInterestRateOverdraftParamName, element);
|
||||||
baseDataValidator.reset().parameter(odMinLimitParamName).value(minLimit).ignoreIfNull().zeroOrPositiveAmount();
|
baseDataValidator.reset().parameter(nominalAnnualInterestRateOverdraftParamName).value(nominalAnnualInterestRateOverdraft).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
if (minLimit != null && maxLimit != null && minLimit.compareTo(maxLimit) > 0) {
|
|
||||||
baseDataValidator.reset().parameter(odMinLimitParamName).value(minLimit)
|
|
||||||
.failWithCodeAndMessage("cannot.exceed.maximum.overdraft.limit", "Minimum OD limit cannot exceed the maximum OD limit.");
|
|
||||||
}
|
}
|
||||||
baseDataValidator.reset().parameter(nominalAnnualInterestRateOverdraftParamName).value(rate).notNull().positiveAmount()
|
if (this.fromApiJsonHelper.parameterExists(minOverdraftForInterestCalculationParamName, element)) {
|
||||||
.notGreaterThanMax(MAX_OVERDRAFT_RATE);
|
final BigDecimal minOverdraftForInterestCalculation = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(minOverdraftForInterestCalculationParamName, element);
|
||||||
baseDataValidator.reset().parameter(minOverdraftForInterestCalculationParamName).value(minOdForInterest).ignoreIfNull()
|
baseDataValidator.reset().parameter(minOverdraftForInterestCalculationParamName).value(minOverdraftForInterestCalculation).ignoreIfNull().zeroOrPositiveAmount();
|
||||||
.zeroOrPositiveAmount();
|
|
||||||
|
|
||||||
final String validity = stringOrStored(element, validForPeriodParamName, product == null ? null : product.getValidForPeriod());
|
|
||||||
baseDataValidator.reset().parameter(validForPeriodParamName).value(validity).notBlank()
|
|
||||||
.isOneOfTheseStringValues(OD_VALIDITY_PERIODS);
|
|
||||||
|
|
||||||
final String securityType = stringOrStored(element, odSecurityTypeParamName,
|
|
||||||
product == null ? null : product.getOdSecurityType());
|
|
||||||
baseDataValidator.reset().parameter(odSecurityTypeParamName).value(securityType).notBlank()
|
|
||||||
.isOneOfTheseStringValues(OD_SECURITY_TYPES);
|
|
||||||
|
|
||||||
// Excess drawing past the sanctioned limit. Off means a withdrawal beyond the limit is refused. On, the
|
|
||||||
// excess is capped at a percentage of the limit and carries a penal charge on the excess alone -- a separate
|
|
||||||
// charge, as RBI's 2023 penal-charges directions require, not a higher rate on the whole balance.
|
|
||||||
final boolean excessAllowed = this.fromApiJsonHelper.parameterExists(odExcessAllowedParamName, element)
|
|
||||||
? BooleanUtils.isTrue(this.fromApiJsonHelper.extractBooleanNamed(odExcessAllowedParamName, element))
|
|
||||||
: product != null && product.isOdExcessAllowed();
|
|
||||||
if (excessAllowed) {
|
|
||||||
final BigDecimal excessPercent = bigDecimalOrStored(element, odExcessLimitPercentParamName,
|
|
||||||
product == null ? null : product.getOdExcessLimitPercent());
|
|
||||||
baseDataValidator.reset().parameter(odExcessLimitPercentParamName).value(excessPercent).notNull().positiveAmount()
|
|
||||||
.notGreaterThanMax(MAX_EXCESS_PERCENT);
|
|
||||||
final BigDecimal penalRate = bigDecimalOrStored(element, odPenalRateParamName,
|
|
||||||
product == null ? null : product.getOdPenalRate());
|
|
||||||
baseDataValidator.reset().parameter(odPenalRateParamName).value(penalRate).notNull().positiveAmount()
|
|
||||||
.notGreaterThanMax(MAX_OVERDRAFT_RATE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Integer postingPeriod = this.fromApiJsonHelper.parameterExists(interestPostingPeriodTypeParamName, element)
|
|
||||||
? this.fromApiJsonHelper.extractIntegerSansLocaleNamed(interestPostingPeriodTypeParamName, element)
|
|
||||||
: product == null ? null : product.getInterestPostingPeriodType();
|
|
||||||
baseDataValidator.reset().parameter(interestPostingPeriodTypeParamName).value(postingPeriod).ignoreIfNull()
|
|
||||||
.isOneOfTheseValues(SavingsPostingInterestPeriodType.MONTHLY.getValue(),
|
|
||||||
SavingsPostingInterestPeriodType.QUATERLY.getValue());
|
|
||||||
|
|
||||||
final Integer daysInYear = this.fromApiJsonHelper.parameterExists(interestCalculationDaysInYearTypeParamName, element)
|
|
||||||
? this.fromApiJsonHelper.extractIntegerSansLocaleNamed(interestCalculationDaysInYearTypeParamName, element)
|
|
||||||
: product == null ? null : product.getInterestCalculationDaysInYearType();
|
|
||||||
baseDataValidator.reset().parameter(interestCalculationDaysInYearTypeParamName).value(daysInYear).ignoreIfNull()
|
|
||||||
.isOneOfTheseValues(SavingsInterestCalculationDaysInYearType.DAYS_360.getValue(),
|
|
||||||
SavingsInterestCalculationDaysInYearType.DAYS_365.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigDecimal bigDecimalOrStored(final JsonElement element, final String paramName, final BigDecimal stored) {
|
|
||||||
return this.fromApiJsonHelper.parameterExists(paramName, element)
|
|
||||||
? this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(paramName, element)
|
|
||||||
: stored;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String stringOrStored(final JsonElement element, final String paramName, final String stored) {
|
|
||||||
return this.fromApiJsonHelper.parameterExists(paramName, element) ? this.fromApiJsonHelper.extractStringNamed(paramName, element)
|
|
||||||
: stored;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateLienParams(final DataValidatorBuilder baseDataValidator, final JsonElement element) {
|
private void validateLienParams(final DataValidatorBuilder baseDataValidator, final JsonElement element) {
|
||||||
@@ -526,7 +430,7 @@ public class CurrentProductDataValidator {
|
|||||||
&& BooleanUtils.isTrue(this.fromApiJsonHelper.extractBooleanNamed(allowOverdraftParamName, element))) {
|
&& BooleanUtils.isTrue(this.fromApiJsonHelper.extractBooleanNamed(allowOverdraftParamName, element))) {
|
||||||
final BigDecimal maxAllowedLienLimit = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(maxAllowedLienLimitParamName, element);
|
final BigDecimal maxAllowedLienLimit = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(maxAllowedLienLimitParamName, element);
|
||||||
final BigDecimal overdraftLimit = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(overdraftLimitParamName, element);
|
final BigDecimal overdraftLimit = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed(overdraftLimitParamName, element);
|
||||||
if (overdraftLimit != null && maxAllowedLienLimit != null && overdraftLimit.compareTo(maxAllowedLienLimit) > 0) {
|
if (overdraftLimit.compareTo(maxAllowedLienLimit) > 0) {
|
||||||
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("Overdraft.limit.can.not.be.greater.than.lien.limit");
|
baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("Overdraft.limit.can.not.be.greater.than.lien.limit");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-68
@@ -68,11 +68,6 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.autoDebi
|
|||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.avgBalanceCalcPeriodParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.avgBalanceCalcPeriodParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.validForPeriodParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.validForPeriodParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odAccountClosedZeroBalanceInDayClosingParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odAccountClosedZeroBalanceInDayClosingParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odMinLimitParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odSecurityTypeParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odExcessAllowedParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odExcessLimitPercentParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odPenalRateParamName;
|
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import jakarta.persistence.CascadeType;
|
import jakarta.persistence.CascadeType;
|
||||||
@@ -295,25 +290,6 @@ public class CurrentProduct extends AbstractPersistableCustom<Long> {
|
|||||||
@Column(name = "od_account_closed_zero_balance_in_day_closing")
|
@Column(name = "od_account_closed_zero_balance_in_day_closing")
|
||||||
private boolean odAccountClosedZeroBalanceInDayClosing = false;
|
private boolean odAccountClosedZeroBalanceInDayClosing = false;
|
||||||
|
|
||||||
// The smallest limit an account on this scheme may be sanctioned; overdraftLimit is the largest.
|
|
||||||
@Column(name = "od_min_limit", scale = 6, precision = 19)
|
|
||||||
private BigDecimal odMinLimit;
|
|
||||||
|
|
||||||
// CLEAN, SECURED or BOTH: whether a sanction must be backed by security (FD lien, property...).
|
|
||||||
@Column(name = "od_security_type", length = 20)
|
|
||||||
private String odSecurityType;
|
|
||||||
|
|
||||||
// Excess drawing past the sanctioned limit: off means it is blocked. When on, odExcessLimitPercent caps the excess
|
|
||||||
// as a percentage of the limit and odPenalRate (% p.a.) is charged on the excess alone.
|
|
||||||
@Column(name = "od_excess_allowed")
|
|
||||||
private boolean odExcessAllowed = false;
|
|
||||||
|
|
||||||
@Column(name = "od_excess_limit_percent", scale = 6, precision = 19)
|
|
||||||
private BigDecimal odExcessLimitPercent;
|
|
||||||
|
|
||||||
@Column(name = "od_penal_rate", scale = 6, precision = 19)
|
|
||||||
private BigDecimal odPenalRate;
|
|
||||||
|
|
||||||
@OneToOne(cascade = CascadeType.ALL, mappedBy = "currentProduct", orphanRemoval = true)
|
@OneToOne(cascade = CascadeType.ALL, mappedBy = "currentProduct", orphanRemoval = true)
|
||||||
private CurrentProductFacilityConfig facilityConfig;
|
private CurrentProductFacilityConfig facilityConfig;
|
||||||
|
|
||||||
@@ -828,45 +804,11 @@ public class CurrentProduct extends AbstractPersistableCustom<Long> {
|
|||||||
actualChanges.put(odAccountClosedZeroBalanceInDayClosingParamName, newValue);
|
actualChanges.put(odAccountClosedZeroBalanceInDayClosingParamName, newValue);
|
||||||
this.odAccountClosedZeroBalanceInDayClosing = newValue;
|
this.odAccountClosedZeroBalanceInDayClosing = newValue;
|
||||||
}
|
}
|
||||||
if (command.isChangeInBigDecimalParameterNamedDefaultingZeroToNull(odMinLimitParamName, this.odMinLimit)) {
|
|
||||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamedDefaultToNullIfZero(odMinLimitParamName);
|
|
||||||
actualChanges.put(odMinLimitParamName, newValue);
|
|
||||||
this.odMinLimit = newValue;
|
|
||||||
}
|
|
||||||
if (command.isChangeInStringParameterNamed(odSecurityTypeParamName, this.odSecurityType)) {
|
|
||||||
final String newValue = command.stringValueOfParameterNamed(odSecurityTypeParamName);
|
|
||||||
actualChanges.put(odSecurityTypeParamName, newValue);
|
|
||||||
this.odSecurityType = newValue;
|
|
||||||
}
|
|
||||||
if (command.isChangeInBooleanParameterNamed(odExcessAllowedParamName, this.odExcessAllowed)) {
|
|
||||||
final boolean newValue = command.booleanPrimitiveValueOfParameterNamed(odExcessAllowedParamName);
|
|
||||||
actualChanges.put(odExcessAllowedParamName, newValue);
|
|
||||||
this.odExcessAllowed = newValue;
|
|
||||||
}
|
|
||||||
if (command.isChangeInBigDecimalParameterNamedDefaultingZeroToNull(odExcessLimitPercentParamName, this.odExcessLimitPercent)) {
|
|
||||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamedDefaultToNullIfZero(odExcessLimitPercentParamName);
|
|
||||||
actualChanges.put(odExcessLimitPercentParamName, newValue);
|
|
||||||
this.odExcessLimitPercent = newValue;
|
|
||||||
}
|
|
||||||
if (command.isChangeInBigDecimalParameterNamedDefaultingZeroToNull(odPenalRateParamName, this.odPenalRate)) {
|
|
||||||
final BigDecimal newValue = command.bigDecimalValueOfParameterNamedDefaultToNullIfZero(odPenalRateParamName);
|
|
||||||
actualChanges.put(odPenalRateParamName, newValue);
|
|
||||||
this.odPenalRate = newValue;
|
|
||||||
}
|
|
||||||
if (!this.odExcessAllowed) {
|
|
||||||
this.odExcessLimitPercent = null;
|
|
||||||
this.odPenalRate = null;
|
|
||||||
}
|
|
||||||
// Clear OD-specific fields when overdraft is disabled
|
// Clear OD-specific fields when overdraft is disabled
|
||||||
if (!this.allowOverdraft) {
|
if (!this.allowOverdraft) {
|
||||||
this.avgBalanceCalcPeriod = null;
|
this.avgBalanceCalcPeriod = null;
|
||||||
this.validForPeriod = null;
|
this.validForPeriod = null;
|
||||||
this.odAccountClosedZeroBalanceInDayClosing = false;
|
this.odAccountClosedZeroBalanceInDayClosing = false;
|
||||||
this.odMinLimit = null;
|
|
||||||
this.odSecurityType = null;
|
|
||||||
this.odExcessAllowed = false;
|
|
||||||
this.odExcessLimitPercent = null;
|
|
||||||
this.odPenalRate = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return actualChanges;
|
return actualChanges;
|
||||||
@@ -948,14 +890,4 @@ public class CurrentProduct extends AbstractPersistableCustom<Long> {
|
|||||||
public void setValidForPeriod(String validForPeriod) { this.validForPeriod = validForPeriod; }
|
public void setValidForPeriod(String validForPeriod) { this.validForPeriod = validForPeriod; }
|
||||||
public boolean isOdAccountClosedZeroBalanceInDayClosing() { return odAccountClosedZeroBalanceInDayClosing; }
|
public boolean isOdAccountClosedZeroBalanceInDayClosing() { return odAccountClosedZeroBalanceInDayClosing; }
|
||||||
public void setOdAccountClosedZeroBalanceInDayClosing(boolean val) { this.odAccountClosedZeroBalanceInDayClosing = val; }
|
public void setOdAccountClosedZeroBalanceInDayClosing(boolean val) { this.odAccountClosedZeroBalanceInDayClosing = val; }
|
||||||
public BigDecimal getOdMinLimit() { return odMinLimit; }
|
|
||||||
public void setOdMinLimit(BigDecimal odMinLimit) { this.odMinLimit = odMinLimit; }
|
|
||||||
public String getOdSecurityType() { return odSecurityType; }
|
|
||||||
public void setOdSecurityType(String odSecurityType) { this.odSecurityType = odSecurityType; }
|
|
||||||
public boolean isOdExcessAllowed() { return odExcessAllowed; }
|
|
||||||
public void setOdExcessAllowed(boolean odExcessAllowed) { this.odExcessAllowed = odExcessAllowed; }
|
|
||||||
public BigDecimal getOdExcessLimitPercent() { return odExcessLimitPercent; }
|
|
||||||
public void setOdExcessLimitPercent(BigDecimal odExcessLimitPercent) { this.odExcessLimitPercent = odExcessLimitPercent; }
|
|
||||||
public BigDecimal getOdPenalRate() { return odPenalRate; }
|
|
||||||
public void setOdPenalRate(BigDecimal odPenalRate) { this.odPenalRate = odPenalRate; }
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-22
@@ -43,11 +43,6 @@ import static org.apache.fineract.portfolio.savings.SavingsApiConstants.autoDebi
|
|||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.avgBalanceCalcPeriodParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.avgBalanceCalcPeriodParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.validForPeriodParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.validForPeriodParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odAccountClosedZeroBalanceInDayClosingParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odAccountClosedZeroBalanceInDayClosingParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odMinLimitParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odSecurityTypeParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odExcessAllowedParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odExcessLimitPercentParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.odPenalRateParamName;
|
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.endDateParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.endDateParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.enforceMinRequiredBalanceParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.enforceMinRequiredBalanceParamName;
|
||||||
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.frequencyFixDayParamName;
|
import static org.apache.fineract.portfolio.savings.SavingsApiConstants.frequencyFixDayParamName;
|
||||||
@@ -319,23 +314,6 @@ public class CurrentProductAssembler {
|
|||||||
if (command.parameterExists(odAccountClosedZeroBalanceInDayClosingParamName)) {
|
if (command.parameterExists(odAccountClosedZeroBalanceInDayClosingParamName)) {
|
||||||
product.setOdAccountClosedZeroBalanceInDayClosing(command.booleanPrimitiveValueOfParameterNamed(odAccountClosedZeroBalanceInDayClosingParamName));
|
product.setOdAccountClosedZeroBalanceInDayClosing(command.booleanPrimitiveValueOfParameterNamed(odAccountClosedZeroBalanceInDayClosingParamName));
|
||||||
}
|
}
|
||||||
if (command.parameterExists(odMinLimitParamName)) {
|
|
||||||
product.setOdMinLimit(command.bigDecimalValueOfParameterNamed(odMinLimitParamName));
|
|
||||||
}
|
|
||||||
if (command.parameterExists(odSecurityTypeParamName)) {
|
|
||||||
product.setOdSecurityType(command.stringValueOfParameterNamed(odSecurityTypeParamName));
|
|
||||||
}
|
|
||||||
final boolean excessAllowed = command.parameterExists(odExcessAllowedParamName)
|
|
||||||
&& command.booleanPrimitiveValueOfParameterNamed(odExcessAllowedParamName);
|
|
||||||
product.setOdExcessAllowed(excessAllowed);
|
|
||||||
if (excessAllowed) {
|
|
||||||
if (command.parameterExists(odExcessLimitPercentParamName)) {
|
|
||||||
product.setOdExcessLimitPercent(command.bigDecimalValueOfParameterNamed(odExcessLimitPercentParamName));
|
|
||||||
}
|
|
||||||
if (command.parameterExists(odPenalRateParamName)) {
|
|
||||||
product.setOdPenalRate(command.bigDecimalValueOfParameterNamed(odPenalRateParamName));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return product;
|
return product;
|
||||||
@@ -400,6 +378,7 @@ public class CurrentProductAssembler {
|
|||||||
config.setNeftFacility(facilityConfigJson.has("neftFacility") ? facilityConfigJson.get("neftFacility").getAsBoolean() : false);
|
config.setNeftFacility(facilityConfigJson.has("neftFacility") ? facilityConfigJson.get("neftFacility").getAsBoolean() : false);
|
||||||
config.setRtgsFacility(facilityConfigJson.has("rtgsFacility") ? facilityConfigJson.get("rtgsFacility").getAsBoolean() : false);
|
config.setRtgsFacility(facilityConfigJson.has("rtgsFacility") ? facilityConfigJson.get("rtgsFacility").getAsBoolean() : false);
|
||||||
config.setInterBankTotalCapFacility(facilityConfigJson.has("interBankTotalCapFacility") ? facilityConfigJson.get("interBankTotalCapFacility").getAsBoolean() : false);
|
config.setInterBankTotalCapFacility(facilityConfigJson.has("interBankTotalCapFacility") ? facilityConfigJson.get("interBankTotalCapFacility").getAsBoolean() : false);
|
||||||
|
config.setWithdrawalFacility(facilityConfigJson.has("withdrawalFacility") ? facilityConfigJson.get("withdrawalFacility").getAsBoolean() : false);
|
||||||
config.setDepositFacilityKyc(facilityConfigJson.has("depositFacilityKyc") ? facilityConfigJson.get("depositFacilityKyc").getAsBoolean() : false);
|
config.setDepositFacilityKyc(facilityConfigJson.has("depositFacilityKyc") ? facilityConfigJson.get("depositFacilityKyc").getAsBoolean() : false);
|
||||||
config.setVirtualDebitCard(facilityConfigJson.has("virtualDebitCard") ? facilityConfigJson.get("virtualDebitCard").getAsBoolean() : false);
|
config.setVirtualDebitCard(facilityConfigJson.has("virtualDebitCard") ? facilityConfigJson.get("virtualDebitCard").getAsBoolean() : false);
|
||||||
return config;
|
return config;
|
||||||
|
|||||||
+6
@@ -75,6 +75,9 @@ public class CurrentProductFacilityConfig extends AbstractPersistableCustom<Long
|
|||||||
@Column(name = "inter_bank_total_cap_facility")
|
@Column(name = "inter_bank_total_cap_facility")
|
||||||
private Boolean interBankTotalCapFacility = false;
|
private Boolean interBankTotalCapFacility = false;
|
||||||
|
|
||||||
|
@Column(name = "withdrawal_facility")
|
||||||
|
private Boolean withdrawalFacility = false;
|
||||||
|
|
||||||
@Column(name = "deposit_facility_kyc")
|
@Column(name = "deposit_facility_kyc")
|
||||||
private Boolean depositFacilityKyc = false;
|
private Boolean depositFacilityKyc = false;
|
||||||
|
|
||||||
@@ -122,6 +125,8 @@ public class CurrentProductFacilityConfig extends AbstractPersistableCustom<Long
|
|||||||
public void setRtgsFacility(Boolean v) { this.rtgsFacility = v != null ? v : false; }
|
public void setRtgsFacility(Boolean v) { this.rtgsFacility = v != null ? v : false; }
|
||||||
public Boolean getInterBankTotalCapFacility() { return interBankTotalCapFacility; }
|
public Boolean getInterBankTotalCapFacility() { return interBankTotalCapFacility; }
|
||||||
public void setInterBankTotalCapFacility(Boolean v) { this.interBankTotalCapFacility = v != null ? v : false; }
|
public void setInterBankTotalCapFacility(Boolean v) { this.interBankTotalCapFacility = v != null ? v : false; }
|
||||||
|
public Boolean getWithdrawalFacility() { return withdrawalFacility; }
|
||||||
|
public void setWithdrawalFacility(Boolean v) { this.withdrawalFacility = v != null ? v : false; }
|
||||||
public Boolean getDepositFacilityKyc() { return depositFacilityKyc; }
|
public Boolean getDepositFacilityKyc() { return depositFacilityKyc; }
|
||||||
public void setDepositFacilityKyc(Boolean v) { this.depositFacilityKyc = v != null ? v : false; }
|
public void setDepositFacilityKyc(Boolean v) { this.depositFacilityKyc = v != null ? v : false; }
|
||||||
public Boolean getVirtualDebitCard() { return virtualDebitCard; }
|
public Boolean getVirtualDebitCard() { return virtualDebitCard; }
|
||||||
@@ -142,6 +147,7 @@ public class CurrentProductFacilityConfig extends AbstractPersistableCustom<Long
|
|||||||
this.neftFacility = other.getNeftFacility();
|
this.neftFacility = other.getNeftFacility();
|
||||||
this.rtgsFacility = other.getRtgsFacility();
|
this.rtgsFacility = other.getRtgsFacility();
|
||||||
this.interBankTotalCapFacility = other.getInterBankTotalCapFacility();
|
this.interBankTotalCapFacility = other.getInterBankTotalCapFacility();
|
||||||
|
this.withdrawalFacility = other.getWithdrawalFacility();
|
||||||
this.depositFacilityKyc = other.getDepositFacilityKyc();
|
this.depositFacilityKyc = other.getDepositFacilityKyc();
|
||||||
this.virtualDebitCard = other.getVirtualDebitCard();
|
this.virtualDebitCard = other.getVirtualDebitCard();
|
||||||
}
|
}
|
||||||
|
|||||||
-115
@@ -1,115 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.currentproduct.service;
|
|
||||||
|
|
||||||
import com.google.gson.JsonElement;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.apache.fineract.accounting.common.AccountingConstants.SavingProductAccountingParams;
|
|
||||||
import org.apache.fineract.infrastructure.core.api.JsonCommand;
|
|
||||||
import org.apache.fineract.portfolio.PortfolioProductType;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes a current product's GL mappings to acc_product_mapping under {@link PortfolioProductType#CURRENT}.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* They used to be written by the savings mapping writer under SAVING, keyed only by product id, so a current product
|
|
||||||
* and a savings product with the same id shared rows: two Current Control rows came back for one lookup and the
|
|
||||||
* account's GL posting failed outright, leaving the balance moved with no journal entry. Written under their own type,
|
|
||||||
* the two can never meet.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A parameter present in the request replaces that one mapping (null clears it); an absent one is left alone, so a
|
|
||||||
* partial edit changes only what it names. Accounting rule NONE clears every mapping.
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class CurrentProductGlMappingWriter {
|
|
||||||
|
|
||||||
/** Request parameter -> financial account type (CashAccountsForSavings / AccrualAccountsForSavings). */
|
|
||||||
private static final Map<String, Integer> PARAM_TO_FINANCIAL_TYPE = new LinkedHashMap<>();
|
|
||||||
|
|
||||||
static {
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.SAVINGS_REFERENCE.getValue(), 1);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.SAVINGS_CONTROL.getValue(), 2);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.INTEREST_ON_SAVINGS.getValue(), 3);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.INCOME_FROM_FEES.getValue(), 4);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.INCOME_FROM_PENALTIES.getValue(), 5);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.TRANSFERS_SUSPENSE.getValue(), 10);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.OVERDRAFT_PORTFOLIO_CONTROL.getValue(), 11);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.INCOME_FROM_INTEREST.getValue(), 12);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.LOSSES_WRITTEN_OFF.getValue(), 13);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.ESCHEAT_LIABILITY.getValue(), 14);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.FEES_RECEIVABLE.getValue(), 15);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.PENALTIES_RECEIVABLE.getValue(), 16);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.INTEREST_PAYABLE.getValue(), 17);
|
|
||||||
PARAM_TO_FINANCIAL_TYPE.put(SavingProductAccountingParams.INTEREST_RECEIVABLE.getValue(), 18);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final int CURRENT = PortfolioProductType.CURRENT.getValue();
|
|
||||||
|
|
||||||
private final JdbcTemplate jdbcTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Applies the request's mappings to the product and returns what changed, keyed by parameter name.
|
|
||||||
*
|
|
||||||
* @param accountingRule
|
|
||||||
* the product's accounting rule after this request (1 = NONE)
|
|
||||||
*/
|
|
||||||
public Map<String, Object> write(final Long productId, final JsonCommand command, final Integer accountingRule) {
|
|
||||||
final Map<String, Object> changes = new LinkedHashMap<>();
|
|
||||||
if (accountingRule == null || accountingRule == 1) {
|
|
||||||
jdbcTemplate.update("DELETE FROM acc_product_mapping WHERE product_type = ? AND product_id = ?", CURRENT, productId);
|
|
||||||
return changes;
|
|
||||||
}
|
|
||||||
final JsonElement parsed = command.parsedJson();
|
|
||||||
final JsonObject json = parsed != null && parsed.isJsonObject() ? parsed.getAsJsonObject() : new JsonObject();
|
|
||||||
for (final Map.Entry<String, Integer> entry : PARAM_TO_FINANCIAL_TYPE.entrySet()) {
|
|
||||||
final String param = entry.getKey();
|
|
||||||
if (!json.has(param)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final Long glAccountId = json.get(param).isJsonNull() ? null : json.get(param).getAsLong();
|
|
||||||
final Long existing = jdbcTemplate.queryForList(
|
|
||||||
"SELECT gl_account_id FROM acc_product_mapping WHERE product_type = ? AND product_id = ? AND financial_account_type = ?"
|
|
||||||
+ " AND payment_type IS NULL AND charge_id IS NULL",
|
|
||||||
Long.class, CURRENT, productId, entry.getValue()).stream().findFirst().orElse(null);
|
|
||||||
if (java.util.Objects.equals(existing, glAccountId)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
jdbcTemplate.update("DELETE FROM acc_product_mapping WHERE product_type = ? AND product_id = ? AND financial_account_type = ?"
|
|
||||||
+ " AND payment_type IS NULL AND charge_id IS NULL", CURRENT, productId, entry.getValue());
|
|
||||||
if (glAccountId != null) {
|
|
||||||
jdbcTemplate.update("INSERT INTO acc_product_mapping (gl_account_id, product_id, product_type, financial_account_type)"
|
|
||||||
+ " VALUES (?, ?, ?, ?)", glAccountId, productId, CURRENT, entry.getValue());
|
|
||||||
}
|
|
||||||
changes.put(param, glAccountId);
|
|
||||||
}
|
|
||||||
return changes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Removes every mapping of a deleted product. */
|
|
||||||
public void deleteAll(final Long productId) {
|
|
||||||
jdbcTemplate.update("DELETE FROM acc_product_mapping WHERE product_type = ? AND product_id = ?", CURRENT, productId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-8
@@ -117,6 +117,7 @@ public class CurrentProductReadPlatformServiceImpl implements CurrentProductRead
|
|||||||
facilityConfigMap.put("neftFacility", facilityConfig.getNeftFacility());
|
facilityConfigMap.put("neftFacility", facilityConfig.getNeftFacility());
|
||||||
facilityConfigMap.put("rtgsFacility", facilityConfig.getRtgsFacility());
|
facilityConfigMap.put("rtgsFacility", facilityConfig.getRtgsFacility());
|
||||||
facilityConfigMap.put("interBankTotalCapFacility", facilityConfig.getInterBankTotalCapFacility());
|
facilityConfigMap.put("interBankTotalCapFacility", facilityConfig.getInterBankTotalCapFacility());
|
||||||
|
facilityConfigMap.put("withdrawalFacility", facilityConfig.getWithdrawalFacility());
|
||||||
facilityConfigMap.put("depositFacilityKyc", facilityConfig.getDepositFacilityKyc());
|
facilityConfigMap.put("depositFacilityKyc", facilityConfig.getDepositFacilityKyc());
|
||||||
facilityConfigMap.put("virtualDebitCard", facilityConfig.getVirtualDebitCard());
|
facilityConfigMap.put("virtualDebitCard", facilityConfig.getVirtualDebitCard());
|
||||||
product.setAccountFacilityConfig(facilityConfigMap);
|
product.setAccountFacilityConfig(facilityConfigMap);
|
||||||
@@ -268,9 +269,6 @@ public class CurrentProductReadPlatformServiceImpl implements CurrentProductRead
|
|||||||
sqlBuilder.append("cp.balance_swap_option as balanceSwapOption, cp.msme as msme, cp.auto_debit_facility as autoDebitFacility, ");
|
sqlBuilder.append("cp.balance_swap_option as balanceSwapOption, cp.msme as msme, cp.auto_debit_facility as autoDebitFacility, ");
|
||||||
sqlBuilder.append("cp.avg_balance_calc_period as avgBalanceCalcPeriod, cp.valid_for_period as validForPeriod, ");
|
sqlBuilder.append("cp.avg_balance_calc_period as avgBalanceCalcPeriod, cp.valid_for_period as validForPeriod, ");
|
||||||
sqlBuilder.append("cp.od_account_closed_zero_balance_in_day_closing as odAccountClosedZeroBalanceInDayClosing, ");
|
sqlBuilder.append("cp.od_account_closed_zero_balance_in_day_closing as odAccountClosedZeroBalanceInDayClosing, ");
|
||||||
sqlBuilder.append("cp.od_min_limit as odMinLimit, cp.od_security_type as odSecurityType, ");
|
|
||||||
sqlBuilder.append("cp.od_excess_allowed as odExcessAllowed, cp.od_excess_limit_percent as odExcessLimitPercent, ");
|
|
||||||
sqlBuilder.append("cp.od_penal_rate as odPenalRate, ");
|
|
||||||
sqlBuilder.append("exists(select 1 from m_saving_product_temp spt where spt.product_id = cp.id "
|
sqlBuilder.append("exists(select 1 from m_saving_product_temp spt where spt.product_id = cp.id "
|
||||||
+ "and spt.product_type = 'CURRENT' and spt.status = 'PENDING') as isPendingApproval ");
|
+ "and spt.product_type = 'CURRENT' and spt.status = 'PENDING') as isPendingApproval ");
|
||||||
|
|
||||||
@@ -396,11 +394,6 @@ public class CurrentProductReadPlatformServiceImpl implements CurrentProductRead
|
|||||||
productData.setAvgBalanceCalcPeriod(rs.getString("avgBalanceCalcPeriod"));
|
productData.setAvgBalanceCalcPeriod(rs.getString("avgBalanceCalcPeriod"));
|
||||||
productData.setValidForPeriod(rs.getString("validForPeriod"));
|
productData.setValidForPeriod(rs.getString("validForPeriod"));
|
||||||
productData.setOdAccountClosedZeroBalanceInDayClosing(rs.getBoolean("odAccountClosedZeroBalanceInDayClosing"));
|
productData.setOdAccountClosedZeroBalanceInDayClosing(rs.getBoolean("odAccountClosedZeroBalanceInDayClosing"));
|
||||||
productData.setOdMinLimit(rs.getBigDecimal("odMinLimit"));
|
|
||||||
productData.setOdSecurityType(rs.getString("odSecurityType"));
|
|
||||||
productData.setOdExcessAllowed(rs.getBoolean("odExcessAllowed"));
|
|
||||||
productData.setOdExcessLimitPercent(rs.getBigDecimal("odExcessLimitPercent"));
|
|
||||||
productData.setOdPenalRate(rs.getBigDecimal("odPenalRate"));
|
|
||||||
productData.setIsPendingApproval(rs.getBoolean("isPendingApproval"));
|
productData.setIsPendingApproval(rs.getBoolean("isPendingApproval"));
|
||||||
|
|
||||||
return productData;
|
return productData;
|
||||||
|
|||||||
+6
-6
@@ -98,7 +98,6 @@ public class CurrentProductWritePlatformServiceJpaRepositoryImpl implements Curr
|
|||||||
private final ProductPendingEditGlMappingRepository pendingEditGlMappingRepository;
|
private final ProductPendingEditGlMappingRepository pendingEditGlMappingRepository;
|
||||||
private final FromJsonHelper fromApiJsonHelper;
|
private final FromJsonHelper fromApiJsonHelper;
|
||||||
private final CommandSourceRepository commandSourceRepository;
|
private final CommandSourceRepository commandSourceRepository;
|
||||||
private final CurrentProductGlMappingWriter glMappingWriter;
|
|
||||||
|
|
||||||
private void handleDataIntegrityIssues(final JsonCommand command, final Throwable realCause, final Exception dae) {
|
private void handleDataIntegrityIssues(final JsonCommand command, final Throwable realCause, final Exception dae) {
|
||||||
String msgCode = "error.msg." + DepositsApiConstants.CURRENT_PRODUCT_RESOURCE_NAME;
|
String msgCode = "error.msg." + DepositsApiConstants.CURRENT_PRODUCT_RESOURCE_NAME;
|
||||||
@@ -162,8 +161,8 @@ public class CurrentProductWritePlatformServiceJpaRepositoryImpl implements Curr
|
|||||||
this.depositLimitKycRepository.saveAndFlush(depositLimitKyc);
|
this.depositLimitKycRepository.saveAndFlush(depositLimitKyc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Under the product's own CURRENT type, never SAVING: see CurrentProductGlMappingWriter.
|
this.accountMappingWritePlatformService.createSavingProductToGLAccountMapping(product.getId(), command,
|
||||||
this.glMappingWriter.write(product.getId(), command, product.getAccountingType());
|
DepositAccountType.SAVINGS_DEPOSIT);
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
return new CommandProcessingResultBuilder() //
|
||||||
.withEntityId(product.getId()) //
|
.withEntityId(product.getId()) //
|
||||||
@@ -259,8 +258,10 @@ public class CurrentProductWritePlatformServiceJpaRepositoryImpl implements Curr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// accounting related changes
|
// accounting related changes
|
||||||
final Map<String, Object> accountingMappingChanges = this.glMappingWriter.write(product.getId(), command,
|
final boolean accountingTypeChanged = changes.containsKey(accountingRuleParamName);
|
||||||
product.getAccountingType());
|
final Map<String, Object> accountingMappingChanges = this.accountMappingWritePlatformService
|
||||||
|
.updateSavingsProductToGLAccountMapping(product.getId(), command, accountingTypeChanged, product.getAccountingType(),
|
||||||
|
DepositAccountType.SAVINGS_DEPOSIT);
|
||||||
changes.putAll(accountingMappingChanges);
|
changes.putAll(accountingMappingChanges);
|
||||||
|
|
||||||
if (!changes.isEmpty()) {
|
if (!changes.isEmpty()) {
|
||||||
@@ -503,7 +504,6 @@ public class CurrentProductWritePlatformServiceJpaRepositoryImpl implements Curr
|
|||||||
.orElseThrow(() -> new SavingsProductNotFoundException(productId));
|
.orElseThrow(() -> new SavingsProductNotFoundException(productId));
|
||||||
|
|
||||||
this.currentProductRepository.delete(product);
|
this.currentProductRepository.delete(product);
|
||||||
this.glMappingWriter.deleteAll(productId);
|
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
return new CommandProcessingResultBuilder() //
|
||||||
.withEntityId(product.getId()) //
|
.withEntityId(product.getId()) //
|
||||||
|
|||||||
+2
-3
@@ -33,7 +33,6 @@ import org.apache.fineract.portfolio.currentproduct.domain.CurrentProductDeposit
|
|||||||
import org.apache.fineract.portfolio.currentproduct.domain.CurrentProductFacilityConfigRepository;
|
import org.apache.fineract.portfolio.currentproduct.domain.CurrentProductFacilityConfigRepository;
|
||||||
import org.apache.fineract.portfolio.currentproduct.domain.CurrentProductFacilityLimitRepository;
|
import org.apache.fineract.portfolio.currentproduct.domain.CurrentProductFacilityLimitRepository;
|
||||||
import org.apache.fineract.portfolio.currentproduct.domain.CurrentProductRepository;
|
import org.apache.fineract.portfolio.currentproduct.domain.CurrentProductRepository;
|
||||||
import org.apache.fineract.portfolio.currentproduct.service.CurrentProductGlMappingWriter;
|
|
||||||
import org.apache.fineract.portfolio.currentproduct.service.CurrentProductReadPlatformService;
|
import org.apache.fineract.portfolio.currentproduct.service.CurrentProductReadPlatformService;
|
||||||
import org.apache.fineract.portfolio.currentproduct.service.CurrentProductReadPlatformServiceImpl;
|
import org.apache.fineract.portfolio.currentproduct.service.CurrentProductReadPlatformServiceImpl;
|
||||||
import org.apache.fineract.portfolio.currentproduct.service.CurrentProductWritePlatformService;
|
import org.apache.fineract.portfolio.currentproduct.service.CurrentProductWritePlatformService;
|
||||||
@@ -79,11 +78,11 @@ public class CurrentProductConfiguration {
|
|||||||
ProductPendingEditFacilityLimitRepository pendingEditFacilityLimitRepository,
|
ProductPendingEditFacilityLimitRepository pendingEditFacilityLimitRepository,
|
||||||
ProductPendingEditGlMappingRepository pendingEditGlMappingRepository,
|
ProductPendingEditGlMappingRepository pendingEditGlMappingRepository,
|
||||||
FromJsonHelper fromApiJsonHelper,
|
FromJsonHelper fromApiJsonHelper,
|
||||||
CommandSourceRepository commandSourceRepository, CurrentProductGlMappingWriter glMappingWriter) {
|
CommandSourceRepository commandSourceRepository) {
|
||||||
return new CurrentProductWritePlatformServiceJpaRepositoryImpl(context, currentProductRepository, currentProductDataValidator,
|
return new CurrentProductWritePlatformServiceJpaRepositoryImpl(context, currentProductRepository, currentProductDataValidator,
|
||||||
currentProductAssembler, accountMappingWritePlatformService, currentFacilityConfigRepository,
|
currentProductAssembler, accountMappingWritePlatformService, currentFacilityConfigRepository,
|
||||||
currentFacilityLimitRepository, currentDepositLimitKycRepository, productPendingEditRepository,
|
currentFacilityLimitRepository, currentDepositLimitKycRepository, productPendingEditRepository,
|
||||||
pendingEditSubmittedFieldRepository, pendingEditChargeRepository, pendingEditFacilityLimitRepository,
|
pendingEditSubmittedFieldRepository, pendingEditChargeRepository, pendingEditFacilityLimitRepository,
|
||||||
pendingEditGlMappingRepository, fromApiJsonHelper, commandSourceRepository, glMappingWriter);
|
pendingEditGlMappingRepository, fromApiJsonHelper, commandSourceRepository);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
-189
@@ -1,189 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.loanaccount.domain.transactionprocessor.impl;
|
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
import org.apache.fineract.infrastructure.core.service.ExternalIdFactory;
|
|
||||||
import org.apache.fineract.organisation.monetary.domain.MonetaryCurrency;
|
|
||||||
import org.apache.fineract.organisation.monetary.domain.Money;
|
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanCharge;
|
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanRepaymentScheduleInstallment;
|
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransaction;
|
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionToRepaymentScheduleMapping;
|
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.AbstractLoanRepaymentScheduleTransactionProcessor;
|
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.transactionprocessor.LoanRepaymentScheduleTransactionProcessor;
|
|
||||||
import org.apache.fineract.portfolio.loanaccount.serialization.LoanChargeValidator;
|
|
||||||
import org.apache.fineract.portfolio.loanaccount.service.LoanBalanceService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@link LoanRepaymentScheduleTransactionProcessor} that pays off components in order of fees, penalties, interest,
|
|
||||||
* then principal.
|
|
||||||
*
|
|
||||||
* Other formulas exist on fineract where you can choose 'Declining-Balance Interest Recalculation' which simply means,
|
|
||||||
* recalculate the interest component based on the how much principal is outstanding at a point in time; but this isnt
|
|
||||||
* trying to model that option only the basic one for now.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public class FeesPenaltyInterestPrincipalOrderLoanRepaymentScheduleTransactionProcessor extends AbstractLoanRepaymentScheduleTransactionProcessor {
|
|
||||||
|
|
||||||
public static final String STRATEGY_CODE = "fees-penalties-interest-principal-order-strategy";
|
|
||||||
|
|
||||||
public static final String STRATEGY_NAME = "Fees, Penalties, Interest, Principal Order";
|
|
||||||
|
|
||||||
public FeesPenaltyInterestPrincipalOrderLoanRepaymentScheduleTransactionProcessor(final ExternalIdFactory externalIdFactory,
|
|
||||||
final LoanChargeValidator loanChargeValidator, final LoanBalanceService loanBalanceService) {
|
|
||||||
super(externalIdFactory, loanChargeValidator, loanBalanceService);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCode() {
|
|
||||||
return STRATEGY_CODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return STRATEGY_NAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For early/'in advance' repayments, pay off in the same way as on-time payments, interest first then principal.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected Money handleTransactionThatIsPaymentInAdvanceOfInstallment(final LoanRepaymentScheduleInstallment currentInstallment,
|
|
||||||
final List<LoanRepaymentScheduleInstallment> installments, final LoanTransaction loanTransaction, final Money paymentInAdvance,
|
|
||||||
List<LoanTransactionToRepaymentScheduleMapping> transactionMappings, Set<LoanCharge> charges) {
|
|
||||||
|
|
||||||
return handleTransactionThatIsOnTimePaymentOfInstallment(currentInstallment, loanTransaction, paymentInAdvance, transactionMappings,
|
|
||||||
charges);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For late repayments, pay off in the same way as on-time payments, interest first then principal.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected Money handleTransactionThatIsALateRepaymentOfInstallment(final LoanRepaymentScheduleInstallment currentInstallment,
|
|
||||||
final List<LoanRepaymentScheduleInstallment> installments, final LoanTransaction loanTransaction,
|
|
||||||
final Money transactionAmountUnprocessed, List<LoanTransactionToRepaymentScheduleMapping> transactionMappings,
|
|
||||||
Set<LoanCharge> charges) {
|
|
||||||
|
|
||||||
return handleTransactionThatIsOnTimePaymentOfInstallment(currentInstallment, loanTransaction, transactionAmountUnprocessed,
|
|
||||||
transactionMappings, charges);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For normal on-time repayments, pays off interest first, then principal.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected Money handleTransactionThatIsOnTimePaymentOfInstallment(final LoanRepaymentScheduleInstallment currentInstallment,
|
|
||||||
final LoanTransaction loanTransaction, final Money transactionAmountUnprocessed,
|
|
||||||
List<LoanTransactionToRepaymentScheduleMapping> transactionMappings, Set<LoanCharge> charges) {
|
|
||||||
|
|
||||||
final LocalDate transactionDate = loanTransaction.getTransactionDate();
|
|
||||||
final MonetaryCurrency currency = transactionAmountUnprocessed.getCurrency();
|
|
||||||
Money transactionAmountRemaining = transactionAmountUnprocessed;
|
|
||||||
Money principalPortion = Money.zero(transactionAmountRemaining.getCurrency());
|
|
||||||
Money interestPortion = Money.zero(transactionAmountRemaining.getCurrency());
|
|
||||||
Money feeChargesPortion = Money.zero(transactionAmountRemaining.getCurrency());
|
|
||||||
Money penaltyChargesPortion = Money.zero(transactionAmountRemaining.getCurrency());
|
|
||||||
|
|
||||||
if (loanTransaction.isChargesWaiver()) {
|
|
||||||
penaltyChargesPortion = currentInstallment.waivePenaltyChargesComponent(transactionDate,
|
|
||||||
loanTransaction.getPenaltyChargesPortion(currency));
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(penaltyChargesPortion);
|
|
||||||
|
|
||||||
feeChargesPortion = currentInstallment.waiveFeeChargesComponent(transactionDate,
|
|
||||||
loanTransaction.getFeeChargesPortion(currency));
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(feeChargesPortion);
|
|
||||||
|
|
||||||
} else if (loanTransaction.isInterestWaiver()) {
|
|
||||||
interestPortion = currentInstallment.waiveInterestComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(interestPortion);
|
|
||||||
|
|
||||||
loanTransaction.updateComponents(principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion);
|
|
||||||
} else if (loanTransaction.isChargePayment()) {
|
|
||||||
if (loanTransaction.isPenaltyPayment()) {
|
|
||||||
penaltyChargesPortion = currentInstallment.payPenaltyChargesComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(penaltyChargesPortion);
|
|
||||||
} else {
|
|
||||||
feeChargesPortion = currentInstallment.payFeeChargesComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(feeChargesPortion);
|
|
||||||
}
|
|
||||||
loanTransaction.updateComponents(principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion);
|
|
||||||
} else {
|
|
||||||
feeChargesPortion = currentInstallment.payFeeChargesComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(feeChargesPortion);
|
|
||||||
|
|
||||||
penaltyChargesPortion = currentInstallment.payPenaltyChargesComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(penaltyChargesPortion);
|
|
||||||
|
|
||||||
interestPortion = currentInstallment.payInterestComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(interestPortion);
|
|
||||||
|
|
||||||
principalPortion = currentInstallment.payPrincipalComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(principalPortion);
|
|
||||||
|
|
||||||
loanTransaction.updateComponents(principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion);
|
|
||||||
}
|
|
||||||
if (principalPortion.plus(interestPortion).plus(feeChargesPortion).plus(penaltyChargesPortion).isGreaterThanZero()) {
|
|
||||||
transactionMappings.add(LoanTransactionToRepaymentScheduleMapping.createFrom(loanTransaction, currentInstallment,
|
|
||||||
principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion));
|
|
||||||
}
|
|
||||||
return transactionAmountRemaining;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Money handleRefundTransactionPaymentOfInstallment(final LoanRepaymentScheduleInstallment currentInstallment,
|
|
||||||
final LoanTransaction loanTransaction, final Money transactionAmountUnprocessed,
|
|
||||||
List<LoanTransactionToRepaymentScheduleMapping> transactionMappings) {
|
|
||||||
|
|
||||||
final LocalDate transactionDate = loanTransaction.getTransactionDate();
|
|
||||||
final MonetaryCurrency currency = transactionAmountUnprocessed.getCurrency();
|
|
||||||
Money transactionAmountRemaining = transactionAmountUnprocessed;
|
|
||||||
Money principalPortion = Money.zero(currency);
|
|
||||||
Money interestPortion = Money.zero(currency);
|
|
||||||
Money feeChargesPortion = Money.zero(currency);
|
|
||||||
Money penaltyChargesPortion = Money.zero(currency);
|
|
||||||
|
|
||||||
principalPortion = currentInstallment.unpayPrincipalComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(principalPortion);
|
|
||||||
|
|
||||||
if (transactionAmountRemaining.isGreaterThanZero()) {
|
|
||||||
interestPortion = currentInstallment.unpayInterestComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(interestPortion);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transactionAmountRemaining.isGreaterThanZero()) {
|
|
||||||
penaltyChargesPortion = currentInstallment.unpayPenaltyChargesComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(penaltyChargesPortion);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transactionAmountRemaining.isGreaterThanZero()) {
|
|
||||||
feeChargesPortion = currentInstallment.unpayFeeChargesComponent(transactionDate, transactionAmountRemaining);
|
|
||||||
transactionAmountRemaining = transactionAmountRemaining.minus(feeChargesPortion);
|
|
||||||
}
|
|
||||||
loanTransaction.updateComponents(principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion);
|
|
||||||
if (principalPortion.plus(interestPortion).plus(feeChargesPortion).plus(penaltyChargesPortion).isGreaterThanZero()) {
|
|
||||||
transactionMappings.add(LoanTransactionToRepaymentScheduleMapping.createFrom(loanTransaction, currentInstallment,
|
|
||||||
principalPortion, interestPortion, feeChargesPortion, penaltyChargesPortion));
|
|
||||||
}
|
|
||||||
return transactionAmountRemaining;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-30
@@ -1,30 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.loanaccount.starter;
|
|
||||||
|
|
||||||
import org.apache.fineract.infrastructure.core.condition.PropertiesCondition;
|
|
||||||
import org.apache.fineract.infrastructure.core.config.FineractProperties;
|
|
||||||
|
|
||||||
public class FeesPenaltiesInterestPrincipalLoanRepaymentScheduleTransactionProcessorCondition extends PropertiesCondition {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean matches(FineractProperties properties) {
|
|
||||||
return properties.getLoan().getTransactionProcessor().getFeesPenaltiesInterestPrincipal().isEnabled();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+16
-10
@@ -225,12 +225,6 @@ public class LoanProductData implements Serializable {
|
|||||||
private final LoanProductGuaranteeData productGuaranteeData;
|
private final LoanProductGuaranteeData productGuaranteeData;
|
||||||
private final Boolean accountMovesOutOfNPAOnlyOnArrearsCompletion;
|
private final Boolean accountMovesOutOfNPAOnlyOnArrearsCompletion;
|
||||||
private LoanProductConfigurableAttributes allowAttributeOverrides;
|
private LoanProductConfigurableAttributes allowAttributeOverrides;
|
||||||
|
|
||||||
/**
|
|
||||||
* "Advances A/C" satellite fields (security, lien, renewal, npa, cheque book), flat by their form field
|
|
||||||
* name. Set after construction (like {@link #allowAttributeOverrides}) so the edit form can repopulate.
|
|
||||||
*/
|
|
||||||
private Map<String, Object> advanceExtensions;
|
|
||||||
private final boolean syncExpectedWithDisbursementDate;
|
private final boolean syncExpectedWithDisbursementDate;
|
||||||
private final boolean isEqualAmortization;
|
private final boolean isEqualAmortization;
|
||||||
private final BigDecimal fixedPrincipalPercentagePerInstallment;
|
private final BigDecimal fixedPrincipalPercentagePerInstallment;
|
||||||
@@ -1472,12 +1466,24 @@ public class LoanProductData implements Serializable {
|
|||||||
this.allowAttributeOverrides = loanProductConfigurableAttributes;
|
this.allowAttributeOverrides = loanProductConfigurableAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAdvanceExtensions(final Map<String, Object> advanceExtensions) {
|
/**
|
||||||
this.advanceExtensions = advanceExtensions;
|
* The legacy "Account Type Creation" fields, flat and keyed by their form field name.
|
||||||
|
*
|
||||||
|
* Set after construction rather than through a constructor parameter: the main constructor already
|
||||||
|
* takes over a hundred arguments, and threading two more through it would touch every call site for
|
||||||
|
* no benefit. Follows the same pattern as setLoanProductConfigurableAttributes above.
|
||||||
|
*/
|
||||||
|
private Map<String, Object> cbsExtensions;
|
||||||
|
|
||||||
|
/** The legacy Interest Rate Detail grid: one entry per interest type, in form order. */
|
||||||
|
private List<Map<String, Object>> interestRateDetail;
|
||||||
|
|
||||||
|
public void setCbsExtensions(final Map<String, Object> cbsExtensions) {
|
||||||
|
this.cbsExtensions = cbsExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> getAdvanceExtensions() {
|
public void setInterestRateDetail(final List<Map<String, Object>> interestRateDetail) {
|
||||||
return this.advanceExtensions;
|
this.interestRateDetail = interestRateDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIsLinkedToFloatingInterestRates() {
|
public boolean isIsLinkedToFloatingInterestRates() {
|
||||||
|
|||||||
-471
@@ -1,471 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright since 2025 Mifos Initiative
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.FetchType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.JoinColumn;
|
|
||||||
import jakarta.persistence.OneToOne;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* "Advances A/C" product configuration that Fineract's loan-product schema has no home for
|
|
||||||
* (security & margin, lien, deposit-linked interest, penal/NPA handling, renewal, monitoring,
|
|
||||||
* cheque book). It is a standalone satellite keyed by {@code loan_product_id} rather than a widening
|
|
||||||
* of {@code m_product_loan} or a new relation on {@link LoanProduct}: the product entity graph is
|
|
||||||
* loaded on the hot loan-origination path, so it is deliberately left untouched.
|
|
||||||
*
|
|
||||||
* Typed columns (not a JSON blob) so reports can filter on them and GL ids get a real FK.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Table(name = "m_product_loan_advance_ext")
|
|
||||||
public class LoanProductAdvanceExt {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "loan_product_id")
|
|
||||||
private Long loanProductId;
|
|
||||||
|
|
||||||
/** Shared primary key, mapped read-only; {@link #loanProductId} is the writable side. */
|
|
||||||
@OneToOne(fetch = FetchType.LAZY)
|
|
||||||
@JoinColumn(name = "loan_product_id", insertable = false, updatable = false)
|
|
||||||
private LoanProduct loanProduct;
|
|
||||||
|
|
||||||
// ---- classification -------------------------------------------------
|
|
||||||
@Column(name = "product_type_group")
|
|
||||||
private String productTypeGroup;
|
|
||||||
|
|
||||||
@Column(name = "product_type_sub_group")
|
|
||||||
private String productTypeSubGroup;
|
|
||||||
|
|
||||||
@Column(name = "gl_account_id")
|
|
||||||
private Long glAccountId;
|
|
||||||
|
|
||||||
@Column(name = "loan_product_category")
|
|
||||||
private String loanProductCategory;
|
|
||||||
|
|
||||||
@Column(name = "priority_sector")
|
|
||||||
private String prioritySector;
|
|
||||||
|
|
||||||
@Column(name = "cibil_account_type")
|
|
||||||
private String cibilAccountType;
|
|
||||||
|
|
||||||
@Column(name = "kfs_enabled")
|
|
||||||
private Boolean kfsEnabled;
|
|
||||||
|
|
||||||
@Column(name = "apr_enabled")
|
|
||||||
private Boolean aprEnabled;
|
|
||||||
|
|
||||||
// ---- facility -------------------------------------------------------
|
|
||||||
@Column(name = "facility_type")
|
|
||||||
private String facilityType;
|
|
||||||
|
|
||||||
// ---- security & margin ----------------------------------------------
|
|
||||||
@Column(name = "security_type")
|
|
||||||
private String securityType;
|
|
||||||
|
|
||||||
@Column(name = "charge_type")
|
|
||||||
private String chargeType;
|
|
||||||
|
|
||||||
@Column(name = "eligible_amount_basis")
|
|
||||||
private String eligibleAmountBasis;
|
|
||||||
|
|
||||||
@Column(name = "margin_pct")
|
|
||||||
private BigDecimal marginPct;
|
|
||||||
|
|
||||||
@Column(name = "ltv_pct")
|
|
||||||
private BigDecimal ltvPct;
|
|
||||||
|
|
||||||
@Column(name = "dp_method")
|
|
||||||
private String dpMethod;
|
|
||||||
|
|
||||||
// ---- lien -----------------------------------------------------------
|
|
||||||
@Column(name = "lien_required")
|
|
||||||
private Boolean lienRequired;
|
|
||||||
|
|
||||||
@Column(name = "lien_marking_stage")
|
|
||||||
private String lienMarkingStage;
|
|
||||||
|
|
||||||
@Column(name = "lien_certificate_required")
|
|
||||||
private Boolean lienCertificateRequired;
|
|
||||||
|
|
||||||
@Column(name = "lien_certificate_prefix")
|
|
||||||
private String lienCertificatePrefix;
|
|
||||||
|
|
||||||
@Column(name = "print_certificate_on_disbursement")
|
|
||||||
private Boolean printCertificateOnDisbursement;
|
|
||||||
|
|
||||||
// ---- interest (extras; rate bounds live on the core product) --------
|
|
||||||
@Column(name = "interest_basis")
|
|
||||||
private String interestBasis;
|
|
||||||
|
|
||||||
@Column(name = "spread_pct")
|
|
||||||
private BigDecimal spreadPct;
|
|
||||||
|
|
||||||
@Column(name = "interest_charged_on")
|
|
||||||
private String interestChargedOn;
|
|
||||||
|
|
||||||
@Column(name = "interest_posting_frequency")
|
|
||||||
private String interestPostingFrequency;
|
|
||||||
|
|
||||||
// ---- penal & NPA (extras; npaDays/grace/tolerance live on core) ------
|
|
||||||
@Column(name = "penal_applicable")
|
|
||||||
private Boolean penalApplicable;
|
|
||||||
|
|
||||||
@Column(name = "penal_rate_pct")
|
|
||||||
private BigDecimal penalRatePct;
|
|
||||||
|
|
||||||
@Column(name = "penal_applied_on")
|
|
||||||
private String penalAppliedOn;
|
|
||||||
|
|
||||||
@Column(name = "penal_grace_days")
|
|
||||||
private Integer penalGraceDays;
|
|
||||||
|
|
||||||
@Column(name = "npa_trigger")
|
|
||||||
private String npaTrigger;
|
|
||||||
|
|
||||||
@Column(name = "interest_after_npa")
|
|
||||||
private String interestAfterNpa;
|
|
||||||
|
|
||||||
@Column(name = "undebited_interest_gl_id")
|
|
||||||
private Long undebitedInterestGlId;
|
|
||||||
|
|
||||||
// ---- renewal & closure ----------------------------------------------
|
|
||||||
@Column(name = "renewal_allowed")
|
|
||||||
private Boolean renewalAllowed;
|
|
||||||
|
|
||||||
@Column(name = "renewal_period_months")
|
|
||||||
private Integer renewalPeriodMonths;
|
|
||||||
|
|
||||||
@Column(name = "renewal_grace_days")
|
|
||||||
private Integer renewalGraceDays;
|
|
||||||
|
|
||||||
@Column(name = "preclosure_allowed")
|
|
||||||
private String preclosureAllowed;
|
|
||||||
|
|
||||||
@Column(name = "lock_in_months")
|
|
||||||
private Integer lockInMonths;
|
|
||||||
|
|
||||||
@Column(name = "interest_on_preclosure")
|
|
||||||
private String interestOnPreclosure;
|
|
||||||
|
|
||||||
// ---- monitoring -----------------------------------------------------
|
|
||||||
@Column(name = "revaluation_freq_months")
|
|
||||||
private Integer revaluationFreqMonths;
|
|
||||||
|
|
||||||
@Column(name = "insurance_required")
|
|
||||||
private Boolean insuranceRequired;
|
|
||||||
|
|
||||||
@Column(name = "stock_statement_freq_months")
|
|
||||||
private Integer stockStatementFreqMonths;
|
|
||||||
|
|
||||||
// ---- cheque book ----------------------------------------------------
|
|
||||||
@Column(name = "cheque_book_enabled")
|
|
||||||
private Boolean chequeBookEnabled;
|
|
||||||
|
|
||||||
@Column(name = "cheque_type")
|
|
||||||
private String chequeType;
|
|
||||||
|
|
||||||
@Column(name = "default_cheque_book_size")
|
|
||||||
private Integer defaultChequeBookSize;
|
|
||||||
|
|
||||||
@Column(name = "pps_threshold")
|
|
||||||
private BigDecimal ppsThreshold;
|
|
||||||
|
|
||||||
@Column(name = "pps_mandatory_above")
|
|
||||||
private BigDecimal ppsMandatoryAbove;
|
|
||||||
|
|
||||||
// ---- share (co-op) --------------------------------------------------
|
|
||||||
@Column(name = "share_capital_gl_id")
|
|
||||||
private Long shareCapitalGlId;
|
|
||||||
|
|
||||||
// ---- security & lien extras -----------------------------------------
|
|
||||||
/** Pledgeable deposit product names, joined with "|". */
|
|
||||||
@Column(name = "eligible_deposit_products")
|
|
||||||
private String eligibleDepositProducts;
|
|
||||||
|
|
||||||
@Column(name = "lien_tenure_not_exceed_maturity")
|
|
||||||
private Boolean lienTenureNotExceedMaturity;
|
|
||||||
|
|
||||||
@Column(name = "lien_auto_release_on_closure")
|
|
||||||
private Boolean lienAutoReleaseOnClosure;
|
|
||||||
|
|
||||||
@Column(name = "lien_allow_multiple_deposits")
|
|
||||||
private Boolean lienAllowMultipleDeposits;
|
|
||||||
|
|
||||||
@Column(name = "lien_adjust_from_maturity")
|
|
||||||
private Boolean lienAdjustFromMaturity;
|
|
||||||
|
|
||||||
@Column(name = "lien_allow_third_party")
|
|
||||||
private Boolean lienAllowThirdParty;
|
|
||||||
|
|
||||||
@Column(name = "lien_allow_renewal_under_lien")
|
|
||||||
private Boolean lienAllowRenewalUnderLien;
|
|
||||||
|
|
||||||
// ---- limit & tenure extras ------------------------------------------
|
|
||||||
@Column(name = "repayment_type")
|
|
||||||
private String repaymentType;
|
|
||||||
|
|
||||||
@Column(name = "appropriation_order")
|
|
||||||
private String appropriationOrder;
|
|
||||||
|
|
||||||
@Column(name = "debit_balance_allow")
|
|
||||||
private Boolean debitBalanceAllow;
|
|
||||||
|
|
||||||
@Column(name = "allow_debit_after_due_date")
|
|
||||||
private Boolean allowDebitAfterDueDate;
|
|
||||||
|
|
||||||
@Column(name = "branch_level_account_type")
|
|
||||||
private Boolean branchLevelAccountType;
|
|
||||||
|
|
||||||
// ---- interest extras ------------------------------------------------
|
|
||||||
@Column(name = "interest_calc_method")
|
|
||||||
private String interestCalcMethod;
|
|
||||||
|
|
||||||
@Column(name = "interest_on_credit_balance")
|
|
||||||
private Boolean interestOnCreditBalance;
|
|
||||||
|
|
||||||
@Column(name = "interest_posting_day")
|
|
||||||
private String interestPostingDay;
|
|
||||||
|
|
||||||
// ---- NPA upgrade rules ----------------------------------------------
|
|
||||||
@Column(name = "npa_upgrade_only_all_arrears")
|
|
||||||
private Boolean npaUpgradeOnlyAllArrears;
|
|
||||||
|
|
||||||
@Column(name = "npa_keep_standard_if_deposit_covers")
|
|
||||||
private Boolean npaKeepStandardIfDepositCovers;
|
|
||||||
|
|
||||||
// ---- cheque book full config ----------------------------------------
|
|
||||||
/** Allowed book sizes (leaves), joined with "|". */
|
|
||||||
@Column(name = "cheque_book_sizes")
|
|
||||||
private String chequeBookSizes;
|
|
||||||
|
|
||||||
@Column(name = "cheque_max_books_outstanding")
|
|
||||||
private Integer chequeMaxBooksOutstanding;
|
|
||||||
|
|
||||||
@Column(name = "cheque_reissue_when_leaves")
|
|
||||||
private Integer chequeReissueWhenLeaves;
|
|
||||||
|
|
||||||
@Column(name = "cheque_first_book_free")
|
|
||||||
private Boolean chequeFirstBookFree;
|
|
||||||
|
|
||||||
@Column(name = "cheque_free_books_per_year")
|
|
||||||
private Integer chequeFreeBooksPerYear;
|
|
||||||
|
|
||||||
@Column(name = "cheque_name_printed")
|
|
||||||
private String chequeNamePrinted;
|
|
||||||
|
|
||||||
@Column(name = "cheque_print_description")
|
|
||||||
private String chequePrintDescription;
|
|
||||||
|
|
||||||
@Column(name = "cheque_stop_payment_allowed")
|
|
||||||
private Boolean chequeStopPaymentAllowed;
|
|
||||||
|
|
||||||
@Column(name = "cheque_maintain_stock_register")
|
|
||||||
private Boolean chequeMaintainStockRegister;
|
|
||||||
|
|
||||||
@Column(name = "cheque_allow_withdrawal_slip")
|
|
||||||
private Boolean chequeAllowWithdrawalSlip;
|
|
||||||
|
|
||||||
@Column(name = "cheque_block_npa")
|
|
||||||
private Boolean chequeBlockNpa;
|
|
||||||
|
|
||||||
@Column(name = "cheque_block_limit_expired")
|
|
||||||
private Boolean chequeBlockLimitExpired;
|
|
||||||
|
|
||||||
@Column(name = "cheque_block_over_dp")
|
|
||||||
private Boolean chequeBlockOverDp;
|
|
||||||
|
|
||||||
@Column(name = "cheque_block_frozen")
|
|
||||||
private Boolean chequeBlockFrozen;
|
|
||||||
|
|
||||||
@Column(name = "cheque_block_lien_released")
|
|
||||||
private Boolean chequeBlockLienReleased;
|
|
||||||
|
|
||||||
// ---- Loans A/C (EMI) wizard fields -------------------------------------
|
|
||||||
@Column(name = "loan_security_mandatory")
|
|
||||||
private String securityMandatory;
|
|
||||||
|
|
||||||
@Column(name = "loan_guarantors_required")
|
|
||||||
private Integer guarantorsRequired;
|
|
||||||
|
|
||||||
@Column(name = "loan_co_applicant")
|
|
||||||
private String coApplicant;
|
|
||||||
|
|
||||||
@Column(name = "loan_third_party_security")
|
|
||||||
private String thirdPartySecurity;
|
|
||||||
|
|
||||||
@Column(name = "loan_legal_opinion_required")
|
|
||||||
private Boolean legalOpinionRequired;
|
|
||||||
|
|
||||||
@Column(name = "loan_property_insurance_required")
|
|
||||||
private Boolean propertyInsuranceRequired;
|
|
||||||
|
|
||||||
@Column(name = "loan_register_charge")
|
|
||||||
private Boolean registerCharge;
|
|
||||||
|
|
||||||
@Column(name = "loan_release_security_on_closure")
|
|
||||||
private Boolean releaseSecurityOnClosure;
|
|
||||||
|
|
||||||
@Column(name = "loan_allow_multiple_securities")
|
|
||||||
private Boolean allowMultipleSecurities;
|
|
||||||
|
|
||||||
@Column(name = "loan_allow_third_party_deposit")
|
|
||||||
private Boolean allowThirdPartyDeposit;
|
|
||||||
|
|
||||||
@Column(name = "loan_min_age")
|
|
||||||
private Integer minAge;
|
|
||||||
|
|
||||||
@Column(name = "loan_max_age_at_maturity")
|
|
||||||
private Integer maxAgeAtMaturity;
|
|
||||||
|
|
||||||
@Column(name = "loan_min_cibil")
|
|
||||||
private Integer minCibil;
|
|
||||||
|
|
||||||
@Column(name = "loan_min_monthly_income")
|
|
||||||
private BigDecimal minMonthlyIncome;
|
|
||||||
|
|
||||||
@Column(name = "loan_max_foir")
|
|
||||||
private BigDecimal maxFoir;
|
|
||||||
|
|
||||||
@Column(name = "loan_max_loans_per_customer")
|
|
||||||
private Integer maxLoansPerCustomer;
|
|
||||||
|
|
||||||
@Column(name = "loan_disbursement_type")
|
|
||||||
private String disbursementType;
|
|
||||||
|
|
||||||
@Column(name = "loan_disbursement_mode")
|
|
||||||
private String disbursementMode;
|
|
||||||
|
|
||||||
@Column(name = "loan_undisbursed_interest")
|
|
||||||
private String undisbursedInterest;
|
|
||||||
|
|
||||||
@Column(name = "loan_pre_emi_interest")
|
|
||||||
private Boolean preEmiInterest;
|
|
||||||
|
|
||||||
@Column(name = "loan_emi_due_day")
|
|
||||||
private String emiDueDay;
|
|
||||||
|
|
||||||
@Column(name = "loan_holiday_rule")
|
|
||||||
private String holidayRule;
|
|
||||||
|
|
||||||
@Column(name = "loan_moratorium_months")
|
|
||||||
private Integer moratoriumMonths;
|
|
||||||
|
|
||||||
@Column(name = "loan_moratorium_interest")
|
|
||||||
private String moratoriumInterest;
|
|
||||||
|
|
||||||
@Column(name = "loan_variable_installments")
|
|
||||||
private Boolean variableInstallments;
|
|
||||||
|
|
||||||
@Column(name = "loan_repayment_mode")
|
|
||||||
private String repaymentMode;
|
|
||||||
|
|
||||||
@Column(name = "loan_linked_account_type")
|
|
||||||
private String linkedAccountType;
|
|
||||||
|
|
||||||
@Column(name = "loan_pdc_collection")
|
|
||||||
private String pdcCollection;
|
|
||||||
|
|
||||||
@Column(name = "loan_mandate_required")
|
|
||||||
private Boolean mandateRequired;
|
|
||||||
|
|
||||||
@Column(name = "loan_advance_emi")
|
|
||||||
private String advanceEmi;
|
|
||||||
|
|
||||||
@Column(name = "loan_rate_type")
|
|
||||||
private String rateType;
|
|
||||||
|
|
||||||
@Column(name = "loan_register_particular")
|
|
||||||
private String registerParticular;
|
|
||||||
|
|
||||||
@Column(name = "loan_apply_cibil_adjustment")
|
|
||||||
private Boolean applyCibilAdjustment;
|
|
||||||
|
|
||||||
@Column(name = "loan_rate_resolved_at")
|
|
||||||
private String rateResolvedAt;
|
|
||||||
|
|
||||||
@Column(name = "loan_calc_period")
|
|
||||||
private String calcPeriod;
|
|
||||||
|
|
||||||
@Column(name = "loan_interest_starts_from")
|
|
||||||
private String interestStartsFrom;
|
|
||||||
|
|
||||||
@Column(name = "loan_compounding")
|
|
||||||
private String compounding;
|
|
||||||
|
|
||||||
@Column(name = "loan_benchmark")
|
|
||||||
private String benchmark;
|
|
||||||
|
|
||||||
@Column(name = "loan_reset_frequency")
|
|
||||||
private String resetFrequency;
|
|
||||||
|
|
||||||
@Column(name = "loan_reset_change")
|
|
||||||
private String resetChange;
|
|
||||||
|
|
||||||
@Column(name = "loan_part_prepayment_allowed")
|
|
||||||
private Boolean partPrepaymentAllowed;
|
|
||||||
|
|
||||||
@Column(name = "loan_min_part_payment")
|
|
||||||
private BigDecimal minPartPayment;
|
|
||||||
|
|
||||||
@Column(name = "loan_allowed_on")
|
|
||||||
private String allowedOn;
|
|
||||||
|
|
||||||
@Column(name = "loan_part_payments_per_year")
|
|
||||||
private String partPaymentsPerYear;
|
|
||||||
|
|
||||||
@Column(name = "loan_part_prepayment_mode")
|
|
||||||
private String partPrepaymentMode;
|
|
||||||
|
|
||||||
@Column(name = "loan_foreclosure_floating_individual")
|
|
||||||
private BigDecimal foreclosureFloatingIndividual;
|
|
||||||
|
|
||||||
@Column(name = "loan_foreclosure_fixed_individual")
|
|
||||||
private BigDecimal foreclosureFixedIndividual;
|
|
||||||
|
|
||||||
@Column(name = "loan_foreclosure_non_individual")
|
|
||||||
private BigDecimal foreclosureNonIndividual;
|
|
||||||
|
|
||||||
@Column(name = "loan_foreclosure_takeover")
|
|
||||||
private BigDecimal foreclosureTakeover;
|
|
||||||
|
|
||||||
@Column(name = "loan_foreclosure_quote_valid_days")
|
|
||||||
private Integer foreclosureQuoteValidDays;
|
|
||||||
|
|
||||||
@Column(name = "loan_auto_close_on_zero_balance")
|
|
||||||
private Boolean autoCloseOnZeroBalance;
|
|
||||||
|
|
||||||
@Column(name = "loan_noc_letter")
|
|
||||||
private String nocLetter;
|
|
||||||
|
|
||||||
@Column(name = "loan_restructuring")
|
|
||||||
private String restructuring;
|
|
||||||
|
|
||||||
@Column(name = "loan_release_collateral_on_closure")
|
|
||||||
private Boolean releaseCollateralOnClosure;
|
|
||||||
|
|
||||||
@Column(name = "loan_top_up_allowed")
|
|
||||||
private Boolean topUpAllowed;
|
|
||||||
|
|
||||||
@Column(name = "loan_balance_transfer_out_allowed")
|
|
||||||
private Boolean balanceTransferOutAllowed;
|
|
||||||
|
|
||||||
public LoanProductAdvanceExt(final LoanProduct loanProduct) {
|
|
||||||
this.loanProduct = loanProduct;
|
|
||||||
this.loanProductId = loanProduct.getId();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+740
@@ -0,0 +1,740 @@
|
|||||||
|
/**
|
||||||
|
* Copyright since 2025 Mifos Initiative
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
package org.apache.fineract.portfolio.loanproduct.domain;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.OneToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The legacy "Account Type Creation" configuration for a loan product.
|
||||||
|
*
|
||||||
|
* Fineract's loan product schema has no home for these fields, and they are specific to this
|
||||||
|
* deployment, so they hang off {@link LoanProduct} 1:1 instead of widening m_product_loan - an
|
||||||
|
* upstream change to that table can then never collide with them.
|
||||||
|
*
|
||||||
|
* Loan account creation reads this at origination time, which is why these are typed columns rather
|
||||||
|
* than a JSON blob: callers get a compile-checked getter and reports get a plain column.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Table(name = "m_product_loan_cbs_ext")
|
||||||
|
public class LoanProductCbsExt {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Column(name = "loan_product_id")
|
||||||
|
private Long loanProductId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shared primary key: this and {@link #loanProductId} are the same column, so the association is
|
||||||
|
* mapped read-only and {@code loanProductId} is the one that writes it. EclipseLink rejects an
|
||||||
|
* entity with two writable mappings for one field.
|
||||||
|
*/
|
||||||
|
@OneToOne(fetch = FetchType.LAZY)
|
||||||
|
@JoinColumn(name = "loan_product_id", insertable = false, updatable = false)
|
||||||
|
private LoanProduct loanProduct;
|
||||||
|
|
||||||
|
// ---- classification & legacy header fields (24) ---------------------
|
||||||
|
|
||||||
|
@Column(name = "product_type_group")
|
||||||
|
private String productTypeGroup;
|
||||||
|
|
||||||
|
@Column(name = "product_type_sub_group")
|
||||||
|
private String productTypeSubGroup;
|
||||||
|
|
||||||
|
@Column(name = "debit_int_calculation")
|
||||||
|
private Boolean debitIntCalculation;
|
||||||
|
|
||||||
|
@Column(name = "separate_penal_interest")
|
||||||
|
private Boolean separatePenalInterest;
|
||||||
|
|
||||||
|
@Column(name = "credit_int_calculation")
|
||||||
|
private Boolean creditIntCalculation;
|
||||||
|
|
||||||
|
@Column(name = "sub_account_type_balance")
|
||||||
|
private Boolean subAccountTypeBalance;
|
||||||
|
|
||||||
|
@Column(name = "final_int_rounding")
|
||||||
|
private Boolean finalIntRounding;
|
||||||
|
|
||||||
|
@Column(name = "rounding_up_to")
|
||||||
|
private Integer roundingUpTo;
|
||||||
|
|
||||||
|
@Column(name = "account_type_code")
|
||||||
|
private String accountTypeCode;
|
||||||
|
|
||||||
|
@Column(name = "micr_transaction_code")
|
||||||
|
private String micrTransactionCode;
|
||||||
|
|
||||||
|
@Column(name = "reserved_ecs_serial_number")
|
||||||
|
private String reservedEcsSerialNumber;
|
||||||
|
|
||||||
|
@Column(name = "reverse_ecs_number")
|
||||||
|
private String reverseEcsNumber;
|
||||||
|
|
||||||
|
@Column(name = "lock_cheque_info_enabled")
|
||||||
|
private Boolean lockChequeInfoEnabled;
|
||||||
|
|
||||||
|
@Column(name = "lock_page_two_info_enabled")
|
||||||
|
private Boolean lockPageTwoInfoEnabled;
|
||||||
|
|
||||||
|
@Column(name = "computerization_date")
|
||||||
|
private LocalDate computerizationDate;
|
||||||
|
|
||||||
|
@Column(name = "cheque_print_description")
|
||||||
|
private String chequePrintDescription;
|
||||||
|
|
||||||
|
@Column(name = "pos_account_type_description")
|
||||||
|
private String posAccountTypeDescription;
|
||||||
|
|
||||||
|
@Column(name = "pfms_account_type")
|
||||||
|
private String pfmsAccountType;
|
||||||
|
|
||||||
|
@Column(name = "renewal_date_add_months")
|
||||||
|
private Integer renewalDateAddMonths;
|
||||||
|
|
||||||
|
@Column(name = "document_renewal_date_add_months")
|
||||||
|
private Integer documentRenewalDateAddMonths;
|
||||||
|
|
||||||
|
@Column(name = "pps_limit")
|
||||||
|
private BigDecimal ppsLimit;
|
||||||
|
|
||||||
|
@Column(name = "is_write_off_account_type")
|
||||||
|
private Boolean isWriteOffAccountType;
|
||||||
|
|
||||||
|
@Column(name = "write_off_account_type_code")
|
||||||
|
private String writeOffAccountTypeCode;
|
||||||
|
|
||||||
|
@Column(name = "renewal_grace_days")
|
||||||
|
private Integer renewalGraceDays;
|
||||||
|
|
||||||
|
// ---- Cheque Book Settings (10) --------------------------------------
|
||||||
|
|
||||||
|
@Column(name = "cheque_book_issue_enabled")
|
||||||
|
private Boolean chequeBookIssueEnabled;
|
||||||
|
|
||||||
|
@Column(name = "cheque_validation_required")
|
||||||
|
private Boolean chequeValidationRequired;
|
||||||
|
|
||||||
|
@Column(name = "is_first_cheque_book_free")
|
||||||
|
private Boolean isFirstChequeBookFree;
|
||||||
|
|
||||||
|
@Column(name = "cheque_printing_account_type")
|
||||||
|
private String chequePrintingAccountType;
|
||||||
|
|
||||||
|
@Column(name = "allow_withdrawal_slip_usage")
|
||||||
|
private Boolean allowWithdrawalSlipUsage;
|
||||||
|
|
||||||
|
@Column(name = "maintain_cheque_book_stock_registry")
|
||||||
|
private Boolean maintainChequeBookStockRegistry;
|
||||||
|
|
||||||
|
@Column(name = "free_cheque_books_per_year")
|
||||||
|
private Integer freeChequeBooksPerYear;
|
||||||
|
|
||||||
|
@Column(name = "allow_credit_by_cheque_number")
|
||||||
|
private Boolean allowCreditByChequeNumber;
|
||||||
|
|
||||||
|
@Column(name = "credit_cheque_validation_required")
|
||||||
|
private Boolean creditChequeValidationRequired;
|
||||||
|
|
||||||
|
@Column(name = "grace_days_for_stock_statement")
|
||||||
|
private Integer graceDaysForStockStatement;
|
||||||
|
|
||||||
|
// ---- Additional Product Settings (37) -------------------------------
|
||||||
|
|
||||||
|
@Column(name = "account_type_active_for_transactions")
|
||||||
|
private Boolean accountTypeActiveForTransactions;
|
||||||
|
|
||||||
|
@Column(name = "sub_type_activity_enabled")
|
||||||
|
private Boolean subTypeActivityEnabled;
|
||||||
|
|
||||||
|
@Column(name = "account_opening_charges")
|
||||||
|
private BigDecimal accountOpeningCharges;
|
||||||
|
|
||||||
|
@Column(name = "maximum_gold_loan_limit")
|
||||||
|
private BigDecimal maximumGoldLoanLimit;
|
||||||
|
|
||||||
|
@Column(name = "last_account_number_opened")
|
||||||
|
private String lastAccountNumberOpened;
|
||||||
|
|
||||||
|
@Column(name = "customer_termination_allowed")
|
||||||
|
private Boolean customerTerminationAllowed;
|
||||||
|
|
||||||
|
@Column(name = "charges_for_cash_credit_above_limit")
|
||||||
|
private BigDecimal chargesForCashCreditAboveLimit;
|
||||||
|
|
||||||
|
@Column(name = "death_interest_gl_account")
|
||||||
|
private String deathInterestGLAccount;
|
||||||
|
|
||||||
|
@Column(name = "starting_ledger_number")
|
||||||
|
private Integer startingLedgerNumber;
|
||||||
|
|
||||||
|
@Column(name = "ending_ledger_number")
|
||||||
|
private Integer endingLedgerNumber;
|
||||||
|
|
||||||
|
@Column(name = "current_ledger_number")
|
||||||
|
private Integer currentLedgerNumber;
|
||||||
|
|
||||||
|
@Column(name = "remittance_account_number")
|
||||||
|
private String remittanceAccountNumber;
|
||||||
|
|
||||||
|
@Column(name = "is_non_resident_indian_account")
|
||||||
|
private Boolean isNonResidentIndianAccount;
|
||||||
|
|
||||||
|
@Column(name = "debit_clearing_gl_account")
|
||||||
|
private String debitClearingGLAccount;
|
||||||
|
|
||||||
|
@Column(name = "missed_call_alert_service_active")
|
||||||
|
private Boolean missedCallAlertServiceActive;
|
||||||
|
|
||||||
|
@Column(name = "standing_instruction_charge_gl_account")
|
||||||
|
private String standingInstructionChargeGLAccount;
|
||||||
|
|
||||||
|
@Column(name = "standing_instruction_debit_charge_skip_option")
|
||||||
|
private String standingInstructionDebitChargeSkipOption;
|
||||||
|
|
||||||
|
@Column(name = "opening_balance_multiplier_for_remittance_charges")
|
||||||
|
private BigDecimal openingBalanceMultiplierForRemittanceCharges;
|
||||||
|
|
||||||
|
@Column(name = "gold_loan_packet_number_with_year_enabled")
|
||||||
|
private Boolean goldLoanPacketNumberWithYearEnabled;
|
||||||
|
|
||||||
|
@Column(name = "account_move_to_inoperative_enabled")
|
||||||
|
private Boolean accountMoveToInoperativeEnabled;
|
||||||
|
|
||||||
|
@Column(name = "generate_gl_diff_entry_enabled")
|
||||||
|
private Boolean generateGlDiffEntryEnabled;
|
||||||
|
|
||||||
|
@Column(name = "sub_type_wise_gl_balance_generation_enabled")
|
||||||
|
private Boolean subTypeWiseGlBalanceGenerationEnabled;
|
||||||
|
|
||||||
|
@Column(name = "validate_before_deleting_debit_entry_enabled")
|
||||||
|
private Boolean validateBeforeDeletingDebitEntryEnabled;
|
||||||
|
|
||||||
|
@Column(name = "rc_file_concept_enabled")
|
||||||
|
private Boolean rcFileConceptEnabled;
|
||||||
|
|
||||||
|
@Column(name = "account_close_zero_balance_in_open_day_process")
|
||||||
|
private Boolean accountCloseZeroBalanceInOpenDayProcess;
|
||||||
|
|
||||||
|
@Column(name = "account_close_zero_balance_at_subledger_tran_entry")
|
||||||
|
private Boolean accountCloseZeroBalanceAtSubledgerTranEntry;
|
||||||
|
|
||||||
|
@Column(name = "limit_enhancement_against_clearing_screen_display_enabled")
|
||||||
|
private Boolean limitEnhancementAgainstClearingScreenDisplayEnabled;
|
||||||
|
|
||||||
|
@Column(name = "advance_interest_parameter_in_ledger_enabled")
|
||||||
|
private Boolean advanceInterestParameterInLedgerEnabled;
|
||||||
|
|
||||||
|
@Column(name = "vehicle_detail_in_master_enabled")
|
||||||
|
private Boolean vehicleDetailInMasterEnabled;
|
||||||
|
|
||||||
|
@Column(name = "deleted_cheque_issue_enabled")
|
||||||
|
private Boolean deletedChequeIssueEnabled;
|
||||||
|
|
||||||
|
@Column(name = "dp_reduce_in_document_renewal_date_enabled")
|
||||||
|
private Boolean dpReduceInDocumentRenewalDateEnabled;
|
||||||
|
|
||||||
|
@Column(name = "dp_reduce_in_renewal_date_enabled")
|
||||||
|
private Boolean dpReduceInRenewalDateEnabled;
|
||||||
|
|
||||||
|
@Column(name = "auto_close_at_day_end_enabled")
|
||||||
|
private Boolean autoCloseAtDayEndEnabled;
|
||||||
|
|
||||||
|
@Column(name = "loan_rate_from_master_enabled")
|
||||||
|
private Boolean loanRateFromMasterEnabled;
|
||||||
|
|
||||||
|
@Column(name = "cheque_short_name")
|
||||||
|
private String chequeShortName;
|
||||||
|
|
||||||
|
@Column(name = "statement_print_enabled")
|
||||||
|
private Boolean statementPrintEnabled;
|
||||||
|
|
||||||
|
@Column(name = "nesl_code")
|
||||||
|
private String neslCode;
|
||||||
|
|
||||||
|
// ---- Interest Related Parameters (53) -------------------------------
|
||||||
|
|
||||||
|
@Column(name = "drawing_power_and_limit_generation_procedure")
|
||||||
|
private String drawingPowerAndLimitGenerationProcedure;
|
||||||
|
|
||||||
|
@Column(name = "advances_interest_calculation_method")
|
||||||
|
private String advancesInterestCalculationMethod;
|
||||||
|
|
||||||
|
@Column(name = "against_interest_calculation_enabled")
|
||||||
|
private Boolean againstInterestCalculationEnabled;
|
||||||
|
|
||||||
|
@Column(name = "day_wise_against_clearing_interest_rounding")
|
||||||
|
private Boolean dayWiseAgainstClearingInterestRounding;
|
||||||
|
|
||||||
|
@Column(name = "interest_calculation_one_fourth_method")
|
||||||
|
private String interestCalculationOneFourthMethod;
|
||||||
|
|
||||||
|
@Column(name = "against_clearing_interest_procedure_type")
|
||||||
|
private String againstClearingInterestProcedureType;
|
||||||
|
|
||||||
|
@Column(name = "consider_debit_closing_amount_for_against_clearing")
|
||||||
|
private Boolean considerDebitClosingAmountForAgainstClearing;
|
||||||
|
|
||||||
|
@Column(name = "interest_rounding_method")
|
||||||
|
private String interestRoundingMethod;
|
||||||
|
|
||||||
|
@Column(name = "penalty_interest_calculation_enabled")
|
||||||
|
private Boolean penaltyInterestCalculationEnabled;
|
||||||
|
|
||||||
|
@Column(name = "penalty_interest_calculation_method")
|
||||||
|
private String penaltyInterestCalculationMethod;
|
||||||
|
|
||||||
|
@Column(name = "penalty_interest_procedure_number")
|
||||||
|
private String penaltyInterestProcedureNumber;
|
||||||
|
|
||||||
|
@Column(name = "overdrawn_interest_calculation_method")
|
||||||
|
private String overdrawnInterestCalculationMethod;
|
||||||
|
|
||||||
|
@Column(name = "calculate_overdrawn_interest_after_renewal")
|
||||||
|
private Boolean calculateOverdrawnInterestAfterRenewal;
|
||||||
|
|
||||||
|
@Column(name = "interest_on_credit_balance")
|
||||||
|
private Boolean interestOnCreditBalance;
|
||||||
|
|
||||||
|
@Column(name = "penalty_interest_date_different_than_regular_interest")
|
||||||
|
private Boolean penaltyInterestDateDifferentThanRegularInterest;
|
||||||
|
|
||||||
|
@Column(name = "fixed_deposit_overdraft_certificate_sort_order")
|
||||||
|
private String fixedDepositOverdraftCertificateSortOrder;
|
||||||
|
|
||||||
|
@Column(name = "use_document_submission_date_for_interest")
|
||||||
|
private Boolean useDocumentSubmissionDateForInterest;
|
||||||
|
|
||||||
|
@Column(name = "loan_management_system_renewal_penalty_active")
|
||||||
|
private Boolean loanManagementSystemRenewalPenaltyActive;
|
||||||
|
|
||||||
|
@Column(name = "minimum_normal_interest_amount")
|
||||||
|
private BigDecimal minimumNormalInterestAmount;
|
||||||
|
|
||||||
|
@Column(name = "minimum_interest_calculation_method")
|
||||||
|
private String minimumInterestCalculationMethod;
|
||||||
|
|
||||||
|
@Column(name = "minimum_against_clearing_interest_amount")
|
||||||
|
private BigDecimal minimumAgainstClearingInterestAmount;
|
||||||
|
|
||||||
|
@Column(name = "limit_increase_upto_interest_amount_in_interest_calculation")
|
||||||
|
private Boolean limitIncreaseUptoInterestAmountInInterestCalculation;
|
||||||
|
|
||||||
|
@Column(name = "minimum_penalty_interest_amount")
|
||||||
|
private BigDecimal minimumPenaltyInterestAmount;
|
||||||
|
|
||||||
|
@Column(name = "days_for_limit_increase_upto_interest_amount")
|
||||||
|
private Integer daysForLimitIncreaseUptoInterestAmount;
|
||||||
|
|
||||||
|
@Column(name = "additional_interest_rate_for_fixed_deposit_overdraft")
|
||||||
|
private BigDecimal additionalInterestRateForFixedDepositOverdraft;
|
||||||
|
|
||||||
|
@Column(name = "consider_dd_payorder_in_against_clearing_interest_calculation")
|
||||||
|
private Boolean considerDdPayorderInAgainstClearingInterestCalculation;
|
||||||
|
|
||||||
|
@Column(name = "grace_days_after_renew_date")
|
||||||
|
private Integer graceDaysAfterRenewDate;
|
||||||
|
|
||||||
|
@Column(name = "apply_undebited_interest_concept_enabled")
|
||||||
|
private Boolean applyUndebitedInterestConceptEnabled;
|
||||||
|
|
||||||
|
@Column(name = "interest_register_print_format_type")
|
||||||
|
private String interestRegisterPrintFormatType;
|
||||||
|
|
||||||
|
@Column(name = "normal_grace_days_after_overdue")
|
||||||
|
private Integer normalGraceDaysAfterOverdue;
|
||||||
|
|
||||||
|
@Column(name = "allow_against_clearing_entry")
|
||||||
|
private Boolean allowAgainstClearingEntry;
|
||||||
|
|
||||||
|
@Column(name = "allow_no_balance_entry")
|
||||||
|
private Boolean allowNoBalanceEntry;
|
||||||
|
|
||||||
|
@Column(name = "fd_od_penalty_interest_combined_with_normal_interest")
|
||||||
|
private Boolean fixedDepositOverdraftPenaltyInterestCombinedWithNormalInterest;
|
||||||
|
|
||||||
|
@Column(name = "allow_no_balance_entry_with_password")
|
||||||
|
private Boolean allowNoBalanceEntryWithPassword;
|
||||||
|
|
||||||
|
@Column(name = "undebited_simple_interest_account_wise")
|
||||||
|
private Boolean undebitedSimpleInterestAccountWise;
|
||||||
|
|
||||||
|
@Column(name = "daily_interest_calculation_enabled")
|
||||||
|
private Boolean dailyInterestCalculationEnabled;
|
||||||
|
|
||||||
|
@Column(name = "daily_interest_calculation_start_date")
|
||||||
|
private String dailyInterestCalculationStartDate;
|
||||||
|
|
||||||
|
@Column(name = "non_performing_asset_penal_interest_rate_update")
|
||||||
|
private Boolean nonPerformingAssetPenalInterestRateUpdate;
|
||||||
|
|
||||||
|
@Column(name = "non_performing_asset_penal_interest_rate")
|
||||||
|
private BigDecimal nonPerformingAssetPenalInterestRate;
|
||||||
|
|
||||||
|
@Column(name = "fd_od_penal_interest_rate_update_in_branch_process")
|
||||||
|
private Boolean fixedDepositOverdraftPenalInterestRateUpdateInBranchProcess;
|
||||||
|
|
||||||
|
@Column(name = "add_penal_interest_rate")
|
||||||
|
private BigDecimal addPenalInterestRate;
|
||||||
|
|
||||||
|
@Column(name = "atyp14_simple_interest_enabled")
|
||||||
|
private Boolean atyp14SimpleInterestEnabled;
|
||||||
|
|
||||||
|
@Column(name = "fixed_deposit_overdraft_margin_type")
|
||||||
|
private String fixedDepositOverdraftMarginType;
|
||||||
|
|
||||||
|
@Column(name = "check_master_detail_edited_passing_pending_enabled")
|
||||||
|
private Boolean checkMasterDetailEditedPassingPendingEnabled;
|
||||||
|
|
||||||
|
@Column(name = "credit_debit_interest_calculation_separate_enabled")
|
||||||
|
private Boolean creditDebitInterestCalculationSeparateEnabled;
|
||||||
|
|
||||||
|
@Column(name = "on_time_interest_provision_enabled")
|
||||||
|
private Boolean onTimeInterestProvisionEnabled;
|
||||||
|
|
||||||
|
@Column(name = "check_against_clearing_enabled")
|
||||||
|
private Boolean checkAgainstClearingEnabled;
|
||||||
|
|
||||||
|
@Column(name = "gst_on_penalty_enabled")
|
||||||
|
private Boolean gstOnPenaltyEnabled;
|
||||||
|
|
||||||
|
@Column(name = "penalty_interest_grace_days")
|
||||||
|
private Integer penaltyInterestGraceDays;
|
||||||
|
|
||||||
|
@Column(name = "overdrawn_interest_rate")
|
||||||
|
private BigDecimal overdrawnInterestRate;
|
||||||
|
|
||||||
|
@Column(name = "calculate_daily_limit_enhancement_tod_enabled")
|
||||||
|
private Boolean calculateDailyLimitEnhancementTodEnabled;
|
||||||
|
|
||||||
|
@Column(name = "fixed_deposit_overdraft_multiple_interest_rate_enabled")
|
||||||
|
private Boolean fixedDepositOverdraftMultipleInterestRateEnabled;
|
||||||
|
|
||||||
|
@Column(name = "grace_days_after_overdue_for_moratorium")
|
||||||
|
private Integer graceDaysAfterOverdueForMoratorium;
|
||||||
|
|
||||||
|
// ---- Credit Bureau Settings (CIBIL) (8) ----------------------------
|
||||||
|
|
||||||
|
@Column(name = "cibil_account_type")
|
||||||
|
private String cibilAccountType;
|
||||||
|
|
||||||
|
@Column(name = "cibil_commercial_account_type")
|
||||||
|
private String cibilCommercialAccountType;
|
||||||
|
|
||||||
|
@Column(name = "highmark_account_type")
|
||||||
|
private String highmarkAccountType;
|
||||||
|
|
||||||
|
@Column(name = "highmark_commercial_account_type")
|
||||||
|
private String highmarkCommercialAccountType;
|
||||||
|
|
||||||
|
@Column(name = "experian_account_type")
|
||||||
|
private String experianAccountType;
|
||||||
|
|
||||||
|
@Column(name = "experian_commercial_account_type")
|
||||||
|
private String experianCommercialAccountType;
|
||||||
|
|
||||||
|
@Column(name = "equifax_account_type")
|
||||||
|
private String equifaxAccountType;
|
||||||
|
|
||||||
|
@Column(name = "equifax_commercial_account_type")
|
||||||
|
private String equifaxCommercialAccountType;
|
||||||
|
|
||||||
|
// ---- RBI Compliance & Product Category (6) -------------------------
|
||||||
|
|
||||||
|
@Column(name = "loan_product_category")
|
||||||
|
private String loanProductCategory;
|
||||||
|
|
||||||
|
@Column(name = "penal_charge_method")
|
||||||
|
private String penalChargeMethod;
|
||||||
|
|
||||||
|
@Column(name = "is_floating_rate")
|
||||||
|
private Boolean isFloatingRate;
|
||||||
|
|
||||||
|
@Column(name = "foreclosure_charges_applicable")
|
||||||
|
private Boolean foreclosureChargesApplicable;
|
||||||
|
|
||||||
|
@Column(name = "key_fact_statement_enabled")
|
||||||
|
private Boolean keyFactStatementEnabled;
|
||||||
|
|
||||||
|
@Column(name = "annual_percentage_rate_calculation_enabled")
|
||||||
|
private Boolean annualPercentageRateCalculationEnabled;
|
||||||
|
|
||||||
|
// ---- Channel & Transaction Limits (23) ------------------------------
|
||||||
|
|
||||||
|
@Column(name = "is_mobile_app_enabled")
|
||||||
|
private Boolean isMobileAppEnabled;
|
||||||
|
|
||||||
|
@Column(name = "is_atm_enabled")
|
||||||
|
private Boolean isAtmEnabled;
|
||||||
|
|
||||||
|
@Column(name = "atm_yearly_charge_enabled")
|
||||||
|
private Boolean atmYearlyChargeEnabled;
|
||||||
|
|
||||||
|
@Column(name = "atm_minimum_balance")
|
||||||
|
private BigDecimal atmMinimumBalance;
|
||||||
|
|
||||||
|
@Column(name = "email_active_enabled")
|
||||||
|
private Boolean emailActiveEnabled;
|
||||||
|
|
||||||
|
@Column(name = "is_imps_enabled")
|
||||||
|
private Boolean isImpsEnabled;
|
||||||
|
|
||||||
|
@Column(name = "is_upi_enabled")
|
||||||
|
private Boolean isUpiEnabled;
|
||||||
|
|
||||||
|
@Column(name = "is_pos_enabled")
|
||||||
|
private Boolean isPosEnabled;
|
||||||
|
|
||||||
|
@Column(name = "is_bbps_enabled")
|
||||||
|
private Boolean isBbpsEnabled;
|
||||||
|
|
||||||
|
@Column(name = "inter_bank_limit_per_day")
|
||||||
|
private BigDecimal interBankLimitPerDay;
|
||||||
|
|
||||||
|
@Column(name = "inter_bank_limit_per_transaction")
|
||||||
|
private BigDecimal interBankLimitPerTransaction;
|
||||||
|
|
||||||
|
@Column(name = "neft_rtgs_limit_per_day")
|
||||||
|
private BigDecimal neftRtgsLimitPerDay;
|
||||||
|
|
||||||
|
@Column(name = "neft_rtgs_limit_per_transaction")
|
||||||
|
private BigDecimal neftRtgsLimitPerTransaction;
|
||||||
|
|
||||||
|
@Column(name = "neft_cutoff_limit")
|
||||||
|
private BigDecimal neftCutoffLimit;
|
||||||
|
|
||||||
|
@Column(name = "rtgs_cutoff_limit")
|
||||||
|
private BigDecimal rtgsCutoffLimit;
|
||||||
|
|
||||||
|
@Column(name = "neft_rtgs_minimum_balance")
|
||||||
|
private BigDecimal neftRtgsMinimumBalance;
|
||||||
|
|
||||||
|
@Column(name = "is_charge_required_neft_rtgs_cbs")
|
||||||
|
private Boolean isChargeRequiredNeftRtgsCbs;
|
||||||
|
|
||||||
|
@Column(name = "is_charge_required_neft_rtgs_mobile")
|
||||||
|
private Boolean isChargeRequiredNeftRtgsMobile;
|
||||||
|
|
||||||
|
@Column(name = "imps_limit_per_day")
|
||||||
|
private BigDecimal impsLimitPerDay;
|
||||||
|
|
||||||
|
@Column(name = "imps_limit_per_transaction")
|
||||||
|
private BigDecimal impsLimitPerTransaction;
|
||||||
|
|
||||||
|
@Column(name = "imps_limit_per_month")
|
||||||
|
private BigDecimal impsLimitPerMonth;
|
||||||
|
|
||||||
|
@Column(name = "imps_min_limit")
|
||||||
|
private BigDecimal impsMinLimit;
|
||||||
|
|
||||||
|
@Column(name = "imps_monthly_transaction_count")
|
||||||
|
private Integer impsMonthlyTransactionCount;
|
||||||
|
|
||||||
|
// ---- POS Facility & ATM CSV Settings (10) ---------------------------
|
||||||
|
|
||||||
|
@Column(name = "max_per_transaction_limit_atm")
|
||||||
|
private BigDecimal maxPerTransactionLimitAtm;
|
||||||
|
|
||||||
|
@Column(name = "max_day_transaction_limit_atm")
|
||||||
|
private BigDecimal maxDayTransactionLimitAtm;
|
||||||
|
|
||||||
|
@Column(name = "max_per_transaction_limit_pos")
|
||||||
|
private BigDecimal maxPerTransactionLimitPos;
|
||||||
|
|
||||||
|
@Column(name = "max_day_transaction_limit_pos")
|
||||||
|
private BigDecimal maxDayTransactionLimitPos;
|
||||||
|
|
||||||
|
@Column(name = "max_per_transaction_limit_ecom")
|
||||||
|
private BigDecimal maxPerTransactionLimitEcom;
|
||||||
|
|
||||||
|
@Column(name = "max_day_transaction_limit_ecom")
|
||||||
|
private BigDecimal maxDayTransactionLimitEcom;
|
||||||
|
|
||||||
|
@Column(name = "max_per_transaction_limit_upi")
|
||||||
|
private BigDecimal maxPerTransactionLimitUpi;
|
||||||
|
|
||||||
|
@Column(name = "max_day_transaction_limit_upi")
|
||||||
|
private BigDecimal maxDayTransactionLimitUpi;
|
||||||
|
|
||||||
|
@Column(name = "atm_csv_product_code")
|
||||||
|
private String atmCsvProductCode;
|
||||||
|
|
||||||
|
@Column(name = "atm_csv_type_code")
|
||||||
|
private String atmCsvTypeCode;
|
||||||
|
|
||||||
|
// ---- Auto Interest Post Parameters (4) -----------------------------
|
||||||
|
|
||||||
|
@Column(name = "auto_interest_post_type")
|
||||||
|
private String autoInterestPostType;
|
||||||
|
|
||||||
|
@Column(name = "auto_interest_post_when")
|
||||||
|
private String autoInterestPostWhen;
|
||||||
|
|
||||||
|
@Column(name = "auto_interest_post_fix_day")
|
||||||
|
private Integer autoInterestPostFixDay;
|
||||||
|
|
||||||
|
@Column(name = "auto_last_interest_date")
|
||||||
|
private String autoLastInterestDate;
|
||||||
|
|
||||||
|
// ---- Foreclosure / Early Account Closure (3) -----------------------
|
||||||
|
|
||||||
|
@Column(name = "calculate_early_account_close_charge")
|
||||||
|
private Boolean calculateEarlyAccountCloseCharge;
|
||||||
|
|
||||||
|
@Column(name = "early_account_close_charge")
|
||||||
|
private BigDecimal earlyAccountCloseCharge;
|
||||||
|
|
||||||
|
@Column(name = "early_account_close_period_in_months")
|
||||||
|
private Integer earlyAccountClosePeriodInMonths;
|
||||||
|
|
||||||
|
// ---- Terms step (3) ------------------------------------------------
|
||||||
|
|
||||||
|
@Column(name = "debit_balance_allow")
|
||||||
|
private Boolean debitBalanceAllow;
|
||||||
|
|
||||||
|
@Column(name = "allow_debit_trans_after_due_date")
|
||||||
|
private Boolean allowDebitTransAfterDueDate;
|
||||||
|
|
||||||
|
@Column(name = "branch_level_account_type")
|
||||||
|
private Boolean branchLevelAccountType;
|
||||||
|
|
||||||
|
// ---- legacy cheque / standing instruction / minimum balance charges (24)
|
||||||
|
|
||||||
|
@Column(name = "cheque_book_charge_enabled")
|
||||||
|
private Boolean chequeBookChargeEnabled;
|
||||||
|
|
||||||
|
@Column(name = "cheque_return_charge_enabled")
|
||||||
|
private Boolean chequeReturnChargeEnabled;
|
||||||
|
|
||||||
|
@Column(name = "ic_charge_debit_enabled")
|
||||||
|
private Boolean icChargeDebitEnabled;
|
||||||
|
|
||||||
|
@Column(name = "cash_bundle_charge_enabled")
|
||||||
|
private Boolean cashBundleChargeEnabled;
|
||||||
|
|
||||||
|
@Column(name = "cash_bundle_charge_with_pan_limit")
|
||||||
|
private BigDecimal cashBundleChargeWithPanLimit;
|
||||||
|
|
||||||
|
@Column(name = "per_cheque_entry_charge")
|
||||||
|
private BigDecimal perChequeEntryCharge;
|
||||||
|
|
||||||
|
@Column(name = "per_cheque_entry_service_charge")
|
||||||
|
private BigDecimal perChequeEntryServiceCharge;
|
||||||
|
|
||||||
|
@Column(name = "per_inward_cheque_entry_charge")
|
||||||
|
private BigDecimal perInwardChequeEntryCharge;
|
||||||
|
|
||||||
|
@Column(name = "per_outward_cheque_entry_charge")
|
||||||
|
private BigDecimal perOutwardChequeEntryCharge;
|
||||||
|
|
||||||
|
@Column(name = "creditor_standing_instruction_fail_charge")
|
||||||
|
private BigDecimal creditorStandingInstructionFailCharge;
|
||||||
|
|
||||||
|
@Column(name = "debtor_standing_instruction_fail_charge")
|
||||||
|
private BigDecimal debtorStandingInstructionFailCharge;
|
||||||
|
|
||||||
|
@Column(name = "minimum_balance_checking_type")
|
||||||
|
private String minimumBalanceCheckingType;
|
||||||
|
|
||||||
|
@Column(name = "auto_minimum_balance_charge")
|
||||||
|
private Boolean autoMinimumBalanceCharge;
|
||||||
|
|
||||||
|
@Column(name = "calculate_daily_minimum_balance_charges")
|
||||||
|
private Boolean calculateDailyMinimumBalanceCharges;
|
||||||
|
|
||||||
|
@Column(name = "minimum_balance_charge_enabled")
|
||||||
|
private Boolean minimumBalanceChargeEnabled;
|
||||||
|
|
||||||
|
@Column(name = "minimum_balance_charge_amount")
|
||||||
|
private BigDecimal minimumBalanceChargeAmount;
|
||||||
|
|
||||||
|
@Column(name = "minimum_balance_charge_for_cheque_issue")
|
||||||
|
private BigDecimal minimumBalanceChargeForChequeIssue;
|
||||||
|
|
||||||
|
@Column(name = "minimum_balance_charge_method")
|
||||||
|
private String minimumBalanceChargeMethod;
|
||||||
|
|
||||||
|
@Column(name = "months_after_min_balance_charge_calculate")
|
||||||
|
private Integer monthsAfterMinBalanceChargeCalculate;
|
||||||
|
|
||||||
|
@Column(name = "for_cheque_issue")
|
||||||
|
private BigDecimal forChequeIssue;
|
||||||
|
|
||||||
|
@Column(name = "for_cheque_issue_avg")
|
||||||
|
private BigDecimal forChequeIssueAvg;
|
||||||
|
|
||||||
|
@Column(name = "for_withdrawal_slip")
|
||||||
|
private BigDecimal forWithdrawalSlip;
|
||||||
|
|
||||||
|
@Column(name = "for_withdrawal_slip_avg")
|
||||||
|
private BigDecimal forWithdrawalSlipAvg;
|
||||||
|
|
||||||
|
@Column(name = "calculate_daily_against_clearing_charge")
|
||||||
|
private Boolean calculateDailyAgainstClearingCharge;
|
||||||
|
|
||||||
|
// ---- custom GL account mappings (14) --------------------------------
|
||||||
|
|
||||||
|
@Column(name = "int_receivables_gl_account_id")
|
||||||
|
private Long intReceivablesGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "int_payable_gl_account_id")
|
||||||
|
private Long intPayableGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "deaf_int_payable_gl_account_id")
|
||||||
|
private Long deafIntPayableGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "int_overdue_reserve_account_id")
|
||||||
|
private Long intOverdueReserveAccountId;
|
||||||
|
|
||||||
|
@Column(name = "undebited_interest_account_id")
|
||||||
|
private Long undebitedInterestAccountId;
|
||||||
|
|
||||||
|
@Column(name = "penal_int_cr_gl_account_id")
|
||||||
|
private Long penalIntCrGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "rd_matured_gl_account_id")
|
||||||
|
private Long rdMaturedGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "gl_account_id")
|
||||||
|
private Long glAccountId;
|
||||||
|
|
||||||
|
@Column(name = "ic_charge_gl_account_id")
|
||||||
|
private Long icChargeGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "inoperative_gl_account_id")
|
||||||
|
private Long inoperativeGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "credit_balance_liability_gl_account_id")
|
||||||
|
private Long creditBalanceLiabilityGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "credit_balance_asset_gl_account_id")
|
||||||
|
private Long creditBalanceAssetGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "overdue_accounts_gl_account_id")
|
||||||
|
private Long overdueAccountsGlAccountId;
|
||||||
|
|
||||||
|
@Column(name = "rebate_gl_account_id")
|
||||||
|
private Long rebateGlAccountId;
|
||||||
|
|
||||||
|
public LoanProductCbsExt(final LoanProduct loanProduct) {
|
||||||
|
this.loanProduct = loanProduct;
|
||||||
|
this.loanProductId = loanProduct.getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-2
@@ -10,7 +10,11 @@ package org.apache.fineract.portfolio.loanproduct.domain;
|
|||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface LoanProductAdvanceExtRepository extends JpaRepository<LoanProductAdvanceExt, Long> {
|
public interface LoanProductCbsExtRepository extends JpaRepository<LoanProductCbsExt, Long> {
|
||||||
|
|
||||||
Optional<LoanProductAdvanceExt> findByLoanProductId(Long loanProductId);
|
/**
|
||||||
|
* A product created before this table existed - or one saved without any legacy field filled in - has
|
||||||
|
* no row here, so callers must handle the empty case rather than assuming one exists.
|
||||||
|
*/
|
||||||
|
Optional<LoanProductCbsExt> findByLoanProductId(Long loanProductId);
|
||||||
}
|
}
|
||||||
+82
@@ -0,0 +1,82 @@
|
|||||||
|
/**
|
||||||
|
* Copyright since 2025 Mifos Initiative
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
package org.apache.fineract.portfolio.loanproduct.domain;
|
||||||
|
|
||||||
|
import jakarta.persistence.Column;
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.FetchType;
|
||||||
|
import jakarta.persistence.JoinColumn;
|
||||||
|
import jakarta.persistence.ManyToOne;
|
||||||
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.persistence.UniqueConstraint;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.apache.fineract.infrastructure.core.domain.AbstractPersistableCustom;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* One row of the legacy "Interest Rate Detail" grid on the loan product form.
|
||||||
|
*
|
||||||
|
* The grid is a fixed four rows - Normal Debit, Normal Credit, Against Clearing and Penalty - each
|
||||||
|
* carrying a Normal and a Special min/max rate plus the period they apply over. It is a child table
|
||||||
|
* rather than twenty-four columns on {@link LoanProductCbsExt} because the interest type reads far
|
||||||
|
* better as data than as part of a column name: against_clearing_special_max_rate and its siblings
|
||||||
|
* are almost unreadable, and any new interest type would mean another migration.
|
||||||
|
*
|
||||||
|
* The rows are fixed today, so {@link #INTEREST_TYPES} is the full set and the table carries a unique
|
||||||
|
* constraint on (product, interest type) - a replayed save updates in place instead of doubling the
|
||||||
|
* grid.
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Table(name = "m_product_loan_cbs_interest_rate", uniqueConstraints = {
|
||||||
|
@UniqueConstraint(columnNames = { "loan_product_id", "interest_type" }, name = "mplcir_unq_product_interest_type") })
|
||||||
|
public class LoanProductCbsInterestRate extends AbstractPersistableCustom<Long> {
|
||||||
|
|
||||||
|
/** The grid's rows, in the order the form shows them. */
|
||||||
|
public static final String[] INTEREST_TYPES = { "Normal Debit", "Normal Credit", "Against Clearing", "Penalty" };
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY, optional = false)
|
||||||
|
@JoinColumn(name = "loan_product_id", nullable = false)
|
||||||
|
private LoanProduct loanProduct;
|
||||||
|
|
||||||
|
@Column(name = "interest_type", nullable = false, length = 30)
|
||||||
|
private String interestType;
|
||||||
|
|
||||||
|
@Column(name = "calculation")
|
||||||
|
private Boolean calculation;
|
||||||
|
|
||||||
|
@Column(name = "normal_min_rate", precision = 9, scale = 6)
|
||||||
|
private BigDecimal normalMinRate;
|
||||||
|
|
||||||
|
@Column(name = "normal_max_rate", precision = 9, scale = 6)
|
||||||
|
private BigDecimal normalMaxRate;
|
||||||
|
|
||||||
|
@Column(name = "special_min_rate", precision = 9, scale = 6)
|
||||||
|
private BigDecimal specialMinRate;
|
||||||
|
|
||||||
|
@Column(name = "special_max_rate", precision = 9, scale = 6)
|
||||||
|
private BigDecimal specialMaxRate;
|
||||||
|
|
||||||
|
@Column(name = "period", length = 20)
|
||||||
|
private String period;
|
||||||
|
|
||||||
|
public LoanProductCbsInterestRate(final LoanProduct loanProduct, final String interestType) {
|
||||||
|
this.loanProduct = loanProduct;
|
||||||
|
this.interestType = interestType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** True when the officer left this row untouched, so it need not be persisted. */
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return !Boolean.TRUE.equals(this.calculation) && this.normalMinRate == null && this.normalMaxRate == null
|
||||||
|
&& this.specialMinRate == null && this.specialMaxRate == null && (this.period == null || this.period.isBlank());
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
-3
@@ -10,8 +10,9 @@ package org.apache.fineract.portfolio.loanproduct.domain;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
public interface LoanRateRegisterCibilSlabRepository extends JpaRepository<LoanRateRegisterCibilSlab, Long> {
|
public interface LoanProductCbsInterestRateRepository extends JpaRepository<LoanProductCbsInterestRate, Long> {
|
||||||
|
|
||||||
/** CIBIL bands for a version, ordered as the UI shows them (ascending score bands). */
|
List<LoanProductCbsInterestRate> findByLoanProductIdOrderById(Long loanProductId);
|
||||||
List<LoanRateRegisterCibilSlab> findByEffectiveIdOrderByDisplayOrderAsc(Long effectiveId);
|
|
||||||
|
LoanProductCbsInterestRate findByLoanProductIdAndInterestType(Long loanProductId, String interestType);
|
||||||
}
|
}
|
||||||
-76
@@ -1,76 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright since 2025 Mifos Initiative
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* One CIBIL/credit-score band of a rate register version — e.g. {601..650} tier "Fair" adds +1.00%.
|
|
||||||
* Applied on top of the chart cell at loan sanction. Typically 5 rows per version; ordered on reads
|
|
||||||
* by {@code displayOrder}.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "m_loan_rate_register_cibil_slab")
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class LoanRateRegisterCibilSlab {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Column(name = "effective_id", nullable = false)
|
|
||||||
private Long effectiveId;
|
|
||||||
|
|
||||||
@Column(name = "score_from", nullable = false)
|
|
||||||
private Integer scoreFrom;
|
|
||||||
|
|
||||||
@Column(name = "score_to", nullable = false)
|
|
||||||
private Integer scoreTo;
|
|
||||||
|
|
||||||
@Column(name = "tier", length = 30, nullable = false)
|
|
||||||
private String tier;
|
|
||||||
|
|
||||||
@Column(name = "slab_type", length = 20, nullable = false)
|
|
||||||
private String slabType;
|
|
||||||
|
|
||||||
@Column(name = "adjustment_pct", nullable = false)
|
|
||||||
private BigDecimal adjustmentPct;
|
|
||||||
|
|
||||||
@Column(name = "display_order", nullable = false)
|
|
||||||
private Integer displayOrder;
|
|
||||||
|
|
||||||
@Column(name = "created_date")
|
|
||||||
private LocalDateTime createdDate;
|
|
||||||
|
|
||||||
public static LoanRateRegisterCibilSlab create(final Long effectiveId, final Integer scoreFrom, final Integer scoreTo, final String tier,
|
|
||||||
final String slabType, final BigDecimal adjustmentPct, final Integer displayOrder) {
|
|
||||||
final LoanRateRegisterCibilSlab s = new LoanRateRegisterCibilSlab();
|
|
||||||
s.effectiveId = effectiveId;
|
|
||||||
s.scoreFrom = scoreFrom;
|
|
||||||
s.scoreTo = scoreTo;
|
|
||||||
s.tier = tier;
|
|
||||||
s.slabType = slabType != null ? slabType : "Flat";
|
|
||||||
s.adjustmentPct = adjustmentPct;
|
|
||||||
s.displayOrder = displayOrder;
|
|
||||||
s.createdDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-94
@@ -1,94 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright since 2025 Mifos Initiative
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* One effective (versioned) copy of the central Loan Interest Rate Register. Mirrors the
|
|
||||||
* {@code FdBaseInterestRateEffective} versioning model: each approved save creates a new row with
|
|
||||||
* {@code isActive=true} and deactivates the previous active row ({@code isActive=false,
|
|
||||||
* effectiveToDate=today}). Reads for "current active" filter on {@code isActive=true}.
|
|
||||||
*
|
|
||||||
* The 34-product × 10-slab rate matrix for this version lives in {@link LoanRateRegisterSlabHistory};
|
|
||||||
* the CIBIL/credit-score bands live in {@link LoanRateRegisterCibilSlab}, both keyed by this row's
|
|
||||||
* id and cascade-deleted with it.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "m_loan_rate_register_effective")
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class LoanRateRegisterEffective {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Column(name = "name", length = 200, nullable = false)
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Column(name = "effective_from_date", nullable = false)
|
|
||||||
private LocalDate effectiveFromDate;
|
|
||||||
|
|
||||||
@Column(name = "effective_to_date")
|
|
||||||
private LocalDate effectiveToDate;
|
|
||||||
|
|
||||||
@Column(name = "currency_code", length = 3, nullable = false)
|
|
||||||
private String currencyCode;
|
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
|
||||||
private Boolean isActive;
|
|
||||||
|
|
||||||
@Column(name = "fallback_no_cibil_slab", nullable = false)
|
|
||||||
private Integer fallbackNoCibilSlab;
|
|
||||||
|
|
||||||
@Column(name = "fallback_below_min", length = 20, nullable = false)
|
|
||||||
private String fallbackBelowMin;
|
|
||||||
|
|
||||||
@Column(name = "note", length = 500)
|
|
||||||
private String note;
|
|
||||||
|
|
||||||
@Column(name = "created_by_id")
|
|
||||||
private Long createdById;
|
|
||||||
|
|
||||||
@Column(name = "created_date")
|
|
||||||
private LocalDateTime createdDate;
|
|
||||||
|
|
||||||
public static LoanRateRegisterEffective create(final String name, final LocalDate effectiveFromDate, final String currencyCode,
|
|
||||||
final Integer fallbackNoCibilSlab, final String fallbackBelowMin, final String note, final Long createdById) {
|
|
||||||
final LoanRateRegisterEffective e = new LoanRateRegisterEffective();
|
|
||||||
e.name = name;
|
|
||||||
e.effectiveFromDate = effectiveFromDate;
|
|
||||||
e.currencyCode = currencyCode != null ? currencyCode : "INR";
|
|
||||||
e.isActive = true;
|
|
||||||
e.fallbackNoCibilSlab = fallbackNoCibilSlab != null ? fallbackNoCibilSlab : 2;
|
|
||||||
e.fallbackBelowMin = fallbackBelowMin != null ? fallbackBelowMin : "block";
|
|
||||||
e.note = note;
|
|
||||||
e.createdById = createdById;
|
|
||||||
e.createdDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Flip this version to inactive and close its effective window. Called when a newer version is approved. */
|
|
||||||
public void deactivate(final LocalDate toDate) {
|
|
||||||
this.isActive = false;
|
|
||||||
this.effectiveToDate = toDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright since 2025 Mifos Initiative
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Optional;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
public interface LoanRateRegisterEffectiveRepository extends JpaRepository<LoanRateRegisterEffective, Long> {
|
|
||||||
|
|
||||||
/** All active versions, newest-effective first. At most one row in a healthy system. */
|
|
||||||
List<LoanRateRegisterEffective> findByIsActiveTrueOrderByEffectiveFromDateDesc();
|
|
||||||
|
|
||||||
/** The current active version, if any. */
|
|
||||||
Optional<LoanRateRegisterEffective> findFirstByIsActiveTrueOrderByEffectiveFromDateDesc();
|
|
||||||
|
|
||||||
/** Version history list — all versions, newest first. */
|
|
||||||
List<LoanRateRegisterEffective> findAllByOrderByEffectiveFromDateDesc();
|
|
||||||
}
|
|
||||||
-52
@@ -1,52 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright since 2025 Mifos Initiative
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A "particular" (loan type) row of the Loan Interest Rate Register chart. The GL account is a
|
|
||||||
* property of the particular, so it lives here rather than on each rate-register version. Kept as a
|
|
||||||
* plain {@code gl_account_id} column (no relation) to avoid pulling the accounting module's entity
|
|
||||||
* graph into the loan module.
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "m_loan_rate_register_product")
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class LoanRateRegisterProduct {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Column(name = "sr_no", nullable = false)
|
|
||||||
private Integer srNo;
|
|
||||||
|
|
||||||
@Column(name = "name", length = 200, nullable = false)
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Column(name = "gl_account_id")
|
|
||||||
private Long glAccountId;
|
|
||||||
|
|
||||||
@Column(name = "is_active", nullable = false)
|
|
||||||
private Boolean isActive;
|
|
||||||
|
|
||||||
@Column(name = "created_date")
|
|
||||||
private LocalDateTime createdDate;
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright since 2025 Mifos Initiative
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
public interface LoanRateRegisterProductRepository extends JpaRepository<LoanRateRegisterProduct, Long> {
|
|
||||||
|
|
||||||
/** Active particulars in chart order. */
|
|
||||||
List<LoanRateRegisterProduct> findByIsActiveTrueOrderBySrNoAsc();
|
|
||||||
}
|
|
||||||
-98
@@ -1,98 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright since 2025 Mifos Initiative
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
|
||||||
|
|
||||||
import jakarta.persistence.Column;
|
|
||||||
import jakarta.persistence.Entity;
|
|
||||||
import jakarta.persistence.GeneratedValue;
|
|
||||||
import jakarta.persistence.GenerationType;
|
|
||||||
import jakarta.persistence.Id;
|
|
||||||
import jakarta.persistence.Table;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A single cell of a rate register version — one row per {product × amount-slab}. Product and slab
|
|
||||||
* metadata are denormalised so one query can rebuild the full matrix without a join. The cell holds
|
|
||||||
* either a plain numeric rate, a formula string ({@code "1% + FD"}) resolved at sanction, or
|
|
||||||
* N.A. (both value and formula null, {@code isNa=true}) to mean "slab not offered".
|
|
||||||
*/
|
|
||||||
@Entity
|
|
||||||
@Table(name = "m_loan_rate_register_slab_history")
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
public class LoanRateRegisterSlabHistory {
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Column(name = "effective_id", nullable = false)
|
|
||||||
private Long effectiveId;
|
|
||||||
|
|
||||||
// ---- product dimension ----------------------------------------------
|
|
||||||
/** Stable link to the master particular (and its GL). Null only for rows written before the master existed. */
|
|
||||||
@Column(name = "product_id")
|
|
||||||
private Long productId;
|
|
||||||
|
|
||||||
@Column(name = "product_sr_no", nullable = false)
|
|
||||||
private Integer productSrNo;
|
|
||||||
|
|
||||||
@Column(name = "product_name", length = 200, nullable = false)
|
|
||||||
private String productName;
|
|
||||||
|
|
||||||
// ---- amount-slab dimension ------------------------------------------
|
|
||||||
@Column(name = "slab_order", nullable = false)
|
|
||||||
private Integer slabOrder;
|
|
||||||
|
|
||||||
@Column(name = "slab_label", length = 60, nullable = false)
|
|
||||||
private String slabLabel;
|
|
||||||
|
|
||||||
@Column(name = "amount_upto")
|
|
||||||
private BigDecimal amountUpto;
|
|
||||||
|
|
||||||
// ---- cell value (exactly one of value / formula is populated; both null + isNa=true means N.A.) ----
|
|
||||||
@Column(name = "rate_value")
|
|
||||||
private BigDecimal rateValue;
|
|
||||||
|
|
||||||
@Column(name = "rate_formula", length = 50)
|
|
||||||
private String rateFormula;
|
|
||||||
|
|
||||||
@Column(name = "is_formula", nullable = false)
|
|
||||||
private Boolean isFormula;
|
|
||||||
|
|
||||||
@Column(name = "is_na", nullable = false)
|
|
||||||
private Boolean isNa;
|
|
||||||
|
|
||||||
@Column(name = "created_date")
|
|
||||||
private LocalDateTime createdDate;
|
|
||||||
|
|
||||||
public static LoanRateRegisterSlabHistory create(final Long effectiveId, final Long productId, final Integer productSrNo,
|
|
||||||
final String productName, final Integer slabOrder, final String slabLabel, final BigDecimal amountUpto,
|
|
||||||
final BigDecimal rateValue, final String rateFormula, final boolean isFormula, final boolean isNa) {
|
|
||||||
final LoanRateRegisterSlabHistory s = new LoanRateRegisterSlabHistory();
|
|
||||||
s.effectiveId = effectiveId;
|
|
||||||
s.productId = productId;
|
|
||||||
s.productSrNo = productSrNo;
|
|
||||||
s.productName = productName;
|
|
||||||
s.slabOrder = slabOrder;
|
|
||||||
s.slabLabel = slabLabel;
|
|
||||||
s.amountUpto = amountUpto;
|
|
||||||
s.rateValue = rateValue;
|
|
||||||
s.rateFormula = rateFormula;
|
|
||||||
s.isFormula = isFormula;
|
|
||||||
s.isNa = isNa;
|
|
||||||
s.createdDate = LocalDateTime.now(DateUtils.getDateTimeZoneOfTenant());
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright since 2025 Mifos Initiative
|
|
||||||
*
|
|
||||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
*/
|
|
||||||
package org.apache.fineract.portfolio.loanproduct.domain;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
public interface LoanRateRegisterSlabHistoryRepository extends JpaRepository<LoanRateRegisterSlabHistory, Long> {
|
|
||||||
|
|
||||||
/** All cells of a version, ordered by product then by amount-slab. Rebuilds the full matrix in order. */
|
|
||||||
List<LoanRateRegisterSlabHistory> findByEffectiveIdOrderByProductSrNoAscSlabOrderAsc(Long effectiveId);
|
|
||||||
}
|
|
||||||
-243
@@ -1,243 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.accounting.balancesheet.api;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import jakarta.ws.rs.Consumes;
|
|
||||||
import jakarta.ws.rs.GET;
|
|
||||||
import jakarta.ws.rs.Path;
|
|
||||||
import jakarta.ws.rs.Produces;
|
|
||||||
import jakarta.ws.rs.QueryParam;
|
|
||||||
import jakarta.ws.rs.core.MediaType;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
|
||||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An "as on date" balance sheet built directly off the live chart of accounts and journal entries,
|
|
||||||
* rather than a stock Fineract trial balance report — this reproduces the specific sub-group-wise
|
|
||||||
* layout this bank's own paper balance sheet uses: every top-level Header account (Capital, Deposit
|
|
||||||
* Account, Other Liabilities, ...) is one named block, with its Detail (and any nested Header)
|
|
||||||
* children indented underneath it and a subtotal on the block itself. A Detail account with no
|
|
||||||
* Header at all (see GLAccountTransactionGuard's sibling concern - some accounts are seeded standalone)
|
|
||||||
* still needs to appear somewhere, so it is listed as its own root-level line rather than silently
|
|
||||||
* dropped.
|
|
||||||
*
|
|
||||||
* A Header account never itself carries a journal entry (see the header/detail discussion this
|
|
||||||
* feature grew out of), so its balance is always the recursive sum of its children - never read off
|
|
||||||
* acc_gl_journal_entry directly.
|
|
||||||
*/
|
|
||||||
@Path("/v1/accounting/balancesheet")
|
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Produces({ MediaType.APPLICATION_JSON })
|
|
||||||
public class BalanceSheetApiResource {
|
|
||||||
|
|
||||||
private static final String RESOURCE_NAME_FOR_PERMISSION = "GLACCOUNT";
|
|
||||||
|
|
||||||
private final PlatformSecurityContext context;
|
|
||||||
private final JdbcTemplate jdbcTemplate;
|
|
||||||
private final Gson gson = new Gson();
|
|
||||||
|
|
||||||
// classification_enum values (see acc_gl_account / GLAccountType).
|
|
||||||
private static final int ASSET = 1;
|
|
||||||
private static final int LIABILITY = 2;
|
|
||||||
private static final int EQUITY = 3;
|
|
||||||
private static final int INCOME = 4;
|
|
||||||
private static final int EXPENSE = 5;
|
|
||||||
// account_usage values (see GLAccountUsage).
|
|
||||||
private static final int DETAIL = 1;
|
|
||||||
private static final int HEADER = 2;
|
|
||||||
|
|
||||||
private static final class Node {
|
|
||||||
|
|
||||||
Long id;
|
|
||||||
String name;
|
|
||||||
String glCode;
|
|
||||||
int usage;
|
|
||||||
int classification;
|
|
||||||
Long parentId;
|
|
||||||
BigDecimal ownBalance = BigDecimal.ZERO;
|
|
||||||
final List<Node> children = new ArrayList<>();
|
|
||||||
|
|
||||||
BigDecimal balance() {
|
|
||||||
if (usage == DETAIL) {
|
|
||||||
return ownBalance;
|
|
||||||
}
|
|
||||||
BigDecimal sum = BigDecimal.ZERO;
|
|
||||||
for (final Node child : children) {
|
|
||||||
sum = sum.add(child.balance());
|
|
||||||
}
|
|
||||||
return sum;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Object> toJson() {
|
|
||||||
final Map<String, Object> json = new LinkedHashMap<>();
|
|
||||||
json.put("id", id);
|
|
||||||
json.put("name", name);
|
|
||||||
json.put("glCode", glCode);
|
|
||||||
json.put("usage", usage == HEADER ? "HEADER" : "DETAIL");
|
|
||||||
json.put("balance", balance());
|
|
||||||
final List<Map<String, Object>> childJson = new ArrayList<>();
|
|
||||||
for (final Node child : children) {
|
|
||||||
childJson.add(child.toJson());
|
|
||||||
}
|
|
||||||
json.put("children", childJson);
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@GET
|
|
||||||
@Consumes({ MediaType.APPLICATION_JSON })
|
|
||||||
public String retrieveBalanceSheet(@QueryParam("asOnDate") final String asOnDateParam,
|
|
||||||
@QueryParam("officeId") final Long officeId) {
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSION);
|
|
||||||
|
|
||||||
final LocalDate asOnDate = (asOnDateParam == null || asOnDateParam.isBlank()) ? DateUtils.getBusinessLocalDate()
|
|
||||||
: LocalDate.parse(asOnDateParam);
|
|
||||||
|
|
||||||
final Map<Long, Node> nodesById = new LinkedHashMap<>();
|
|
||||||
for (final Map<String, Object> row : this.jdbcTemplate.queryForList(
|
|
||||||
"SELECT id, name, gl_code, parent_id, account_usage, classification_enum FROM acc_gl_account "
|
|
||||||
+ "WHERE disabled = false ORDER BY gl_code")) {
|
|
||||||
final Node node = new Node();
|
|
||||||
node.id = ((Number) row.get("id")).longValue();
|
|
||||||
node.name = (String) row.get("name");
|
|
||||||
node.glCode = (String) row.get("gl_code");
|
|
||||||
node.parentId = row.get("parent_id") == null ? null : ((Number) row.get("parent_id")).longValue();
|
|
||||||
node.usage = ((Number) row.get("account_usage")).intValue();
|
|
||||||
node.classification = ((Number) row.get("classification_enum")).intValue();
|
|
||||||
nodesById.put(node.id, node);
|
|
||||||
}
|
|
||||||
|
|
||||||
// entry_date (not transaction_date) and "reversed = false" are this codebase's settled
|
|
||||||
// convention for reading balances off the ledger - ProfitAndLossApiResource, the dividend
|
|
||||||
// reports and IncomeProfitTransferService all cut the same way, so this report agrees with
|
|
||||||
// them rather than quietly producing a second set of numbers.
|
|
||||||
//
|
|
||||||
// The reversal_id exclusion covers a case that plain "reversed = false" gets wrong. This
|
|
||||||
// codebase reverses in two different ways: the clerk/sponsor-DD undo paths just flip the
|
|
||||||
// flag on the original leg (no counter entry - excluding it is exactly right), while
|
|
||||||
// Fineract's own revertJournalEntry additionally posts an opposite-sign counter entry and
|
|
||||||
// links it back through reversal_id. For that second kind, dropping only the original would
|
|
||||||
// leave its counter entry standing alone and swing the balance by the full amount in the
|
|
||||||
// wrong direction, so the counter entry has to go too.
|
|
||||||
final Map<Long, BigDecimal[]> balances = new LinkedHashMap<>();
|
|
||||||
final String balanceSql = "SELECT account_id, "
|
|
||||||
+ "COALESCE(SUM(CASE WHEN type_enum = 2 THEN amount ELSE 0 END), 0) AS total_debit, "
|
|
||||||
+ "COALESCE(SUM(CASE WHEN type_enum = 1 THEN amount ELSE 0 END), 0) AS total_credit "
|
|
||||||
+ "FROM acc_gl_journal_entry WHERE entry_date <= ? "
|
|
||||||
+ "AND (reversed IS NULL OR reversed = false) "
|
|
||||||
+ "AND id NOT IN (SELECT reversal_id FROM acc_gl_journal_entry WHERE reversal_id IS NOT NULL)"
|
|
||||||
+ (officeId != null ? " AND office_id = ?" : "") + " GROUP BY account_id";
|
|
||||||
final List<Map<String, Object>> balanceRows = officeId != null
|
|
||||||
? this.jdbcTemplate.queryForList(balanceSql, java.sql.Date.valueOf(asOnDate), officeId)
|
|
||||||
: this.jdbcTemplate.queryForList(balanceSql, java.sql.Date.valueOf(asOnDate));
|
|
||||||
for (final Map<String, Object> row : balanceRows) {
|
|
||||||
balances.put(((Number) row.get("account_id")).longValue(),
|
|
||||||
new BigDecimal[] { (BigDecimal) row.get("total_debit"), (BigDecimal) row.get("total_credit") });
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final Node node : nodesById.values()) {
|
|
||||||
if (node.usage != DETAIL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final BigDecimal[] debitCredit = balances.get(node.id);
|
|
||||||
if (debitCredit == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
final boolean debitNatured = node.classification == ASSET || node.classification == EXPENSE;
|
|
||||||
node.ownBalance = debitNatured ? debitCredit[0].subtract(debitCredit[1]) : debitCredit[1].subtract(debitCredit[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<Node> roots = new ArrayList<>();
|
|
||||||
for (final Node node : nodesById.values()) {
|
|
||||||
if (node.parentId == null) {
|
|
||||||
roots.add(node);
|
|
||||||
} else {
|
|
||||||
final Node parent = nodesById.get(node.parentId);
|
|
||||||
if (parent != null) {
|
|
||||||
parent.children.add(node);
|
|
||||||
} else {
|
|
||||||
// Parent was disabled (filtered out above) - surface this node at the top level
|
|
||||||
// rather than silently losing its balance from the report.
|
|
||||||
roots.add(node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final Map<String, Object> debitSide = buildSide("ASSETS", roots, ASSET, EXPENSE);
|
|
||||||
final Map<String, Object> creditSide = buildSide("LIABILITIES", roots, LIABILITY, EQUITY, INCOME);
|
|
||||||
|
|
||||||
final Map<String, Object> response = new LinkedHashMap<>();
|
|
||||||
response.put("asOnDate", asOnDate.toString());
|
|
||||||
response.put("officeId", officeId);
|
|
||||||
response.put("debitSide", debitSide);
|
|
||||||
response.put("creditSide", creditSide);
|
|
||||||
return this.gson.toJson(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, Object> buildSide(final String label, final List<Node> roots, final int... classifications) {
|
|
||||||
final List<Map<String, Object>> groups = new ArrayList<>();
|
|
||||||
BigDecimal sideTotal = BigDecimal.ZERO;
|
|
||||||
for (final int classification : classifications) {
|
|
||||||
final List<Map<String, Object>> nodeJsons = new ArrayList<>();
|
|
||||||
BigDecimal groupTotal = BigDecimal.ZERO;
|
|
||||||
for (final Node root : roots) {
|
|
||||||
if (root.classification != classification) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
nodeJsons.add(root.toJson());
|
|
||||||
groupTotal = groupTotal.add(root.balance());
|
|
||||||
}
|
|
||||||
if (!nodeJsons.isEmpty()) {
|
|
||||||
final Map<String, Object> group = new LinkedHashMap<>();
|
|
||||||
group.put("classification", classificationLabel(classification));
|
|
||||||
group.put("total", groupTotal);
|
|
||||||
group.put("nodes", nodeJsons);
|
|
||||||
groups.add(group);
|
|
||||||
sideTotal = sideTotal.add(groupTotal);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
final Map<String, Object> side = new LinkedHashMap<>();
|
|
||||||
side.put("label", label);
|
|
||||||
side.put("total", sideTotal);
|
|
||||||
side.put("groups", groups);
|
|
||||||
return side;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String classificationLabel(final int classification) {
|
|
||||||
return switch (classification) {
|
|
||||||
case ASSET -> "ASSET";
|
|
||||||
case LIABILITY -> "LIABILITY";
|
|
||||||
case EQUITY -> "EQUITY";
|
|
||||||
case INCOME -> "INCOME";
|
|
||||||
case EXPENSE -> "EXPENSE";
|
|
||||||
default -> "OTHER";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-112
@@ -1,112 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.accounting.common;
|
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.apache.fineract.accounting.common.AccountingConstants.FinancialActivity;
|
|
||||||
import org.apache.fineract.infrastructure.core.exception.GeneralPlatformDomainRuleException;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resolves the GL accounts the dividend lifecycle posts to, from the Financial Activity Mappings an administrator
|
|
||||||
* configures.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* These accounts used to be found by hardcoded GL code - {@code BANKPROFITND01} and {@code BANKPROFIT01} - spread
|
|
||||||
* across five classes. A society whose chart of accounts did not happen to use those exact codes got no dividend
|
|
||||||
* journal entries at all, and nothing said so: every call site checked for null and returned quietly. Reading them from
|
|
||||||
* the mapping table instead lets each society name its own accounts, and keeps the whole lifecycle answerable from one
|
|
||||||
* screen.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Resolution is mapping-only, with no fallback to the old codes: a society that has not mapped an account has not made
|
|
||||||
* the decision yet, and quietly posting to an account it never chose is worse than refusing. Every method here throws
|
|
||||||
* rather than returning null, so a missing mapping surfaces at the point of posting with the name of the activity to
|
|
||||||
* configure, instead of leaving a declaration that appears to have worked but moved nothing.
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class DividendGlAccountResolver {
|
|
||||||
|
|
||||||
private final JdbcTemplate jdbcTemplate;
|
|
||||||
|
|
||||||
/** The year's closed-out profit a dividend is declared against. */
|
|
||||||
public Long distributableProfitAccount() {
|
|
||||||
return requireMapped(FinancialActivity.DISTRIBUTABLE_PROFIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Where profit settles once it is no longer distributable: the undistributed remainder, rounding, forfeitures. */
|
|
||||||
public Long retainedProfitAccount() {
|
|
||||||
return requireMapped(FinancialActivity.RETAINED_PROFIT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Equity the declared profit is set aside in, between declaration and board approval. */
|
|
||||||
public Long reserveForDividendAccount() {
|
|
||||||
return requireMapped(FinancialActivity.RESERVE_FOR_DIVIDEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The liability to members, created on approval and discharged as each member claims. */
|
|
||||||
public Long payableDividendsAccount() {
|
|
||||||
return requireMapped(FinancialActivity.PAYABLE_DIVIDENDS);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Where the paise a dividend cannot divide evenly are swept.
|
|
||||||
*
|
|
||||||
* Falls back to retained profit when unmapped, which is exactly where the residue went before this account existed
|
|
||||||
* - so a society that does not care to separate it keeps the behaviour it already had, and one that maps it gets
|
|
||||||
* the arithmetic artefact out of a figure it reads as a business result. This is a presentation choice rather than
|
|
||||||
* a decision the society has failed to make, which is why it resolves rather than throwing.
|
|
||||||
*/
|
|
||||||
public Long dividendRoundOffAccount() {
|
|
||||||
final Long roundOff = mappedAccount(FinancialActivity.DIVIDEND_ROUND_OFF);
|
|
||||||
return roundOff != null ? roundOff : retainedProfitAccount();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Contra the claim is routed through, so claimed and unclaimed read as two balances rather than one net figure.
|
|
||||||
*
|
|
||||||
* Optional by design - a society that has not mapped it still gets a correct payout, posted straight from Dividend
|
|
||||||
* Payable, just without that separate measure. This is the one account here that may legitimately be absent, so it
|
|
||||||
* returns null instead of throwing.
|
|
||||||
*/
|
|
||||||
public Long dividendPaidAccountOrNull() {
|
|
||||||
return mappedAccount(FinancialActivity.DIVIDEND_PAID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The GL mapped to an activity, or null when the society has not configured it. */
|
|
||||||
public Long mappedAccount(final FinancialActivity activity) {
|
|
||||||
return this.jdbcTemplate
|
|
||||||
.queryForList("SELECT gl_account_id FROM acc_gl_financial_activity_account WHERE financial_activity_type = ?", Long.class,
|
|
||||||
activity.getValue())
|
|
||||||
.stream().findFirst().orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Long requireMapped(final FinancialActivity activity) {
|
|
||||||
final Long glAccountId = mappedAccount(activity);
|
|
||||||
if (glAccountId == null) {
|
|
||||||
throw new GeneralPlatformDomainRuleException("error.msg.financial.activity.mapping." + activity.getCode() + ".not.configured",
|
|
||||||
"No GL account is mapped to the '" + activity + "' financial activity. Map one under Accounting > Financial Activity "
|
|
||||||
+ "Mappings before running the dividend cycle.",
|
|
||||||
activity.getValue());
|
|
||||||
}
|
|
||||||
return glAccountId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-185
@@ -1,185 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.accounting.dividendpaidreport.api;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.ws.rs.GET;
|
|
||||||
import jakarta.ws.rs.Path;
|
|
||||||
import jakarta.ws.rs.Produces;
|
|
||||||
import jakarta.ws.rs.core.MediaType;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Every declared dividend, financial year by financial year: how much was declared, how much members have collected,
|
|
||||||
* how much is still unclaimed, and how much has come back to profit.
|
|
||||||
*
|
|
||||||
* The GL accounts are shared across years, so their balances only ever give running totals — "how much of FY 2026-27 is
|
|
||||||
* still unclaimed" cannot be read off Dividend Payable. This walks the declarations themselves instead: locks carry the
|
|
||||||
* per-member entitlement and their status says what became of it, which is the authoritative record. The GL is where the
|
|
||||||
* money moved; the locks are what it moved for.
|
|
||||||
*
|
|
||||||
* The columns mirror the money's actual path, which begins and ends in the same place:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* declare Dr Bank Profit Cr Dividend Payable
|
|
||||||
* member claims Dr Dividend Payable Cr Dividend Paid → Cr Sponsor DD Payable
|
|
||||||
* 3 yrs unclaimed Dr Dividend Payable Cr Bank Profit
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* So for a closed year, claimed + forfeited + rounding residue should account for the whole declaration; anything left
|
|
||||||
* is what is still sitting unclaimed and still within its three-year window.
|
|
||||||
*/
|
|
||||||
@Path("/v1/accounting/dividend-yearwise-report")
|
|
||||||
@Component
|
|
||||||
@Tag(name = "Dividend Year-wise Report", description = "Declared, claimed, unclaimed and forfeited dividend per financial year.")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class DividendYearwiseReportApiResource {
|
|
||||||
|
|
||||||
private static final String RESOURCE_NAME_FOR_PERMISSIONS = "DIVIDEND_SHAREPRODUCT";
|
|
||||||
|
|
||||||
private final JdbcTemplate jdbcTemplate;
|
|
||||||
private final PlatformSecurityContext context;
|
|
||||||
private final Gson gson = new GsonBuilder().serializeNulls().create();
|
|
||||||
|
|
||||||
@GET
|
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
|
||||||
public String report() {
|
|
||||||
this.context.authenticatedUser().validateHasReadPermission(RESOURCE_NAME_FOR_PERMISSIONS);
|
|
||||||
|
|
||||||
// A declaration is labelled by the financial year its period CLOSES in, which is how a member
|
|
||||||
// and an auditor both refer to it: a period ending 31-Mar-2027 is FY 2026-27. Locks are joined
|
|
||||||
// through the per-member detail rather than counted off the declaration, because a lock is only
|
|
||||||
// created for a member who actually had something to collect.
|
|
||||||
// Declared amounts and lock outcomes are aggregated separately before being joined by year.
|
|
||||||
// Summing the declaration amount across a join to its locks would multiply it by the number
|
|
||||||
// of members it was split between.
|
|
||||||
final List<Map<String, Object>> rows = jdbcTemplate.queryForList("""
|
|
||||||
WITH fy AS (
|
|
||||||
SELECT d.id,
|
|
||||||
CASE WHEN EXTRACT(MONTH FROM d.dividend_period_end_date) >= 4
|
|
||||||
THEN EXTRACT(YEAR FROM d.dividend_period_end_date)
|
|
||||||
ELSE EXTRACT(YEAR FROM d.dividend_period_end_date) - 1 END AS fy_start,
|
|
||||||
d.amount
|
|
||||||
FROM m_share_product_dividend_pay_out d
|
|
||||||
),
|
|
||||||
declared AS (
|
|
||||||
SELECT fy_start, COUNT(*) AS declaration_count, SUM(amount) AS declared_amount
|
|
||||||
FROM fy GROUP BY fy_start
|
|
||||||
),
|
|
||||||
outcomes AS (
|
|
||||||
SELECT fy.fy_start,
|
|
||||||
COALESCE(SUM(CASE WHEN l.status = 'CLAIMED' THEN l.amount ELSE 0 END), 0) AS claimed_amount,
|
|
||||||
COUNT(l.id) FILTER (WHERE l.status = 'CLAIMED') AS claimed_count,
|
|
||||||
COALESCE(SUM(CASE WHEN l.status = 'UNCLAIMED' THEN l.amount ELSE 0 END), 0) AS unclaimed_amount,
|
|
||||||
COUNT(l.id) FILTER (WHERE l.status = 'UNCLAIMED') AS unclaimed_count,
|
|
||||||
COALESCE(SUM(CASE WHEN l.status = 'FORFEITED' THEN l.amount ELSE 0 END), 0) AS forfeited_amount,
|
|
||||||
COUNT(l.id) FILTER (WHERE l.status = 'FORFEITED') AS forfeited_count,
|
|
||||||
MIN(l.release_due_date) FILTER (WHERE l.status = 'UNCLAIMED') AS earliest_release_due
|
|
||||||
FROM fy
|
|
||||||
LEFT JOIN m_share_account_dividend_details sad ON sad.dividend_pay_out_id = fy.id
|
|
||||||
LEFT JOIN m_share_dividend_lock l ON l.dividend_detail_id = sad.id
|
|
||||||
GROUP BY fy.fy_start
|
|
||||||
)
|
|
||||||
SELECT d.fy_start, d.declaration_count, d.declared_amount,
|
|
||||||
COALESCE(o.claimed_amount, 0) AS claimed_amount, COALESCE(o.claimed_count, 0) AS claimed_count,
|
|
||||||
COALESCE(o.unclaimed_amount, 0) AS unclaimed_amount, COALESCE(o.unclaimed_count, 0) AS unclaimed_count,
|
|
||||||
COALESCE(o.forfeited_amount, 0) AS forfeited_amount, COALESCE(o.forfeited_count, 0) AS forfeited_count,
|
|
||||||
o.earliest_release_due
|
|
||||||
FROM declared d
|
|
||||||
LEFT JOIN outcomes o ON o.fy_start = d.fy_start
|
|
||||||
ORDER BY d.fy_start DESC
|
|
||||||
""");
|
|
||||||
|
|
||||||
// Rounding residue is tracked per declaration rather than per lock — it never belonged to a
|
|
||||||
// member, so no lock was ever created for it. Pulled separately and matched by year.
|
|
||||||
final Map<String, BigDecimal> residueByYear = new LinkedHashMap<>();
|
|
||||||
for (final Map<String, Object> row : jdbcTemplate.queryForList("""
|
|
||||||
SELECT CASE WHEN EXTRACT(MONTH FROM period_end_date) >= 4
|
|
||||||
THEN EXTRACT(YEAR FROM period_end_date)
|
|
||||||
ELSE EXTRACT(YEAR FROM period_end_date) - 1 END AS fy_start,
|
|
||||||
COALESCE(SUM(residue_amount), 0) AS residue
|
|
||||||
FROM m_share_dividend_rounding_residue
|
|
||||||
GROUP BY fy_start
|
|
||||||
""")) {
|
|
||||||
residueByYear.put(financialYearLabel(((Number) row.get("fy_start")).intValue()), (BigDecimal) row.get("residue"));
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<Map<String, Object>> years = new ArrayList<>();
|
|
||||||
BigDecimal totalDeclared = BigDecimal.ZERO;
|
|
||||||
BigDecimal totalClaimed = BigDecimal.ZERO;
|
|
||||||
BigDecimal totalUnclaimed = BigDecimal.ZERO;
|
|
||||||
BigDecimal totalForfeited = BigDecimal.ZERO;
|
|
||||||
|
|
||||||
for (final Map<String, Object> row : rows) {
|
|
||||||
final String financialYear = financialYearLabel(((Number) row.get("fy_start")).intValue());
|
|
||||||
final BigDecimal declared = (BigDecimal) row.get("declared_amount");
|
|
||||||
final BigDecimal claimed = (BigDecimal) row.get("claimed_amount");
|
|
||||||
final BigDecimal unclaimed = (BigDecimal) row.get("unclaimed_amount");
|
|
||||||
final BigDecimal forfeited = (BigDecimal) row.get("forfeited_amount");
|
|
||||||
final BigDecimal residue = residueByYear.getOrDefault(financialYear, BigDecimal.ZERO);
|
|
||||||
|
|
||||||
final Map<String, Object> entry = new LinkedHashMap<>();
|
|
||||||
entry.put("financialYear", financialYear);
|
|
||||||
entry.put("declarationCount", row.get("declaration_count"));
|
|
||||||
entry.put("declaredAmount", declared);
|
|
||||||
entry.put("claimedAmount", claimed);
|
|
||||||
entry.put("claimedCount", row.get("claimed_count"));
|
|
||||||
entry.put("unclaimedAmount", unclaimed);
|
|
||||||
entry.put("unclaimedCount", row.get("unclaimed_count"));
|
|
||||||
entry.put("forfeitedAmount", forfeited);
|
|
||||||
entry.put("forfeitedCount", row.get("forfeited_count"));
|
|
||||||
entry.put("roundingResidueAmount", residue);
|
|
||||||
// What has already gone back to profit for this year: forfeited entitlements plus the
|
|
||||||
// rounding residue swept at declaration time.
|
|
||||||
entry.put("returnedToProfitAmount", forfeited.add(residue));
|
|
||||||
// When this year's oldest unclaimed lock forfeits — the date the remaining unclaimed
|
|
||||||
// amount starts returning to profit.
|
|
||||||
entry.put("earliestReleaseDueDate",
|
|
||||||
row.get("earliest_release_due") == null ? null : String.valueOf(row.get("earliest_release_due")));
|
|
||||||
years.add(entry);
|
|
||||||
|
|
||||||
totalDeclared = totalDeclared.add(declared);
|
|
||||||
totalClaimed = totalClaimed.add(claimed);
|
|
||||||
totalUnclaimed = totalUnclaimed.add(unclaimed);
|
|
||||||
totalForfeited = totalForfeited.add(forfeited);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Map<String, Object> response = new LinkedHashMap<>();
|
|
||||||
response.put("years", years);
|
|
||||||
response.put("totalDeclared", totalDeclared);
|
|
||||||
response.put("totalClaimed", totalClaimed);
|
|
||||||
response.put("totalUnclaimed", totalUnclaimed);
|
|
||||||
response.put("totalForfeited", totalForfeited);
|
|
||||||
return gson.toJson(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String financialYearLabel(final int startYear) {
|
|
||||||
return startYear + "-" + String.format("%02d", (startYear + 1) % 100);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-103
@@ -1,103 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.accounting.glaccount.validation;
|
|
||||||
|
|
||||||
import org.apache.fineract.accounting.glaccount.domain.GLAccountUsage;
|
|
||||||
import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityException;
|
|
||||||
import org.springframework.dao.EmptyResultDataAccessException;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Header GL account (account_usage = HEADER) is a pure grouping node in the chart-of-accounts tree - it
|
|
||||||
* exists to organize Detail accounts underneath it, never to receive a transaction itself. The standard
|
|
||||||
* Fineract journal-entry command path (JournalEntryWritePlatformServiceJpaRepositoryImpl) never checked
|
|
||||||
* this - only "disabled" and "manual entries allowed" - and several features in this codebase post journal
|
|
||||||
* entries via direct JDBC INSERT into acc_gl_journal_entry, bypassing that command path entirely. This is
|
|
||||||
* the one shared check every such call site uses so a Header account can never end up with its own
|
|
||||||
* transaction (which would silently break every report that assumes a Header's balance is just the sum of
|
|
||||||
* its Detail children).
|
|
||||||
*/
|
|
||||||
public final class GLAccountTransactionGuard {
|
|
||||||
|
|
||||||
private GLAccountTransactionGuard() {}
|
|
||||||
|
|
||||||
public static void assertPostable(final JdbcTemplate jdbcTemplate, final Long glAccountId) {
|
|
||||||
if (glAccountId == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final Integer usage;
|
|
||||||
try {
|
|
||||||
usage = jdbcTemplate.queryForObject("SELECT account_usage FROM acc_gl_account WHERE id = ?", Integer.class, glAccountId);
|
|
||||||
} catch (final EmptyResultDataAccessException e) {
|
|
||||||
throw new PlatformDataIntegrityException("error.msg.glaccount.not.found",
|
|
||||||
"GL account with id " + glAccountId + " does not exist.", "glAccountId", glAccountId);
|
|
||||||
}
|
|
||||||
if (GLAccountUsage.HEADER.getValue().equals(usage)) {
|
|
||||||
throw new PlatformDataIntegrityException("error.msg.glaccount.header.account.not.postable",
|
|
||||||
"GL account " + glAccountId + " is a Header account (a chart-of-accounts grouping node) and cannot receive a "
|
|
||||||
+ "transaction directly. Select a Detail account instead.",
|
|
||||||
"glAccountId", glAccountId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Refuses to draw more out of a holding account than it holds.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A suspense or sundry account exists to hold money on its way somewhere else, so what is in it
|
|
||||||
* is the whole of what can come out. Drawing more leaves it with a negative balance, and a
|
|
||||||
* liability with a negative balance is not a small number - it says the bank owes less than
|
|
||||||
* nothing, which is not a state that exists. It also breaks the balance sheet by the overdraw,
|
|
||||||
* and the figure is small enough to sit unnoticed inside a head that totals positive.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Checked here rather than at each call site because the accounts this protects are reached by
|
|
||||||
* several features posting directly through JDBC, and a rule enforced in one of them is a rule
|
|
||||||
* the next one added will not have.
|
|
||||||
*
|
|
||||||
* @param glAccountId the account being drawn on.
|
|
||||||
* @param amount how much the caller wants to take out.
|
|
||||||
* @param what the account's role in the caller's own words, for the message a clerk reads.
|
|
||||||
*/
|
|
||||||
public static void assertSufficientBalance(final JdbcTemplate jdbcTemplate, final Long glAccountId,
|
|
||||||
final java.math.BigDecimal amount, final String what) {
|
|
||||||
if (glAccountId == null || amount == null || amount.signum() <= 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Credits less debits: these are liability-natured holding accounts, so the balance is what
|
|
||||||
// is still owed onward. Reversed entries and the entries they reverse both drop out - a
|
|
||||||
// reversal pair nets to nothing, and counting either side alone moves the balance by the
|
|
||||||
// whole amount.
|
|
||||||
final java.math.BigDecimal held = jdbcTemplate.queryForObject("""
|
|
||||||
SELECT COALESCE(SUM(CASE WHEN type_enum = 1 THEN amount ELSE -amount END), 0)
|
|
||||||
FROM acc_gl_journal_entry
|
|
||||||
WHERE account_id = ?
|
|
||||||
AND (reversed IS NULL OR reversed = false)
|
|
||||||
AND id NOT IN (SELECT reversal_id FROM acc_gl_journal_entry WHERE reversal_id IS NOT NULL)
|
|
||||||
""", java.math.BigDecimal.class, glAccountId);
|
|
||||||
final java.math.BigDecimal balance = held == null ? java.math.BigDecimal.ZERO : held;
|
|
||||||
if (balance.compareTo(amount) < 0) {
|
|
||||||
throw new PlatformDataIntegrityException("error.msg.glaccount.insufficient.balance",
|
|
||||||
what + " holds " + balance + " but " + amount + " was asked of it. Drawing the "
|
|
||||||
+ "difference would leave the account with a negative balance, which a "
|
|
||||||
+ "holding account cannot have.",
|
|
||||||
"glAccountId", glAccountId, amount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1435
-1746
File diff suppressed because it is too large
Load Diff
+6
-22
@@ -173,28 +173,12 @@ public class AccrualBasedAccountingProcessorForSavings implements AccountingProc
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (savingsTransactionDTO.getTransactionType().isInterestPosting()) {
|
else if (savingsTransactionDTO.getTransactionType().isInterestPosting()) {
|
||||||
// A premature FD closure that reprices interest downward (see
|
// Post journal entry if earned interest amount is greater than
|
||||||
// FixedDepositAccount#postPreMaturityInterest) posts the difference as a NEGATIVE
|
// zero
|
||||||
// interest-posting transaction -- a clawback of interest already recognised in earlier
|
if (savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
// periods, not "zero interest, nothing to post". Skipping it here (the original
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||||
// "amount > 0" guard) left the FD subledger showing the clawback while the GL never
|
AccrualAccountsForSavings.INTEREST_PAYABLE.getValue(), AccrualAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||||
// recorded it, silently going out of sync. Treating a negative amount as a mirror-image
|
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||||
// reversal -- positive magnitude, debit/credit legs swapped, same mechanism
|
|
||||||
// createInterestPostingJournalEntriesForSavings already uses for isReversal -- keeps the two
|
|
||||||
// in sync instead. See CashBasedAccountingProcessorForSavings for the same fix on the
|
|
||||||
// cash-based path.
|
|
||||||
final int amountSign = savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO);
|
|
||||||
if (amountSign != 0) {
|
|
||||||
final boolean isClawback = amountSign < 0;
|
|
||||||
final BigDecimal postingAmount = isClawback ? amount.abs() : amount;
|
|
||||||
final boolean effectiveIsReversal = isReversal ^ isClawback;
|
|
||||||
// Routed through the same helper the cash processor uses, so a posting states
|
|
||||||
// the whole chain the product is configured for -- out of the payable, through
|
|
||||||
// the interest-paid account, into the member's balance -- rather than the single
|
|
||||||
// payable-to-control pair that used to be here, which skipped interest-paid
|
|
||||||
// entirely and left the expense off the P&L.
|
|
||||||
this.helper.createInterestPostingJournalEntriesForSavings(office, currencyCode, savingsProductId, paymentTypeId,
|
|
||||||
savingsId, transactionId, transactionDate, postingAmount, effectiveIsReversal);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-20
@@ -167,26 +167,12 @@ public class CashBasedAccountingProcessorForSavings implements AccountingProcess
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (savingsTransactionDTO.getTransactionType().isInterestPosting()) {
|
else if (savingsTransactionDTO.getTransactionType().isInterestPosting()) {
|
||||||
// A premature FD closure that reprices interest downward (see
|
// Post journal entry if earned interest amount is greater than
|
||||||
// FixedDepositAccount#postPreMaturityInterest) posts the difference as a NEGATIVE
|
// zero
|
||||||
// interest-posting transaction -- a clawback of interest already recognised in earlier
|
if (savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
// periods, not "zero interest, nothing to post". Skipping it here (the original
|
this.helper.createCashBasedJournalEntriesAndReversalsForSavings(office, currencyCode,
|
||||||
// "amount > 0" guard) left the FD subledger showing the clawback while the GL never
|
CashAccountsForSavings.INTEREST_ON_SAVINGS.getValue(), CashAccountsForSavings.SAVINGS_CONTROL.getValue(),
|
||||||
// recorded it, silently going out of sync. Treating a negative amount as a mirror-image
|
savingsProductId, paymentTypeId, savingsId, transactionId, transactionDate, amount, isReversal);
|
||||||
// reversal -- positive magnitude, debit/credit legs swapped, same mechanism
|
|
||||||
// createInterestPostingJournalEntriesForSavings already uses for isReversal -- keeps the two
|
|
||||||
// in sync instead.
|
|
||||||
final int amountSign = savingsTransactionDTO.getAmount().compareTo(BigDecimal.ZERO);
|
|
||||||
if (amountSign != 0) {
|
|
||||||
final boolean isClawback = amountSign < 0;
|
|
||||||
final BigDecimal postingAmount = isClawback ? amount.abs() : amount;
|
|
||||||
final boolean effectiveIsReversal = isReversal ^ isClawback;
|
|
||||||
// Routed through the payable and paid accounts the product names, so the society
|
|
||||||
// can read interest declared but not yet credited as its own balance. Collapses
|
|
||||||
// to the plain Dr Interest On Savings / Cr Savings Control pair for a product
|
|
||||||
// that names neither.
|
|
||||||
this.helper.createInterestPostingJournalEntriesForSavings(office, currencyCode, savingsProductId, paymentTypeId,
|
|
||||||
savingsId, transactionId, transactionDate, postingAmount, effectiveIsReversal);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-17
@@ -105,23 +105,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
.append(" journalEntry.currency_code as currencyCode, curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ")
|
.append(" journalEntry.currency_code as currencyCode, curr.name as currencyName, curr.internationalized_name_code as currencyNameCode, ")
|
||||||
.append(" curr.display_symbol as currencyDisplaySymbol, curr.decimal_places as currencyDigits, curr.currency_multiplesof as inMultiplesOf, ")
|
.append(" curr.display_symbol as currencyDisplaySymbol, curr.decimal_places as currencyDigits, curr.currency_multiplesof as inMultiplesOf, ")
|
||||||
.append(" eao.external_id as externalAssetOwner, ")
|
.append(" eao.external_id as externalAssetOwner, ")
|
||||||
// entity_type_enum=6 (PortfolioProductType.CURRENT) unambiguously names a row in
|
|
||||||
// m_current_account -- newer write paths tag current-account entries with it
|
|
||||||
// instead of reusing SAVING's type, specifically so this case needs no guessing.
|
|
||||||
//
|
|
||||||
// entity_type_enum=2 (PortfolioProductType.SAVING) is still written for BOTH savings
|
|
||||||
// and current-account entries by older write paths not yet updated to the above --
|
|
||||||
// current products used to deliberately share SAVING's GL type space (see
|
|
||||||
// PortfolioProductType.CURRENT's own comment) -- and m_savings_account/
|
|
||||||
// m_current_account each have their own id sequence, so an entity_id can be a real
|
|
||||||
// row in both, making a plain COALESCE(ca.account_no, sa.account_no) pick the current
|
|
||||||
// account's number even for an entry that is genuinely a savings one.
|
|
||||||
// savings_transaction_id is the one unambiguous signal available for those older
|
|
||||||
// entries -- only a real savings transaction sets it -- so it decides first; only
|
|
||||||
// when it's absent does the current-account guess apply.
|
|
||||||
.append(" CASE ")
|
.append(" CASE ")
|
||||||
.append(" WHEN journalEntry.entity_type_enum = 6 THEN ca.account_no ")
|
|
||||||
.append(" WHEN journalEntry.entity_type_enum = 2 AND journalEntry.savings_transaction_id IS NOT NULL THEN sa.account_no ")
|
|
||||||
.append(" WHEN journalEntry.entity_type_enum = 2 THEN COALESCE(ca.account_no, sa.account_no) ")
|
.append(" WHEN journalEntry.entity_type_enum = 2 THEN COALESCE(ca.account_no, sa.account_no) ")
|
||||||
.append(" ELSE NULL ")
|
.append(" ELSE NULL ")
|
||||||
.append(" END as savingsAccountNo ");
|
.append(" END as savingsAccountNo ");
|
||||||
@@ -146,7 +130,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat
|
|||||||
.append(" left join m_external_asset_owner_journal_entry_mapping eajem on eajem.journal_entry_id = journalEntry.id ")
|
.append(" left join m_external_asset_owner_journal_entry_mapping eajem on eajem.journal_entry_id = journalEntry.id ")
|
||||||
.append(" left join m_external_asset_owner eao on eao.id = eajem.owner_id ")
|
.append(" left join m_external_asset_owner eao on eao.id = eajem.owner_id ")
|
||||||
.append(" left join m_savings_account sa on sa.id = journalEntry.entity_id AND journalEntry.entity_type_enum = 2 ")
|
.append(" left join m_savings_account sa on sa.id = journalEntry.entity_id AND journalEntry.entity_type_enum = 2 ")
|
||||||
.append(" left join m_current_account ca on ca.id = journalEntry.entity_id AND journalEntry.entity_type_enum IN (2, 6) ");
|
.append(" left join m_current_account ca on ca.id = journalEntry.entity_id AND journalEntry.entity_type_enum = 2 ");
|
||||||
if (associationParametersData.isTransactionDetailsRequired()) {
|
if (associationParametersData.isTransactionDetailsRequired()) {
|
||||||
sb.append(" left join m_loan_transaction as lt on journalEntry.loan_transaction_id = lt.id ")
|
sb.append(" left join m_loan_transaction as lt on journalEntry.loan_transaction_id = lt.id ")
|
||||||
.append(" left join m_savings_account_transaction as st on journalEntry.savings_transaction_id = st.id ")
|
.append(" left join m_savings_account_transaction as st on journalEntry.savings_transaction_id = st.id ")
|
||||||
|
|||||||
+2
-138
@@ -21,11 +21,9 @@ package org.apache.fineract.accounting.journalentry.service;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@@ -106,8 +104,6 @@ import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepositor
|
|||||||
import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
|
import org.apache.fineract.portfolio.loanproduct.service.LoanEnumerations;
|
||||||
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
|
import org.apache.fineract.portfolio.paymentdetail.domain.PaymentDetail;
|
||||||
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
|
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
|
||||||
import org.apache.fineract.portfolio.voucher.service.VoucherLine;
|
|
||||||
import org.apache.fineract.portfolio.voucher.service.VoucherService;
|
|
||||||
import org.apache.fineract.useradministration.domain.AppUser;
|
import org.apache.fineract.useradministration.domain.AppUser;
|
||||||
import org.springframework.dao.DataIntegrityViolationException;
|
import org.springframework.dao.DataIntegrityViolationException;
|
||||||
import org.springframework.dao.NonTransientDataAccessException;
|
import org.springframework.dao.NonTransientDataAccessException;
|
||||||
@@ -140,7 +136,6 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
private final ExternalAssetOwnerRepository externalAssetOwnerRepository;
|
private final ExternalAssetOwnerRepository externalAssetOwnerRepository;
|
||||||
private final LoanAmortizationAllocationMappingRepository loanAmortizationAllocationMappingRepository;
|
private final LoanAmortizationAllocationMappingRepository loanAmortizationAllocationMappingRepository;
|
||||||
private final LoanTransactionRepository loanTransactionRepository;
|
private final LoanTransactionRepository loanTransactionRepository;
|
||||||
private final VoucherService voucherService;
|
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
@@ -237,73 +232,14 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Raise the voucher from the entries that were actually written, rather than from the
|
|
||||||
// command: an accounting rule can supply a side the request never named, so reading
|
|
||||||
// back by transaction id is the only view that matches what the ledger now holds.
|
|
||||||
final String voucherNo = raiseJournalVoucher(transactionId);
|
|
||||||
if (voucherNo != null) {
|
|
||||||
changes.put("voucherNo", voucherNo);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withOfficeId(officeId)
|
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withOfficeId(officeId)
|
||||||
.withTransactionId(transactionId).with(changes).build();
|
.withTransactionId(transactionId).build();
|
||||||
} catch (final JpaSystemException | DataIntegrityViolationException dve) {
|
} catch (final JpaSystemException | DataIntegrityViolationException dve) {
|
||||||
final Throwable throwable = dve.getMostSpecificCause();
|
final Throwable throwable = dve.getMostSpecificCause();
|
||||||
throw handleJournalEntryDataIntegrityIssues(throwable, dve);
|
throw handleJournalEntryDataIntegrityIssues(throwable, dve);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Records a manual journal in the voucher register and returns its number.
|
|
||||||
*
|
|
||||||
* The sides are read back from the entries just written rather than taken from the request,
|
|
||||||
* because an accounting rule can contribute a debit or credit the caller never named; only the
|
|
||||||
* persisted rows show what the ledger actually holds.
|
|
||||||
*
|
|
||||||
* A failure here does not fail the journal. The entries are already posted and correct, and
|
|
||||||
* refusing them because the register could not be written would reject a sound accounting
|
|
||||||
* transaction over its paperwork. The problem is logged and the journal stands without a
|
|
||||||
* voucher, which reads as a gap in the register rather than as a missing ledger entry.
|
|
||||||
*/
|
|
||||||
private String raiseJournalVoucher(final String transactionId) {
|
|
||||||
// A register that posts its ledger movement through this command raises its own voucher,
|
|
||||||
// naming the member and the instrument. Raising a journal one beside it would put the same
|
|
||||||
// money in the register twice.
|
|
||||||
if (!this.voucherService.shouldRaiseVoucher()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
final List<JournalEntry> entries = this.glJournalEntryRepository
|
|
||||||
.findUnReversedManualJournalEntriesByTransactionId(transactionId);
|
|
||||||
if (CollectionUtils.isEmpty(entries)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
final List<VoucherLine> lines = new ArrayList<>();
|
|
||||||
for (final JournalEntry entry : entries) {
|
|
||||||
final GLAccount account = entry.getGlAccount();
|
|
||||||
final Long accountId = account == null ? null : account.getId();
|
|
||||||
final String name = account == null ? null : account.getName();
|
|
||||||
final String code = account == null ? null : account.getGlCode();
|
|
||||||
|
|
||||||
final VoucherLine line = entry.isDebitEntry() ? VoucherLine.debitGl(accountId, name, code, entry.getAmount())
|
|
||||||
: VoucherLine.creditGl(accountId, name, code, entry.getAmount());
|
|
||||||
lines.add(entry.getDescription() == null ? line : line.withDescription(entry.getDescription()));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Debits first, so the voucher prints the way a slip is read.
|
|
||||||
lines.sort(Comparator.comparing(VoucherLine::isDebit).reversed());
|
|
||||||
|
|
||||||
final AppUser currentUser = this.context.authenticatedUser();
|
|
||||||
return this.voucherService.createVoucherWithLines(VoucherService.TYPE_JOURNAL, VoucherService.REF_JOURNAL_ENTRY, null,
|
|
||||||
transactionId, currentUser, VoucherService.PREFIX_JOURNAL, lines);
|
|
||||||
} catch (final RuntimeException e) {
|
|
||||||
log.error("Could not raise a voucher for journal transaction {}", transactionId, e);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void validateDebitOrCreditArrayForExistingGLAccount(final GLAccount glaccount,
|
private void validateDebitOrCreditArrayForExistingGLAccount(final GLAccount glaccount,
|
||||||
final SingleDebitOrCreditEntryCommand[] creditOrDebits) {
|
final SingleDebitOrCreditEntryCommand[] creditOrDebits) {
|
||||||
/**
|
/**
|
||||||
@@ -392,9 +328,6 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
} else if (!creditOrDebitAccountHead.isManualEntriesAllowed()) {
|
} else if (!creditOrDebitAccountHead.isManualEntriesAllowed()) {
|
||||||
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED, null,
|
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.GL_ACCOUNT_MANUAL_ENTRIES_NOT_PERMITTED, null,
|
||||||
creditOrDebitAccountHead.getName(), creditOrDebitAccountHead.getGlCode());
|
creditOrDebitAccountHead.getName(), creditOrDebitAccountHead.getGlCode());
|
||||||
} else if (creditOrDebitAccountHead.isHeaderAccount()) {
|
|
||||||
throw new JournalEntryInvalidException(GlJournalEntryInvalidReason.GL_ACCOUNT_IS_HEADER, null,
|
|
||||||
creditOrDebitAccountHead.getName(), creditOrDebitAccountHead.getGlCode());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -631,12 +564,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
final boolean cashBasedAccountingEnabled = (Boolean) accountingBridgeData.get("cashBasedAccountingEnabled");
|
final boolean cashBasedAccountingEnabled = (Boolean) accountingBridgeData.get("cashBasedAccountingEnabled");
|
||||||
final boolean accrualBasedAccountingEnabled = (Boolean) accountingBridgeData.get("accrualBasedAccountingEnabled");
|
final boolean accrualBasedAccountingEnabled = (Boolean) accountingBridgeData.get("accrualBasedAccountingEnabled");
|
||||||
|
|
||||||
// A register that knows the transaction's real counterparty posts the entry itself, in one
|
if (cashBasedAccountingEnabled) {
|
||||||
// balanced pair against that account, and says so by wrapping the command in
|
|
||||||
// ShareAccountingSuppression.withOwnShareEntries(). Posting here as well would add a second
|
|
||||||
// entry for the same money, booked against the product's fixed Shares Reference account --
|
|
||||||
// which is what that register is avoiding in the first place.
|
|
||||||
if (cashBasedAccountingEnabled && ShareAccountingSuppression.shouldPostShareEntries()) {
|
|
||||||
final SharesDTO sharesDTO = this.helper.populateSharesDtoFromMap(accountingBridgeData, cashBasedAccountingEnabled,
|
final SharesDTO sharesDTO = this.helper.populateSharesDtoFromMap(accountingBridgeData, cashBasedAccountingEnabled,
|
||||||
accrualBasedAccountingEnabled);
|
accrualBasedAccountingEnabled);
|
||||||
final AccountingProcessorForShares accountingProcessorForShares = this.accountingProcessorForSharesFactory
|
final AccountingProcessorForShares accountingProcessorForShares = this.accountingProcessorForSharesFactory
|
||||||
@@ -784,30 +712,15 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
final String currencyCode = command.stringValueOfParameterNamed(JournalEntryJsonInputParams.CURRENCY_CODE.getValue());
|
final String currencyCode = command.stringValueOfParameterNamed(JournalEntryJsonInputParams.CURRENCY_CODE.getValue());
|
||||||
|
|
||||||
validateBusinessRulesForJournalEntries(journalEntryCommand);
|
validateBusinessRulesForJournalEntries(journalEntryCommand);
|
||||||
validateNoDenominationManagedCashAccounts(journalEntryCommand);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* revert old journal entries
|
* revert old journal entries
|
||||||
*
|
|
||||||
* A transaction that carries a leg against the denomination-managed cash account (see
|
|
||||||
* validateNoDenominationManagedCashAccounts) is skipped here rather than reversed: it is
|
|
||||||
* tied to this same office+contra pairing (Migrate Cash Denomination posts its opening
|
|
||||||
* entry against this same Opening Balances Contra account), so the query above finds it
|
|
||||||
* too. Reversing it here, while the new submission is barred from ever re-posting a cash
|
|
||||||
* leg, would silently erase the cash account's opening balance every time an admin
|
|
||||||
* redefines opening balances for any OTHER account at this office.
|
|
||||||
*/
|
*/
|
||||||
final List<Long> denominationManagedGlAccountIds = resolveDenominationManagedCashGlAccountIds();
|
|
||||||
final List<String> transactionIdsToBeReversed = this.glJournalEntryRepository.findNonReversedContraTransactionIds(contraId,
|
final List<String> transactionIdsToBeReversed = this.glJournalEntryRepository.findNonReversedContraTransactionIds(contraId,
|
||||||
officeId);
|
officeId);
|
||||||
for (String transactionId : transactionIdsToBeReversed) {
|
for (String transactionId : transactionIdsToBeReversed) {
|
||||||
final List<JournalEntry> journalEntries = this.glJournalEntryRepository
|
final List<JournalEntry> journalEntries = this.glJournalEntryRepository
|
||||||
.findUnReversedManualJournalEntriesByTransactionId(transactionId);
|
.findUnReversedManualJournalEntriesByTransactionId(transactionId);
|
||||||
final boolean touchesDenominationManagedCashAccount = journalEntries.stream()
|
|
||||||
.anyMatch(je -> je.getGlAccount() != null && denominationManagedGlAccountIds.contains(je.getGlAccount().getId()));
|
|
||||||
if (touchesDenominationManagedCashAccount) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
revertJournalEntry(journalEntries, "defining opening balance");
|
revertJournalEntry(journalEntries, "defining opening balance");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -889,55 +802,6 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The GL account(s) Financial Activity 101 (Cash at Vault) / 102 (Cash at Teller) map to. Shared
|
|
||||||
* by the validation below and by defineOpeningBalance's own revert step, so both agree on exactly
|
|
||||||
* which account(s) Migrate Cash Denomination owns.
|
|
||||||
*/
|
|
||||||
private List<Long> resolveDenominationManagedCashGlAccountIds() {
|
|
||||||
final List<Long> ids = new ArrayList<>();
|
|
||||||
for (final FinancialActivityAccount mapping : this.financialActivityAccountRepositoryWrapper.findAll()) {
|
|
||||||
final Integer type = mapping.getFinancialActivityType();
|
|
||||||
if ((type != null && (type == 101 || type == 102)) && mapping.getGlAccount() != null) {
|
|
||||||
ids.add(mapping.getGlAccount().getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ids;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The GL account(s) mapped to Financial Activity 101 (Cash at Vault) / 102 (Cash at Teller) are
|
|
||||||
* managed exclusively through Migrate Cash Denomination (BranchDayRegisterApiResource#migrateCashDenomination),
|
|
||||||
* which keeps the GL figure tied to an actual counted note-and-coin breakdown, and validates any
|
|
||||||
* redefinition against that same count. Defining or redefining that account's opening balance here
|
|
||||||
* instead - as a bare number, with no denomination breakdown behind it - would let the GL figure
|
|
||||||
* drift away from what is physically in the till, with nothing left to catch the mismatch. So this
|
|
||||||
* command refuses to touch either of those accounts at all, on either side of the entry, rather than
|
|
||||||
* only when the amount would differ from what is already posted: the physical count is the only
|
|
||||||
* source of truth for this account, never a number typed into a generic opening-balance grid.
|
|
||||||
*/
|
|
||||||
private void validateNoDenominationManagedCashAccounts(final JournalEntryCommand command) {
|
|
||||||
final List<Long> denominationManagedGlAccountIds = resolveDenominationManagedCashGlAccountIds();
|
|
||||||
if (denominationManagedGlAccountIds.isEmpty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final List<SingleDebitOrCreditEntryCommand> allEntries = new ArrayList<>();
|
|
||||||
if (command.getDebits() != null) {
|
|
||||||
allEntries.addAll(Arrays.asList(command.getDebits()));
|
|
||||||
}
|
|
||||||
if (command.getCredits() != null) {
|
|
||||||
allEntries.addAll(Arrays.asList(command.getCredits()));
|
|
||||||
}
|
|
||||||
for (final SingleDebitOrCreditEntryCommand entry : allEntries) {
|
|
||||||
if (denominationManagedGlAccountIds.contains(entry.getGlAccountId())) {
|
|
||||||
throw new GeneralPlatformDomainRuleException("error.msg.journalentry.opening.balance.cash.account.locked",
|
|
||||||
"This account is the tenant's Cash at Vault / Cash at Teller account and is managed through "
|
|
||||||
+ "Migrate Cash Denomination - it cannot be set or changed from Migrate Opening Balances.",
|
|
||||||
entry.getGlAccountId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createJournalEntriesForClientTransactions(Map<String, Object> accountingBridgeData) {
|
public void createJournalEntriesForClientTransactions(Map<String, Object> accountingBridgeData) {
|
||||||
final ClientTransactionDTO clientTransactionDTO = this.helper.populateClientTransactionDtoFromMap(accountingBridgeData);
|
final ClientTransactionDTO clientTransactionDTO = this.helper.populateClientTransactionDtoFromMap(accountingBridgeData);
|
||||||
|
|||||||
-157
@@ -1,157 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.accounting.journalentry.service;
|
|
||||||
|
|
||||||
import java.sql.Date;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import org.apache.fineract.infrastructure.core.service.DateUtils;
|
|
||||||
import org.springframework.jdbc.core.JdbcTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mints the transaction id that ties the rows of one posting together in acc_gl_journal_entry.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Every feature here that posts a journal entry by direct JDBC used to invent this id by hand, and the two
|
|
||||||
* shapes that emerged were each wrong in their own way. Some concatenated a business row's own primary key
|
|
||||||
* ({@code "DIVROUND" + dividendPayOutId}); a primary key is only unique while its sequence keeps climbing,
|
|
||||||
* so a reset hands the same number out twice - which is exactly how two unrelated share withdrawals came to
|
|
||||||
* share one transaction id and render as a single doubled voucher. Others concatenated
|
|
||||||
* {@code System.nanoTime()}, which is unique but says nothing to whoever reads it off a screen
|
|
||||||
* ({@code "CASHMIG-1-20260913-923935527932300"}).
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* This generator replaces both with one readable shape, {@code PREFIX-YYMMDD-NNNN}:
|
|
||||||
*
|
|
||||||
* <pre>
|
|
||||||
* SHWGL-260916-0001 the first share-withdrawal GL settlement posted on 16 Sep 2026
|
|
||||||
* DIVRND-260916-0007 the seventh dividend rounding posted that day
|
|
||||||
* </pre>
|
|
||||||
*
|
|
||||||
* The prefix names the event, the date is the tenant's business date, and the serial restarts at 0001 each
|
|
||||||
* day. That makes a transaction id self-describing: a reader can tell what it was and when it happened
|
|
||||||
* without looking anything up.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Uniqueness does not depend on any business table. The serial comes from {@code m_ledger_txn_sequence}, a
|
|
||||||
* counter that belongs to no entity, so no entity's sequence can make it repeat. The counter is bumped by a
|
|
||||||
* single {@code INSERT ... ON CONFLICT DO UPDATE}, which takes and releases the row lock atomically, so two
|
|
||||||
* users posting at the same instant are serialised by the database rather than handed the same number - the
|
|
||||||
* same mechanism {@code m_voucher_sequence} already uses for voucher numbers.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The counter alone would still repeat if that table were ever truncated or rewound by hand, which is
|
|
||||||
* precisely the accident being defended against, so the minted id is also checked against the ledger before
|
|
||||||
* being handed back and the counter is advanced past anything already in use. That makes a duplicate
|
|
||||||
* impossible by construction rather than by convention: the id is only returned once no row holds it.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Ids already in the ledger keep their old shape. Nothing reconstructs a custom id to find its rows again
|
|
||||||
* (every call site mints one, posts with it, and never derives it a second time), so old and new shapes
|
|
||||||
* coexist without anything needing to read both.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Postings made by Fineract's own command path are not covered here and keep their native
|
|
||||||
* {@code "S"/"L"/"SH"/"C" + transaction id} form, which {@code AccountingProcessorHelper} derives and
|
|
||||||
* several readers reconstruct. Those readers are hardened at the query instead, by resolving to the most
|
|
||||||
* recently posted rows rather than assuming the text is unique.
|
|
||||||
*/
|
|
||||||
public final class LedgerTransactionId {
|
|
||||||
|
|
||||||
/** Guards against an impossible-in-practice runaway if the ledger and the counter disagree. */
|
|
||||||
private static final int MAX_PROBES = 50;
|
|
||||||
|
|
||||||
private static final DateTimeFormatter YYMMDD = DateTimeFormatter.ofPattern("yyMMdd");
|
|
||||||
|
|
||||||
private LedgerTransactionId() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the next transaction id for this kind of posting, e.g. {@code SHWGL-260916-0001}.
|
|
||||||
*
|
|
||||||
* @param prefix
|
|
||||||
* short uppercase code naming the event, from {@link LedgerTxnPrefix}
|
|
||||||
*/
|
|
||||||
public static String next(final JdbcTemplate jdbcTemplate, final String prefix) {
|
|
||||||
// Tenant timezone, not the server's - the day the counter resets on has to be the branch's
|
|
||||||
// business day, otherwise a late-evening posting lands in the wrong series.
|
|
||||||
final LocalDate today = LocalDate.now(DateUtils.getDateTimeZoneOfTenant());
|
|
||||||
final String datePart = today.format(YYMMDD);
|
|
||||||
|
|
||||||
for (int probe = 0; probe < MAX_PROBES; probe++) {
|
|
||||||
final int serial = nextSerial(jdbcTemplate, prefix, today);
|
|
||||||
final String candidate = String.format("%s-%s-%04d", prefix, datePart, serial);
|
|
||||||
if (!isTaken(jdbcTemplate, candidate)) {
|
|
||||||
return candidate;
|
|
||||||
}
|
|
||||||
// Only reachable if the counter was rewound behind the ledger by hand. Bumping again walks
|
|
||||||
// it forward until it clears whatever is already posted, which self-heals the counter.
|
|
||||||
}
|
|
||||||
throw new IllegalStateException("Could not mint a free ledger transaction id for prefix " + prefix + " after " + MAX_PROBES
|
|
||||||
+ " attempts. The m_ledger_txn_sequence counter for this prefix is far behind the entries already posted today.");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the id for a posting that has to be reproducible, e.g. {@code SAVINT-260916-P0002}.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Some postings are not one-shot: a pooled interest run pays hundreds of members, and a run that
|
|
||||||
* stops halfway is resumed rather than restarted. Those resumed legs belong to the posting that
|
|
||||||
* started them, so the id has to come out the same on the second pass - a counter would hand the
|
|
||||||
* remainder a different id and split one posting across two transactions. This builds the id from
|
|
||||||
* what identifies the run instead: the same prefix, date and discriminator always produce the same
|
|
||||||
* string, and no counter is consumed.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Uniqueness rests on the caller's own discriminator being unique for that prefix and date (the
|
|
||||||
* product being posted, say), which is what makes the id reproducible in the first place. Use
|
|
||||||
* {@link #next} for everything else - a posting that happens once wants a counter, not a formula.
|
|
||||||
* The {@code P} marks the tail as a discriminator so it is not misread as a serial.
|
|
||||||
*
|
|
||||||
* @param date
|
|
||||||
* the date the posting belongs to, which is not always today - interest can be posted
|
|
||||||
* for an earlier day
|
|
||||||
* @param discriminator
|
|
||||||
* what makes this run distinct from another on the same date, e.g. the product id
|
|
||||||
*/
|
|
||||||
public static String forDatedSeries(final String prefix, final LocalDate date, final long discriminator) {
|
|
||||||
return String.format("%s-%s-P%04d", prefix, date.format(YYMMDD), discriminator);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reserves the next counter value for one (prefix, day) series.
|
|
||||||
*
|
|
||||||
* The INSERT ... ON CONFLICT DO UPDATE both creates the series on its first use of the day and
|
|
||||||
* increments it thereafter. Being a single statement it is atomic, so no explicit lock is needed.
|
|
||||||
*/
|
|
||||||
private static int nextSerial(final JdbcTemplate jdbcTemplate, final String prefix, final LocalDate day) {
|
|
||||||
return jdbcTemplate.queryForObject("""
|
|
||||||
INSERT INTO m_ledger_txn_sequence (prefix, series_date, last_number)
|
|
||||||
VALUES (?,?,1)
|
|
||||||
ON CONFLICT (prefix, series_date)
|
|
||||||
DO UPDATE SET last_number = m_ledger_txn_sequence.last_number + 1
|
|
||||||
RETURNING last_number
|
|
||||||
""", Integer.class, prefix, Date.valueOf(day));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean isTaken(final JdbcTemplate jdbcTemplate, final String transactionId) {
|
|
||||||
final Boolean taken = jdbcTemplate.queryForObject("SELECT EXISTS (SELECT 1 FROM acc_gl_journal_entry WHERE transaction_id = ?)",
|
|
||||||
Boolean.class, transactionId);
|
|
||||||
return Boolean.TRUE.equals(taken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-87
@@ -1,87 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.accounting.journalentry.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The event codes that open a transaction id minted by {@link LedgerTransactionId}.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* They live together in one place so a reader can decode any transaction id on a screen from a single list,
|
|
||||||
* and so no two features can drift into naming the same event differently - which had already happened:
|
|
||||||
* dividend forfeiture was posting under {@code DIVFORF} from one service and {@code DIVFORFEIT} from
|
|
||||||
* another, for the same event.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Codes are uppercase, up to eight characters, and grouped by the module that raises them. A code is part of
|
|
||||||
* the audit trail once it has been posted, so treat these as append-only: add a new one for a new event
|
|
||||||
* rather than renaming an existing one, which would leave already-posted entries speaking a language nothing
|
|
||||||
* else uses any more.
|
|
||||||
*/
|
|
||||||
public final class LedgerTxnPrefix {
|
|
||||||
|
|
||||||
private LedgerTxnPrefix() {}
|
|
||||||
|
|
||||||
// A clerk's share withdrawal has no code here on purpose: it posts under the transaction id the
|
|
||||||
// native redeem command already minted ("SH" + share transaction id), because its debit leg is
|
|
||||||
// that command's own and the two have to group as one balanced entry.
|
|
||||||
|
|
||||||
// ── Share tranche funding ─────────────────────────────────────────────────
|
|
||||||
/** Additional share tranche: reversal of the stock reference posting. */
|
|
||||||
public static final String SHARE_TRANCHE_REFERENCE = "SHTREF";
|
|
||||||
/** Additional share tranche funded from the member's savings account. */
|
|
||||||
public static final String SHARE_TRANCHE_SAVINGS = "SHTSAV";
|
|
||||||
|
|
||||||
// ── Share collection and advances ─────────────────────────────────────────
|
|
||||||
/** Share application money collected. */
|
|
||||||
public static final String SHARE_COLLECTION = "SHCOL";
|
|
||||||
/** Share advance collected against a future allotment. */
|
|
||||||
public static final String SHARE_ADVANCE = "SHADV";
|
|
||||||
/** Share advance applied to an allotment. */
|
|
||||||
public static final String SHARE_ADVANCE_APPLIED = "SHAPP";
|
|
||||||
|
|
||||||
// ── Dividend ──────────────────────────────────────────────────────────────
|
|
||||||
/** Dividend claim paid out to a member. */
|
|
||||||
public static final String DIVIDEND_CLAIM = "DIVCLM";
|
|
||||||
/** Dividend declaration posted. */
|
|
||||||
public static final String DIVIDEND_DECLARED = "DIVDCL";
|
|
||||||
/** Dividend declaration approved. */
|
|
||||||
public static final String DIVIDEND_APPROVED = "DIVAPR";
|
|
||||||
/** Dividend payout closed off. */
|
|
||||||
public static final String DIVIDEND_CLOSED = "DIVCLS";
|
|
||||||
/** Rounding difference on a dividend payout. */
|
|
||||||
public static final String DIVIDEND_ROUNDING = "DIVRND";
|
|
||||||
/** Unclaimed dividend forfeited. */
|
|
||||||
public static final String DIVIDEND_FORFEIT = "DIVFRF";
|
|
||||||
|
|
||||||
// ── Branch day and cash ───────────────────────────────────────────────────
|
|
||||||
/** Opening cash migrated into the branch day register. */
|
|
||||||
public static final String CASH_MIGRATION = "CSHMIG";
|
|
||||||
/** Rounding difference on a clerk's day closure. */
|
|
||||||
public static final String CLOSURE_ROUNDING = "CLSRND";
|
|
||||||
|
|
||||||
// ── Year end ──────────────────────────────────────────────────────────────
|
|
||||||
/** Year-end transfer of income into the profit account. */
|
|
||||||
public static final String YEAR_END_PROFIT = "YEPFT";
|
|
||||||
/** Year-end closure of an income or expense account. */
|
|
||||||
public static final String YEAR_END_CLOSE = "YECLS";
|
|
||||||
|
|
||||||
// ── Savings ───────────────────────────────────────────────────────────────
|
|
||||||
/** Pooled savings interest posting for one product and date. */
|
|
||||||
public static final String SAVINGS_INTEREST_POOLED = "SAVINT";
|
|
||||||
}
|
|
||||||
-83
@@ -1,83 +0,0 @@
|
|||||||
/**
|
|
||||||
* 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.accounting.journalentry.service;
|
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Lets a register that posts a share transaction's accounting itself tell the platform not to post its
|
|
||||||
* own.
|
|
||||||
*
|
|
||||||
* <h3>Why this exists</h3>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Fineract books every share transaction against a fixed "Shares Reference" account taken from the
|
|
||||||
* product's GL mapping: a redemption posts Dr Shares Equity / Cr Shares Reference, whatever the money
|
|
||||||
* actually did. That account is a placeholder for a counterparty the platform does not know, and in a
|
|
||||||
* real core banking ledger there is no such thing — a redemption paid in cash credits the cash
|
|
||||||
* account, and one settled by transfer credits the account it was transferred to. Naming a single
|
|
||||||
* asset account for both leaves every redemption sitting against a GL the money never touched, which
|
|
||||||
* then has to be corrected by hand.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* The governed clerk registers already know the real counterparty, because the clerk keyed it: the
|
|
||||||
* linked savings account, or the GL picked on the transfer's credit row. They post the redemption
|
|
||||||
* themselves, correctly, in one balanced entry. Before this flag existed they had to let the platform
|
|
||||||
* post its version first and then reverse the half that was wrong, which left a dead Cr Shares
|
|
||||||
* Reference row behind on every redemption and made the ledger read as though cash had moved.
|
|
||||||
*
|
|
||||||
* <h3>Why a flag and not the product's accounting rule</h3>
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* Turning the share product's accounting off entirely ({@code m_share_product.accounting_type = NONE})
|
|
||||||
* would silence the platform everywhere, including the share account screen's own Redeem action, which
|
|
||||||
* no register covers — those redemptions would post nothing at all and go unnoticed, because that
|
|
||||||
* branch fails silently by design. Scoping the suppression to the one call that is about to post its
|
|
||||||
* own entry leaves every other path exactly as it is.
|
|
||||||
*
|
|
||||||
* <p>
|
|
||||||
* A ThreadLocal rather than a request attribute, and restoring the previous value rather than clearing
|
|
||||||
* it, for the same reasons as {@code VoucherService.withOwnVoucher} — a batch job has no request to
|
|
||||||
* hang the flag on, and nesting must not switch the suppression off early for an outer caller.
|
|
||||||
*/
|
|
||||||
public final class ShareAccountingSuppression {
|
|
||||||
|
|
||||||
private static final ThreadLocal<Boolean> CALLER_POSTS_SHARE_ENTRIES = ThreadLocal.withInitial(() -> Boolean.FALSE);
|
|
||||||
|
|
||||||
private ShareAccountingSuppression() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs {@code command} with the platform's own share journal entries suppressed, for a caller that
|
|
||||||
* posts the transaction's accounting itself.
|
|
||||||
*/
|
|
||||||
public static <T> T withOwnShareEntries(final Supplier<T> command) {
|
|
||||||
final boolean previous = CALLER_POSTS_SHARE_ENTRIES.get();
|
|
||||||
CALLER_POSTS_SHARE_ENTRIES.set(Boolean.TRUE);
|
|
||||||
try {
|
|
||||||
return command.get();
|
|
||||||
} finally {
|
|
||||||
CALLER_POSTS_SHARE_ENTRIES.set(previous);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** False only while a caller inside {@link #withOwnShareEntries} is posting its own entries. */
|
|
||||||
public static boolean shouldPostShareEntries() {
|
|
||||||
return !CALLER_POSTS_SHARE_ENTRIES.get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+4
-6
@@ -52,7 +52,6 @@ import org.apache.fineract.portfolio.charge.domain.ChargeRepositoryWrapper;
|
|||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanAmortizationAllocationMappingRepository;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanAmortizationAllocationMappingRepository;
|
||||||
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository;
|
import org.apache.fineract.portfolio.loanaccount.domain.LoanTransactionRepository;
|
||||||
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
|
import org.apache.fineract.portfolio.paymentdetail.service.PaymentDetailWritePlatformService;
|
||||||
import org.apache.fineract.portfolio.voucher.service.VoucherService;
|
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -68,10 +67,10 @@ public class AccountingJournalEntryConfiguration {
|
|||||||
FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository, GLClosureRepository closureRepository,
|
FinancialActivityAccountRepositoryWrapper financialActivityAccountRepository, GLClosureRepository closureRepository,
|
||||||
GLAccountRepository glAccountRepository, OfficeRepository officeRepository,
|
GLAccountRepository glAccountRepository, OfficeRepository officeRepository,
|
||||||
AccountTransfersReadPlatformService accountTransfersReadPlatformService, ChargeRepositoryWrapper chargeRepositoryWrapper,
|
AccountTransfersReadPlatformService accountTransfersReadPlatformService, ChargeRepositoryWrapper chargeRepositoryWrapper,
|
||||||
BusinessEventNotifierService businessEventNotifierService, JdbcTemplate jdbcTemplate) {
|
BusinessEventNotifierService businessEventNotifierService) {
|
||||||
return new AccountingProcessorHelper(glJournalEntryRepository, accountMappingRepository, financialActivityAccountRepository,
|
return new AccountingProcessorHelper(glJournalEntryRepository, accountMappingRepository, financialActivityAccountRepository,
|
||||||
closureRepository, glAccountRepository, officeRepository, accountTransfersReadPlatformService, chargeRepositoryWrapper,
|
closureRepository, glAccountRepository, officeRepository, accountTransfersReadPlatformService, chargeRepositoryWrapper,
|
||||||
businessEventNotifierService, jdbcTemplate);
|
businessEventNotifierService);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -99,13 +98,12 @@ public class AccountingJournalEntryConfiguration {
|
|||||||
ConfigurationReadPlatformService configurationReadPlatformService, AccountingService accountingService,
|
ConfigurationReadPlatformService configurationReadPlatformService, AccountingService accountingService,
|
||||||
ExternalAssetOwnerRepository externalAssetOwnerRepository,
|
ExternalAssetOwnerRepository externalAssetOwnerRepository,
|
||||||
LoanAmortizationAllocationMappingRepository loanAmortizationAllocationMappingRepository,
|
LoanAmortizationAllocationMappingRepository loanAmortizationAllocationMappingRepository,
|
||||||
LoanTransactionRepository loanTransactionRepository, VoucherService voucherService) {
|
LoanTransactionRepository loanTransactionRepository) {
|
||||||
return new JournalEntryWritePlatformServiceJpaRepositoryImpl(glClosureRepository, glAccountRepository, glJournalEntryRepository,
|
return new JournalEntryWritePlatformServiceJpaRepositoryImpl(glClosureRepository, glAccountRepository, glJournalEntryRepository,
|
||||||
officeRepositoryWrapper, accountingProcessorForLoanFactory, accountingProcessorForSavingsFactory,
|
officeRepositoryWrapper, accountingProcessorForLoanFactory, accountingProcessorForSavingsFactory,
|
||||||
accountingProcessorForSharesFactory, helper, fromApiJsonDeserializer, accountingRuleRepository,
|
accountingProcessorForSharesFactory, helper, fromApiJsonDeserializer, accountingRuleRepository,
|
||||||
glAccountReadPlatformService, organisationCurrencyRepository, context, paymentDetailWritePlatformService,
|
glAccountReadPlatformService, organisationCurrencyRepository, context, paymentDetailWritePlatformService,
|
||||||
financialActivityAccountRepositoryWrapper, accountingProcessorForClientTransactions, configurationReadPlatformService,
|
financialActivityAccountRepositoryWrapper, accountingProcessorForClientTransactions, configurationReadPlatformService,
|
||||||
accountingService, externalAssetOwnerRepository, loanAmortizationAllocationMappingRepository, loanTransactionRepository,
|
accountingService, externalAssetOwnerRepository, loanAmortizationAllocationMappingRepository, loanTransactionRepository);
|
||||||
voucherService);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user