public class SavingsService
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CENTRE_ID |
Constructor and Description |
---|
SavingsService(MambuAPIService mambuAPIService)
Create a new savings service
|
Modifier and Type | Method and Description |
---|---|
com.mambu.savings.shared.model.SavingsTransaction |
applyFeeToSavingsAccount(java.lang.String accountId,
java.util.List<com.mambu.loans.shared.model.CustomPredefinedFee> fees,
java.lang.String notes)
Apply Predefined Fee to to a savings account
|
com.mambu.savings.shared.model.SavingsTransaction |
applyFeeToSavingsAccount(java.lang.String accountId,
java.lang.String amount,
java.lang.String notes)
Apply Arbitrary FEE to a savings account
|
com.mambu.savings.shared.model.SavingsAccount |
approveSavingsAccount(java.lang.String accountId,
java.lang.String notes)
Approve Savings account
|
com.mambu.savings.shared.model.SavingsAccount |
closeSavingsAccount(java.lang.String accountId,
APIData.CLOSER_TYPE closerType,
java.lang.String notes)
Close Savings account specifying the type of closer (withdraw, reject or close)
Note: available since Mambu 3.4 See MBU-4581 and MBU-10976 for details.
|
com.mambu.api.server.handler.savings.model.JSONSavingsAccount |
createSavingsAccount(com.mambu.api.server.handler.savings.model.JSONSavingsAccount jsonSavingsAccount)
Create new SavingsAccount using JSONSavingsAccount object and sending it via the JSON API.
|
com.mambu.savings.shared.model.SavingsAccount |
createSavingsAccount(com.mambu.savings.shared.model.SavingsAccount savingsAccount)
Convenience method to create new SavingsAccount using SavingsAccount object.
|
boolean |
deleteSavingsAccount(java.lang.String accountId)
Delete Savings Account by its Id
Note: available since Mambu 3.4 See MBU-4581 for details.
|
com.mambu.savings.shared.model.SavingsTransaction |
executeJSONTransactionRequest(java.lang.String accountId,
com.mambu.savings.shared.model.SavingsTransactionType transactionType,
com.mambu.api.server.handler.loan.model.JSONTransactionRequest transactionRequest)
Convenience method to execute Savings Account transaction by providing JSONTransactionRequest
|
java.util.List<com.mambu.loans.shared.model.LoanAccount> |
getFundedLoanAccounts(java.lang.String savingsId)
Get all loan accounts funded by a deposit investor account
|
com.mambu.savings.shared.model.SavingsAccount |
getSavingsAccount(java.lang.String accountId)
Get a savings account by its id
|
com.mambu.savings.shared.model.SavingsAccount |
getSavingsAccountDetails(java.lang.String accountId)
Get a savings account with full details by its id
|
java.util.List<com.mambu.savings.shared.model.SavingsAccount> |
getSavingsAccounts(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints,
java.lang.String offset,
java.lang.String limit)
Get savings accounts by specifying filter constraints.
|
java.util.List<com.mambu.savings.shared.model.SavingsAccount> |
getSavingsAccountsByBranchCentreOfficerState(java.lang.String branchId,
java.lang.String centreId,
java.lang.String creditOfficerUserName,
java.lang.String accountState,
java.lang.String offset,
java.lang.String limit)
Get the Savings accounts by branch id, centreId, credit officer, accountState
|
java.util.List<com.mambu.savings.shared.model.SavingsAccount> |
getSavingsAccountsByBranchOfficerState(java.lang.String branchId,
java.lang.String creditOfficerUserName,
java.lang.String accountState,
java.lang.String offset,
java.lang.String limit)
Get the Savings accounts by branch id, credit officer, accountState
|
java.util.List<com.mambu.savings.shared.model.SavingsAccount> |
getSavingsAccountsForClient(java.lang.String clientId)
Get all the savings accounts for a given client
|
java.util.List<com.mambu.savings.shared.model.SavingsAccount> |
getSavingsAccountsForGroup(java.lang.String groupId)
Get all the savings accounts for a given group
|
java.util.List<com.mambu.savings.shared.model.SavingsTransaction> |
getSavingsAccountTransactions(java.lang.String accountId,
java.lang.String offset,
java.lang.String limit)
Get Savings Account Transactions by an account id and offset and limit
|
com.mambu.savings.shared.model.SavingsProduct |
getSavingsProduct(java.lang.String productId)
Get a Savings Product by Product id
|
java.util.List<com.mambu.savings.shared.model.SavingsProduct> |
getSavingsProducts(java.lang.String offset,
java.lang.String limit)
Get a list of Savings Products
|
java.util.List<com.mambu.savings.shared.model.SavingsTransaction> |
getSavingsTransactions(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints,
java.lang.String offset,
java.lang.String limit)
Deprecated.
|
java.util.List<com.mambu.savings.shared.model.SavingsTransaction> |
getSavingsTransactionsWithBasicDetails(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints,
java.lang.String offset,
java.lang.String limit)
Get savings transactions by specifying filter constraints with all the details (no custom fields)
|
java.util.List<com.mambu.savings.shared.model.SavingsTransaction> |
getSavingsTransactionsWithFullDetails(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints,
java.lang.String offset,
java.lang.String limit)
Get savings transactions by specifying filter constraints with all the details (custom fields included)
|
com.mambu.savings.shared.model.SavingsTransaction |
makeDeposit(java.lang.String accountId,
com.mambu.core.shared.model.Money amount,
java.util.Date date,
com.mambu.accounts.shared.model.TransactionDetails transactionDetails,
java.util.List<com.mambu.core.shared.model.CustomFieldValue> customInformation,
java.lang.String notes)
Make a deposit to an account.
|
com.mambu.savings.shared.model.SavingsTransaction |
makeTransfer(java.lang.String fromAccountId,
java.lang.String destinationAccountKey,
com.mambu.accounts.shared.model.Account.Type destinationAccountType,
java.lang.String amount,
java.lang.String notes)
Make transfer from an account
|
com.mambu.savings.shared.model.SavingsTransaction |
makeWithdrawal(java.lang.String accountId,
com.mambu.core.shared.model.Money amount,
java.util.Date date,
com.mambu.accounts.shared.model.TransactionDetails transactionDetails,
java.util.List<com.mambu.core.shared.model.CustomFieldValue> customInformation,
java.lang.String notes)
Make a withdrawal from an account.
|
boolean |
patchSavingsAccount(com.mambu.savings.shared.model.SavingsAccount savings)
Update savings terms for an existent savings account This API allows updating SavingsAccount terms only.
|
com.mambu.savings.shared.model.SavingsTransaction |
reverseSavingsTransaction(com.mambu.savings.shared.model.SavingsTransaction originalTransaction,
java.lang.String notes)
Reverse transaction for a savings account by providing the original savings transaction
|
com.mambu.savings.shared.model.SavingsTransaction |
reverseSavingsTransaction(java.lang.String accountId,
com.mambu.savings.shared.model.SavingsTransactionType originalTransactionType,
java.lang.String originalTransactionId,
java.lang.String notes)
Reverse savings transactions for a savings account
|
com.mambu.savings.shared.model.SavingsAccount |
startMaturity(java.lang.String accountId,
java.util.Date date,
java.lang.String notes)
Starts maturity for a saving account.
|
com.mambu.savings.shared.model.SavingsAccount |
undoApproveSavingsAccount(java.lang.String accountId,
java.lang.String notes)
Undo Approve for a savings account
|
com.mambu.savings.shared.model.SavingsAccount |
undoCloseSavingsAccount(com.mambu.savings.shared.model.SavingsAccount savingsAccount,
java.lang.String notes)
Undo Close Savings account.
|
com.mambu.api.server.handler.savings.model.JSONSavingsAccount |
updateSavingsAccount(com.mambu.api.server.handler.savings.model.JSONSavingsAccount jsonSavingsAccount)
Update an existent SavingsAccount using JSONSavingsAccount object and sending it via the JSON API.
|
com.mambu.savings.shared.model.SavingsAccount |
updateSavingsAccount(com.mambu.savings.shared.model.SavingsAccount savingsAccount)
Convenience method to Update an existent SavingsAccount.
|
public static final java.lang.String CENTRE_ID
@Inject public SavingsService(MambuAPIService mambuAPIService)
mambuAPIService
- the service responsible with the connection to the serverpublic com.mambu.savings.shared.model.SavingsAccount getSavingsAccount(java.lang.String accountId) throws MambuApiException
accountId
- the id of the accountMambuApiException
public com.mambu.savings.shared.model.SavingsAccount getSavingsAccountDetails(java.lang.String accountId) throws MambuApiException
accountId
- the id of the accountMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsAccount> getSavingsAccountsForClient(java.lang.String clientId) throws MambuApiException
clientId
- the id of the clientMambuApiException
public com.mambu.savings.shared.model.SavingsAccount approveSavingsAccount(java.lang.String accountId, java.lang.String notes) throws MambuApiException
accountId
- the id of the accountMambuApiException
public com.mambu.savings.shared.model.SavingsAccount undoApproveSavingsAccount(java.lang.String accountId, java.lang.String notes) throws MambuApiException
accountId
- the id of the savings accountMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsTransaction> getSavingsAccountTransactions(java.lang.String accountId, java.lang.String offset, java.lang.String limit) throws MambuApiException
accountId
- the id of the accountoffset
- first transaction numberlimit
- last transaction number Note: if offset and limit both equal null, all transactions are returned
(Note: transaction are sorted by date)MambuApiException
@Deprecated public java.util.List<com.mambu.savings.shared.model.SavingsTransaction> getSavingsTransactions(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints, java.lang.String offset, java.lang.String limit) throws MambuApiException
filterConstraints
- filter constraints. Must not be nulloffset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsTransaction> getSavingsTransactionsWithFullDetails(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints, java.lang.String offset, java.lang.String limit) throws MambuApiException
filterConstraints
- filter constraints. Must not be nulloffset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsTransaction> getSavingsTransactionsWithBasicDetails(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints, java.lang.String offset, java.lang.String limit) throws MambuApiException
filterConstraints
- filter constraints. Must not be nulloffset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public com.mambu.savings.shared.model.SavingsTransaction makeWithdrawal(java.lang.String accountId, com.mambu.core.shared.model.Money amount, java.util.Date date, com.mambu.accounts.shared.model.TransactionDetails transactionDetails, java.util.List<com.mambu.core.shared.model.CustomFieldValue> customInformation, java.lang.String notes) throws MambuApiException
accountId
- account ID or encoded key. Must not be nullamount
- transaction amountdate
- transaction datetransactionDetails
- transaction detailscustomInformation
- transaction custom fieldsnotes
- transaction notesMambuApiException
public com.mambu.savings.shared.model.SavingsTransaction makeDeposit(java.lang.String accountId, com.mambu.core.shared.model.Money amount, java.util.Date date, com.mambu.accounts.shared.model.TransactionDetails transactionDetails, java.util.List<com.mambu.core.shared.model.CustomFieldValue> customInformation, java.lang.String notes) throws MambuApiException
accountId
- account ID or encoded key. Must not be nullamount
- transaction amountdate
- transaction datetransactionDetails
- transaction detailscustomInformation
- transaction custom fieldsnotes
- transaction notesMambuApiException
public com.mambu.savings.shared.model.SavingsTransaction makeTransfer(java.lang.String fromAccountId, java.lang.String destinationAccountKey, com.mambu.accounts.shared.model.Account.Type destinationAccountType, java.lang.String amount, java.lang.String notes) throws MambuApiException
fromAccountId
- the id of the account the amount to transfer fromdestinationAccountKey
- the id of the account to transfer todestinationAccountType
- type of the account (Type.Loan or Type.Savings)amount
- amount to transfernotes
- MambuApiException
public com.mambu.savings.shared.model.SavingsTransaction applyFeeToSavingsAccount(java.lang.String accountId, java.lang.String amount, java.lang.String notes) throws MambuApiException
accountId
- the id of the accountamount
- fee amountnotes
- transaction notesMambuApiException
public com.mambu.savings.shared.model.SavingsTransaction applyFeeToSavingsAccount(java.lang.String accountId, java.util.List<com.mambu.loans.shared.model.CustomPredefinedFee> fees, java.lang.String notes) throws MambuApiException
accountId
- the id or the encoded key of the account. Must not be nullfees
- fees. Only Manual Predefined Fees are currently supported. Must not be null. Must contain exactly one
fee.
Note: Once MBU-12865 is implemented this method will support both predefined fees and arbitrary fees
and the (@link #applyFeeToLoanAccount(String, String, String, String)} method used for
arbitrary fees can be deprecatednotes
- transaction notesMambuApiException
public com.mambu.savings.shared.model.SavingsTransaction executeJSONTransactionRequest(java.lang.String accountId, com.mambu.savings.shared.model.SavingsTransactionType transactionType, com.mambu.api.server.handler.loan.model.JSONTransactionRequest transactionRequest) throws MambuApiException
accountId
- account id or encoded key. Must not be nulltransactionType
- savings transaction type. Must not be null. Supported types are: FEE_APPLIED, DEPOSIT and WITHDRAWALtransactionRequest
- JSON transaction requestMambuApiException
public com.mambu.savings.shared.model.SavingsTransaction reverseSavingsTransaction(java.lang.String accountId, com.mambu.savings.shared.model.SavingsTransactionType originalTransactionType, java.lang.String originalTransactionId, java.lang.String notes) throws MambuApiException
accountId
- the id of the savings account. MandatoryoriginalTransactionType
- Original transaction type to be reversed. The following transaction types can be reversed: DEPOSIT,
WITHDRAWAL, TRANSFER, FEE. Mandatory.originalTransactionId
- the id or the encodedKey of the transaction to be reversed. Mandatorynotes
- transaction notesMambuApiException
public com.mambu.savings.shared.model.SavingsTransaction reverseSavingsTransaction(com.mambu.savings.shared.model.SavingsTransaction originalTransaction, java.lang.String notes) throws MambuApiException
originalTransaction
- The following transactions can be reversed: DEPOSIT, WITHDRAWAL and TRANSFER. Mandatory.notes
- transaction notesMambuApiException
public boolean deleteSavingsAccount(java.lang.String accountId) throws MambuApiException
accountId
- MambuApiException
public com.mambu.savings.shared.model.SavingsAccount closeSavingsAccount(java.lang.String accountId, APIData.CLOSER_TYPE closerType, java.lang.String notes) throws MambuApiException
accountId
- the id of the account to withdraw. Must not be nullcloserType
- type of closer (withdraw, reject or close). Must not be nullnotes
- optional notesMambuApiException
public com.mambu.savings.shared.model.SavingsAccount startMaturity(java.lang.String accountId, java.util.Date date, java.lang.String notes) throws MambuApiException
accountId
- The id of the saving account that maturity will be started for. Must not be NULL.date
- The date used to indicate when the maturity starts.notes
- Some notes that will be posted on the transaction that will be created for starting the maturity for
the account.MambuApiException
public com.mambu.savings.shared.model.SavingsAccount undoCloseSavingsAccount(com.mambu.savings.shared.model.SavingsAccount savingsAccount, java.lang.String notes) throws MambuApiException
savingsAccount
- closed savings account. Must not be null and must be in one of the supported closed states.notes
- undo closer reason notesMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsAccount> getSavingsAccountsForGroup(java.lang.String groupId) throws MambuApiException
groupId
- the id of the groupMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsAccount> getSavingsAccountsByBranchCentreOfficerState(java.lang.String branchId, java.lang.String centreId, java.lang.String creditOfficerUserName, java.lang.String accountState, java.lang.String offset, java.lang.String limit) throws MambuApiException
branchId
- The ID of the branch to which the accounts are assigned tocentreId
- The ID of the centre to which the loan accounts are assigned to. If both branchId and centreId are
provided then this centre must be assigned to the branchIdcreditOfficerUserName
- the username of the credit officer to whom the accounts are assigned toaccountState
- the state of the accounts to filter on (e.g: APPROVED)offset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsAccount> getSavingsAccountsByBranchOfficerState(java.lang.String branchId, java.lang.String creditOfficerUserName, java.lang.String accountState, java.lang.String offset, java.lang.String limit) throws MambuApiException
branchId
- The ID of the branch to which the accounts are assigned to provided then this centre must be assigned
to the branchIdcreditOfficerUserName
- the username of the credit officer to whom the accounts are assigned toaccountState
- the state of the accounts to filter on (e.g: APPROVED)offset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsAccount> getSavingsAccounts(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints, java.lang.String offset, java.lang.String limit) throws MambuApiException
filterConstraints
- filter constraints. Must not be nulloffset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.savings.shared.model.SavingsProduct> getSavingsProducts(java.lang.String offset, java.lang.String limit) throws MambuApiException
offset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public com.mambu.savings.shared.model.SavingsProduct getSavingsProduct(java.lang.String productId) throws MambuApiException
productId
- the id of the productMambuApiException
public com.mambu.api.server.handler.savings.model.JSONSavingsAccount createSavingsAccount(com.mambu.api.server.handler.savings.model.JSONSavingsAccount jsonSavingsAccount) throws MambuApiException
jsonSavingsAccount
- JSONSavingsAccount object containing SavingsAccount. Must be not null. SavingsAccount's encodedKey
must be null for account createMambuApiException
public com.mambu.savings.shared.model.SavingsAccount createSavingsAccount(com.mambu.savings.shared.model.SavingsAccount savingsAccount) throws MambuApiException
savingsAccount
- SavingsAccount object. Must not be null. SavingsAccount's encodedKey must be null for account createMambuApiException
public com.mambu.api.server.handler.savings.model.JSONSavingsAccount updateSavingsAccount(com.mambu.api.server.handler.savings.model.JSONSavingsAccount jsonSavingsAccount) throws MambuApiException
jsonSavingsAccount
- JSONSavingsAccount object containing SavingsAccount. SavingsAccount encodedKey or id must be NOT null
for account updateMambuApiException
public com.mambu.savings.shared.model.SavingsAccount updateSavingsAccount(com.mambu.savings.shared.model.SavingsAccount savingsAccount) throws MambuApiException
savingsAccount
- savings account object to be updated. Must not be null. SavingsAccount encodedKey or id must be NOT
null for account updateMambuApiException
public boolean patchSavingsAccount(com.mambu.savings.shared.model.SavingsAccount savings) throws MambuApiException
savings
- SavingsAccount object. Either account's encoded key or its ID must be NOT null for updating account
Note that only some savings terms can be updated. As of Mambu 3.14 the following fields can be
updated: interestRate, maxWidthdrawlAmount, recommendedDepositAmount, targetAmount,
overdraftInterestSpread, overdraftLimit, overdraftExpiryDate.
See MBU-10447 for more detailsMambuApiException
java.lang.IllegalArgumentException
public java.util.List<com.mambu.loans.shared.model.LoanAccount> getFundedLoanAccounts(java.lang.String savingsId) throws MambuApiException
savingsId
- encoded key or an id of an investor funding savings account. Must not be nullMambuApiException