[ 
https://issues.apache.org/jira/browse/FINERACT-2496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ralph Hopman resolved FINERACT-2496.
------------------------------------
    Resolution: Fixed

> Add Batch API Support for Creating Savings Account Charges
> ----------------------------------------------------------
>
>                 Key: FINERACT-2496
>                 URL: https://issues.apache.org/jira/browse/FINERACT-2496
>             Project: Apache Fineract
>          Issue Type: Improvement
>          Components: Charges, Savings
>            Reporter: Ralph Hopman
>            Assignee: Ralph Hopman
>            Priority: Minor
>
> The Batch API currently supports most savings account operations including 
> account creation, transactions, and transaction adjustments. However, it 
> lacks support for creating charges on savings accounts via the POST 
> {{/v1/savingsaccounts/\{savingsAccountId}/charges}} endpoint.
> This story will add the missing functionality to enable atomic creation of 
> savings account charges within batch operations.
> h2. Current State
> The Batch API supports:
>  * Creating savings accounts ({{{}POST /v1/savingsaccounts{}}})
>  * Retrieving savings accounts ({{{}GET /v1/savingsaccounts/{id{}}}})
>  * Creating savings transactions ({{{}POST 
> /v1/savingsaccounts/\{id}/transactions{}}})
>  * Adjusting savings transactions ({{{}POST 
> /v1/savingsaccounts/\{id}/transactions/{transactionId{}}}})
> *Missing:* Creating charges on savings accounts ({{{}POST 
> /v1/savingsaccounts/\{savingsAccountId}/charges{}}})
> h2. Business Value
> This enhancement will enable users to perform complex savings account 
> operations atomically within a single batch request. For example:
>  * Process a withdrawal and apply a withdrawal fee in one transaction
>  * Create a savings account and add initial charges atomically
>  * Apply multiple charges across different accounts with all-or-nothing 
> semantics using {{enclosingTransaction=true}}
> h2. Technical Implementation Plan
> The solution will implement:
>  # *CommandStrategy Implementation:* Create 
> {{CreateSavingsAccountChargeCommandStrategy}} class that:
>  ** Extracts {{savingsAccountId}} from the URL path
>  ** Delegates to 
> {{SavingsAccountChargesApiResource.addSavingsAccountCharge()}}
>  ** Returns appropriate HTTP response with status code and resource ID
>  # *Strategy Registration:* Update {{CommandStrategyProvider.init()}} to 
> register the new strategy with URL pattern 
> {{v1/savingsaccounts/\{id}/charges}} and HTTP method {{POST}}
>  # *Unit Tests:* Create comprehensive test coverage including:
>  ** {{CreateSavingsAccountChargeCommandStrategyTest}} - will verify command 
> execution
>  ** {{CommandStrategyProviderTest}} - will verify strategy registration and 
> routing
> h2. Testing Approach
> h3. Unit Tests
> The implementation will include two test classes:
> *CreateSavingsAccountChargeCommandStrategyTest*
>  * Will verify the strategy extracts {{savingsAccountId}} from the URL 
> correctly
>  * Will verify the strategy delegates to 
> {{SavingsAccountChargesApiResource.addSavingsAccountCharge()}}
>  * Will verify proper HTTP response (status code 200) is returned
>  * Will verify the response contains correct {{requestId}} and {{resourceId}}
>  * Will use Mockito to mock the {{SavingsAccountChargesApiResource}}
> *CommandStrategyProviderTest*
>  * Will verify the strategy is registered with the correct URL pattern
>  * Will verify the strategy is registered with the correct HTTP method (POST)
>  * Will verify the {{CommandStrategyProvider}} returns the correct strategy 
> bean
>  * Will ensure no regression in existing strategy registrations
> h2. Implementation Notes
>  * Follow the exact same pattern as {{CreateChargeCommandStrategy}} (for loan 
> charges)
>  * Ensure proper Spring {{@Component}} annotation for dependency injection
>  * Use {{@RequiredArgsConstructor}} for constructor injection
>  * Extract {{savingsAccountId}} from URL using regex matching
>  * Delegate to existing 
> {{SavingsAccountChargesApiResource.addSavingsAccountCharge()}} method
>  * Return appropriate {{BatchResponse}} with status code and resource 
> identifiers



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to