Package org.cyclos.impl.banking
Class PaymentServiceImpl
- java.lang.Object
-
- org.cyclos.impl.AbstractServerComponent
-
- org.cyclos.impl.AbstractNetworkedServerComponent
-
- org.cyclos.impl.BaseServiceImpl
-
- org.cyclos.impl.banking.PaymentServiceImpl
-
- All Implemented Interfaces:
PaymentServiceLocal,PaymentService,Service
@Service public class PaymentServiceImpl extends BaseServiceImpl implements PaymentServiceLocal
implementation forPaymentService
-
-
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 PaymentServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PaymentacceptExternalPayment(ExternalPayment externalPayment, User destinationUser)Performs the payment for the given external paymentPaymentacceptPaymentRequest(PaymentRequest paymentRequest)Performs the payment for the given payment requestPaymentconfirmOrder(Order order)Performs the payment related to the given order, returning the reserved amount, if anyPaymentcreateForVoucherBuying(VoucherType type, User buyer, BigDecimal amount, List<CustomFieldValueDTO> customValues)Generate a payment when buying a voucherPaymentcreateForVoucherRedeeming(Voucher voucher, User user, BigDecimal amount, List<CustomFieldValueDTO> customValues)Create a payment when redeeming a voucherPaymentcreateForVoucherTopUp(Voucher voucher, User user, BigDecimal amount, List<CustomFieldValueDTO> customValues)Performs a payment for topping-up a voucherPaymentPreviewVOdoPreview(PerformPaymentDTO parameters, boolean validateCustomFields, boolean runExtensionPoints, SessionData receiverSessionData, PaymentCreationType creationType)Previews the payment.PaymentDatagetData(Long id)Returns data about a paymentPaymentimportPayment(PerformPaymentDTO parameters, boolean sendNotifications)Imports a paymentvoidinitialize()voidnotifyPaymentPerformed(Payment payment)PaymentVOperform(PerformPaymentDTO parameters)Performs a payment, according to the given parameters, returning the resulting payment.PaymentPreviewVOpreview(PerformPaymentDTO parameters)Previews a payment to be performedPaymentPreviewVOpreviewAcceptPaymentRequest(PaymentRequest paymentRequest)Previews accepting the given payment requestPaymentPreviewVOpreviewApproveTicket(Ticket ticket)Previews approving the given ticketPaymentPreviewVOpreviewReceive(PerformPaymentDTO parameters)Previews a payment to be receivedPaymentPreviewVOpreviewVoucherBuying(VoucherType type, User buyer, BigDecimal amount, List<CustomFieldValueDTO> customValues)Previews the payment performed on voucher buyingPaymentprocessTicket(Ticket ticket)Performs a payment for the given ticketPaymentVOreceive(PerformPaymentDTO parameters)Receives a payment, according to the given parameters, returning the resulting payment.Paymentrefund(Voucher voucher)Performs a payment for refunding the given voucherprotected voidregisterNetworkMappings(NetworkPathRegistry networkPathRegistry)Needs to be overridden by subclasses to register the path up to the networkprotected PerformPaymentDTOtoBuyVoucherParams(VoucherType type, User buyer, BigDecimal amount, List<CustomFieldValueDTO> customValues)StringtoId(Long id)voidvalidate(PerformPaymentDTO dto)Validates the parameters to perform a payment without actually performing the payment.-
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
-
acceptExternalPayment
public Payment acceptExternalPayment(ExternalPayment externalPayment, User destinationUser)
Description copied from interface:PaymentServiceLocalPerforms the payment for the given external payment- Specified by:
acceptExternalPaymentin interfacePaymentServiceLocaldestinationUser- The user that will receive the payment
-
acceptPaymentRequest
public Payment acceptPaymentRequest(PaymentRequest paymentRequest) throws FrameworkException, TransferException, PasswordException
Description copied from interface:PaymentServiceLocalPerforms the payment for the given payment request- Specified by:
acceptPaymentRequestin interfacePaymentServiceLocal- Throws:
FrameworkExceptionTransferExceptionPasswordException
-
confirmOrder
public Payment confirmOrder(Order order) throws TransferException, PasswordException
Description copied from interface:PaymentServiceLocalPerforms the payment related to the given order, returning the reserved amount, if any- Specified by:
confirmOrderin interfacePaymentServiceLocal- Throws:
TransferExceptionPasswordException
-
createForVoucherBuying
public Payment createForVoucherBuying(VoucherType type, User buyer, BigDecimal amount, List<CustomFieldValueDTO> customValues) throws FrameworkException, TransferException
Description copied from interface:PaymentServiceLocalGenerate a payment when buying a voucher- Specified by:
createForVoucherBuyingin interfacePaymentServiceLocal- Throws:
FrameworkExceptionTransferException
-
createForVoucherRedeeming
public Payment createForVoucherRedeeming(Voucher voucher, User user, BigDecimal amount, List<CustomFieldValueDTO> customValues)
Description copied from interface:PaymentServiceLocalCreate a payment when redeeming a voucher- Specified by:
createForVoucherRedeemingin interfacePaymentServiceLocal
-
createForVoucherTopUp
public Payment createForVoucherTopUp(Voucher voucher, User user, BigDecimal amount, List<CustomFieldValueDTO> customValues)
Description copied from interface:PaymentServiceLocalPerforms a payment for topping-up a voucher- Specified by:
createForVoucherTopUpin interfacePaymentServiceLocal
-
doPreview
public PaymentPreviewVO doPreview(PerformPaymentDTO parameters, boolean validateCustomFields, boolean runExtensionPoints, SessionData receiverSessionData, PaymentCreationType creationType)
Description copied from interface:PaymentServiceLocalPreviews the payment.- Specified by:
doPreviewin interfacePaymentServiceLocalreceiverSessionData- If not null, is the session data of the payment receiver. If null is not a receive payment
-
getData
public PaymentData getData(Long id) throws FrameworkException
Description copied from interface:PaymentServiceReturns data about a payment- Specified by:
getDatain interfacePaymentService- Throws:
FrameworkException
-
importPayment
public Payment importPayment(PerformPaymentDTO parameters, boolean sendNotifications) throws FrameworkException
Description copied from interface:PaymentServiceLocalImports a payment- Specified by:
importPaymentin interfacePaymentServiceLocal- Throws:
FrameworkException
-
initialize
@PostConstruct public void initialize()
-
notifyPaymentPerformed
public void notifyPaymentPerformed(Payment payment)
- Specified by:
notifyPaymentPerformedin interfacePaymentServiceLocal
-
perform
public PaymentVO perform(PerformPaymentDTO parameters) throws TransferException, ValidationException, PasswordException
Description copied from interface:PaymentServicePerforms a payment, according to the given parameters, returning the resulting payment.- Specified by:
performin interfacePaymentService- Throws:
InsufficientBalanceException- When the source account, or source account for any generated fee is limited and had insufficient balance for such a paymentMaxAmountPerDayExceededException- When the maximum amount for payments of this transfer type has been exceeded, according to the transfer type configurationUpperCreditLimitReachedException- When the destination account, or destination account for any generated fee is limited and would have more balance than the allowed maximumPasswordException- When the confirmation password doesn't matchTransferExceptionValidationException
-
preview
public PaymentPreviewVO preview(PerformPaymentDTO parameters) throws ValidationException
Description copied from interface:PaymentServicePreviews a payment to be performed- Specified by:
previewin interfacePaymentService- Throws:
ValidationException
-
previewAcceptPaymentRequest
public PaymentPreviewVO previewAcceptPaymentRequest(PaymentRequest paymentRequest)
Description copied from interface:PaymentServiceLocalPreviews accepting the given payment request- Specified by:
previewAcceptPaymentRequestin interfacePaymentServiceLocal
-
previewApproveTicket
public PaymentPreviewVO previewApproveTicket(Ticket ticket)
Description copied from interface:PaymentServiceLocalPreviews approving the given ticket- Specified by:
previewApproveTicketin interfacePaymentServiceLocal
-
previewReceive
public PaymentPreviewVO previewReceive(PerformPaymentDTO parameters) throws FrameworkException, TransferException
Description copied from interface:PaymentServicePreviews a payment to be received- Specified by:
previewReceivein interfacePaymentService- Throws:
FrameworkExceptionTransferException
-
previewVoucherBuying
public PaymentPreviewVO previewVoucherBuying(VoucherType type, User buyer, BigDecimal amount, List<CustomFieldValueDTO> customValues)
Description copied from interface:PaymentServiceLocalPreviews the payment performed on voucher buying- Specified by:
previewVoucherBuyingin interfacePaymentServiceLocal
-
processTicket
public Payment processTicket(Ticket ticket)
Description copied from interface:PaymentServiceLocalPerforms a payment for the given ticket- Specified by:
processTicketin interfacePaymentServiceLocal
-
receive
public PaymentVO receive(PerformPaymentDTO parameters) throws FrameworkException, TransferException
Description copied from interface:PaymentServiceReceives a payment, according to the given parameters, returning the resulting payment.- Specified by:
receivein interfacePaymentService- Throws:
FrameworkExceptionTransferException- See Also:
PaymentService.perform(PerformPaymentDTO)
-
refund
public Payment refund(Voucher voucher)
Description copied from interface:PaymentServiceLocalPerforms a payment for refunding the given voucher- Specified by:
refundin interfacePaymentServiceLocal
-
validate
public void validate(PerformPaymentDTO dto) throws FrameworkException
Description copied from interface:PaymentServiceValidates the parameters to perform a payment without actually performing the payment. Attention: will only validate for required / invalid fields, but will not check for balance, maximum amount per day or other validations that require access to actual accounts.- Specified by:
validatein interfacePaymentService- Throws:
FrameworkException
-
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
-
toBuyVoucherParams
protected PerformPaymentDTO toBuyVoucherParams(VoucherType type, User buyer, BigDecimal amount, List<CustomFieldValueDTO> customValues)
-
-