From 6a464291d548babbb76c04c3dc540ce9dac41830 Mon Sep 17 00:00:00 2001 From: Aditya Date: Tue, 17 Mar 2026 18:16:36 +0530 Subject: [PATCH] Add Current Account module mirroring Savings Account infrastructure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CurrentAccount entity (@DiscriminatorValue 400) extending SavingsAccount - 4 JAX-RS API resources: /v1/currentaccounts, /v1/currentproducts, transactions, charges - 38 command handlers delegating to existing savings services - ~35 CommandWrapperBuilder methods for current account commands - DB migration 0225 with 67 permissions (CURRENTACCOUNT, CURRENTPRODUCT, CURRENTACCOUNTCHARGE) - DepositsApiConstants and DepositAccountType enum updated for CURRENT_DEPOSIT Reuses existing m_savings_account table (deposit_type_enum=400), GL accounting, interest calculation, and all savings write/read services — no code duplication. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../service/CommandWrapperBuilder.java | 419 ++++++++++++++ .../portfolio/savings/DepositAccountType.java | 1 + .../savings/DepositsApiConstants.java | 5 + .../api/CurrentAccountChargesApiResource.java | 177 ++++++ ...CurrentAccountTransactionsApiResource.java | 147 +++++ .../api/CurrentAccountsApiResource.java | 301 ++++++++++ .../api/CurrentProductsApiResource.java | 264 +++++++++ .../ActivateCurrentAccountCommandHandler.java | 46 ++ ...AddCurrentAccountChargeCommandHandler.java | 46 ++ ...AnnualFeeCurrentAccountCommandHandler.java | 46 ++ ...CreditsToCurrentAccountCommandHandler.java | 46 ++ .../BlockCurrentAccountCommandHandler.java | 46 ++ ...ebitsFromCurrentAccountCommandHandler.java | 46 ++ ...eInterestCurrentAccountCommandHandler.java | 46 ++ ...seSavingsCurrentAccountCommandHandler.java | 46 ++ .../CreateCurrentProductCommandHandler.java | 46 ++ ...ountApplicationApprovalCommandHandler.java | 46 ++ ...ApplicationApprovalUndoCommandHandler.java | 46 ++ ...ountApplicationDeletionCommandHandler.java | 46 ++ ...ApplicationModificationCommandHandler.java | 46 ++ ...ountApplicationRejectedCommandHandler.java | 46 ++ ...untApplicationSubmittalCommandHandler.java | 46 ++ ...untApplicationWithdrawnCommandHandler.java | 46 ++ ...ntTransactionAdjustmentCommandHandler.java | 47 ++ ...eteCurrentAccountChargeCommandHandler.java | 46 ++ .../DeleteCurrentProductCommandHandler.java | 46 ++ .../DepositCurrentAccountCommandHandler.java | 46 ++ ...oldAmountCurrentAccountCommandHandler.java | 46 ++ ...ateCurrentAccountChargeCommandHandler.java | 46 ++ ...PayCurrentAccountChargeCommandHandler.java | 46 ++ ...AccountInterestAsOnDateCommandHandler.java | 46 ++ ...tInterestCurrentAccountCommandHandler.java | 46 ++ ...aseAmountCurrentAccountCommandHandler.java | 47 ++ ...veCurrentAccountOfficerCommandHandler.java | 46 ++ ...ansactionCurrentAccountCommandHandler.java | 47 ++ ...CreditsToCurrentAccountCommandHandler.java | 46 ++ .../UnblockCurrentAccountCommandHandler.java | 46 ++ ...ebitsFromCurrentAccountCommandHandler.java | 46 ++ ...ansactionCurrentAccountCommandHandler.java | 47 ++ ...ateCurrentAccountChargeCommandHandler.java | 46 ++ ...teCurrentAccountOfficerCommandHandler.java | 46 ++ .../UpdateCurrentProductCommandHandler.java | 46 ++ ...thHoldTaxCurrentAccountCommandHandler.java | 46 ++ ...iveCurrentAccountChargeCommandHandler.java | 46 ++ .../WithdrawCurrentAccountCommandHandler.java | 46 ++ .../db/changelog/tenant/changelog-tenant.xml | 10 + .../0225_add_current_account_support.xml | 519 ++++++++++++++++++ .../savings/domain/CurrentAccount.java | 31 ++ 48 files changed, 3626 insertions(+) create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountChargesApiResource.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountTransactionsApiResource.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountsApiResource.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentProductsApiResource.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ActivateCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/AddCurrentAccountChargeCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ApplyAnnualFeeCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockCreditsToCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockDebitsFromCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CalculateInterestCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CloseSavingsCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CreateCurrentProductCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationApprovalCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationApprovalUndoCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationDeletionCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationModificationCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationRejectedCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationSubmittalCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationWithdrawnCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountTransactionAdjustmentCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DeleteCurrentAccountChargeCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DeleteCurrentProductCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DepositCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/HoldAmountCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/InactivateCurrentAccountChargeCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PayCurrentAccountChargeCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PostCurrentAccountInterestAsOnDateCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PostInterestCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ReleaseAmountCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/RemoveCurrentAccountOfficerCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ReverseTransactionCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockCreditsToCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockDebitsFromCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UndoTransactionCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentAccountChargeCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentAccountOfficerCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentProductCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateWithHoldTaxCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/WaiveCurrentAccountChargeCommandHandler.java create mode 100644 fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/WithdrawCurrentAccountCommandHandler.java create mode 100644 fineract-provider/src/main/resources/db/changelog/tenant/parts/0225_add_current_account_support.xml create mode 100644 fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/domain/CurrentAccount.java diff --git a/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java b/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java index ea70324f0..2eec6a4d5 100644 --- a/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java +++ b/fineract-core/src/main/java/org/apache/fineract/commands/service/CommandWrapperBuilder.java @@ -573,6 +573,80 @@ public class CommandWrapperBuilder { return this; } + // ── KYC ────────────────────────────────────────────────────────────────── + + public CommandWrapperBuilder initiateClientKyc(final Long clientId) { + this.actionName = "CREATE"; + this.entityName = "CLIENTKYC"; + this.entityId = null; + this.clientId = clientId; + this.href = "/clients/" + clientId + "/kyc"; + return this; + } + + public CommandWrapperBuilder updateClientKyc(final Long clientId, final Long kycId) { + this.actionName = "UPDATE"; + this.entityName = "CLIENTKYC"; + this.entityId = kycId; + this.clientId = clientId; + this.href = "/clients/" + clientId + "/kyc/" + kycId; + return this; + } + + public CommandWrapperBuilder verifyClientKyc(final Long clientId, final Long kycId) { + this.actionName = "VERIFY"; + this.entityName = "CLIENTKYC"; + this.entityId = kycId; + this.clientId = clientId; + this.href = "/clients/" + clientId + "/kyc/" + kycId + "?command=verify"; + return this; + } + + public CommandWrapperBuilder rejectClientKyc(final Long clientId, final Long kycId) { + this.actionName = "REJECT"; + this.entityName = "CLIENTKYC"; + this.entityId = kycId; + this.clientId = clientId; + this.href = "/clients/" + clientId + "/kyc/" + kycId + "?command=reject"; + return this; + } + + public CommandWrapperBuilder generateAadhaarOtpClientKyc(final Long clientId, final Long kycId) { + this.actionName = "GENERATEAADHAROTP"; + this.entityName = "CLIENTKYC"; + this.entityId = kycId; + this.clientId = clientId; + this.href = "/clients/" + clientId + "/kyc/" + kycId + "?command=aadhaar-generate-otp"; + return this; + } + + public CommandWrapperBuilder verifyPanClientKyc(final Long clientId, final Long kycId) { + this.actionName = "VERIFYPAN"; + this.entityName = "CLIENTKYC"; + this.entityId = kycId; + this.clientId = clientId; + this.href = "/clients/" + clientId + "/kyc/" + kycId + "?command=verify-pan"; + return this; + } + + public CommandWrapperBuilder verifyAadhaarClientKyc(final Long clientId, final Long kycId) { + this.actionName = "VERIFYAADHAAR"; + this.entityName = "CLIENTKYC"; + this.entityId = kycId; + this.clientId = clientId; + this.href = "/clients/" + clientId + "/kyc/" + kycId + "?command=verify-aadhaar"; + return this; + } + + public CommandWrapperBuilder verifyGstinClientKyc(final Long clientId, final Long kycId) { + this.actionName = "VERIFYGSTIN"; + this.entityName = "CLIENTKYC"; + this.entityId = kycId; + this.clientId = clientId; + this.href = "/clients/" + clientId + "/kyc/" + kycId + "?command=verify-gstin"; + return this; + } + public CommandWrapperBuilder createClient() { this.actionName = "CREATE"; this.entityName = "CLIENT"; @@ -3354,6 +3428,351 @@ public class CommandWrapperBuilder { return this; } + // ── Current Account ───────────────────────────────────────────────────────── + + public CommandWrapperBuilder createCurrentProduct() { + this.actionName = "CREATE"; + this.entityName = "CURRENTPRODUCT"; + this.entityId = null; + this.href = "/currentproducts/template"; + return this; + } + + public CommandWrapperBuilder updateCurrentProduct(final Long productId) { + this.actionName = "UPDATE"; + this.entityName = "CURRENTPRODUCT"; + this.entityId = productId; + this.href = "/currentproducts/" + productId; + return this; + } + + public CommandWrapperBuilder deleteCurrentProduct(final Long productId) { + this.actionName = "DELETE"; + this.entityName = "CURRENTPRODUCT"; + this.entityId = productId; + this.href = "/currentproducts/" + productId; + return this; + } + + public CommandWrapperBuilder createCurrentAccount() { + this.actionName = "CREATE"; + this.entityName = "CURRENTACCOUNT"; + this.entityId = null; + this.href = "/currentaccounts/template"; + return this; + } + + public CommandWrapperBuilder updateCurrentAccount(final Long accountId) { + this.actionName = "UPDATE"; + this.entityName = "CURRENTACCOUNT"; + this.entityId = accountId; + this.href = "/currentaccounts/" + accountId; + return this; + } + + public CommandWrapperBuilder deleteCurrentAccount(final Long accountId) { + this.actionName = "DELETE"; + this.entityName = "CURRENTACCOUNT"; + this.entityId = accountId; + this.href = "/currentaccounts/" + accountId; + return this; + } + + public CommandWrapperBuilder rejectCurrentAccountApplication(final Long accountId) { + this.actionName = "REJECT"; + this.entityName = "CURRENTACCOUNT"; + this.entityId = accountId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=reject"; + return this; + } + + public CommandWrapperBuilder withdrawCurrentAccountApplication(final Long accountId) { + this.actionName = "WITHDRAW"; + this.entityName = "CURRENTACCOUNT"; + this.entityId = accountId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=withdrawnByApplicant"; + return this; + } + + public CommandWrapperBuilder approveCurrentAccountApplication(final Long accountId) { + this.actionName = "APPROVE"; + this.entityName = "CURRENTACCOUNT"; + this.entityId = accountId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=approve"; + return this; + } + + public CommandWrapperBuilder undoCurrentAccountApplication(final Long accountId) { + this.actionName = "APPROVALUNDO"; + this.entityName = "CURRENTACCOUNT"; + this.entityId = accountId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=undoapproval"; + return this; + } + + public CommandWrapperBuilder currentAccountActivation(final Long accountId) { + this.actionName = "ACTIVATE"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=activate"; + return this; + } + + public CommandWrapperBuilder closeCurrentAccountApplication(final Long accountId) { + this.actionName = "CLOSE"; + this.entityName = "CURRENTACCOUNT"; + this.entityId = accountId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=close"; + return this; + } + + public CommandWrapperBuilder currentAccountDeposit(final Long accountId) { + this.actionName = "DEPOSIT"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "/transactions"; + return this; + } + + public CommandWrapperBuilder currentAccountWithdrawal(final Long accountId) { + this.actionName = "WITHDRAWAL"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "/transactions"; + return this; + } + + public CommandWrapperBuilder undoCurrentAccountTransaction(final Long accountId, final Long transactionId) { + this.actionName = "UNDOTRANSACTION"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = accountId; + this.subentityId = transactionId; + this.transactionId = transactionId.toString(); + this.href = "/currentaccounts/" + accountId + "/transactions/" + transactionId + "?command=undo"; + return this; + } + + public CommandWrapperBuilder reverseCurrentAccountTransaction(final Long accountId, final Long transactionId) { + this.actionName = "REVERSETRANSACTION"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = accountId; + this.subentityId = transactionId; + this.transactionId = transactionId.toString(); + this.href = "/currentaccounts/" + accountId + "/transactions/" + transactionId + "?command=reverse"; + return this; + } + + public CommandWrapperBuilder adjustCurrentAccountTransaction(final Long accountId, final Long transactionId) { + this.actionName = "ADJUSTTRANSACTION"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = accountId; + this.subentityId = transactionId; + this.transactionId = transactionId.toString(); + this.href = "/currentaccounts/" + accountId + "/transactions/" + transactionId + "?command=modify"; + return this; + } + + public CommandWrapperBuilder currentAccountInterestCalculation(final Long accountId) { + this.actionName = "CALCULATEINTEREST"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=calculateInterest"; + return this; + } + + public CommandWrapperBuilder currentAccountInterestPosting(final Long accountId) { + this.actionName = "POSTINTEREST"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=postInterest"; + return this; + } + + public CommandWrapperBuilder currentAccountInterestPostingAsOnDate(final Long accountId) { + this.actionName = "POSTINTERESTASONDATE"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=postInterestAsOnDate"; + return this; + } + + public CommandWrapperBuilder currentAccountApplyAnnualFees(final Long accountId) { + this.actionName = "APPLYANNUALFEE"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=applyAnnualFees"; + return this; + } + + public CommandWrapperBuilder holdAmountCurrentAccount(final Long accountId) { + this.actionName = "HOLDAMOUNT"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "/transactions"; + return this; + } + + public CommandWrapperBuilder releaseAmountCurrentAccount(final Long accountId, final Long transactionId) { + this.actionName = "RELEASEAMOUNT"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.subentityId = transactionId; + this.transactionId = transactionId.toString(); + this.href = "/currentaccounts/" + accountId + "/transactions/" + transactionId + "?command=releaseAmount"; + return this; + } + + public CommandWrapperBuilder blockCurrentAccount(final Long accountId) { + this.actionName = "BLOCK"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=block"; + return this; + } + + public CommandWrapperBuilder unblockCurrentAccount(final Long accountId) { + this.actionName = "UNBLOCK"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=unblock"; + return this; + } + + public CommandWrapperBuilder blockDebitsFromCurrentAccount(final Long accountId) { + this.actionName = "BLOCKDEBIT"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=blockDebit"; + return this; + } + + public CommandWrapperBuilder unblockDebitsFromCurrentAccount(final Long accountId) { + this.actionName = "UNBLOCKDEBIT"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=unblockDebit"; + return this; + } + + public CommandWrapperBuilder blockCreditsToCurrentAccount(final Long accountId) { + this.actionName = "BLOCKCREDIT"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=blockCredit"; + return this; + } + + public CommandWrapperBuilder unblockCreditsToCurrentAccount(final Long accountId) { + this.actionName = "UNBLOCKCREDIT"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=unblockCredit"; + return this; + } + + public CommandWrapperBuilder assignCurrentAccountOfficer(final Long accountId) { + this.actionName = "UPDATESAVINGSOFFICER"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=assignSavingsOfficer"; + return this; + } + + public CommandWrapperBuilder unassignCurrentAccountOfficer(final Long accountId) { + this.actionName = "REMOVESAVINGSOFFICER"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = null; + this.href = "/currentaccounts/" + accountId + "?command=unassignSavingsOfficer"; + return this; + } + + public CommandWrapperBuilder updateWithHoldTaxCurrentAccount(final Long accountId) { + this.actionName = "UPDATEWITHHOLDTAX"; + this.entityName = "CURRENTACCOUNT"; + this.savingsId = accountId; + this.entityId = accountId; + this.href = "/currentaccounts/" + accountId + "?command=updateWithHoldTax"; + return this; + } + + public CommandWrapperBuilder createCurrentAccountCharge(final Long accountId) { + this.actionName = "CREATE"; + this.entityName = "CURRENTACCOUNTCHARGE"; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "/charges"; + return this; + } + + public CommandWrapperBuilder updateCurrentAccountCharge(final Long accountId, final Long chargeId) { + this.actionName = "UPDATE"; + this.entityName = "CURRENTACCOUNTCHARGE"; + this.entityId = chargeId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "/charges/" + chargeId; + return this; + } + + public CommandWrapperBuilder waiveCurrentAccountCharge(final Long accountId, final Long chargeId) { + this.actionName = "WAIVE"; + this.entityName = "CURRENTACCOUNTCHARGE"; + this.entityId = chargeId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "/charges/" + chargeId; + return this; + } + + public CommandWrapperBuilder payCurrentAccountCharge(final Long accountId, final Long chargeId) { + this.actionName = "PAY"; + this.entityName = "CURRENTACCOUNTCHARGE"; + this.entityId = chargeId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "/charges/" + chargeId; + return this; + } + + public CommandWrapperBuilder inactivateCurrentAccountCharge(final Long accountId, final Long chargeId) { + this.actionName = "INACTIVATE"; + this.entityName = "CURRENTACCOUNTCHARGE"; + this.entityId = chargeId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "/charges/" + chargeId; + return this; + } + + public CommandWrapperBuilder deleteCurrentAccountCharge(final Long accountId, final Long chargeId) { + this.actionName = "DELETE"; + this.entityName = "CURRENTACCOUNTCHARGE"; + this.entityId = chargeId; + this.savingsId = accountId; + this.href = "/currentaccounts/" + accountId + "/charges/" + chargeId; + return this; + } + public CommandWrapperBuilder disableAdHoc(Long adHocId) { this.actionName = "DISABLE"; this.entityName = "ADHOC"; diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java index c11de1c1d..33dec151d 100644 --- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java +++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositAccountType.java @@ -91,6 +91,7 @@ public enum DepositAccountType { case FIXED_DEPOSIT -> DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME; case RECURRING_DEPOSIT -> DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME; case SAVINGS_DEPOSIT -> DepositsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME; + case CURRENT_DEPOSIT -> DepositsApiConstants.CURRENT_ACCOUNT_RESOURCE_NAME; default -> "INVALID"; }; } diff --git a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java index 0f4405628..a825a0d98 100644 --- a/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java +++ b/fineract-core/src/main/java/org/apache/fineract/portfolio/savings/DepositsApiConstants.java @@ -41,6 +41,11 @@ public final class DepositsApiConstants { public static final String SAVINGS_ACCOUNT_TRANSACTION_RESOURCE_NAME = "savingsaccount.transaction"; public static final String SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME = "savingsaccountcharge"; + // Current accounts + public static final String CURRENT_ACCOUNT_RESOURCE_NAME = "currentaccount"; + public static final String CURRENT_PRODUCT_RESOURCE_NAME = "currentproduct"; + public static final String CURRENT_ACCOUNT_CHARGE_RESOURCE_NAME = "currentaccountcharge"; + // deposit product actions public static final String summitalAction = ".summital"; public static final String approvalAction = ".approval"; diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountChargesApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountChargesApiResource.java new file mode 100644 index 000000000..5367ee7c4 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountChargesApiResource.java @@ -0,0 +1,177 @@ +/** + * 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.api; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.UriInfo; +import java.util.Collection; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.fineract.commands.domain.CommandWrapper; +import org.apache.fineract.commands.service.CommandWrapperBuilder; +import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; +import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; +import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException; +import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.portfolio.savings.DepositsApiConstants; +import org.apache.fineract.portfolio.savings.data.SavingsAccountChargeData; +import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPlatformService; +import org.springframework.stereotype.Component; + +@Path("/v1/currentaccounts/{accountId}/charges") +@Component +@Tag(name = "Current Account Charges", description = "Charges for current accounts") +@RequiredArgsConstructor +public class CurrentAccountChargesApiResource { + + private final PlatformSecurityContext context; + private final DefaultToApiJsonSerializer toApiJsonSerializer; + private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; + private final ApiRequestParameterHelper apiRequestParameterHelper; + private final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService; + + @GET + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "List current account charges") + @ApiResponse(responseCode = "200", description = "OK") + public String retrieveAllCharges(@PathParam("accountId") final Long accountId, + @DefaultValue("all") @QueryParam("chargeStatus") final String chargeStatus, @Context final UriInfo uriInfo) { + + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_ACCOUNT_CHARGE_RESOURCE_NAME); + final Collection charges = savingsAccountChargeReadPlatformService + .retrieveSavingsAccountCharges(accountId, chargeStatus); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return toApiJsonSerializer.serialize(settings, charges, + SavingsApiSetConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS); + } + + @GET + @Path("{chargeId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Retrieve a current account charge") + @ApiResponse(responseCode = "200", description = "OK") + public String retrieveCharge(@PathParam("accountId") final Long accountId, + @PathParam("chargeId") final Long chargeId, @Context final UriInfo uriInfo) { + + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_ACCOUNT_CHARGE_RESOURCE_NAME); + final SavingsAccountChargeData charge = savingsAccountChargeReadPlatformService.retrieveSavingsAccountChargeDetails(chargeId, + accountId); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return toApiJsonSerializer.serialize(settings, charge, + SavingsApiSetConstants.SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS); + } + + @POST + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Create a current account charge") + @ApiResponse(responseCode = "200", description = "OK") + public String addCharge(@PathParam("accountId") final Long accountId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + + final CommandWrapper commandRequest = new CommandWrapperBuilder().createCurrentAccountCharge(accountId) + .withJson(apiRequestBodyAsJson).build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + @PUT + @Path("{chargeId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Update a current account charge") + @ApiResponse(responseCode = "200", description = "OK") + public String updateCharge(@PathParam("accountId") final Long accountId, + @PathParam("chargeId") final Long chargeId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + + final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCurrentAccountCharge(accountId, chargeId) + .withJson(apiRequestBodyAsJson).build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + @POST + @Path("{chargeId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Pay / Waive / Inactivate a current account charge") + @ApiResponse(responseCode = "200", description = "OK") + public String handleChargeCommand(@PathParam("accountId") final Long accountId, + @PathParam("chargeId") final Long chargeId, + @QueryParam("command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + + final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); + + CommandProcessingResult result = null; + if (is(commandParam, "paycharge")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.payCurrentAccountCharge(accountId, chargeId).build()); + } else if (is(commandParam, "waive")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.waiveCurrentAccountCharge(accountId, chargeId).build()); + } else if (is(commandParam, "inactivate")) { + result = commandsSourceWritePlatformService + .logCommandSource(builder.inactivateCurrentAccountCharge(accountId, chargeId).build()); + } + + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "paycharge", "waive", "inactivate" }); + } + + return toApiJsonSerializer.serialize(result); + } + + @DELETE + @Path("{chargeId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Delete a current account charge") + @ApiResponse(responseCode = "200", description = "OK") + public String deleteCharge(@PathParam("accountId") final Long accountId, + @PathParam("chargeId") final Long chargeId) { + + final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCurrentAccountCharge(accountId, chargeId).build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + private boolean is(final String commandParam, final String commandValue) { + return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountTransactionsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountTransactionsApiResource.java new file mode 100644 index 000000000..f5b15b94e --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountTransactionsApiResource.java @@ -0,0 +1,147 @@ +/** + * 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.api; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.UriInfo; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.fineract.commands.domain.CommandWrapper; +import org.apache.fineract.commands.service.CommandWrapperBuilder; +import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; +import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; +import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException; +import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.portfolio.savings.DepositsApiConstants; +import org.apache.fineract.portfolio.savings.DepositAccountType; +import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData; +import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService; +import org.springframework.stereotype.Component; + +@Path("/v1/currentaccounts/{accountId}/transactions") +@Component +@Tag(name = "Current Account Transactions", description = "Transactions for current accounts") +@RequiredArgsConstructor +public class CurrentAccountTransactionsApiResource { + + private final PlatformSecurityContext context; + private final DefaultToApiJsonSerializer toApiJsonSerializer; + private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; + private final ApiRequestParameterHelper apiRequestParameterHelper; + private final SavingsAccountReadPlatformService savingsAccountReadPlatformService; + + @GET + @Path("{transactionId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Retrieve a current account transaction") + @ApiResponse(responseCode = "200", description = "OK") + public String retrieveOne(@PathParam("accountId") final Long accountId, + @PathParam("transactionId") final Long transactionId, @Context final UriInfo uriInfo) { + + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_ACCOUNT_RESOURCE_NAME); + final SavingsAccountTransactionData transactionData = savingsAccountReadPlatformService.retrieveSavingsTransaction(accountId, + transactionId, DepositAccountType.CURRENT_DEPOSIT); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return toApiJsonSerializer.serialize(settings, transactionData, + SavingsApiSetConstants.SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS); + } + + @POST + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Deposit / Withdrawal / Hold amount on current account") + @ApiResponse(responseCode = "200", description = "OK") + public String transaction(@PathParam("accountId") final Long accountId, + @QueryParam("command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + + final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); + + CommandProcessingResult result = null; + if (is(commandParam, "deposit")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.currentAccountDeposit(accountId).build()); + } else if (is(commandParam, "withdrawal")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.currentAccountWithdrawal(accountId).build()); + } else if (is(commandParam, "holdAmount")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.holdAmountCurrentAccount(accountId).build()); + } + + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam, new Object[] { "deposit", "withdrawal", "holdAmount" }); + } + + return toApiJsonSerializer.serialize(result); + } + + @POST + @Path("{transactionId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Undo / Reverse / Adjust / Release amount on a current account transaction") + @ApiResponse(responseCode = "200", description = "OK") + public String handleTransactionCommands(@PathParam("accountId") final Long accountId, + @PathParam("transactionId") final Long transactionId, + @QueryParam("command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + + final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson); + + CommandProcessingResult result = null; + if (is(commandParam, "undo")) { + result = commandsSourceWritePlatformService + .logCommandSource(builder.undoCurrentAccountTransaction(accountId, transactionId).build()); + } else if (is(commandParam, "reverse")) { + result = commandsSourceWritePlatformService + .logCommandSource(builder.reverseCurrentAccountTransaction(accountId, transactionId).build()); + } else if (is(commandParam, "modify")) { + result = commandsSourceWritePlatformService + .logCommandSource(builder.adjustCurrentAccountTransaction(accountId, transactionId).build()); + } else if (is(commandParam, "releaseAmount")) { + result = commandsSourceWritePlatformService + .logCommandSource(builder.releaseAmountCurrentAccount(accountId, transactionId).build()); + } + + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam, + new Object[] { "undo", "reverse", "modify", "releaseAmount" }); + } + + return toApiJsonSerializer.serialize(result); + } + + private boolean is(final String commandParam, final String commandValue) { + return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountsApiResource.java new file mode 100644 index 000000000..ebc8008be --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentAccountsApiResource.java @@ -0,0 +1,301 @@ +/** + * 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.api; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.UriInfo; +import java.util.Arrays; +import java.util.Collection; +import java.util.Set; +import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; +import org.apache.fineract.commands.domain.CommandWrapper; +import org.apache.fineract.commands.service.CommandWrapperBuilder; +import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.core.api.ApiParameterHelper; +import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; +import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; +import org.apache.fineract.infrastructure.core.exception.UnrecognizedQueryParamException; +import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; +import org.apache.fineract.infrastructure.core.service.Page; +import org.apache.fineract.infrastructure.core.service.SearchParameters; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.infrastructure.security.service.SqlValidator; +import org.apache.fineract.portfolio.savings.DepositsApiConstants; +import org.apache.fineract.portfolio.savings.DepositAccountType; +import org.apache.fineract.portfolio.savings.SavingsApiConstants; +import org.apache.fineract.portfolio.savings.data.SavingsAccountChargeData; +import org.apache.fineract.portfolio.savings.data.SavingsAccountData; +import org.apache.fineract.portfolio.savings.data.SavingsAccountTransactionData; +import org.apache.fineract.portfolio.savings.service.SavingsAccountChargeReadPlatformService; +import org.apache.fineract.portfolio.savings.service.SavingsAccountReadPlatformService; +import org.apache.fineract.portfolio.savings.service.SavingsAccountTemplateReadPlatformService; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +@Path("/v1/currentaccounts") +@Component +@Tag(name = "Current Account", description = "Current accounts are instances of a particular current product created for an individual or group.") +@RequiredArgsConstructor +public class CurrentAccountsApiResource { + + private final SavingsAccountReadPlatformService savingsAccountReadPlatformService; + private final SavingsAccountTemplateReadPlatformService savingsAccountTemplateReadPlatformService; + private final PlatformSecurityContext context; + private final DefaultToApiJsonSerializer toApiJsonSerializer; + private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; + private final ApiRequestParameterHelper apiRequestParameterHelper; + private final SavingsAccountChargeReadPlatformService savingsAccountChargeReadPlatformService; + private final SqlValidator sqlValidator; + + @GET + @Path("template") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Retrieve Current Account Template") + @ApiResponse(responseCode = "200", description = "OK") + public String template(@QueryParam("clientId") @Parameter(description = "clientId") final Long clientId, + @QueryParam("groupId") @Parameter(description = "groupId") final Long groupId, + @QueryParam("productId") @Parameter(description = "productId") final Long productId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @Context final UriInfo uriInfo) { + + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_ACCOUNT_RESOURCE_NAME); + final SavingsAccountData savingsAccount = savingsAccountTemplateReadPlatformService.retrieveTemplate(clientId, groupId, productId, + staffInSelectedOfficeOnly); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return toApiJsonSerializer.serialize(settings, savingsAccount, SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS); + } + + @GET + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "List current accounts") + @ApiResponse(responseCode = "200", description = "OK") + public String retrieveAll(@Context final UriInfo uriInfo, + @QueryParam("externalId") final String externalId, + @QueryParam("offset") final Integer offset, + @QueryParam("limit") final Integer limit, + @QueryParam("orderBy") final String orderBy, + @QueryParam("sortOrder") final String sortOrder) { + + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_ACCOUNT_RESOURCE_NAME); + sqlValidator.validate(orderBy); + sqlValidator.validate(sortOrder); + sqlValidator.validate(externalId); + final SearchParameters searchParameters = SearchParameters.builder().limit(limit).externalId(externalId).offset(offset) + .orderBy(orderBy).sortOrder(sortOrder).build(); + final Page products = savingsAccountReadPlatformService.retrieveAll(searchParameters); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return toApiJsonSerializer.serialize(settings, products, SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS); + } + + @POST + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Submit new current account application") + @ApiResponse(responseCode = "200", description = "OK") + public String submitApplication(@Parameter(hidden = true) final String apiRequestBodyAsJson) { + final CommandWrapper commandRequest = new CommandWrapperBuilder().createCurrentAccount().withJson(apiRequestBodyAsJson).build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + @GET + @Path("{accountId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Retrieve a current account") + @ApiResponse(responseCode = "200", description = "OK") + public String retrieveOne(@PathParam("accountId") final Long accountId, + @DefaultValue("false") @QueryParam("staffInSelectedOfficeOnly") final boolean staffInSelectedOfficeOnly, + @DefaultValue("all") @QueryParam("chargeStatus") final String chargeStatus, + @Context final UriInfo uriInfo) { + + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_ACCOUNT_RESOURCE_NAME); + + if (!(is(chargeStatus, "all") || is(chargeStatus, "active") || is(chargeStatus, "inactive"))) { + throw new UnrecognizedQueryParamException("status", chargeStatus, new Object[] { "all", "active", "inactive" }); + } + + final SavingsAccountData savingsAccount = savingsAccountReadPlatformService.retrieveOne(accountId); + return populateTemplateAndAssociations(accountId, savingsAccount, staffInSelectedOfficeOnly, chargeStatus, uriInfo); + } + + @PUT + @Path("{accountId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Modify a current account application") + @ApiResponse(responseCode = "200", description = "OK") + public String update(@PathParam("accountId") final Long accountId, + @Parameter(hidden = true) final String apiRequestBodyAsJson, + @QueryParam("command") final String commandParam) { + + if (is(commandParam, "updateWithHoldTax")) { + final CommandWrapper commandRequest = new CommandWrapperBuilder().withJson(apiRequestBodyAsJson) + .updateWithHoldTaxCurrentAccount(accountId).build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCurrentAccount(accountId).withJson(apiRequestBodyAsJson) + .build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + @POST + @Path("{accountId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Approve/Reject/Activate/Close/Deposit/Withdrawal and other current account commands") + @ApiResponse(responseCode = "200", description = "OK") + public String handleCommands(@PathParam("accountId") final Long accountId, + @QueryParam("command") final String commandParam, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + + String jsonApiRequest = apiRequestBodyAsJson; + if (StringUtils.isBlank(jsonApiRequest)) { + jsonApiRequest = "{}"; + } + + final CommandWrapperBuilder builder = new CommandWrapperBuilder().withJson(jsonApiRequest); + + CommandProcessingResult result = null; + if (is(commandParam, "reject")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.rejectCurrentAccountApplication(accountId).build()); + } else if (is(commandParam, "withdrawnByApplicant")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.withdrawCurrentAccountApplication(accountId).build()); + } else if (is(commandParam, "approve")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.approveCurrentAccountApplication(accountId).build()); + } else if (is(commandParam, "undoapproval")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.undoCurrentAccountApplication(accountId).build()); + } else if (is(commandParam, "activate")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.currentAccountActivation(accountId).build()); + } else if (is(commandParam, "calculateInterest")) { + result = commandsSourceWritePlatformService + .logCommandSource(builder.withNoJsonBody().currentAccountInterestCalculation(accountId).build()); + } else if (is(commandParam, "postInterest")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.currentAccountInterestPosting(accountId).build()); + } else if (is(commandParam, "applyAnnualFees")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.currentAccountApplyAnnualFees(accountId).build()); + } else if (is(commandParam, "close")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.closeCurrentAccountApplication(accountId).build()); + } else if (is(commandParam, "assignSavingsOfficer")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.assignCurrentAccountOfficer(accountId).build()); + } else if (is(commandParam, "unassignSavingsOfficer")) { + result = commandsSourceWritePlatformService.logCommandSource(builder.unassignCurrentAccountOfficer(accountId).build()); + } else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_DEBIT)) { + result = commandsSourceWritePlatformService.logCommandSource(builder.blockDebitsFromCurrentAccount(accountId).build()); + } else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_DEBIT)) { + result = commandsSourceWritePlatformService.logCommandSource(builder.unblockDebitsFromCurrentAccount(accountId).build()); + } else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_CREDIT)) { + result = commandsSourceWritePlatformService.logCommandSource(builder.blockCreditsToCurrentAccount(accountId).build()); + } else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_CREDIT)) { + result = commandsSourceWritePlatformService.logCommandSource(builder.unblockCreditsToCurrentAccount(accountId).build()); + } else if (is(commandParam, SavingsApiConstants.COMMAND_BLOCK_ACCOUNT)) { + result = commandsSourceWritePlatformService.logCommandSource(builder.blockCurrentAccount(accountId).build()); + } else if (is(commandParam, SavingsApiConstants.COMMAND_UNBLOCK_ACCOUNT)) { + result = commandsSourceWritePlatformService.logCommandSource(builder.unblockCurrentAccount(accountId).build()); + } + + if (result == null) { + throw new UnrecognizedQueryParamException("command", commandParam, + new Object[] { "reject", "withdrawnByApplicant", "approve", "undoapproval", "activate", "calculateInterest", + "postInterest", "close", "assignSavingsOfficer", "unassignSavingsOfficer", + SavingsApiConstants.COMMAND_BLOCK_DEBIT, SavingsApiConstants.COMMAND_UNBLOCK_DEBIT, + SavingsApiConstants.COMMAND_BLOCK_CREDIT, SavingsApiConstants.COMMAND_UNBLOCK_CREDIT, + SavingsApiConstants.COMMAND_BLOCK_ACCOUNT, SavingsApiConstants.COMMAND_UNBLOCK_ACCOUNT }); + } + + return toApiJsonSerializer.serialize(result); + } + + @DELETE + @Path("{accountId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Delete a current account application") + @ApiResponse(responseCode = "200", description = "OK") + public String delete(@PathParam("accountId") final Long accountId) { + final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCurrentAccount(accountId).build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + private boolean is(final String commandParam, final String commandValue) { + return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue); + } + + private String populateTemplateAndAssociations(final Long accountId, final SavingsAccountData savingsAccount, + final boolean staffInSelectedOfficeOnly, final String chargeStatus, final UriInfo uriInfo) { + + Collection transactions = null; + Collection charges = null; + + final Set associationParameters = ApiParameterHelper.extractAssociationsForResponseIfProvided(uriInfo.getQueryParameters()); + if (!associationParameters.isEmpty()) { + if (associationParameters.contains("all")) { + associationParameters.addAll(Arrays.asList(SavingsApiConstants.transactions, SavingsApiConstants.charges)); + } + if (associationParameters.contains(SavingsApiConstants.transactions)) { + final Collection currentTransactions = savingsAccountReadPlatformService + .retrieveAllTransactions(accountId, DepositAccountType.CURRENT_DEPOSIT); + if (!CollectionUtils.isEmpty(currentTransactions)) { + transactions = currentTransactions; + } + } + if (associationParameters.contains(SavingsApiConstants.charges)) { + final Collection currentCharges = savingsAccountChargeReadPlatformService + .retrieveSavingsAccountCharges(accountId, chargeStatus); + if (!CollectionUtils.isEmpty(currentCharges)) { + charges = currentCharges; + } + } + } + + SavingsAccountData templateData = null; + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + if (settings.isTemplate()) { + templateData = savingsAccountTemplateReadPlatformService.retrieveTemplate(savingsAccount.getClientId(), + savingsAccount.getGroupId(), savingsAccount.getSavingsProductId(), staffInSelectedOfficeOnly); + } + + return toApiJsonSerializer.serialize(settings, + SavingsAccountData.withTemplateOptions(savingsAccount, templateData, transactions, charges), + SavingsApiSetConstants.SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentProductsApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentProductsApiResource.java new file mode 100644 index 000000000..04e98e335 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/api/CurrentProductsApiResource.java @@ -0,0 +1,264 @@ +/** + * 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.api; + +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DELETE; +import jakarta.ws.rs.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.PUT; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.Context; +import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.UriInfo; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import org.apache.fineract.accounting.common.AccountingDropdownReadPlatformService; +import org.apache.fineract.accounting.common.AccountingEnumerations; +import org.apache.fineract.accounting.common.AccountingRuleType; +import org.apache.fineract.accounting.glaccount.data.GLAccountData; +import org.apache.fineract.accounting.producttoaccountmapping.data.ChargeToGLAccountMapper; +import org.apache.fineract.accounting.producttoaccountmapping.data.PaymentTypeToGLAccountMapper; +import org.apache.fineract.accounting.producttoaccountmapping.service.ProductToGLAccountMappingReadPlatformService; +import org.apache.fineract.commands.domain.CommandWrapper; +import org.apache.fineract.commands.service.CommandWrapperBuilder; +import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService; +import org.apache.fineract.infrastructure.configuration.domain.ConfigurationDomainService; +import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper; +import org.apache.fineract.infrastructure.core.data.CommandProcessingResult; +import org.apache.fineract.infrastructure.core.data.EnumOptionData; +import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings; +import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer; +import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext; +import org.apache.fineract.organisation.monetary.data.CurrencyData; +import org.apache.fineract.organisation.monetary.service.CurrencyReadPlatformService; +import org.apache.fineract.portfolio.charge.data.ChargeData; +import org.apache.fineract.portfolio.charge.service.ChargeReadPlatformService; +import org.apache.fineract.portfolio.paymenttype.data.PaymentTypeData; +import org.apache.fineract.portfolio.paymenttype.service.PaymentTypeReadService; +import org.apache.fineract.portfolio.savings.DepositsApiConstants; +import org.apache.fineract.portfolio.savings.SavingsCompoundingInterestPeriodType; +import org.apache.fineract.portfolio.savings.SavingsInterestCalculationDaysInYearType; +import org.apache.fineract.portfolio.savings.SavingsInterestCalculationType; +import org.apache.fineract.portfolio.savings.SavingsPostingInterestPeriodType; +import org.apache.fineract.portfolio.savings.data.SavingsProductData; +import org.apache.fineract.portfolio.savings.service.SavingsDropdownReadPlatformService; +import org.apache.fineract.portfolio.savings.service.SavingsEnumerations; +import org.apache.fineract.portfolio.savings.service.SavingsProductReadPlatformService; +import org.apache.fineract.portfolio.tax.data.TaxGroupData; +import org.apache.fineract.portfolio.tax.service.TaxReadPlatformService; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +@Path("/v1/currentproducts") +@Component +@Tag(name = "Current Product", description = "Current account product offerings.") +@RequiredArgsConstructor +public class CurrentProductsApiResource { + + private final SavingsProductReadPlatformService savingProductReadPlatformService; + private final SavingsDropdownReadPlatformService dropdownReadPlatformService; + private final CurrencyReadPlatformService currencyReadPlatformService; + private final PlatformSecurityContext context; + private final DefaultToApiJsonSerializer toApiJsonSerializer; + private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; + private final ApiRequestParameterHelper apiRequestParameterHelper; + private final AccountingDropdownReadPlatformService accountingDropdownReadPlatformService; + private final ProductToGLAccountMappingReadPlatformService accountMappingReadPlatformService; + private final ChargeReadPlatformService chargeReadPlatformService; + private final PaymentTypeReadService paymentTypeReadPlatformService; + private final TaxReadPlatformService taxReadPlatformService; + private final ConfigurationDomainService configurationDomainService; + + @POST + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Create a Current Product") + @ApiResponse(responseCode = "200", description = "OK") + public String create(@Parameter(hidden = true) final String apiRequestBodyAsJson) { + final CommandWrapper commandRequest = new CommandWrapperBuilder().createCurrentProduct().withJson(apiRequestBodyAsJson).build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + @PUT + @Path("{productId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Update a Current Product") + @ApiResponse(responseCode = "200", description = "OK") + public String update(@PathParam("productId") final Long productId, + @Parameter(hidden = true) final String apiRequestBodyAsJson) { + final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCurrentProduct(productId).withJson(apiRequestBodyAsJson) + .build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + @GET + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "List Current Products") + @ApiResponse(responseCode = "200", description = "OK") + public String retrieveAll(@Context final UriInfo uriInfo) { + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_PRODUCT_RESOURCE_NAME); + final Collection products = savingProductReadPlatformService.retrieveAll(); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return toApiJsonSerializer.serialize(settings, products, SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS); + } + + @GET + @Path("{productId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Retrieve a Current Product") + @ApiResponse(responseCode = "200", description = "OK") + public String retrieveOne(@PathParam("productId") final Long productId, @Context final UriInfo uriInfo) { + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_PRODUCT_RESOURCE_NAME); + + SavingsProductData savingProductData = savingProductReadPlatformService.retrieveOne(productId); + final Collection charges = chargeReadPlatformService.retrieveSavingsProductCharges(productId); + savingProductData = SavingsProductData.withCharges(savingProductData, charges); + + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + + if (savingProductData.hasAccountingEnabled()) { + final Map accountingMappings = accountMappingReadPlatformService + .fetchAccountMappingDetailsForSavingsProduct(productId, savingProductData.accountingRuleTypeId()); + final Collection paymentChannelToFundSourceMappings = accountMappingReadPlatformService + .fetchPaymentTypeToFundSourceMappingsForSavingsProduct(productId); + Collection feeToGLAccountMappings = accountMappingReadPlatformService + .fetchFeeToIncomeAccountMappingsForSavingsProduct(productId); + Collection penaltyToGLAccountMappings = accountMappingReadPlatformService + .fetchPenaltyToIncomeAccountMappingsForSavingsProduct(productId); + savingProductData = SavingsProductData.withAccountingDetails(savingProductData, accountingMappings, + paymentChannelToFundSourceMappings, feeToGLAccountMappings, penaltyToGLAccountMappings); + } + + if (settings.isTemplate()) { + savingProductData = handleTemplateRelatedData(savingProductData); + } + + return toApiJsonSerializer.serialize(settings, savingProductData, + SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS); + } + + @GET + @Path("template") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Retrieve Current Product Template") + @ApiResponse(responseCode = "200", description = "OK") + public String retrieveTemplate(@Context final UriInfo uriInfo) { + context.authenticatedUser().validateHasReadPermission(DepositsApiConstants.CURRENT_PRODUCT_RESOURCE_NAME); + final SavingsProductData savingProduct = handleTemplateRelatedData(null); + final ApiRequestJsonSerializationSettings settings = apiRequestParameterHelper.process(uriInfo.getQueryParameters()); + return toApiJsonSerializer.serialize(settings, savingProduct, SavingsApiSetConstants.SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS); + } + + @DELETE + @Path("{productId}") + @Consumes({ MediaType.APPLICATION_JSON }) + @Produces({ MediaType.APPLICATION_JSON }) + @Operation(summary = "Delete a Current Product") + @ApiResponse(responseCode = "200", description = "OK") + public String delete(@PathParam("productId") final Long productId) { + final CommandWrapper commandRequest = new CommandWrapperBuilder().deleteCurrentProduct(productId).build(); + final CommandProcessingResult result = commandsSourceWritePlatformService.logCommandSource(commandRequest); + return toApiJsonSerializer.serialize(result); + } + + private SavingsProductData handleTemplateRelatedData(final SavingsProductData savingsProduct) { + + final EnumOptionData interestCompoundingPeriodType = SavingsEnumerations + .compoundingInterestPeriodType(SavingsCompoundingInterestPeriodType.DAILY); + + final EnumOptionData interestPostingPeriodType = SavingsEnumerations + .interestPostingPeriodType(SavingsPostingInterestPeriodType.MONTHLY); + + final EnumOptionData interestCalculationType = SavingsEnumerations + .interestCalculationType(SavingsInterestCalculationType.DAILY_BALANCE); + + final EnumOptionData interestCalculationDaysInYearType = SavingsEnumerations + .interestCalculationDaysInYearType(SavingsInterestCalculationDaysInYearType.DAYS_365); + + final EnumOptionData accountingRule = AccountingEnumerations.accountingRuleType(AccountingRuleType.NONE); + + CurrencyData currency = CurrencyData.blank(); + final Collection currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies(); + if (currencyOptions.size() == 1) { + currency = new ArrayList<>(currencyOptions).get(0); + } + + final Collection interestCompoundingPeriodTypeOptions = dropdownReadPlatformService + .retrieveCompoundingInterestPeriodTypeOptions(); + final Collection interestPostingPeriodTypeOptions = dropdownReadPlatformService + .retrieveInterestPostingPeriodTypeOptions(); + final Collection interestCalculationTypeOptions = dropdownReadPlatformService + .retrieveInterestCalculationTypeOptions(); + final Collection interestCalculationDaysInYearTypeOptions = dropdownReadPlatformService + .retrieveInterestCalculationDaysInYearTypeOptions(); + final Collection lockinPeriodFrequencyTypeOptions = dropdownReadPlatformService + .retrieveLockinPeriodFrequencyTypeOptions(); + final Collection withdrawalFeeTypeOptions = dropdownReadPlatformService.retrievewithdrawalFeeTypeOptions(); + + final Collection paymentTypeOptions = paymentTypeReadPlatformService.retrieveAllPaymentTypes(); + + final Collection accountingRuleOptions = accountingDropdownReadPlatformService + .retrieveAccountingRuleTypeOptions(); + final Map> accountingMappingOptions = accountingDropdownReadPlatformService + .retrieveAccountMappingOptionsForSavingsProducts(); + + final String accountMappingForPayment = configurationDomainService.getAccountMappingForPaymentType(); + + final boolean feeChargesOnly = false; + Collection chargeOptions = chargeReadPlatformService.retrieveSavingsProductApplicableCharges(feeChargesOnly); + chargeOptions = CollectionUtils.isEmpty(chargeOptions) ? null : chargeOptions; + + Collection penaltyOptions = chargeReadPlatformService.retrieveSavingsApplicablePenalties(); + penaltyOptions = CollectionUtils.isEmpty(penaltyOptions) ? null : penaltyOptions; + final Collection taxGroupOptions = taxReadPlatformService.retrieveTaxGroupsForLookUp(); + + SavingsProductData savingsProductToReturn = null; + if (savingsProduct != null) { + savingsProductToReturn = SavingsProductData.withTemplate(savingsProduct, currencyOptions, interestCompoundingPeriodTypeOptions, + interestPostingPeriodTypeOptions, interestCalculationTypeOptions, interestCalculationDaysInYearTypeOptions, + lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, paymentTypeOptions, accountingRuleOptions, + accountingMappingOptions, chargeOptions, penaltyOptions, taxGroupOptions, accountMappingForPayment); + } else { + savingsProductToReturn = SavingsProductData.template(currency, interestCompoundingPeriodType, interestPostingPeriodType, + interestCalculationType, interestCalculationDaysInYearType, accountingRule, currencyOptions, + interestCompoundingPeriodTypeOptions, interestPostingPeriodTypeOptions, interestCalculationTypeOptions, + interestCalculationDaysInYearTypeOptions, lockinPeriodFrequencyTypeOptions, withdrawalFeeTypeOptions, + paymentTypeOptions, accountingRuleOptions, accountingMappingOptions, chargeOptions, penaltyOptions, taxGroupOptions, + accountMappingForPayment); + } + + return savingsProductToReturn; + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ActivateCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ActivateCurrentAccountCommandHandler.java new file mode 100644 index 000000000..f8b6c5e02 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ActivateCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "ACTIVATE") +public class ActivateCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public ActivateCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.activate(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/AddCurrentAccountChargeCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/AddCurrentAccountChargeCommandHandler.java new file mode 100644 index 000000000..a940f3806 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/AddCurrentAccountChargeCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNTCHARGE", action = "CREATE") +public class AddCurrentAccountChargeCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public AddCurrentAccountChargeCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.addSavingsAccountCharge(command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ApplyAnnualFeeCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ApplyAnnualFeeCurrentAccountCommandHandler.java new file mode 100644 index 000000000..bd8821c58 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ApplyAnnualFeeCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "APPLYANNUALFEE") +public class ApplyAnnualFeeCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public ApplyAnnualFeeCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.applyAnnualFee(command.entityId(), command.getSavingsId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockCreditsToCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockCreditsToCurrentAccountCommandHandler.java new file mode 100644 index 000000000..ec476f9f7 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockCreditsToCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "BLOCKCREDIT") +public class BlockCreditsToCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public BlockCreditsToCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.blockCredits(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockCurrentAccountCommandHandler.java new file mode 100644 index 000000000..b801b9ad2 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "BLOCK") +public class BlockCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public BlockCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.blockAccount(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockDebitsFromCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockDebitsFromCurrentAccountCommandHandler.java new file mode 100644 index 000000000..b737d728c --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/BlockDebitsFromCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "BLOCKDEBIT") +public class BlockDebitsFromCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public BlockDebitsFromCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.blockDebits(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CalculateInterestCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CalculateInterestCurrentAccountCommandHandler.java new file mode 100644 index 000000000..78b262420 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CalculateInterestCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "CALCULATEINTEREST") +public class CalculateInterestCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public CalculateInterestCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.calculateInterest(command.getSavingsId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CloseSavingsCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CloseSavingsCurrentAccountCommandHandler.java new file mode 100644 index 000000000..e35ab2855 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CloseSavingsCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "CLOSE") +public class CloseSavingsCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public CloseSavingsCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.close(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CreateCurrentProductCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CreateCurrentProductCommandHandler.java new file mode 100644 index 000000000..a14e198ba --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CreateCurrentProductCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsProductWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTPRODUCT", action = "CREATE") +public class CreateCurrentProductCommandHandler implements NewCommandSourceHandler { + + private final SavingsProductWritePlatformService productWritePlatformService; + + @Autowired + public CreateCurrentProductCommandHandler(final SavingsProductWritePlatformService productWritePlatformService) { + this.productWritePlatformService = productWritePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.productWritePlatformService.create(command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationApprovalCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationApprovalCommandHandler.java new file mode 100644 index 000000000..8b06c11c5 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationApprovalCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsApplicationProcessWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "APPROVE") +public class CurrentAccountApplicationApprovalCommandHandler implements NewCommandSourceHandler { + + private final SavingsApplicationProcessWritePlatformService applicationProcessService; + + @Autowired + public CurrentAccountApplicationApprovalCommandHandler(final SavingsApplicationProcessWritePlatformService applicationProcessService) { + this.applicationProcessService = applicationProcessService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.applicationProcessService.approveApplication(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationApprovalUndoCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationApprovalUndoCommandHandler.java new file mode 100644 index 000000000..0ed4e8466 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationApprovalUndoCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsApplicationProcessWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "APPROVALUNDO") +public class CurrentAccountApplicationApprovalUndoCommandHandler implements NewCommandSourceHandler { + + private final SavingsApplicationProcessWritePlatformService applicationProcessService; + + @Autowired + public CurrentAccountApplicationApprovalUndoCommandHandler(final SavingsApplicationProcessWritePlatformService applicationProcessService) { + this.applicationProcessService = applicationProcessService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.applicationProcessService.undoApplicationApproval(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationDeletionCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationDeletionCommandHandler.java new file mode 100644 index 000000000..135c146c6 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationDeletionCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsApplicationProcessWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "DELETE") +public class CurrentAccountApplicationDeletionCommandHandler implements NewCommandSourceHandler { + + private final SavingsApplicationProcessWritePlatformService applicationProcessService; + + @Autowired + public CurrentAccountApplicationDeletionCommandHandler(final SavingsApplicationProcessWritePlatformService applicationProcessService) { + this.applicationProcessService = applicationProcessService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.applicationProcessService.deleteApplication(command.getSavingsId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationModificationCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationModificationCommandHandler.java new file mode 100644 index 000000000..ce731650b --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationModificationCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsApplicationProcessWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "UPDATE") +public class CurrentAccountApplicationModificationCommandHandler implements NewCommandSourceHandler { + + private final SavingsApplicationProcessWritePlatformService applicationProcessService; + + @Autowired + public CurrentAccountApplicationModificationCommandHandler(final SavingsApplicationProcessWritePlatformService applicationProcessService) { + this.applicationProcessService = applicationProcessService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.applicationProcessService.modifyApplication(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationRejectedCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationRejectedCommandHandler.java new file mode 100644 index 000000000..a3219d2ed --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationRejectedCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsApplicationProcessWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "REJECT") +public class CurrentAccountApplicationRejectedCommandHandler implements NewCommandSourceHandler { + + private final SavingsApplicationProcessWritePlatformService applicationProcessService; + + @Autowired + public CurrentAccountApplicationRejectedCommandHandler(final SavingsApplicationProcessWritePlatformService applicationProcessService) { + this.applicationProcessService = applicationProcessService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.applicationProcessService.rejectApplication(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationSubmittalCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationSubmittalCommandHandler.java new file mode 100644 index 000000000..fc0a4e455 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationSubmittalCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsApplicationProcessWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "CREATE") +public class CurrentAccountApplicationSubmittalCommandHandler implements NewCommandSourceHandler { + + private final SavingsApplicationProcessWritePlatformService applicationProcessService; + + @Autowired + public CurrentAccountApplicationSubmittalCommandHandler(final SavingsApplicationProcessWritePlatformService applicationProcessService) { + this.applicationProcessService = applicationProcessService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.applicationProcessService.submitApplication(command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationWithdrawnCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationWithdrawnCommandHandler.java new file mode 100644 index 000000000..52d761c43 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountApplicationWithdrawnCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsApplicationProcessWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "WITHDRAW") +public class CurrentAccountApplicationWithdrawnCommandHandler implements NewCommandSourceHandler { + + private final SavingsApplicationProcessWritePlatformService applicationProcessService; + + @Autowired + public CurrentAccountApplicationWithdrawnCommandHandler(final SavingsApplicationProcessWritePlatformService applicationProcessService) { + this.applicationProcessService = applicationProcessService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.applicationProcessService.applicantWithdrawsFromApplication(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountTransactionAdjustmentCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountTransactionAdjustmentCommandHandler.java new file mode 100644 index 000000000..d1af50d6e --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/CurrentAccountTransactionAdjustmentCommandHandler.java @@ -0,0 +1,47 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "ADJUSTTRANSACTION") +public class CurrentAccountTransactionAdjustmentCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public CurrentAccountTransactionAdjustmentCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + final Long transactionId = Long.valueOf(command.getTransactionId()); + return this.writePlatformService.adjustSavingsTransaction(command.getSavingsId(), transactionId, command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DeleteCurrentAccountChargeCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DeleteCurrentAccountChargeCommandHandler.java new file mode 100644 index 000000000..03152e915 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DeleteCurrentAccountChargeCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNTCHARGE", action = "DELETE") +public class DeleteCurrentAccountChargeCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public DeleteCurrentAccountChargeCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.deleteSavingsAccountCharge(command.getSavingsId(), command.entityId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DeleteCurrentProductCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DeleteCurrentProductCommandHandler.java new file mode 100644 index 000000000..b730c9a96 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DeleteCurrentProductCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsProductWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTPRODUCT", action = "DELETE") +public class DeleteCurrentProductCommandHandler implements NewCommandSourceHandler { + + private final SavingsProductWritePlatformService productWritePlatformService; + + @Autowired + public DeleteCurrentProductCommandHandler(final SavingsProductWritePlatformService productWritePlatformService) { + this.productWritePlatformService = productWritePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.productWritePlatformService.delete(command.getProductId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DepositCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DepositCurrentAccountCommandHandler.java new file mode 100644 index 000000000..c331667ac --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/DepositCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "DEPOSIT") +public class DepositCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public DepositCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.deposit(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/HoldAmountCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/HoldAmountCurrentAccountCommandHandler.java new file mode 100644 index 000000000..ee3dc3fbd --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/HoldAmountCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "HOLDAMOUNT") +public class HoldAmountCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public HoldAmountCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.holdAmount(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/InactivateCurrentAccountChargeCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/InactivateCurrentAccountChargeCommandHandler.java new file mode 100644 index 000000000..c3a0209e5 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/InactivateCurrentAccountChargeCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNTCHARGE", action = "INACTIVATE") +public class InactivateCurrentAccountChargeCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public InactivateCurrentAccountChargeCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.inactivateCharge(command.getSavingsId(), command.entityId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PayCurrentAccountChargeCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PayCurrentAccountChargeCommandHandler.java new file mode 100644 index 000000000..3582b9b66 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PayCurrentAccountChargeCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNTCHARGE", action = "PAY") +public class PayCurrentAccountChargeCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public PayCurrentAccountChargeCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.payCharge(command.getSavingsId(), command.entityId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PostCurrentAccountInterestAsOnDateCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PostCurrentAccountInterestAsOnDateCommandHandler.java new file mode 100644 index 000000000..dbed5f1ce --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PostCurrentAccountInterestAsOnDateCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "POSTINTERESTASONDATE") +public class PostCurrentAccountInterestAsOnDateCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public PostCurrentAccountInterestAsOnDateCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.postInterest(command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PostInterestCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PostInterestCurrentAccountCommandHandler.java new file mode 100644 index 000000000..ff94fddb5 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/PostInterestCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "POSTINTEREST") +public class PostInterestCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public PostInterestCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.postInterest(command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ReleaseAmountCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ReleaseAmountCurrentAccountCommandHandler.java new file mode 100644 index 000000000..aa42e6b5e --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ReleaseAmountCurrentAccountCommandHandler.java @@ -0,0 +1,47 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "RELEASEAMOUNT") +public class ReleaseAmountCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public ReleaseAmountCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + final Long transactionId = Long.valueOf(command.getTransactionId()); + return this.writePlatformService.releaseAmount(command.getSavingsId(), transactionId); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/RemoveCurrentAccountOfficerCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/RemoveCurrentAccountOfficerCommandHandler.java new file mode 100644 index 000000000..3e29fecb1 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/RemoveCurrentAccountOfficerCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "REMOVESAVINGSOFFICER") +public class RemoveCurrentAccountOfficerCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public RemoveCurrentAccountOfficerCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.unassignFieldOfficer(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ReverseTransactionCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ReverseTransactionCurrentAccountCommandHandler.java new file mode 100644 index 000000000..12561459d --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/ReverseTransactionCurrentAccountCommandHandler.java @@ -0,0 +1,47 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "REVERSETRANSACTION") +public class ReverseTransactionCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public ReverseTransactionCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + final Long transactionId = Long.valueOf(command.getTransactionId()); + return this.writePlatformService.reverseTransaction(command.getSavingsId(), transactionId, false, command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockCreditsToCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockCreditsToCurrentAccountCommandHandler.java new file mode 100644 index 000000000..145727a35 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockCreditsToCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "UNBLOCKCREDIT") +public class UnblockCreditsToCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public UnblockCreditsToCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.unblockCredits(command.getSavingsId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockCurrentAccountCommandHandler.java new file mode 100644 index 000000000..ed2ec355d --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "UNBLOCK") +public class UnblockCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public UnblockCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.unblockAccount(command.getSavingsId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockDebitsFromCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockDebitsFromCurrentAccountCommandHandler.java new file mode 100644 index 000000000..26806ad9b --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UnblockDebitsFromCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "UNBLOCKDEBIT") +public class UnblockDebitsFromCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public UnblockDebitsFromCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.unblockDebits(command.getSavingsId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UndoTransactionCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UndoTransactionCurrentAccountCommandHandler.java new file mode 100644 index 000000000..80cd9d3f8 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UndoTransactionCurrentAccountCommandHandler.java @@ -0,0 +1,47 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "UNDOTRANSACTION") +public class UndoTransactionCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public UndoTransactionCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + final Long transactionId = Long.valueOf(command.getTransactionId()); + return this.writePlatformService.undoTransaction(command.getSavingsId(), transactionId, false); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentAccountChargeCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentAccountChargeCommandHandler.java new file mode 100644 index 000000000..ed2e59f5d --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentAccountChargeCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNTCHARGE", action = "UPDATE") +public class UpdateCurrentAccountChargeCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public UpdateCurrentAccountChargeCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.updateSavingsAccountCharge(command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentAccountOfficerCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentAccountOfficerCommandHandler.java new file mode 100644 index 000000000..d211cfaf8 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentAccountOfficerCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "UPDATESAVINGSOFFICER") +public class UpdateCurrentAccountOfficerCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public UpdateCurrentAccountOfficerCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.assignFieldOfficer(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentProductCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentProductCommandHandler.java new file mode 100644 index 000000000..a7246ea70 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateCurrentProductCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsProductWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTPRODUCT", action = "UPDATE") +public class UpdateCurrentProductCommandHandler implements NewCommandSourceHandler { + + private final SavingsProductWritePlatformService productWritePlatformService; + + @Autowired + public UpdateCurrentProductCommandHandler(final SavingsProductWritePlatformService productWritePlatformService) { + this.productWritePlatformService = productWritePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.productWritePlatformService.update(command.getProductId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateWithHoldTaxCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateWithHoldTaxCurrentAccountCommandHandler.java new file mode 100644 index 000000000..6be9382b1 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/UpdateWithHoldTaxCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "UPDATEWITHHOLDTAX") +public class UpdateWithHoldTaxCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public UpdateWithHoldTaxCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.modifyWithHoldTax(command.entityId(), command); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/WaiveCurrentAccountChargeCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/WaiveCurrentAccountChargeCommandHandler.java new file mode 100644 index 000000000..d9c704273 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/WaiveCurrentAccountChargeCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNTCHARGE", action = "WAIVE") +public class WaiveCurrentAccountChargeCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public WaiveCurrentAccountChargeCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.waiveCharge(command.getSavingsId(), command.entityId()); + } +} diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/WithdrawCurrentAccountCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/WithdrawCurrentAccountCommandHandler.java new file mode 100644 index 000000000..5609c58f1 --- /dev/null +++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/savings/handler/current/WithdrawCurrentAccountCommandHandler.java @@ -0,0 +1,46 @@ +/** + * 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.handler.current; + +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.portfolio.savings.service.SavingsAccountWritePlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@CommandType(entity = "CURRENTACCOUNT", action = "WITHDRAWAL") +public class WithdrawCurrentAccountCommandHandler implements NewCommandSourceHandler { + + private final SavingsAccountWritePlatformService writePlatformService; + + @Autowired + public WithdrawCurrentAccountCommandHandler(final SavingsAccountWritePlatformService writePlatformService) { + this.writePlatformService = writePlatformService; + } + + @Transactional + @Override + public CommandProcessingResult processCommand(final JsonCommand command) { + return this.writePlatformService.withdrawal(command.getSavingsId(), command); + } +} diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml index e3892d613..5da7d21b8 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml @@ -234,4 +234,14 @@ + + + + + + + + + + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0225_add_current_account_support.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0225_add_current_account_support.xml new file mode 100644 index 000000000..475c4c777 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0225_add_current_account_support.xml @@ -0,0 +1,519 @@ + + + + + + + + + SELECT COUNT(*) FROM m_permission WHERE code = 'READ_CURRENTACCOUNT' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/domain/CurrentAccount.java b/fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/domain/CurrentAccount.java new file mode 100644 index 000000000..0acaa8698 --- /dev/null +++ b/fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/domain/CurrentAccount.java @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.fineract.portfolio.savings.domain; + +import jakarta.persistence.DiscriminatorValue; +import jakarta.persistence.Entity; + +@Entity +@DiscriminatorValue("400") +public class CurrentAccount extends SavingsAccount { + + protected CurrentAccount() { + // + } +}