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 TypeMethodDescriptionCreate an instance of aPayment
.void
delete
(String id, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Perform a delete operation on thePayment
identified by the context id.readAllByContextId
(Iterable<String> ids, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Retrieve allPayments
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.readByContextId
(String id, com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Read a single instance of aPayment
.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 aPayment
instance
-
Method Details
-
create
P create(@NonNull P payment, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Create an instance of aPayment
.- Parameters:
payment
- ThePayment
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 aPayment
.- Parameters:
id
- The context id for thePayment
.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 allPayments
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
- TheCustomerRef.getCustomerId()
of thePayment
tenantId
- The ID of theTenant
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.
-
update
P update(@NonNull String id, @NonNull P payment, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context) Update aPayment
instance- Parameters:
id
- The context id for thePayment
.payment
- ThePayment
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 validationcom.broadleafcommerce.data.tracking.core.exception.EntityMissingException
- if a managed instance corresponding to the given id could not be foundcom.broadleafcommerce.common.messaging.exception.ResourceLockException
- if thePaymentLockInfo
does not match thePayment'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 thePayment
identified by the context id. This could result in an archival, or a raw delete, depending on the result of processing throughDomainMapper.deleteMap(Object, ContextInfo)
.- Parameters:
id
- The context id for thePayment
. 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 paymentcontext
- Context information related to multitenancy.- Returns:
- the transaction if found
-