Interface PaymentService<P extends Payment>

All Known Implementing Classes:
DefaultPaymentService

public interface PaymentService<P extends Payment>
Service API for payments. Supported by PaymentRepository.
Author:
Chris Kittrell (ckittrell)
  • Method Summary

    Modifier and Type
    Method
    Description
    create(P payment, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Create an instance of a Payment.
    void
    delete(String id, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Perform a delete operation on the Payment identified by the context id.
    readAllByContextId(Iterable<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Retrieve all Payments based on a list of context ids.
    org.springframework.data.domain.Page<P>
    readAllByCustomerIdAndTenantId(String customerId, String tenantId, 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.
    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.
    default org.springframework.data.domain.Page<P>
    readAllByOwnerTypeAndOwnerIdIncludeArchived(String ownerType, String ownerId, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Find a page of payments, including archived, for the given owner type and owner id.
    readByContextId(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Read a single instance of a Payment.
    readByContextIdAndTenantId(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Finds the payment by the context id and tenant id, ignoring other context filtering like archival status.
    update(String id, P payment, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Update a Payment instance
  • Method Details

    • create

      P create(@NonNull P payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Create an instance of a Payment.
      Parameters:
      payment - The Payment instance.
      context - Context information used to discriminate the correct version of an entity by context id when multiple verions may be available across sandboxes, catalogs and applications.
      Returns:
      The new entity instance in the form of a business type instance.
      Throws:
      com.broadleafcommerce.common.error.validation.ValidationException - if the payment failed validation
    • readByContextId

      P readByContextId(@NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Read a single instance of a Payment.
      Parameters:
      id - The context id for the Payment.
      context - Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.
      Returns:
      The narrowed entity instance in the form of a business instance
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if no entity is found with the given id
    • readAllByContextId

      Iterable<P> readAllByContextId(@NonNull Iterable<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Retrieve all Payments based on a list of context ids.
      Parameters:
      ids - A list of context ids for the entities. This is the id by which the business recognizes the item.
      context - Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.
      Returns:
      The narrowed iterable collection of data in the form of business instances
    • readAllByCustomerIdAndTenantId

      org.springframework.data.domain.Page<P> readAllByCustomerIdAndTenantId(String customerId, String tenantId, @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:
      customerId - The CustomerRef.getCustomerId() of the Payment
      tenantId - The ID of the Tenant the payments belong to.
      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.
    • 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.
    • readAllByOwnerTypeAndOwnerIdIncludeArchived

      default org.springframework.data.domain.Page<P> readAllByOwnerTypeAndOwnerIdIncludeArchived(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, including archived, for the given owner type and owner id.

      The payment can be archived in case it is failed and was archived by the webhook. Such payments still should be retrieved, for example, to validate the callback token.

      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.
    • update

      P update(@NonNull String id, @NonNull P payment, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Update a Payment instance
      Parameters:
      id - The context id for the Payment.
      payment - The Payment payload used to update the existing entity.
      lockToken - Token granted to resource that owns the payment lock.
      context - Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.
      Returns:
      The updated Payment
      Throws:
      com.broadleafcommerce.common.error.validation.ValidationException - if the payment failed validation
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if a managed instance corresponding to the given id could not be found
      com.broadleafcommerce.common.messaging.exception.ResourceLockException - if the PaymentLockInfo does not match the Payment's lock.
    • delete

      void delete(@NonNull String id, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Perform a delete operation on the Payment identified by the context id. This could result in an archival, or a raw delete, depending on the result of processing through DomainMapper.deleteMap(Object, ContextInfo).
      Parameters:
      id - The context id for the Payment. This is the id by which the business recognizes the item.
      lockToken - Token granted to resource that owns the payment lock.
      context - Context information used to discriminate the correct version of an entity by context id when multiple versions may be available across sandboxes, catalogs and applications.
      Throws:
      com.broadleafcommerce.data.tracking.core.exception.EntityMissingException - if no instance was found in the backing store corresponding to id
    • readByContextIdAndTenantId

      P readByContextIdAndTenantId(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Finds the payment by the context id and tenant id, ignoring other context filtering like archival status.
      Parameters:
      id - The context id of the payment
      context - Context information related to multitenancy.
      Returns:
      the transaction if found