Class DefaultPaymentService<P extends Payment>

java.lang.Object
com.broadleafcommerce.paymenttransaction.service.DefaultPaymentService<P>
All Implemented Interfaces:
PaymentService<P>

public class DefaultPaymentService<P extends Payment> extends Object implements PaymentService<P>
Author:
Chris Kittrell (ckittrell)
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultPaymentService(PaymentRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager mapper, PaymentLockService<P> paymentLockService)
     
  • 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(@NonNull String id, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Perform a delete operation on the Payment identified by the context id.
    protected com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper
     
    protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager
     
     
    protected PaymentRepository<com.broadleafcommerce.data.tracking.core.Trackable>
     
    readAllByContextId(@NonNull 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(@NonNull String ownerType, @NonNull 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.
    readByContextId(@NonNull String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Read a single instance of a Payment.
    readByContextIdAndTenantId(@NonNull String id, @NonNull 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(@NonNull String id, P payment, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Update a Payment instance

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultPaymentService

      public DefaultPaymentService(PaymentRepository<com.broadleafcommerce.data.tracking.core.Trackable> repository, com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper helper, com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager mapper, PaymentLockService<P> paymentLockService)
  • Method Details

    • create

      public P create(@NonNull P payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: PaymentService
      Create an instance of a Payment.
      Specified by:
      create in interface PaymentService<P extends 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.
    • readByContextId

      public P readByContextId(@NonNull @NonNull String id, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: PaymentService
      Read a single instance of a Payment.
      Specified by:
      readByContextId in interface PaymentService<P extends 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
    • readAllByContextId

      public Iterable<P> readAllByContextId(@NonNull @NonNull Iterable<String> ids, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: PaymentService
      Retrieve all Payments based on a list of context ids.
      Specified by:
      readAllByContextId in interface PaymentService<P extends Payment>
      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

      public 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)
      Description copied from interface: PaymentService
      Find a page of payments for the given owner type and owner id.
      Specified by:
      readAllByCustomerIdAndTenantId in interface PaymentService<P extends Payment>
      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

      public org.springframework.data.domain.Page<P> readAllByOwnerTypeAndOwnerId(@NonNull @NonNull String ownerType, @NonNull @NonNull String ownerId, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: PaymentService
      Find a page of payments for the given owner type and owner id.
      Specified by:
      readAllByOwnerTypeAndOwnerId in interface PaymentService<P extends Payment>
      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

      public P update(@NonNull @NonNull String id, @NonNull P payment, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: PaymentService
      Update a Payment instance
      Specified by:
      update in interface PaymentService<P extends Payment>
      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
    • delete

      public void delete(@NonNull @NonNull String id, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: PaymentService
      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).
      Specified by:
      delete in interface PaymentService<P extends Payment>
      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.
    • readByContextIdAndTenantId

      public P readByContextIdAndTenantId(@NonNull @NonNull String id, @NonNull @NonNull com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Description copied from interface: PaymentService
      Finds the payment by the context id and tenant id, ignoring other context filtering like archival status.
      Specified by:
      readByContextIdAndTenantId in interface PaymentService<P extends Payment>
      Parameters:
      id - The context id of the payment
      context - Context information related to multitenancy.
      Returns:
      the transaction if found
    • getRepository

      protected PaymentRepository<com.broadleafcommerce.data.tracking.core.Trackable> getRepository()
    • getHelper

      protected com.broadleafcommerce.data.tracking.core.service.CrudEntityHelper getHelper()
    • getMapper

      protected com.broadleafcommerce.data.tracking.core.mapping.DomainMapperManager getMapper()
    • getPaymentLockService

      protected PaymentLockService<P> getPaymentLockService()