Interface PaymentManagementService<P extends Payment>
- All Known Implementing Classes:
DefaultPaymentManagementService
public interface PaymentManagementService<P extends Payment>
Service API for managing
payments. Supported by PaymentService.- Author:
- Chris Kittrell (ckittrell)
-
Method Summary
Modifier and TypeMethodDescriptionvoidarchivePayment(String id, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Archives thePaymentbased on the provided id.blockCustomerMutability(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, boolean shouldMarkTransactionsIneligibleForAutomaticReversal, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finalizes the list ofpaymentsprovided.createPayment(CreatePaymentRequest createPaymentRequest, CustomerRef customerRef, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates aPaymentbased on the providedCreatePaymentRequest.org.springframework.data.domain.Page<P>readAllByOwnerTypeAndOwnerId(String ownerType, String ownerId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Find a page of payments for the given owner type and owner id.readAllByPaymentIds(Iterable<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Find a list of payments for the given payment ids.transferPaymentsFromCSR(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transfers the list ofpaymentsprovided from the CSR.transferPaymentsToCSR(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transfers the list ofpaymentsprovided to the CSR.updatePayment(String id, UpdatePaymentRequest updateRequest, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates thePaymentbased on the providedUpdatePaymentRequest.updatePaymentForCustomer(String id, UpdatePaymentRequest updateRequest, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates thePaymentfor the customer based on the providedUpdatePaymentRequest.
-
Method Details
-
createPayment
P createPayment(CreatePaymentRequest createPaymentRequest, @Nullable CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Creates aPaymentbased on the providedCreatePaymentRequest.- Parameters:
createPaymentRequest- The request payload used to build a newPayment.contextInfo- Context information related to multitenancy.- Returns:
- A
Paymentbased on the providedCreatePaymentRequest. - Throws:
InvalidCreatePaymentRequestException- if the create payment request produced an invalid payment.
-
readAllByPaymentIds
List<P> readAllByPaymentIds(@NonNull Iterable<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Find a list of payments for the given payment ids.- Parameters:
ids- , The ids of the payments.context- Context information related to multitenancy.- Returns:
- A list of payments for the given ids.
-
readAllByOwnerTypeAndOwnerId
org.springframework.data.domain.Page<P> readAllByOwnerTypeAndOwnerId(String ownerType, String ownerId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Find a page of payments for the given owner type and owner id.- Parameters:
ownerType- The type of the payment's owner.ownerId- The id of the payment's owner.page- The requested page of results from the database.context- Context information related to multitenancy.- Returns:
- A page of payments for the given owner type and id.
-
updatePaymentForCustomer
@Nullable P updatePaymentForCustomer(String id, UpdatePaymentRequest updateRequest, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates thePaymentfor the customer based on the providedUpdatePaymentRequest. The default implementation archives the payment ifUpdatePaymentRequest.getAmount()is equal to zero.- Parameters:
id- The context id for thePayment.updateRequest- The request payload used to update thePayment.lockToken- Token granted to resource that owns the payment lock.context- Context information related to multitenancy.- Returns:
- The updated
Payment. - Throws:
InvalidUpdatePaymentRequestException- if the update payment request produced an invalid paymentcom.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if thePaymentcannot be found within the provided context.org.springframework.dao.OptimisticLockingFailureException- if the payment version is out of date
-
updatePayment
@Nullable P updatePayment(String id, UpdatePaymentRequest updateRequest, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Updates thePaymentbased on the providedUpdatePaymentRequest. The default implementation archives the payment ifUpdatePaymentRequest.getAmount()is equal to zero.- Parameters:
id- The context id for thePayment.updateRequest- The request payload used to update thePayment.lockToken- Token granted to resource that owns the payment lock.context- Context information related to multitenancy.- Returns:
- The updated
Payment. - Throws:
InvalidUpdatePaymentRequestException- if the update payment request produced an invalid paymentcom.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if thePaymentcannot be found within the provided context.org.springframework.dao.OptimisticLockingFailureException- if the payment version is out of date
-
archivePayment
void archivePayment(String id, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Archives thePaymentbased on the provided id.- Parameters:
id- The context id for thePayment.lockToken- Token granted to resource that owns the payment lock.context- Context information related to multitenancy.- Throws:
com.broadleafcommerce.data.tracking.core.exception.EntityMissingException- if thePaymentcannot be found within the provided context.org.springframework.dao.OptimisticLockingFailureException- if the payment version is out of date.
-
blockCustomerMutability
UpdatePaymentsResponse blockCustomerMutability(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, boolean shouldMarkTransactionsIneligibleForAutomaticReversal, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Finalizes the list ofpaymentsprovided.- Parameters:
payments- the page of payments to finalizepaymentLockTokens- the collection of payment lock tokens to grant access to the paymentsshouldMarkTransactionsIneligibleForAutomaticReversal- whether or not to mark the payments as ineligible for automatic reversalcontext- Context information related to multitenancy.- Returns:
- the response of successful and failed payments
-
transferPaymentsToCSR
UpdatePaymentsResponse transferPaymentsToCSR(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transfers the list ofpaymentsprovided to the CSR.- Parameters:
payments- the page of payments to transferpaymentLockTokens- the collection of payment lock tokens to grant access to the paymentscontextInfo- Context information related to multitenancy.- Returns:
- the response of successful and failed payments
-
transferPaymentsFromCSR
UpdatePaymentsResponse transferPaymentsFromCSR(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Transfers the list ofpaymentsprovided from the CSR.- Parameters:
payments- the page of payments to transferpaymentLockTokens- the collection of payment lock tokens to grant access to the paymentscontextInfo- Context information related to multitenancy.- Returns:
- the response of successful and failed payments
-