Package org.cyclos.impl.banking
Class TransactionAuthorizationServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.banking.TransactionAuthorizationServiceImpl
-
- All Implemented Interfaces:
TransactionAuthorizationServiceLocal,TransactionAuthorizationService,Service
@Service public class TransactionAuthorizationServiceImpl extends BaseServiceImpl implements TransactionAuthorizationServiceLocal
implementation forTransactionAuthorizationService
-
-
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 TransactionAuthorizationServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PaymentAuthorizationLevelDataauthorize(TransactionAuthorizationDTO params)Authorizes a payment pending authorizationvoidauthorizeFirstLevelIfNeeded(BasePayment transaction)If the given transaction is pending authorization and the logged user could authorize the first level, the transaction is immediately authorized.voidcancel(BasePayment payment, String comments)Cancel the given payment and set the comments to the correspondingTransactionAuthorizationvoidcancel(TransactionAuthorizationDTO params)Cancels a payment pending authorizationintcancelAll(UserAccount account)Cancels all payments pending authorization from or to the given accountvoiddeny(TransactionAuthorizationDTO params)Denies a payment pending authorizationvoidexpire(BasePayment payment)Expires the given payment (invoked by a polling task)Pair<TransactionAuthorizationType,AuthorizationLevel>initialAuthorization(PaymentTransferType paymentType, BigDecimal transactionAmount)Returns the first authorization condition for a given transfervoidnotifyPendingAuthorization(BasePayment payment)Notifies the next authorizer in line about the pending transaction to be authorized.<T extends BasePayment>
voidregisterHandler(AuthorizationAction action, Class<T> transactionClass, Consumer<T> handler)Registers a handler which runs when an authorization action takes place over the given transactionprotected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the network-
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, persist, processBatch, processBatch, refresh, remove, selectFrom, subQuery, update
-
-
-
-
Method Detail
-
authorize
public PaymentAuthorizationLevelData authorize(TransactionAuthorizationDTO params)
Description copied from interface:TransactionAuthorizationServiceAuthorizes a payment pending authorization- Specified by:
authorizein interfaceTransactionAuthorizationService- Returns:
- The next level, if any, or null if authorized
-
authorizeFirstLevelIfNeeded
public void authorizeFirstLevelIfNeeded(BasePayment transaction) throws FrameworkException
Description copied from interface:TransactionAuthorizationServiceLocalIf the given transaction is pending authorization and the logged user could authorize the first level, the transaction is immediately authorized.- Specified by:
authorizeFirstLevelIfNeededin interfaceTransactionAuthorizationServiceLocal- Throws:
FrameworkException
-
cancel
public void cancel(BasePayment payment, String comments)
Description copied from interface:TransactionAuthorizationServiceLocalCancel the given payment and set the comments to the correspondingTransactionAuthorization- Specified by:
cancelin interfaceTransactionAuthorizationServiceLocal
-
cancel
public void cancel(TransactionAuthorizationDTO params)
Description copied from interface:TransactionAuthorizationServiceCancels a payment pending authorization- Specified by:
cancelin interfaceTransactionAuthorizationService
-
cancelAll
public int cancelAll(UserAccount account) throws FrameworkException
Description copied from interface:TransactionAuthorizationServiceLocalCancels all payments pending authorization from or to the given account- Specified by:
cancelAllin interfaceTransactionAuthorizationServiceLocal- Throws:
FrameworkException
-
deny
public void deny(TransactionAuthorizationDTO params)
Description copied from interface:TransactionAuthorizationServiceDenies a payment pending authorization- Specified by:
denyin interfaceTransactionAuthorizationService
-
expire
public void expire(BasePayment payment)
Description copied from interface:TransactionAuthorizationServiceLocalExpires the given payment (invoked by a polling task)- Specified by:
expirein interfaceTransactionAuthorizationServiceLocal
-
initialAuthorization
public Pair<TransactionAuthorizationType,AuthorizationLevel> initialAuthorization(PaymentTransferType paymentType, BigDecimal transactionAmount)
Description copied from interface:TransactionAuthorizationServiceLocalReturns the first authorization condition for a given transfer- Specified by:
initialAuthorizationin interfaceTransactionAuthorizationServiceLocal
-
notifyPendingAuthorization
public void notifyPendingAuthorization(BasePayment payment)
Description copied from interface:TransactionAuthorizationServiceLocalNotifies the next authorizer in line about the pending transaction to be authorized.- Specified by:
notifyPendingAuthorizationin interfaceTransactionAuthorizationServiceLocal
-
registerHandler
public <T extends BasePayment> void registerHandler(AuthorizationAction action, Class<T> transactionClass, Consumer<T> handler)
Description copied from interface:TransactionAuthorizationServiceLocalRegisters a handler which runs when an authorization action takes place over the given transaction- Specified by:
registerHandlerin interfaceTransactionAuthorizationServiceLocal
-
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
-
-