Package org.cyclos.security.banking
Class VoucherServiceSecurity
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.banking.VoucherServiceSecurity
-
- All Implemented Interfaces:
VoucherService,Service
@Security public class VoucherServiceSecurity extends BaseServiceSecurity implements VoucherService
Security layer forVoucherService
-
-
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
-
-
Constructor Summary
Constructors Constructor Description VoucherServiceSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VoucherInfoVOactivateGiftVoucher(@NotNull String token, ActivateGiftVoucherDTO params)Changes the voucher PIN using the voucher information page.voidassign(@NotNull AssignVoucherDTO params)Assigns an unassigned, open generated voucher to a userSerializableInputStreambarcode(VoucherBarcodeParams params)Returns a barcode image of the token of the given voucherVoucherPackWithIdsVObuy(BuyVouchersDTO params)Buys one or more vouchersvoidcancel(CancelVoucherDTO params)Cancels one or more vouchersvoidchangeExpirationDate(ChangeVoucherExpirationDateDTO params)Changes the voucher expiration date according to the given information.voidchangeInfoNotificationSettings(String token, String pin, SimpleChangeVoucherNotificationSettingsDTO settings)Change the voucher notifications settings using the voucher information page.voidchangeInfoPin(@NotNull String token, SimpleChangeVoucherPinDTO changeVoucherPin)Changes the voucher PIN using the voucher information page.voidchangeNotificationSettings(@NotNull ChangeVoucherNotificationSettingsDTO params)Change the voucher notifications settings using the voucher information page.voidchangePin(ChangeVoucherPinDTO changeVoucherPin)Changes the voucher PINprotected voiddoInitialize()FileInfoexportTransaction(@NotNull ExportFormatVO format, @NotNull VoucherTransactionVO transaction)Generates a file with the voucher.FileInfoexportVoucher(@NotNull ExportFormatVO format, @NotNull VoucherVO voucher, boolean markAsPrinted)Generates a file with the voucher.FileInfoexportVouchers(@NotNull ExportFormatVO format, @NotNull BasicVoucherQuery query, boolean markAsPrinted)Generates a file with the query result.List<VouchersSummaryVO>generalSearchSummary(GeneralVoucherQuery params)Returns the summary for a general vouchers search according to the given filtersVoucherPackWithIdsVOgenerate(GenerateVouchersDTO params)Generates vouchersBuyVoucherDatagetBuyData(CreateVoucherDataParams params)Returns data used to buy a voucherVoucherDatagetData(Long id)Returns data about a specific voucherGeneralVouchersSearchDatagetGeneralSearchData()Returns data for a general vouchers searchGenerateVouchersDatagetGenerateData(CreateVoucherDataParams params)Returns data which is needed for generating vouchersVoucherInfoVOgetInfo(@NotNull String token, String pin)Returns information about a voucher which is accessible as guest.VoucherInfoDatagetInfoData()Returns common data for displaying the voucher info applicationRedeemVoucherDatagetRedeemData(VoucherTransactionDataParams params)Returns data used to redeem a voucherInitialVoucherUserDatagetRedeemInitialData(UserLocatorVO userVO)Returns data for starting a voucher redeemingBuyVoucherDatagetSendData(CreateVoucherDataParams params)Returns data used to send a voucherTopUpVoucherDatagetTopUpData(@NotNull VoucherTransactionDataParams params)Returns data used to top-up a voucherInitialVoucherUserDatagetTopUpInitialData(UserLocatorVO userVO)Returns data for starting a voucher top-upVoucherTransactionDatagetTransactionData(Long id)Returns details of a voucher transactionVoucherTransactionsSearchDatagetUserTransactionsSearchData(UserLocatorVO vo)Returns data for a searching redeemed vouchers of the given userUserVouchersSearchDatagetUserVouchersSearchData(UserLocatorVO vo)Returns data for a searching vouchers of the given userbooleanisVisible(VoucherPack voucherPack)booleanisVisible(VoucherVO vo)VoucherVOloadByToken(String token)Returns a voucher by tokenBuyVoucherPreviewVOpreviewBuy(@NotNull BuyVouchersDTO params)Previews a voucher buyingRedeemVoucherPreviewVOpreviewRedeem(@NotNull RedeemVoucherDTO params)Previews the redeeming of a voucherBuyVoucherPreviewVOpreviewSend(@NotNull SendVoucherDTO params)Preview a voucher sending to an e-mail addressTopUpVoucherPreviewVOpreviewTopUp(@NotNull TopUpVoucherDTO params)Previews the top-up of a voucherVoucherTransactionResultVOredeem(RedeemVoucherDTO params)Redeems a voucher, returning the generated voucher idvoidresendEmail(@NotNull VoucherVO voucherVO)Re-sends the e-mail for a sent voucherList<String>resendPin(@NotNull String token, CaptchaResponseDTO captcha)Re-send the voucher pin to the mediums (email/mobile phone) associated to the voucher (if any)protected EntityCheck<?>resolveEntityCheck()Must be implemented in order to return theEntityCheckmanaged by this security component, or null if nonePage<VoucherVO>searchGeneral(GeneralVoucherQuery params)Performs a general vouchers search according to the given filtersPage<VoucherTransactionVO>searchInfoTransactions(@NotNull VoucherInfoTransactionsQuery params, String pin)Searches for voucher transactions according to the given filtersPage<VoucherTransactionResultVO>searchTransactions(@NotNull VoucherTransactionsQuery params)Searches for voucher transactions according to the given filtersPage<VoucherVO>searchUser(@NotNull UserVoucherQuery params)Searches for user vouchers according to the given filtersVoucherPackWithIdsVOsend(@NotNull SendVoucherDTO params)Sends a voucher to an e-mail addressVoucherTransactionResultVOtopUp(@NotNull TopUpVoucherDTO params)Performs a top-up of a voucher.voidunblock(@NotNull UnblockVoucherParams params)Unblocks a voucher in theVoucherStatus.BLOCKEDstatusvoidunblockPin(@NotNull VoucherVO voucherVO)Manually unblocks a voucher PIN that was blocked by exceeding tries-
Methods inherited from class org.cyclos.security.BaseServiceSecurity
checkGuest, checkId, checkIds, checkInternalName, checkLoggedIn, checkManagesUser, checkRelatesToUser, checkScope, checkVO, checkVOs, getEntityCheckRegistry, getUser, initialize
-
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, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
activateGiftVoucher
public VoucherInfoVO activateGiftVoucher(@NotNull @NotNull String token, ActivateGiftVoucherDTO params) throws FrameworkException
Description copied from interface:VoucherServiceChanges the voucher PIN using the voucher information page.- Specified by:
activateGiftVoucherin interfaceVoucherService- Throws:
FrameworkException
-
assign
public void assign(@NotNull @NotNull AssignVoucherDTO params) throws FrameworkExceptionDescription copied from interface:VoucherServiceAssigns an unassigned, open generated voucher to a user- Specified by:
assignin interfaceVoucherService- Throws:
FrameworkException
-
barcode
public SerializableInputStream barcode(VoucherBarcodeParams params) throws FrameworkException
Description copied from interface:VoucherServiceReturns a barcode image of the token of the given voucher- Specified by:
barcodein interfaceVoucherService- Throws:
FrameworkException
-
buy
public VoucherPackWithIdsVO buy(BuyVouchersDTO params) throws FrameworkException
Description copied from interface:VoucherServiceBuys one or more vouchers- Specified by:
buyin interfaceVoucherService- Throws:
FrameworkException
-
cancel
public void cancel(CancelVoucherDTO params) throws FrameworkException
Description copied from interface:VoucherServiceCancels one or more vouchers- Specified by:
cancelin interfaceVoucherService- Throws:
FrameworkException
-
changeExpirationDate
public void changeExpirationDate(ChangeVoucherExpirationDateDTO params) throws FrameworkException
Description copied from interface:VoucherServiceChanges the voucher expiration date according to the given information.- Specified by:
changeExpirationDatein interfaceVoucherService- Throws:
FrameworkException
-
changeInfoNotificationSettings
public void changeInfoNotificationSettings(String token, String pin, SimpleChangeVoucherNotificationSettingsDTO settings) throws FrameworkException
Description copied from interface:VoucherServiceChange the voucher notifications settings using the voucher information page.- Specified by:
changeInfoNotificationSettingsin interfaceVoucherService- Throws:
FrameworkException
-
changeInfoPin
public void changeInfoPin(@NotNull @NotNull String token, SimpleChangeVoucherPinDTO changeVoucherPin) throws FrameworkExceptionDescription copied from interface:VoucherServiceChanges the voucher PIN using the voucher information page.- Specified by:
changeInfoPinin interfaceVoucherService- Throws:
FrameworkException
-
changeNotificationSettings
public void changeNotificationSettings(@NotNull @NotNull ChangeVoucherNotificationSettingsDTO params) throws FrameworkExceptionDescription copied from interface:VoucherServiceChange the voucher notifications settings using the voucher information page.- Specified by:
changeNotificationSettingsin interfaceVoucherService- Throws:
FrameworkException
-
changePin
public void changePin(ChangeVoucherPinDTO changeVoucherPin) throws FrameworkException
Description copied from interface:VoucherServiceChanges the voucher PIN- Specified by:
changePinin interfaceVoucherService- Throws:
FrameworkException
-
exportTransaction
public FileInfo exportTransaction(@NotNull @NotNull ExportFormatVO format, @NotNull @NotNull VoucherTransactionVO transaction) throws FrameworkException
Description copied from interface:VoucherServiceGenerates a file with the voucher.- Specified by:
exportTransactionin interfaceVoucherService- Throws:
FrameworkException
-
exportVoucher
public FileInfo exportVoucher(@NotNull @NotNull ExportFormatVO format, @NotNull @NotNull VoucherVO voucher, boolean markAsPrinted) throws FrameworkException
Description copied from interface:VoucherServiceGenerates a file with the voucher. This operation is read/write because it can update the voucher printed flag.- Specified by:
exportVoucherin interfaceVoucherService- Throws:
FrameworkException
-
exportVouchers
public FileInfo exportVouchers(@NotNull @NotNull ExportFormatVO format, @NotNull @NotNull BasicVoucherQuery query, boolean markAsPrinted) throws FrameworkException
Description copied from interface:VoucherServiceGenerates a file with the query result. This operation is read/write because it can update the each voucher printed flag.- Specified by:
exportVouchersin interfaceVoucherService- Throws:
FrameworkException
-
generalSearchSummary
public List<VouchersSummaryVO> generalSearchSummary(GeneralVoucherQuery params) throws FrameworkException
Description copied from interface:VoucherServiceReturns the summary for a general vouchers search according to the given filters- Specified by:
generalSearchSummaryin interfaceVoucherService- Throws:
FrameworkException
-
generate
public VoucherPackWithIdsVO generate(GenerateVouchersDTO params) throws FrameworkException
Description copied from interface:VoucherServiceGenerates vouchers- Specified by:
generatein interfaceVoucherService- Throws:
FrameworkException
-
getBuyData
public BuyVoucherData getBuyData(CreateVoucherDataParams params) throws FrameworkException
Description copied from interface:VoucherServiceReturns data used to buy a voucher- Specified by:
getBuyDatain interfaceVoucherService- Throws:
FrameworkException
-
getData
public VoucherData getData(Long id) throws FrameworkException
Description copied from interface:VoucherServiceReturns data about a specific voucher- Specified by:
getDatain interfaceVoucherService- Throws:
FrameworkException
-
getGeneralSearchData
public GeneralVouchersSearchData getGeneralSearchData() throws FrameworkException
Description copied from interface:VoucherServiceReturns data for a general vouchers search- Specified by:
getGeneralSearchDatain interfaceVoucherService- Throws:
FrameworkException
-
getGenerateData
public GenerateVouchersData getGenerateData(CreateVoucherDataParams params) throws FrameworkException
Description copied from interface:VoucherServiceReturns data which is needed for generating vouchers- Specified by:
getGenerateDatain interfaceVoucherService- Throws:
FrameworkException
-
getInfo
public VoucherInfoVO getInfo(@NotNull @NotNull String token, String pin) throws FrameworkException
Description copied from interface:VoucherServiceReturns information about a voucher which is accessible as guest. If a PIN is required, the object will be returned only with the token (echoing the input token) and the pinInput field.- Specified by:
getInfoin interfaceVoucherService- Throws:
FrameworkException
-
getInfoData
public VoucherInfoData getInfoData() throws FrameworkException
Description copied from interface:VoucherServiceReturns common data for displaying the voucher info application- Specified by:
getInfoDatain interfaceVoucherService- Throws:
FrameworkException
-
getRedeemData
public RedeemVoucherData getRedeemData(VoucherTransactionDataParams params) throws FrameworkException
Description copied from interface:VoucherServiceReturns data used to redeem a voucher- Specified by:
getRedeemDatain interfaceVoucherService- Throws:
FrameworkException- See Also:
VoucherService.redeem(RedeemVoucherDTO)
-
getRedeemInitialData
public InitialVoucherUserData getRedeemInitialData(UserLocatorVO userVO) throws FrameworkException
Description copied from interface:VoucherServiceReturns data for starting a voucher redeeming- Specified by:
getRedeemInitialDatain interfaceVoucherService- Throws:
FrameworkException
-
getSendData
public BuyVoucherData getSendData(CreateVoucherDataParams params) throws FrameworkException
Description copied from interface:VoucherServiceReturns data used to send a voucher- Specified by:
getSendDatain interfaceVoucherService- Throws:
FrameworkException
-
getTopUpData
public TopUpVoucherData getTopUpData(@NotNull @NotNull VoucherTransactionDataParams params) throws FrameworkException, VoucherTopUpException
Description copied from interface:VoucherServiceReturns data used to top-up a voucher- Specified by:
getTopUpDatain interfaceVoucherService- Throws:
FrameworkExceptionVoucherTopUpException- See Also:
VoucherService.topUp(TopUpVoucherDTO)
-
getTopUpInitialData
public InitialVoucherUserData getTopUpInitialData(UserLocatorVO userVO) throws FrameworkException
Description copied from interface:VoucherServiceReturns data for starting a voucher top-up- Specified by:
getTopUpInitialDatain interfaceVoucherService- Throws:
FrameworkException
-
getTransactionData
public VoucherTransactionData getTransactionData(Long id) throws FrameworkException
Description copied from interface:VoucherServiceReturns details of a voucher transaction- Specified by:
getTransactionDatain interfaceVoucherService- Throws:
FrameworkException
-
getUserTransactionsSearchData
public VoucherTransactionsSearchData getUserTransactionsSearchData(UserLocatorVO vo) throws FrameworkException
Description copied from interface:VoucherServiceReturns data for a searching redeemed vouchers of the given user- Specified by:
getUserTransactionsSearchDatain interfaceVoucherService- Throws:
FrameworkException
-
getUserVouchersSearchData
public UserVouchersSearchData getUserVouchersSearchData(UserLocatorVO vo) throws FrameworkException
Description copied from interface:VoucherServiceReturns data for a searching vouchers of the given user- Specified by:
getUserVouchersSearchDatain interfaceVoucherService- Throws:
FrameworkException
-
isVisible
public boolean isVisible(VoucherPack voucherPack)
-
isVisible
public boolean isVisible(VoucherVO vo)
-
loadByToken
public VoucherVO loadByToken(String token) throws FrameworkException
Description copied from interface:VoucherServiceReturns a voucher by token- Specified by:
loadByTokenin interfaceVoucherService- Throws:
FrameworkException
-
previewBuy
public BuyVoucherPreviewVO previewBuy(@NotNull @NotNull BuyVouchersDTO params) throws FrameworkException, VoucherBuyingException, MaxTotalOpenAmountException, TransferException
Description copied from interface:VoucherServicePreviews a voucher buying- Specified by:
previewBuyin interfaceVoucherService- Throws:
FrameworkExceptionVoucherBuyingExceptionMaxTotalOpenAmountExceptionTransferException- See Also:
VoucherService.buy(BuyVouchersDTO)
-
previewRedeem
public RedeemVoucherPreviewVO previewRedeem(@NotNull @NotNull RedeemVoucherDTO params) throws FrameworkException, VoucherRedeemingException
Description copied from interface:VoucherServicePreviews the redeeming of a voucher- Specified by:
previewRedeemin interfaceVoucherService- Throws:
FrameworkExceptionVoucherRedeemingException
-
previewSend
public BuyVoucherPreviewVO previewSend(@NotNull @NotNull SendVoucherDTO params) throws FrameworkException, VoucherBuyingException, MaxTotalOpenAmountException, TransferException
Description copied from interface:VoucherServicePreview a voucher sending to an e-mail address- Specified by:
previewSendin interfaceVoucherService- Throws:
FrameworkExceptionVoucherBuyingExceptionMaxTotalOpenAmountExceptionTransferException- See Also:
VoucherService.send(SendVoucherDTO)
-
previewTopUp
public TopUpVoucherPreviewVO previewTopUp(@NotNull @NotNull TopUpVoucherDTO params) throws FrameworkException, VoucherTopUpException
Description copied from interface:VoucherServicePreviews the top-up of a voucher- Specified by:
previewTopUpin interfaceVoucherService- Throws:
FrameworkExceptionVoucherTopUpException
-
redeem
public VoucherTransactionResultVO redeem(RedeemVoucherDTO params) throws FrameworkException
Description copied from interface:VoucherServiceRedeems a voucher, returning the generated voucher id- Specified by:
redeemin interfaceVoucherService- Throws:
FrameworkException
-
resendEmail
public void resendEmail(@NotNull @NotNull VoucherVO voucherVO) throws FrameworkExceptionDescription copied from interface:VoucherServiceRe-sends the e-mail for a sent voucher- Specified by:
resendEmailin interfaceVoucherService- Throws:
FrameworkException
-
resendPin
public List<String> resendPin(@NotNull @NotNull String token, CaptchaResponseDTO captcha) throws FrameworkException
Description copied from interface:VoucherServiceRe-send the voucher pin to the mediums (email/mobile phone) associated to the voucher (if any)- Specified by:
resendPinin interfaceVoucherService- Throws:
FrameworkException
-
searchGeneral
public Page<VoucherVO> searchGeneral(GeneralVoucherQuery params) throws FrameworkException
Description copied from interface:VoucherServicePerforms a general vouchers search according to the given filters- Specified by:
searchGeneralin interfaceVoucherService- Throws:
FrameworkException
-
searchInfoTransactions
public Page<VoucherTransactionVO> searchInfoTransactions(@NotNull @NotNull VoucherInfoTransactionsQuery params, String pin) throws FrameworkException
Description copied from interface:VoucherServiceSearches for voucher transactions according to the given filters- Specified by:
searchInfoTransactionsin interfaceVoucherService- Throws:
FrameworkException
-
searchTransactions
public Page<VoucherTransactionResultVO> searchTransactions(@NotNull @NotNull VoucherTransactionsQuery params) throws FrameworkException
Description copied from interface:VoucherServiceSearches for voucher transactions according to the given filters- Specified by:
searchTransactionsin interfaceVoucherService- Throws:
FrameworkException
-
searchUser
public Page<VoucherVO> searchUser(@NotNull @NotNull UserVoucherQuery params) throws FrameworkException
Description copied from interface:VoucherServiceSearches for user vouchers according to the given filters- Specified by:
searchUserin interfaceVoucherService- Throws:
FrameworkException
-
send
public VoucherPackWithIdsVO send(@NotNull @NotNull SendVoucherDTO params) throws FrameworkException, VoucherBuyingException, MaxTotalOpenAmountException, TransferException
Description copied from interface:VoucherServiceSends a voucher to an e-mail address- Specified by:
sendin interfaceVoucherService- Throws:
BuyingNotAllowedForUserException- When the user is not in a group allowed to buy this typeBuyingMaxOpenAmountException- When the max open amount for the given user is exceededMaxTotalOpenAmountException- When the total amount of all open vouchers of this type would be exceededTransferException- When there is an error on the paymentFrameworkExceptionVoucherBuyingException
-
topUp
public VoucherTransactionResultVO topUp(@NotNull @NotNull TopUpVoucherDTO params) throws FrameworkException, TransferException
Description copied from interface:VoucherServicePerforms a top-up of a voucher. If the voucher is inactive, activates it.- Specified by:
topUpin interfaceVoucherService- Throws:
TransferException- When there was a problem when performing the top-up paymentFrameworkException
-
unblock
public void unblock(@NotNull @NotNull UnblockVoucherParams params) throws FrameworkException, VoucherTopUpExceptionDescription copied from interface:VoucherServiceUnblocks a voucher in theVoucherStatus.BLOCKEDstatus- Specified by:
unblockin interfaceVoucherService- Throws:
FrameworkExceptionVoucherTopUpException
-
unblockPin
public void unblockPin(@NotNull @NotNull VoucherVO voucherVO) throws FrameworkExceptionDescription copied from interface:VoucherServiceManually unblocks a voucher PIN that was blocked by exceeding tries- Specified by:
unblockPinin interfaceVoucherService- Throws:
FrameworkException
-
doInitialize
protected void doInitialize()
- Overrides:
doInitializein classBaseServiceSecurity
-
resolveEntityCheck
protected EntityCheck<?> resolveEntityCheck()
Description copied from class:BaseServiceSecurityMust be implemented in order to return theEntityCheckmanaged by this security component, or null if none- Specified by:
resolveEntityCheckin classBaseServiceSecurity
-
-