Package org.cyclos.security.banking
Class TicketServiceSecurity
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.security.BaseServiceSecurity
-
- org.cyclos.security.banking.TicketServiceSecurity
-
- All Implemented Interfaces:
TicketService,Service
@Security public class TicketServiceSecurity extends BaseServiceSecurity implements TicketService
-
-
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 TicketServiceSecurity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TicketVOapprove(ApproveTicketDTO params)Approves a ticket, as a payer, only if status isTicketStatus.OPEN.
If there is no "success URL" defined then it generates a new direct payment and the ticket goes toTicketStatus.PROCESSED.SerializableInputStreambarcode(TicketBarcodeParams params)Generates a two-dimensional barcode (aka QR code) only if status isTicketStatus.OPENcontaining a URL of the form: .../pay/ticket_id (e.g https://www.cyclos.org/pay/1234567890123456789).voidcancel(TicketVO ticketVO)Cancels the ticket only if status isTicketStatus.OPENand the logged user is the ticket's receiver or a manger of him.TicketVOcreate(CreateTicketDTO params)Creates a new ticket with statusTicketStatus.OPENfor the logged user (i.e setting it as the receiver).CreateTicketDatagetCreateData(UserLocatorVO ownerVO, UserLocatorVO payer)Returns data used to crate a new ticket for the given user, optionally with a fixed payer.TicketDatagetData(TicketVO vo)Returns data to view the ticket's details.TicketPaymentTypeDatagetTicketPaymentTypeData(UserLocatorVO ownerVO, @NotNull TransferTypeVO transferType)Returns the data for a specific payment type used to create a new ticketbooleanisAccessible(Ticket ticket)ApproveTicketPreviewVOpreviewApprove(TicketVO ticketVO)Previews the payment which would be performed when approving the given ticket as the payer.TicketProcessResultprocess(ProcessTicketDTO params)Processes a ticket as the receiver of the payment (i.e the ticket creator).
Only if the ticket status isTicketStatus.APPROVEDa new direct payment will be generated and the new ticket status will be:TicketStatus.PROCESSED.protected EntityCheck<?>resolveEntityCheck()Must be implemented in order to return theEntityCheckmanaged by this security component, or null if none-
Methods inherited from class org.cyclos.security.BaseServiceSecurity
checkGuest, checkId, checkIds, checkInternalName, checkLoggedIn, checkManagesUser, checkRelatesToUser, checkScope, checkVO, checkVOs, doInitialize, 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
-
approve
public TicketVO approve(ApproveTicketDTO params) throws FrameworkException, TransferException
Description copied from interface:TicketServiceApproves a ticket, as a payer, only if status isTicketStatus.OPEN.
If there is no "success URL" defined then it generates a new direct payment and the ticket goes toTicketStatus.PROCESSED. Otherwise, no payment is generated and the ticket goes toTicketStatus.APPROVEDstatus. The payment will be generated only after being processed by the receiver.- Specified by:
approvein interfaceTicketService- Throws:
FrameworkExceptionTransferException
-
barcode
public SerializableInputStream barcode(TicketBarcodeParams params) throws FrameworkException
Description copied from interface:TicketServiceGenerates a two-dimensional barcode (aka QR code) only if status isTicketStatus.OPENcontaining a URL of the form: .../pay/ticket_id (e.g https://www.cyclos.org/pay/1234567890123456789).- Specified by:
barcodein interfaceTicketService- Throws:
FrameworkException
-
cancel
public void cancel(TicketVO ticketVO) throws FrameworkException
Description copied from interface:TicketServiceCancels the ticket only if status isTicketStatus.OPENand the logged user is the ticket's receiver or a manger of him.- Specified by:
cancelin interfaceTicketService- Throws:
FrameworkException
-
create
public TicketVO create(CreateTicketDTO params) throws FrameworkException
Description copied from interface:TicketServiceCreates a new ticket with statusTicketStatus.OPENfor the logged user (i.e setting it as the receiver).- Specified by:
createin interfaceTicketService- Throws:
FrameworkException
-
getCreateData
public CreateTicketData getCreateData(UserLocatorVO ownerVO, UserLocatorVO payer) throws FrameworkException
Description copied from interface:TicketServiceReturns data used to crate a new ticket for the given user, optionally with a fixed payer.- Specified by:
getCreateDatain interfaceTicketService- Throws:
FrameworkException
-
getData
public TicketData getData(TicketVO vo) throws FrameworkException
Description copied from interface:TicketServiceReturns data to view the ticket's details.- Specified by:
getDatain interfaceTicketService- Throws:
FrameworkException
-
getTicketPaymentTypeData
public TicketPaymentTypeData getTicketPaymentTypeData(UserLocatorVO ownerVO, @NotNull @NotNull TransferTypeVO transferType) throws FrameworkException
Description copied from interface:TicketServiceReturns the data for a specific payment type used to create a new ticket- Specified by:
getTicketPaymentTypeDatain interfaceTicketService- Throws:
FrameworkException
-
isAccessible
public boolean isAccessible(Ticket ticket)
-
previewApprove
public ApproveTicketPreviewVO previewApprove(TicketVO ticketVO) throws FrameworkException
Description copied from interface:TicketServicePreviews the payment which would be performed when approving the given ticket as the payer. The ticket status must beTicketStatus.APPROVEDorTicketStatus.OPENwithout a success url.- Specified by:
previewApprovein interfaceTicketService- Throws:
FrameworkException
-
process
public TicketProcessResult process(ProcessTicketDTO params) throws TransferException, FrameworkException
Description copied from interface:TicketServiceProcesses a ticket as the receiver of the payment (i.e the ticket creator).
Only if the ticket status isTicketStatus.APPROVEDa new direct payment will be generated and the new ticket status will be:TicketStatus.PROCESSED. There could be a case where this method is invoked for an already processed ticket (e.g. the ticket has both a success url and an success webhook), for it, only in case the given process code is the correct one this method runs without errors and returns the same result as the previous invocation (no payment is generated) but with theTicketProcessResult.ACTUALLY_PROCESSEDflag in false.- Specified by:
processin interfaceTicketService- Throws:
TransferExceptionFrameworkException
-
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
-
-