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 Details

    • createPayment

      P createPayment(CreatePaymentRequest createPaymentRequest, @Nullable CustomerRef customerRef, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Creates a Payment based on the provided CreatePaymentRequest.
      Parameters:
      createPaymentRequest - The request payload used to build a new Payment.
      contextInfo - Context information related to multitenancy.
      Returns:
      A Payment based on the provided CreatePaymentRequest.
      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 the Payment for the customer based on the provided UpdatePaymentRequest. The default implementation archives the payment if UpdatePaymentRequest.getAmount() is equal to zero.
      Parameters:
      id - The context id for the Payment.
      updateRequest - The request payload used to update the Payment.
      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 payment
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the Payment cannot be found within the provided context.
      org.springframework.dao.OptimisticLockingFailureException - if the payment version is out of date
    • requestOnlyIncludesSupplementaryValues

      default boolean requestOnlyIncludesSupplementaryValues(P payment, UpdatePaymentRequest updateRequest)
      Determines if the update request only includes supplementary changes (i.e. they don't change the underlying payment method, change the amount related to the initiating transaction, etc.). These changes are deemed safe to make since they're only informative data points, rather than data points that change the function/intent of the interaction.
      Parameters:
      payment - the Payment to be updated
      updateRequest - the candidate UpdatePaymentRequest to be applied against the payment.
      Returns:
      true if the update request only includes supplementary changes, false otherwise
    • updatePayment

      @Nullable P updatePayment(String id, UpdatePaymentRequest updateRequest, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Updates the Payment based on the provided UpdatePaymentRequest. The default implementation archives the payment if UpdatePaymentRequest.getAmount() is equal to zero.
      Parameters:
      id - The context id for the Payment.
      updateRequest - The request payload used to update the Payment.
      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 payment
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if the Payment cannot 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 the Payment based on the provided id.
      Parameters:
      id - The context id for the Payment.
      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 the Payment cannot be found within the provided context.
      org.springframework.dao.OptimisticLockingFailureException - if the payment version is out of date.
    • archiveAllByOwnerTypeAndOwnerId

      void archiveAllByOwnerTypeAndOwnerId(String ownerType, String ownerId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Archives 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.
      context - Context information related to multitenancy.
    • archiveAllByOwnerTypeAndOwnerId

      void archiveAllByOwnerTypeAndOwnerId(String ownerType, String ownerId, @Nullable PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Archives 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.
      paymentLockTokens - Token granted to resource that owns the payment lock.
      context - Context information related to multitenancy.
    • 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 of payments provided.
      Parameters:
      payments - the page of payments to finalize
      paymentLockTokens - the collection of payment lock tokens to grant access to the payments
      shouldMarkTransactionsIneligibleForAutomaticReversal - whether or not to mark the payments as ineligible for automatic reversal
      context - Context information related to multitenancy.
      Returns:
      the response of successful and failed payments
    • blockCustomerMutabilityForPaymentFinalization

      UpdatePaymentsResponse blockCustomerMutabilityForPaymentFinalization(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Parameters:
      payments - the page of payments to update
      paymentLockTokens - the collection of payment lock tokens to grant access to the payments
      context - Context information related to multitenancy.
      Returns:
      the response of successful and failed payments
    • removeCustomerMutabilityBlockForPaymentFinalization

      UpdatePaymentsResponse removeCustomerMutabilityBlockForPaymentFinalization(org.springframework.data.domain.Page<Payment> payments, PaymentLockTokens paymentLockTokens, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Parameters:
      payments - the page of payments to unlock
      paymentLockTokens - the collection of payment lock tokens to grant access to the payments
      context - 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 of payments provided to the CSR.
      Parameters:
      payments - the page of payments to transfer
      paymentLockTokens - the collection of payment lock tokens to grant access to the payments
      contextInfo - 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 of payments provided from the CSR.
      Parameters:
      payments - the page of payments to transfer
      paymentLockTokens - the collection of payment lock tokens to grant access to the payments
      contextInfo - Context information related to multitenancy.
      Returns:
      the response of successful and failed payments