Interface PaymentTransactionService<T extends PaymentTransaction>

All Superinterfaces:
com.broadleafcommerce.data.tracking.core.service.CrudEntityService<T>, com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<T>
All Known Implementing Classes:
DefaultPaymentTransactionService

public interface PaymentTransactionService<T extends PaymentTransaction> extends com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService<T>
Service responsible for the creation of PaymentTransactions & the recording of PaymentResponse results on the PaymentTransaction
Author:
Chris Kittrell (ckittrell)
  • Method Summary

    Modifier and Type
    Method
    Description
    buildChildPaymentTransactionForResponse(Payment payment, PaymentTransaction parentTransaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse)
    Creates the new child payment transaction for the specified parent transaction based on the payment response.
    claimTransactionsForRequest(Payment payment, String requestId, String transactionType, boolean resetTransactionReversalState, String lockToken, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    readAllByContextIdInAndManagementStateIn(List<String> contextIds, List<String> managementStates, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns the transactions with the specified ids and management states.
    org.springframework.data.domain.Page<T>
    readAllByDateRecordedBeforeAndManagementStateIsNotIn(Instant date, List<String> managementStates, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns the transactions with the recorded date before the specified time and management statuses not in the specified list.
    org.springframework.data.domain.Page<T>
    readAllByManagementStateIn(List<String> managementStates, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns the transactions with the specified management states.
    org.springframework.data.domain.Page<T>
    readAllByManagementStateInAndStatusIn(List<String> managementStates, List<String> transactionStatuses, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns the transactions with the specified management states and transaction statuses.
    readByTransactionReferenceId(String transactionReferenceId, com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
    Returns the transactions with the specified transaction reference id.
    org.springframework.data.domain.Page<T>
    readTransactionsToReverse(Duration reversalCandidateTtl, org.springframework.data.domain.Pageable page, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Reads the payment transactions that are eligible for reversal.
    recordTransactionResponse(T transaction, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse response, boolean saveResult, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates the given PaymentTransaction based on the given PaymentResponse and persists the PaymentTransaction.
    default T
    recordTransactionResponse(T transaction, @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse response, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
    Updates the given PaymentTransaction based on the given PaymentResponse and persists the PaymentTransaction.
    updateTransactionBasedOnResponse(T transaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse response)
    Updates the given PaymentTransaction based on the given PaymentResponse.

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.CrudEntityService

    create, createAll, createAllAllowingPartialSuccess, delete, readAll, readAll, readAll, readAllByContextId, readByContextId, replace, replaceAll, replaceAllAllowingPartialSuccess, update, updateAll, updateAllAllowingPartialSuccess, updateSort

    Methods inherited from interface com.broadleafcommerce.data.tracking.core.service.RsqlCrudEntityService

    readAll, readAll, readAll, readAll
  • Method Details

    • readAllByContextIdInAndManagementStateIn

      List<T> readAllByContextIdInAndManagementStateIn(List<String> contextIds, List<String> managementStates, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Returns the transactions with the specified ids and management states.
      Parameters:
      contextIds - the ids of the transactions
      managementStates - the management states of the transactions
      context - Request context information around sandbox and multitenant state
      Returns:
      the transactions with the specified ids and management states
    • readAllByManagementStateIn

      org.springframework.data.domain.Page<T> readAllByManagementStateIn(List<String> managementStates, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Returns the transactions with the specified management states.
      Parameters:
      managementStates - the management states of the transactions
      page - The requested page of results from the database.
      context - Request context information around sandbox and multitenant state
      Returns:
      the transactions with the specified management states
    • readAllByManagementStateInAndStatusIn

      org.springframework.data.domain.Page<T> readAllByManagementStateInAndStatusIn(List<String> managementStates, List<String> transactionStatuses, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Returns the transactions with the specified management states and transaction statuses.
      Parameters:
      managementStates - the management states of the transactions
      transactionStatuses - the statuses of the transactions
      page - The requested page of results from the database.
      context - Request context information around sandbox and multitenant state
      Returns:
      the transactions with the specified management states and transaction statuses
    • readAllByDateRecordedBeforeAndManagementStateIsNotIn

      org.springframework.data.domain.Page<T> readAllByDateRecordedBeforeAndManagementStateIsNotIn(Instant date, List<String> managementStates, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Returns the transactions with the recorded date before the specified time and management statuses not in the specified list.
      Parameters:
      date - the date until which the transaction was recorded
      managementStates - the management states to avoid
      page - The requested page of results from the database.
      context - Request context information around sandbox and multitenant state
      Returns:
      the transactions with the specified management states
    • readByTransactionReferenceId

      T readByTransactionReferenceId(String transactionReferenceId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context)
      Returns the transactions with the specified transaction reference id.
      Parameters:
      transactionReferenceId - the transaction id known by the payment gateway
      context - Request context information around sandbox and multitenant state
      Returns:
      the transactions with the specified transaction reference id
    • recordTransactionResponse

      default T recordTransactionResponse(@NonNull T transaction, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse response, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Updates the given PaymentTransaction based on the given PaymentResponse and persists the PaymentTransaction.
      Parameters:
      transaction - the PaymentTransaction to update and persist
      response - the PaymentResponse to get the data from
      contextInfo - context information related to multitenancy
      Returns:
      updated and persisted PaymentTransaction
    • recordTransactionResponse

      T recordTransactionResponse(@NonNull T transaction, @NonNull @NonNull com.broadleafcommerce.paymentgateway.domain.PaymentResponse response, boolean saveResult, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Updates the given PaymentTransaction based on the given PaymentResponse and persists the PaymentTransaction.
      Parameters:
      transaction - the PaymentTransaction to update and persist
      response - the PaymentResponse to get the data from
      saveResult - save updated transaction if true
      contextInfo - context information related to multitenancy
      Returns:
      updated and persisted PaymentTransaction
    • readTransactionsToReverse

      org.springframework.data.domain.Page<T> readTransactionsToReverse(Duration reversalCandidateTtl, @Nullable org.springframework.data.domain.Pageable page, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Reads the payment transactions that are eligible for reversal. By default, this method returns the transaction with DefaultTransactionManagementStates.REVERSAL_CANDIDATE management state, DefaultTransactionStatuses.SUCCESS status and that have not been updated within a specified duration.
      Parameters:
      reversalCandidateTtl - the amount of time the payment transactions have not been updated and can be reversed
      page - The requested page of results from the database
      contextInfo - context information related to multitenancy
      Returns:
      the payment transactions that are eligible for reversal
      See Also:
    • claimTransactionsForRequest

      Payment claimTransactionsForRequest(Payment payment, String requestId, String transactionType, boolean resetTransactionReversalState, @Nullable String lockToken, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Parameters:
      payment - the Payment instance
      requestId - id used to represent the request that produced this transaction e.g during checkout
      transactionType - the transaction type to change
      resetTransactionReversalState - reset or not the state of the transaction reversal
      lockToken - token granted to resource that owns the payment lock
      contextInfo - context information related to multitenancy
      Returns:
      The up-to-date Payment record
    • buildChildPaymentTransactionForResponse

      T buildChildPaymentTransactionForResponse(Payment payment, PaymentTransaction parentTransaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse paymentResponse)
      Creates the new child payment transaction for the specified parent transaction based on the payment response. By default this method doesn't store the created transaction.
      Parameters:
      payment - the Payment instance
      parentTransaction - the parent transaction
      paymentResponse - the PaymentResponse to get the data from
      Returns:
      the new child PaymentTransaction for the specified payment and parent transaction
    • updateTransactionBasedOnResponse

      T updateTransactionBasedOnResponse(T transaction, com.broadleafcommerce.paymentgateway.domain.PaymentResponse response)
      Updates the given PaymentTransaction based on the given PaymentResponse.
      Parameters:
      transaction - the PaymentTransaction to update
      response - the PaymentResponse to update the transaction with
      Returns:
      the updated PaymentTransaction based on the given PaymentResponse