Package org.cyclos.impl.banking
Class AccountServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.banking.AccountServiceImpl
-
- All Implemented Interfaces:
AccountServiceLocal,AccountService,Service
@Service public class AccountServiceImpl extends BaseServiceImpl implements AccountServiceLocal
implementation forAccountService
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.cyclos.impl.banking.AccountServiceLocal
AccountServiceLocal.AdjustAccountsResult
-
-
Field Summary
-
Fields inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
authHandler, conversionHandler, customFieldValueHandler, entityManagerHandler, groupsHandler, productsHandler, restBeanPropertyMapping, userLocatorHandler
-
Fields inherited from class org.cyclos.impl.AbstractServerComponent
accountHandler, configurationHandler, dataTranslationHandler, notificationHandler, profileFieldHandler, transactionHandler, translationHandler
-
Fields inherited from interface org.cyclos.services.banking.AccountService
MAX_BALANCE_HISTORY_DATAPOINTS
-
Fields inherited from interface org.cyclos.impl.banking.AccountServiceLocal
ATTR_ACCOUNT, ATTR_ACCOUNT_TYPE, ATTR_OWNER, EXPORT, POSSIBLE_STATUSES_TO_OWN_ACCOUNTS
-
-
Constructor Summary
Constructors Constructor Description AccountServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccountNumberExistsOrIsReserved(AccountNumberConfiguration accountNumberConfiguration, String accountNumber)Returns true if the given account number is used in an existing account or is reserved to be used for a pending userAccountServiceLocal.AdjustAccountsResultadjustAccounts(User user, boolean allowInitialCredit)Creates / disposes accounts for the given user, optionally allowing initial creditvoidcheckActive(Account account)If the given account is not active, throws anIllegalActionExceptionvoidcheckActive(AccountOwner owner)If the given owner is a user which is either pending or removed, throes anIllegalActionExceptionvoidcheckAvailableBalance(Account account, BigDecimal amount)Checks that the given account has enough balance for performing a payment with the given amount.SystemAccountcreateSystemAccount(SystemAccountType type)Creates a new system accountExternalPaymentAmountReservationdereserveAmount(ExternalPayment externalPayment)Cancels the amount reservation related to the given external paymentInstallmentAmountReservationdereserveAmount(ScheduledPaymentInstallment installment)Dereserves the amount for the given installmentOrderAmountReservationdereserveAmount(Order order)Cancels the amount reservation related to the given orderPendingAuthorizationAmountReservationdereserveAmountForAuthorization(BasePayment transaction)Dereserves the amount for the transaction which was previously awaiting authorizationVoucherAmountReservationdereserveAmountIfNeeded(Voucher voucher)If the voucher pack had an amount reservation, dereserve the amount for the given voucherVoucherRedeemAmountReservationdereserveAmountIfNeeded(VoucherRedeem voucherRedeem)If the voucher pack had an amount reservation, dereserve the amount for the given voucher redeemFileInfoexportAccountBalanceLimitsOverview(@NotNull ExportFormatVO formatVO, @NotNull AccountBalanceLimitsOverviewQuery params)Generates a file with the query result listing the account balance limitsFileInfoexportAccountHistoriesOverview(@NotNull ExportFormatVO formatVO, @NotNull AccountHistoriesOverviewQuery params)Exports the account histories overview result to fileFileInfoexportAccountHistory(@NotNull ExportFormatVO formatVO, @NotNull AccountHistoryQuery params)Exports the account history result to fileFileInfoexportAccountPaymentAmountLimitsOverview(@NotNull ExportFormatVO formatVO, @NotNull AccountPaymentAmountLimitsOverviewQuery params)Generates a file with the query result listing the account balance limitsFileInfoexportUsersWithBalances(@NotNull ExportFormatVO formatVO, @NotNull UserWithBalanceQuery params)Generates a file with the query result listing the user balancesvoidfillTransSearchData(ITransSearchData data, Account account, InternalAccountOwner accountOwner, ExportFormatContext exportContext)Fills the given data with data common to transfer and transaction search.AccountfindByNumber(String number)Returns the account with the given numberStringgenerateNumber(AccountType type, InternalAccountOwner owner)Generates an unique account number for the given type and owner.AccountBalanceHistoryVOgetAccountBalanceHistory(@NotNull AccountBalanceHistoryParams params)Returns the balance at each data point for a given account.AccountLimitsOverviewDatagetAccountBalanceLimitsOverviewData()Account limits (balance and payment amounts) overview data for performing searches.AccountHistoriesOverviewDatagetAccountHistoriesOverviewData()Gets the details for viewing an account histories overviewAccountHistoriesOverviewStatusVOgetAccountHistoriesOverviewStatus(AccountHistoriesOverviewQuery params)Returns the statuses by currency for the result of searching transactions with the given parametersAccountHistoryDatagetAccountHistoryData(AccountVO accountVO, RateVisibility rateVisibility)Gets the details for viewing an account historyAccountHistoryStatusVOgetAccountHistoryStatus(Account account, AccountHistoryQuery params)Returns historic status for the accountAccountWithHistoryStatusVOgetAccountHistoryStatus(AccountHistoryQuery params)Returns historic status for the accountAccountLimitsOverviewDatagetAccountPaymentAmountLimitsOverviewData()Account limits (balance and payment amounts) overview data for performing searches.List<AccountWithStatusVO>getAccountsSummary(InternalAccountOwner owner, DateTime dateTime)Lists the visible accounts summary for the given account owner, with balances relative to the given dateAccountStatusVOgetAccountStatus(Account account, Date time, RateVisibility includeRates)Returns the account status for the given account at the given timeAccountStatusVOgetAccountStatus(AccountVO accountVO, DateTime dateTime, RateVisibility includeRates)Gets the status for the given accountList<AccountWithStatusVO>getAccountsWithStatus(InternalAccountOwner accountOwner, Date date, Date receivedSince, boolean includeRates)Similar toAccountServiceLocal.listVisible(InternalAccountOwner), but returns each account with the account status, at the given time point.AccountWithStatusVOgetAccountWithStatus(AccountVO vo, DateTime dateTime)Returns the information of an account, with its status, by owner and typeOrderAmountReservationgetAmountDereservation(Order order)Returns theOrderAmountReservationthat canceled the order reserved amount, or null if nonePendingAuthorizationAmountReservationgetAmountDereservationForAuthorization(BasePayment transaction)Returns thePendingAuthorizationAmountReservationcreated when a payment was no longer pending authorization, or null if noneOrderAmountReservationgetAmountReservation(Order order)Returns theOrderAmountReservationthat reserved amount when the order was submitted, or null if nonePendingAuthorizationAmountReservationgetAmountReservationForAuthorization(BasePayment transaction)Returns thePendingAuthorizationAmountReservationcreated when a payment was submitted for authorization, or null if noneBigDecimalgetAvailableBalance(Account account, Date date)Returns the available balance for the given account at the given dateBigDecimalgetAverageBalance(Account account, BigDecimal balanceDiff, DatePeriod period, boolean positive, BigDecimal freebase)Returns the balance average for the given account over the given period.BigDecimalgetBalance(Account account, Date date)Returns the raw balance for the given account at the given timeAccountBalanceLimitLoggetBalanceLimitLog(Account account, Date date)Returns the limit log which is valid on the given time.BigDecimalgetCreditLimit(Account account, Date date)Returns the credit limit of the given account at the given dateBigDecimalgetCurrentAvailableBalance(Account account, NativeAccountStatus status)Returns the available balance for the given account, given that the native account status was already fetchedFrontendDashboardAccountVOgetFrontendDashbordAcccount(Account account, int lastTransfers)Returns data for an account to be used in the new frontend dashboardList<TransferStatusFlow>getManagedFlows(Account account)Returns the managed transfer status flows for the logged user over the given accountNativeAccountStatusgetNativeAccountStatus(Account account, Date date)Returns the native account status for the given accountStringgetOwnerName(Account account)Returns the owner name: if is a system account, get the system account type.AccountPermissionsDatagetPermissions(@NotNull AccountVO accountVO)Returns permissions of what the logged user can do over the given accountAccountPermissionsDatagetPermissions(Account account)Returns permissions of what the logged user can do over the given accountRestrictedOperatorAccessibleAccountsgetRetrictedOperatorAccessibleAccounts()Returns which owner user accounts types are accessible and how by the logged restricted operator.BigDecimalgetUpperCreditLimit(Account account, Date date)Returns the upper credit limit of the given account at the given dateUserAccountBalanceLimitDatagetUserAccountBalanceLimitData(AccountVO accountVO)Get an account limit dataUserAccountPaymentAmountLimitDatagetUserAccountPaymentAmountLimitData(@NotNull AccountVO accountVO)Get an account payment amount limit dataList<AccountBalanceLimitVO>getUserAccountsBalanceLimits(UserLocatorVO userLocator)Returns the user accounts with their upper and lower balance limitsList<UserAccountData>getUserAccountsData(User user)Returns the user's accounts data visible in profileList<AccountPaymentAmountLimitVO>getUserAccountsPaymentAmountLimits(@NotNull UserLocatorVO userLocator)Returns the user accounts with their upper and lower balance limitsUsersWithBalancesOverviewgetUsersWithBalancesOverview(UserWithBalanceQuery params)Returns the overview of users with balances according to the given queryUserWithBalanceSearchDatagetUserWithBalanceSearchData()Returns data to search for users with balancesList<TransferStatusFlow>getVisibleFlows(Account account)Returns the visible transfer status flows for the logged user over the given accountbooleanhasAccess(Account account)Returns whether the given account is accessible by the logged userbooleanhasVisibility(Account account)Returns whether the given account is visible by the logged user or not.
An account is visible if it's accessible and the associatedAccountAccessibilityallow view it.booleanisActive(IAccount account)Returns whether the given account is active.<A extends Account>
List<A>listVisible(InternalAccountOwner owner)Returns the visible accounts for the given owner.<A extends AccountType>
List<A>listVisibleTypes(InternalAccountOwner owner)Calls listVisible(), but projecting each account typeAccountWithCurrencyVOload(Long id)Loads an account by id<A extends Account>
Aload(AccountLocator locator)Loads an account for the given locator, without checking permissions for the logged user For user accounts, if the account is not found yet, returns a transient account.<A extends Account>
Aload(InternalAccountOwner owner, AccountType type)Loads an account for the given owner / type, without checking permissions for the logged user For user accounts, if the account is not found yet, returns a transient account.<A extends Account>
Aload(InternalAccountOwner owner, AccountType type, boolean allowDisposed)Loads an account for the given owner / type, without checking permissions for the logged user.voidmakeBalanceDirty(Account account, Transfer transfer)Marks the balance of the given account as dirty for given transfer.protected voidpersist(IEntity entity)protected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkvoidremoveLastClosedAccountBalances(Transfer transfer)Removes all the closes from the initial date to now of the from and to account of the transfer.<A extends Account>
Arequire(InternalAccountOwner owner, AccountType type)Loads an account for the given owner / type, without checking permissions for the logged user.CustomAmountReservationreserveAmount(Account account, BigDecimal amount)Reserves the given amount for an account checking its available balance.
WARNING: Intended to be used via scripts (it can't be removed after a static analysis).CustomAmountReservationreserveAmount(Account account, BigDecimal amount, boolean ignoreAccountLimits)Reserves the given amount for an account ignoring the limits only ifignoreAccountLimitsis true.
WARNING: Intended to be used via scripts (it can't be removed after a static analysis).ExternalPaymentAmountReservationreserveAmount(ExternalPayment externalPayment)Reserves the amount for the given external paymentScheduledPaymentAmountReservationreserveAmount(ScheduledPayment scheduledPayment)Reserves the total amount for the given scheduled paymentOrderAmountReservationreserveAmount(Order order)Reserves the amount for the given webshop orderPendingAuthorizationAmountReservationreserveAmountForAuthorization(PerformTransactionDTO performTransaction, BasePayment transaction)Reserves the amount for a pending by authorization payment created from the given DTO.VoucherUnblockAmountReservationreserveAmountForUnblocking(Voucher voucher)Reserves the amount for unblocking a blocked voucherVoucherPackAmountReservationreserveAmountIfNeeded(VoucherPack pack)Reserves the total amount for the given voucher pack (count * amount) on the source account of the redeem type, if that account is limited.List<PeriodPreselectorOptionData>resolvePreselectedPeriods()Resolve the available preselected periods for the logged user configurationPage<AccountBalanceLimitVO>searchAccountBalanceLimitsOverview(AccountBalanceLimitsOverviewQuery params)Overview search of account balance limitsPage<AccountHistoryOverviewEntryVO>searchAccountHistoriesOverview(AccountHistoriesOverviewQuery params)Account histories overview filtered by the specified query parameters.Page<AccountHistoryEntryVO>searchAccountHistory(AccountHistoryQuery params)Searches the history entries of a required visible account according to the given query parameters.Page<AccountPaymentAmountLimitVO>searchAccountPaymentAmountLimitsOverview(@NotNull AccountPaymentAmountLimitsOverviewQuery params)Overview search of account balance limitsPage<UserWithBalanceVO>searchUsersWithBalances(UserWithBalanceQuery params)Searches for users together with their respective account balancesvoidsetBalanceLimit(AccountBalanceLimitDTO dto)Change limits of an accountvoidsetPaymentAmountLimit(@NotNull AccountPaymentAmountLimitDTO dto)Change limits of an accountbooleanshouldAdjustAccountsWhenAssigning(MemberProduct product)Indicates whether user accounts should be adjusted if the given member product is assigned to a group / group setAccountWithStatusVOtoAccountWithStatus(Account account, Date date, Date paymentsSince, boolean includeRates)Converts the given account withAccountWithStatusVO, getting the status at the given time point.voidupdateBalance(Account account, BigDecimal balance, Long[] dirtyTransferIds)Updates the current account balance.-
Methods inherited from class org.cyclos.impl.BaseServiceImpl
initializeNetworkMappings
-
Methods inherited from class org.cyclos.impl.AbstractNetworkedServerComponent
canManage, checkManagesUser, checkPermission, checkRelatesToUser, checkValue, clearAlreadyValidated, getBaseEntityManagerHandler, getConfiguration, getLoggedBasicUser, getLoggedUser, getProducts, getTranslatedName, getTranslatedValue, hasPermission, hasValue, inSameNetwork, inSameNetworkOrGlobal, isAdmin, isAlreadyValidated, isBroker, isGlobalAdmin, isGlobalAdminInNetwork, isGuest, isLoggedIn, isMember, isMemberOnly, isNetworkAdmin, isOperator, isRelatedToUser, isSystem, isUserManager, isUserManagerOf, message, message, permission, permission, permissionOptionalValue, permissionOptionalValue, setAlreadyValidated, toDate, toDateTime, validate
-
Methods inherited from class org.cyclos.impl.AbstractServerComponent
dataTranslationProxy, dataTranslationProxy, delete, detach, doDataTranslationProxy, find, flush, from, getApplicationContext, getFormatter, getFormatter, getFormatter, getLogger, getRemoteAddress, getSessionData, mailContentBuilder, message, message, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.cyclos.impl.banking.AccountServiceLocal
adjustAccounts, hasAccess
-
-
-
-
Method Detail
-
accountNumberExistsOrIsReserved
public boolean accountNumberExistsOrIsReserved(AccountNumberConfiguration accountNumberConfiguration, String accountNumber)
Description copied from interface:AccountServiceLocalReturns true if the given account number is used in an existing account or is reserved to be used for a pending user- Specified by:
accountNumberExistsOrIsReservedin interfaceAccountServiceLocal
-
adjustAccounts
public AccountServiceLocal.AdjustAccountsResult adjustAccounts(User user, boolean allowInitialCredit)
Description copied from interface:AccountServiceLocalCreates / disposes accounts for the given user, optionally allowing initial credit- Specified by:
adjustAccountsin interfaceAccountServiceLocal
-
checkActive
public void checkActive(Account account) throws IllegalActionException
Description copied from interface:AccountServiceLocalIf the given account is not active, throws anIllegalActionException- Specified by:
checkActivein interfaceAccountServiceLocal- Throws:
IllegalActionException- See Also:
#isActive(Account)
-
checkActive
public void checkActive(AccountOwner owner) throws IllegalActionException
Description copied from interface:AccountServiceLocalIf the given owner is a user which is either pending or removed, throes anIllegalActionException- Specified by:
checkActivein interfaceAccountServiceLocal- Throws:
IllegalActionException
-
checkAvailableBalance
public void checkAvailableBalance(Account account, BigDecimal amount) throws InsufficientBalanceException, LockAcquisitionException
Description copied from interface:AccountServiceLocalChecks that the given account has enough balance for performing a payment with the given amount.- Specified by:
checkAvailableBalancein interfaceAccountServiceLocal- Throws:
InsufficientBalanceExceptionLockAcquisitionException
-
createSystemAccount
public SystemAccount createSystemAccount(SystemAccountType type)
Description copied from interface:AccountServiceLocalCreates a new system account- Specified by:
createSystemAccountin interfaceAccountServiceLocal
-
dereserveAmount
public ExternalPaymentAmountReservation dereserveAmount(ExternalPayment externalPayment)
Description copied from interface:AccountServiceLocalCancels the amount reservation related to the given external payment- Specified by:
dereserveAmountin interfaceAccountServiceLocal
-
dereserveAmount
public OrderAmountReservation dereserveAmount(Order order)
Description copied from interface:AccountServiceLocalCancels the amount reservation related to the given order- Specified by:
dereserveAmountin interfaceAccountServiceLocal
-
dereserveAmount
public InstallmentAmountReservation dereserveAmount(ScheduledPaymentInstallment installment) throws FrameworkException, IllegalActionException
Description copied from interface:AccountServiceLocalDereserves the amount for the given installment- Specified by:
dereserveAmountin interfaceAccountServiceLocal- Throws:
IllegalActionException- When the given installment is not in a state which allows dereserving amountFrameworkException
-
dereserveAmountForAuthorization
public PendingAuthorizationAmountReservation dereserveAmountForAuthorization(BasePayment transaction) throws FrameworkException
Description copied from interface:AccountServiceLocalDereserves the amount for the transaction which was previously awaiting authorization- Specified by:
dereserveAmountForAuthorizationin interfaceAccountServiceLocal- Throws:
IllegalActionException- When the given transfer is not in a state which allows returning the reserved amountFrameworkException
-
dereserveAmountIfNeeded
public VoucherAmountReservation dereserveAmountIfNeeded(Voucher voucher) throws FrameworkException, InsufficientBalanceException
Description copied from interface:AccountServiceLocalIf the voucher pack had an amount reservation, dereserve the amount for the given voucher- Specified by:
dereserveAmountIfNeededin interfaceAccountServiceLocal- Throws:
FrameworkExceptionInsufficientBalanceException
-
dereserveAmountIfNeeded
public VoucherRedeemAmountReservation dereserveAmountIfNeeded(VoucherRedeem voucherRedeem) throws FrameworkException, InsufficientBalanceException
Description copied from interface:AccountServiceLocalIf the voucher pack had an amount reservation, dereserve the amount for the given voucher redeem- Specified by:
dereserveAmountIfNeededin interfaceAccountServiceLocal- Throws:
FrameworkExceptionInsufficientBalanceException
-
exportAccountBalanceLimitsOverview
public FileInfo exportAccountBalanceLimitsOverview(@NotNull @NotNull ExportFormatVO formatVO, @NotNull @NotNull AccountBalanceLimitsOverviewQuery params) throws FrameworkException
Description copied from interface:AccountServiceGenerates a file with the query result listing the account balance limits- Specified by:
exportAccountBalanceLimitsOverviewin interfaceAccountService- Throws:
FrameworkException
-
exportAccountHistoriesOverview
public FileInfo exportAccountHistoriesOverview(@NotNull @NotNull ExportFormatVO formatVO, @NotNull @NotNull AccountHistoriesOverviewQuery params) throws FrameworkException
Description copied from interface:AccountServiceExports the account histories overview result to file- Specified by:
exportAccountHistoriesOverviewin interfaceAccountService- Throws:
FrameworkException
-
exportAccountHistory
public FileInfo exportAccountHistory(@NotNull @NotNull ExportFormatVO formatVO, @NotNull @NotNull AccountHistoryQuery params) throws FrameworkException
Description copied from interface:AccountServiceExports the account history result to file- Specified by:
exportAccountHistoryin interfaceAccountService- Throws:
FrameworkException
-
exportAccountPaymentAmountLimitsOverview
public FileInfo exportAccountPaymentAmountLimitsOverview(@NotNull @NotNull ExportFormatVO formatVO, @NotNull @NotNull AccountPaymentAmountLimitsOverviewQuery params) throws FrameworkException
Description copied from interface:AccountServiceGenerates a file with the query result listing the account balance limits- Specified by:
exportAccountPaymentAmountLimitsOverviewin interfaceAccountService- Throws:
FrameworkException
-
exportUsersWithBalances
public FileInfo exportUsersWithBalances(@NotNull @NotNull ExportFormatVO formatVO, @NotNull @NotNull UserWithBalanceQuery params) throws FrameworkException
Description copied from interface:AccountServiceGenerates a file with the query result listing the user balances- Specified by:
exportUsersWithBalancesin interfaceAccountService- Throws:
FrameworkException
-
fillTransSearchData
public void fillTransSearchData(ITransSearchData data, Account account, InternalAccountOwner accountOwner, ExportFormatContext exportContext)
Description copied from interface:AccountServiceLocalFills the given data with data common to transfer and transaction search. A source account can be provided to retrieve more specific data.- Specified by:
fillTransSearchDatain interfaceAccountServiceLocal
-
findByNumber
public Account findByNumber(String number) throws FrameworkException
Description copied from interface:AccountServiceLocalReturns the account with the given number- Specified by:
findByNumberin interfaceAccountServiceLocal- Throws:
EntityNotFoundException- If there are is no account with the given numberFrameworkException
-
generateNumber
public String generateNumber(AccountType type, InternalAccountOwner owner) throws FrameworkException
Description copied from interface:AccountServiceLocalGenerates an unique account number for the given type and owner. This method can not only be internally used when an account is created, but scripts could benefit from it to generate numbers for existing accounts.- Specified by:
generateNumberin interfaceAccountServiceLocal- Throws:
FrameworkException
-
getAccountBalanceHistory
public AccountBalanceHistoryVO getAccountBalanceHistory(@NotNull @NotNull AccountBalanceHistoryParams params) throws FrameworkException
Description copied from interface:AccountServiceReturns the balance at each data point for a given account. The account and status are also returned. For example, if the account had 50 transfers over 1 month, but in 20 distinct days of the month, and the request was to return for the month, with a balance per day, there will be 21 entries (the balance on the first day, plus the 20 days that had changed) When no period is given, or if the begin date was before the account creation, it is assumed since the day the account was created. The possible periods for data points are: - Months - Weeks - Days The maximum number of data points cannot exceed 61. So, for example, if the requested period is 1 year, it is possible to request balances per month or week (there's about 52 weeks in a year), but not days.- Specified by:
getAccountBalanceHistoryin interfaceAccountService- Throws:
FrameworkException
-
getAccountBalanceLimitsOverviewData
public AccountLimitsOverviewData getAccountBalanceLimitsOverviewData()
Description copied from interface:AccountServiceAccount limits (balance and payment amounts) overview data for performing searches.- Specified by:
getAccountBalanceLimitsOverviewDatain interfaceAccountService
-
getAccountHistoriesOverviewData
public AccountHistoriesOverviewData getAccountHistoriesOverviewData()
Description copied from interface:AccountServiceGets the details for viewing an account histories overview- Specified by:
getAccountHistoriesOverviewDatain interfaceAccountService
-
getAccountHistoriesOverviewStatus
public AccountHistoriesOverviewStatusVO getAccountHistoriesOverviewStatus(AccountHistoriesOverviewQuery params)
Description copied from interface:AccountServiceReturns the statuses by currency for the result of searching transactions with the given parameters- Specified by:
getAccountHistoriesOverviewStatusin interfaceAccountService
-
getAccountHistoryData
public AccountHistoryData getAccountHistoryData(AccountVO accountVO, RateVisibility rateVisibility)
Description copied from interface:AccountServiceGets the details for viewing an account history- Specified by:
getAccountHistoryDatain interfaceAccountServicerateVisibility- if nullRateVisibility.NOTis used
-
getAccountHistoryStatus
public AccountHistoryStatusVO getAccountHistoryStatus(Account account, AccountHistoryQuery params)
Description copied from interface:AccountServiceLocalReturns historic status for the account- Specified by:
getAccountHistoryStatusin interfaceAccountServiceLocal
-
getAccountHistoryStatus
public AccountWithHistoryStatusVO getAccountHistoryStatus(AccountHistoryQuery params) throws FrameworkException
Description copied from interface:AccountServiceReturns historic status for the account- Specified by:
getAccountHistoryStatusin interfaceAccountService- Throws:
FrameworkException
-
getAccountPaymentAmountLimitsOverviewData
public AccountLimitsOverviewData getAccountPaymentAmountLimitsOverviewData()
Description copied from interface:AccountServiceAccount limits (balance and payment amounts) overview data for performing searches.- Specified by:
getAccountPaymentAmountLimitsOverviewDatain interfaceAccountService
-
getAccountsSummary
public List<AccountWithStatusVO> getAccountsSummary(InternalAccountOwner owner, DateTime dateTime)
Description copied from interface:AccountServiceLists the visible accounts summary for the given account owner, with balances relative to the given date- Specified by:
getAccountsSummaryin interfaceAccountService
-
getAccountStatus
public AccountStatusVO getAccountStatus(Account account, Date time, RateVisibility includeRates)
Description copied from interface:AccountServiceLocalReturns the account status for the given account at the given time- Specified by:
getAccountStatusin interfaceAccountServiceLocalincludeRates- if nullRateVisibility.NOTis used
-
getAccountStatus
public AccountStatusVO getAccountStatus(AccountVO accountVO, DateTime dateTime, RateVisibility includeRates)
Description copied from interface:AccountServiceGets the status for the given account- Specified by:
getAccountStatusin interfaceAccountServiceincludeRates- if nullRateVisibility.NOTis used
-
getAccountsWithStatus
public List<AccountWithStatusVO> getAccountsWithStatus(InternalAccountOwner accountOwner, Date date, Date receivedSince, boolean includeRates) throws FrameworkException
Description copied from interface:AccountServiceLocalSimilar toAccountServiceLocal.listVisible(InternalAccountOwner), but returns each account with the account status, at the given time point.- Specified by:
getAccountsWithStatusin interfaceAccountServiceLocal- Throws:
FrameworkException
-
getAccountWithStatus
public AccountWithStatusVO getAccountWithStatus(AccountVO vo, DateTime dateTime) throws FrameworkException
Description copied from interface:AccountServiceReturns the information of an account, with its status, by owner and type- Specified by:
getAccountWithStatusin interfaceAccountService- Throws:
FrameworkException
-
getAmountDereservation
public OrderAmountReservation getAmountDereservation(Order order)
Description copied from interface:AccountServiceLocalReturns theOrderAmountReservationthat canceled the order reserved amount, or null if none- Specified by:
getAmountDereservationin interfaceAccountServiceLocal
-
getAmountDereservationForAuthorization
public PendingAuthorizationAmountReservation getAmountDereservationForAuthorization(BasePayment transaction)
Description copied from interface:AccountServiceLocalReturns thePendingAuthorizationAmountReservationcreated when a payment was no longer pending authorization, or null if none- Specified by:
getAmountDereservationForAuthorizationin interfaceAccountServiceLocal
-
getAmountReservation
public OrderAmountReservation getAmountReservation(Order order)
Description copied from interface:AccountServiceLocalReturns theOrderAmountReservationthat reserved amount when the order was submitted, or null if none- Specified by:
getAmountReservationin interfaceAccountServiceLocal
-
getAmountReservationForAuthorization
public PendingAuthorizationAmountReservation getAmountReservationForAuthorization(BasePayment transaction)
Description copied from interface:AccountServiceLocalReturns thePendingAuthorizationAmountReservationcreated when a payment was submitted for authorization, or null if none- Specified by:
getAmountReservationForAuthorizationin interfaceAccountServiceLocal
-
getAvailableBalance
public BigDecimal getAvailableBalance(Account account, Date date)
Description copied from interface:AccountServiceLocalReturns the available balance for the given account at the given date- Specified by:
getAvailableBalancein interfaceAccountServiceLocal
-
getAverageBalance
public BigDecimal getAverageBalance(Account account, BigDecimal balanceDiff, DatePeriod period, boolean positive, BigDecimal freebase) throws FrameworkException
Description copied from interface:AccountServiceLocalReturns the balance average for the given account over the given period. It is calculated per day, having the balance at the end of each day, averaging by the number of days the balance was unchanged. It can be calculated either over positive or negative balances, and taking the free base into account (which is subtracted from each day's balance when calculating the total). If present, the balanceDiff is summed to the initial balance when performing calculations.- Specified by:
getAverageBalancein interfaceAccountServiceLocal- Throws:
FrameworkException
-
getBalance
public BigDecimal getBalance(Account account, Date date)
Description copied from interface:AccountServiceLocalReturns the raw balance for the given account at the given time- Specified by:
getBalancein interfaceAccountServiceLocal
-
getBalanceLimitLog
public AccountBalanceLimitLog getBalanceLimitLog(Account account, Date date)
Description copied from interface:AccountServiceLocalReturns the limit log which is valid on the given time. When the time is null, the current time is assumed- Specified by:
getBalanceLimitLogin interfaceAccountServiceLocal
-
getCreditLimit
public BigDecimal getCreditLimit(Account account, Date date)
Description copied from interface:AccountServiceLocalReturns the credit limit of the given account at the given date- Specified by:
getCreditLimitin interfaceAccountServiceLocal
-
getCurrentAvailableBalance
public BigDecimal getCurrentAvailableBalance(Account account, NativeAccountStatus status)
Description copied from interface:AccountServiceLocalReturns the available balance for the given account, given that the native account status was already fetched- Specified by:
getCurrentAvailableBalancein interfaceAccountServiceLocal
-
getFrontendDashbordAcccount
public FrontendDashboardAccountVO getFrontendDashbordAcccount(Account account, int lastTransfers)
Description copied from interface:AccountServiceLocalReturns data for an account to be used in the new frontend dashboard- Specified by:
getFrontendDashbordAcccountin interfaceAccountServiceLocal
-
getManagedFlows
public List<TransferStatusFlow> getManagedFlows(Account account)
Description copied from interface:AccountServiceLocalReturns the managed transfer status flows for the logged user over the given account- Specified by:
getManagedFlowsin interfaceAccountServiceLocal
-
getNativeAccountStatus
public NativeAccountStatus getNativeAccountStatus(Account account, Date date)
Description copied from interface:AccountServiceLocalReturns the native account status for the given account- Specified by:
getNativeAccountStatusin interfaceAccountServiceLocal
-
getOwnerName
public String getOwnerName(Account account)
Description copied from interface:AccountServiceLocalReturns the owner name: if is a system account, get the system account type. otherwise, the name / username of the owner user- Specified by:
getOwnerNamein interfaceAccountServiceLocal
-
getPermissions
public AccountPermissionsData getPermissions(Account account) throws FrameworkException
Description copied from interface:AccountServiceLocalReturns permissions of what the logged user can do over the given account- Specified by:
getPermissionsin interfaceAccountServiceLocal- Throws:
PermissionDeniedException- if the given account is not managed by the authenticated userFrameworkException- See Also:
AccountService.getPermissions(AccountVO)
-
getPermissions
public AccountPermissionsData getPermissions(@NotNull @NotNull AccountVO accountVO)
Description copied from interface:AccountServiceReturns permissions of what the logged user can do over the given account- Specified by:
getPermissionsin interfaceAccountService
-
getRetrictedOperatorAccessibleAccounts
public RestrictedOperatorAccessibleAccounts getRetrictedOperatorAccessibleAccounts()
Description copied from interface:AccountServiceLocalReturns which owner user accounts types are accessible and how by the logged restricted operator. If not logged-in as a restricted operator, returns null.- Specified by:
getRetrictedOperatorAccessibleAccountsin interfaceAccountServiceLocal
-
getUpperCreditLimit
public BigDecimal getUpperCreditLimit(Account account, Date date)
Description copied from interface:AccountServiceLocalReturns the upper credit limit of the given account at the given date- Specified by:
getUpperCreditLimitin interfaceAccountServiceLocal
-
getUserAccountBalanceLimitData
public UserAccountBalanceLimitData getUserAccountBalanceLimitData(AccountVO accountVO)
Description copied from interface:AccountServiceGet an account limit data- Specified by:
getUserAccountBalanceLimitDatain interfaceAccountService
-
getUserAccountPaymentAmountLimitData
public UserAccountPaymentAmountLimitData getUserAccountPaymentAmountLimitData(@NotNull @NotNull AccountVO accountVO) throws FrameworkException
Description copied from interface:AccountServiceGet an account payment amount limit data- Specified by:
getUserAccountPaymentAmountLimitDatain interfaceAccountService- Throws:
FrameworkException
-
getUserAccountsBalanceLimits
public List<AccountBalanceLimitVO> getUserAccountsBalanceLimits(UserLocatorVO userLocator)
Description copied from interface:AccountServiceReturns the user accounts with their upper and lower balance limits- Specified by:
getUserAccountsBalanceLimitsin interfaceAccountService
-
getUserAccountsData
public List<UserAccountData> getUserAccountsData(User user)
Description copied from interface:AccountServiceLocalReturns the user's accounts data visible in profile- Specified by:
getUserAccountsDatain interfaceAccountServiceLocal
-
getUserAccountsPaymentAmountLimits
public List<AccountPaymentAmountLimitVO> getUserAccountsPaymentAmountLimits(@NotNull @NotNull UserLocatorVO userLocator) throws FrameworkException
Description copied from interface:AccountServiceReturns the user accounts with their upper and lower balance limits- Specified by:
getUserAccountsPaymentAmountLimitsin interfaceAccountService- Throws:
FrameworkException
-
getUsersWithBalancesOverview
public UsersWithBalancesOverview getUsersWithBalancesOverview(UserWithBalanceQuery params) throws FrameworkException, QueryParseException
Description copied from interface:AccountServiceReturns the overview of users with balances according to the given query- Specified by:
getUsersWithBalancesOverviewin interfaceAccountService- Throws:
FrameworkExceptionQueryParseException
-
getUserWithBalanceSearchData
public UserWithBalanceSearchData getUserWithBalanceSearchData() throws FrameworkException
Description copied from interface:AccountServiceReturns data to search for users with balances- Specified by:
getUserWithBalanceSearchDatain interfaceAccountService- Throws:
FrameworkException
-
getVisibleFlows
public List<TransferStatusFlow> getVisibleFlows(Account account)
Description copied from interface:AccountServiceLocalReturns the visible transfer status flows for the logged user over the given account- Specified by:
getVisibleFlowsin interfaceAccountServiceLocal
-
hasAccess
public boolean hasAccess(Account account)
Description copied from interface:AccountServiceLocalReturns whether the given account is accessible by the logged user- Specified by:
hasAccessin interfaceAccountServiceLocal- See Also:
AccountServiceLocal.hasVisibility(Account)
-
hasVisibility
public boolean hasVisibility(Account account)
Description copied from interface:AccountServiceLocalReturns whether the given account is visible by the logged user or not.
An account is visible if it's accessible and the associatedAccountAccessibilityallow view it. If an user can access an account then it can operate with it (e.g make/receive payments) regardless it's visible or not.
The visibility is taken into account only in cases the account is shown (as informative data), to know:- Accounts summary
- Account history (i.e the transfers)
HomeData.VISIBLE_ACCOUNTS(only the visible accounts are shown in the home page)UserInitializationData.VISIBLE_ACCOUNTS
- Specified by:
hasVisibilityin interfaceAccountServiceLocal
-
isActive
public boolean isActive(IAccount account)
Description copied from interface:AccountServiceLocalReturns whether the given account is active. System accounts are always active. User accounts are active if the owner is not pending or removed and have at least one product that enables that account type.- Specified by:
isActivein interfaceAccountServiceLocal
-
listVisible
public <A extends Account> List<A> listVisible(InternalAccountOwner owner)
Description copied from interface:AccountServiceLocalReturns the visible accounts for the given owner.- Specified by:
listVisiblein interfaceAccountServiceLocal
-
listVisibleTypes
public <A extends AccountType> List<A> listVisibleTypes(InternalAccountOwner owner)
Description copied from interface:AccountServiceLocalCalls listVisible(), but projecting each account type- Specified by:
listVisibleTypesin interfaceAccountServiceLocal
-
load
public <A extends Account> A load(AccountLocator locator) throws FrameworkException
Description copied from interface:AccountServiceLocalLoads an account for the given locator, without checking permissions for the logged user For user accounts, if the account is not found yet, returns a transient account.- Specified by:
loadin interfaceAccountServiceLocal- Throws:
FrameworkException
-
load
public <A extends Account> A load(InternalAccountOwner owner, AccountType type)
Description copied from interface:AccountServiceLocalLoads an account for the given owner / type, without checking permissions for the logged user For user accounts, if the account is not found yet, returns a transient account.- Specified by:
loadin interfaceAccountServiceLocal
-
load
public <A extends Account> A load(InternalAccountOwner owner, AccountType type, boolean allowDisposed)
Description copied from interface:AccountServiceLocalLoads an account for the given owner / type, without checking permissions for the logged user. Depending on the flag will return an account even if it was disposed. For user accounts, if the account is not found yet, returns a transient account.- Specified by:
loadin interfaceAccountServiceLocal
-
load
public AccountWithCurrencyVO load(Long id)
Description copied from interface:AccountServiceLoads an account by id- Specified by:
loadin interfaceAccountService
-
makeBalanceDirty
public void makeBalanceDirty(Account account, Transfer transfer)
Description copied from interface:AccountServiceLocalMarks the balance of the given account as dirty for given transfer.- Specified by:
makeBalanceDirtyin interfaceAccountServiceLocal
-
removeLastClosedAccountBalances
public void removeLastClosedAccountBalances(Transfer transfer)
Description copied from interface:AccountServiceLocalRemoves all the closes from the initial date to now of the from and to account of the transfer. Also removes the account_balance row for both accounts- Specified by:
removeLastClosedAccountBalancesin interfaceAccountServiceLocal
-
require
public <A extends Account> A require(InternalAccountOwner owner, AccountType type)
Description copied from interface:AccountServiceLocalLoads an account for the given owner / type, without checking permissions for the logged user. For user accounts, if the account is not found yet, will physically create one.- Specified by:
requirein interfaceAccountServiceLocal
-
reserveAmount
public CustomAmountReservation reserveAmount(Account account, BigDecimal amount) throws InsufficientBalanceException
Description copied from interface:AccountServiceLocalReserves the given amount for an account checking its available balance.
WARNING: Intended to be used via scripts (it can't be removed after a static analysis).- Specified by:
reserveAmountin interfaceAccountServiceLocal- Returns:
- If the amount is zero returns null, otherwise the reservation.
- Throws:
InsufficientBalanceException- When there is not enough funds on the expected account to reserve
-
reserveAmount
public CustomAmountReservation reserveAmount(Account account, BigDecimal amount, boolean ignoreAccountLimits) throws InsufficientBalanceException
Description copied from interface:AccountServiceLocalReserves the given amount for an account ignoring the limits only ifignoreAccountLimitsis true.
WARNING: Intended to be used via scripts (it can't be removed after a static analysis).- Specified by:
reserveAmountin interfaceAccountServiceLocal- Returns:
- If the amount is zero returns null, otherwise the reservation.
- Throws:
InsufficientBalanceException- When there is not enough funds on the expected account to reserve
-
reserveAmount
public ExternalPaymentAmountReservation reserveAmount(ExternalPayment externalPayment) throws InsufficientBalanceException
Description copied from interface:AccountServiceLocalReserves the amount for the given external payment- Specified by:
reserveAmountin interfaceAccountServiceLocal- Throws:
InsufficientBalanceException- When there is not enough funds on the expected account to reserve
-
reserveAmount
public OrderAmountReservation reserveAmount(Order order) throws InsufficientBalanceException
Description copied from interface:AccountServiceLocalReserves the amount for the given webshop order- Specified by:
reserveAmountin interfaceAccountServiceLocal- Throws:
InsufficientBalanceException- When there is not enough funds on the expected account to reserve
-
reserveAmount
public ScheduledPaymentAmountReservation reserveAmount(ScheduledPayment scheduledPayment) throws FrameworkException, InsufficientBalanceException, IllegalActionException
Description copied from interface:AccountServiceLocalReserves the total amount for the given scheduled payment- Specified by:
reserveAmountin interfaceAccountServiceLocal- Throws:
IllegalActionException- When the given scheduled payment is not in a state which allows reserving amountInsufficientBalanceException- When there is not enough funds on the expected account to reserveFrameworkException
-
reserveAmountForAuthorization
public PendingAuthorizationAmountReservation reserveAmountForAuthorization(PerformTransactionDTO performTransaction, BasePayment transaction) throws FrameworkException, InsufficientBalanceException, IllegalActionException
Description copied from interface:AccountServiceLocalReserves the amount for a pending by authorization payment created from the given DTO.- Specified by:
reserveAmountForAuthorizationin interfaceAccountServiceLocal- Throws:
IllegalActionException- When the given transfer is not in a state which allows reserving amountInsufficientBalanceException- When there is not enough funds on the expected account to reserveFrameworkException
-
reserveAmountForUnblocking
public VoucherUnblockAmountReservation reserveAmountForUnblocking(Voucher voucher)
Description copied from interface:AccountServiceLocalReserves the amount for unblocking a blocked voucher- Specified by:
reserveAmountForUnblockingin interfaceAccountServiceLocal
-
reserveAmountIfNeeded
public VoucherPackAmountReservation reserveAmountIfNeeded(VoucherPack pack) throws InsufficientBalanceException
Description copied from interface:AccountServiceLocalReserves the total amount for the given voucher pack (count * amount) on the source account of the redeem type, if that account is limited. If it is an unlimited account, just returns null.- Specified by:
reserveAmountIfNeededin interfaceAccountServiceLocal- Throws:
InsufficientBalanceException- When there is not enough funds on the expected account to reserve
-
resolvePreselectedPeriods
public List<PeriodPreselectorOptionData> resolvePreselectedPeriods()
Description copied from interface:AccountServiceLocalResolve the available preselected periods for the logged user configuration- Specified by:
resolvePreselectedPeriodsin interfaceAccountServiceLocal
-
searchAccountBalanceLimitsOverview
public Page<AccountBalanceLimitVO> searchAccountBalanceLimitsOverview(AccountBalanceLimitsOverviewQuery params)
Description copied from interface:AccountServiceOverview search of account balance limits- Specified by:
searchAccountBalanceLimitsOverviewin interfaceAccountService
-
searchAccountHistoriesOverview
public Page<AccountHistoryOverviewEntryVO> searchAccountHistoriesOverview(AccountHistoriesOverviewQuery params)
Description copied from interface:AccountServiceAccount histories overview filtered by the specified query parameters.- Specified by:
searchAccountHistoriesOverviewin interfaceAccountService
-
searchAccountHistory
public Page<AccountHistoryEntryVO> searchAccountHistory(AccountHistoryQuery params)
Description copied from interface:AccountServiceSearches the history entries of a required visible account according to the given query parameters. For searching on multiple accounts seeAccountService.searchAccountHistoriesOverview(AccountHistoriesOverviewQuery)- Specified by:
searchAccountHistoryin interfaceAccountService
-
searchAccountPaymentAmountLimitsOverview
public Page<AccountPaymentAmountLimitVO> searchAccountPaymentAmountLimitsOverview(@NotNull @NotNull AccountPaymentAmountLimitsOverviewQuery params) throws FrameworkException
Description copied from interface:AccountServiceOverview search of account balance limits- Specified by:
searchAccountPaymentAmountLimitsOverviewin interfaceAccountService- Throws:
FrameworkException
-
searchUsersWithBalances
public Page<UserWithBalanceVO> searchUsersWithBalances(UserWithBalanceQuery params) throws FrameworkException
Description copied from interface:AccountServiceSearches for users together with their respective account balances- Specified by:
searchUsersWithBalancesin interfaceAccountService- Throws:
FrameworkException
-
setBalanceLimit
public void setBalanceLimit(AccountBalanceLimitDTO dto)
Description copied from interface:AccountServiceChange limits of an account- Specified by:
setBalanceLimitin interfaceAccountService
-
setPaymentAmountLimit
public void setPaymentAmountLimit(@NotNull @NotNull AccountPaymentAmountLimitDTO dto) throws FrameworkExceptionDescription copied from interface:AccountServiceChange limits of an account- Specified by:
setPaymentAmountLimitin interfaceAccountService- Throws:
FrameworkException
-
shouldAdjustAccountsWhenAssigning
public boolean shouldAdjustAccountsWhenAssigning(MemberProduct product)
Description copied from interface:AccountServiceLocalIndicates whether user accounts should be adjusted if the given member product is assigned to a group / group set- Specified by:
shouldAdjustAccountsWhenAssigningin interfaceAccountServiceLocal
-
toAccountWithStatus
public AccountWithStatusVO toAccountWithStatus(Account account, Date date, Date paymentsSince, boolean includeRates) throws FrameworkException
Description copied from interface:AccountServiceLocalConverts the given account withAccountWithStatusVO, getting the status at the given time point. If paymentsSince is not null, will also return the sum of incoming payments since the given date- Specified by:
toAccountWithStatusin interfaceAccountServiceLocal- Throws:
FrameworkException
-
updateBalance
public void updateBalance(Account account, BigDecimal balance, Long[] dirtyTransferIds)
Description copied from interface:AccountServiceLocalUpdates the current account balance. IMPORTANT! This method should only be called after acquiring a lock for the given account, to ensure consistency. This method calls the native update_balance function.- Specified by:
updateBalancein interfaceAccountServiceLocal
-
persist
protected void persist(IEntity entity)
- Overrides:
persistin classAbstractServerComponent- See Also:
BaseEntityManagerHandler.persist(IEntity)
-
registerNetworkMappings
protected void registerNetworkMappings(NetworkPathRegistry networkPathRegistry)
Description copied from class:BaseServiceImplNeeds to be overridden by subclasses to register the path up to the network- Specified by:
registerNetworkMappingsin classBaseServiceImpl
-
-