Interface PricingTransactionService

All Known Implementing Classes:
DefaultPricingTransactionService

public interface PricingTransactionService
The service class to handle pricing transactions such as recording and rolling back price data usages.
Author:
karanjariwala
  • Method Details

    • recordPriceDataUsage

      com.broadleafcommerce.pricing.client.domain.usage.RecordPriceDataUsageResponse recordPriceDataUsage(com.broadleafcommerce.pricing.client.domain.usage.RecordPriceDataUsageRequest request, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Records price data usages.

      If any one of the PriceDataUsages is no longer available or expired, then none are recorded.

      This is used for price data that are limited by quantity. For example, pricing events such as a flash sale may have limited quantity for a sale price.

      Parameters:
      request - the RecordPriceDataUsageRequest containing the usages to record
      contextInfo - the context info
      Returns:
      the RecordPriceDataUsageResponse representing the result of recording the usages
    • rollbackPriceDataUsages

      void rollbackPriceDataUsages(String transactionReferenceType, String transactionReferenceId, String rollbackReason, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Performs the rollback for PriceData and PriceDataUsageDetail.

      This mainly includes adding back the PriceData.getAvailableQuantity() and archiving the PriceDataUsageDetails.

      Parameters:
      transactionReferenceType - the transactionReferenceType of the details to rollback
      transactionReferenceId - the transactionReferenceId of the details to rollback
      rollbackReason - the reason for rollback
      contextInfo - the context info
    • markPriceDataUsagesRevertible

      void markPriceDataUsagesRevertible(@NonNull @NonNull String transactionRefType, @NonNull @NonNull String transactionRefId, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Sets revertible=true to PriceDataUsageDetail identified by transactionRefType and transactionRefId
      Parameters:
      transactionRefType - the transactionRefType to restrict query
      transactionRefId - the transactionRefId to restrict query
      contextInfo - the context info
    • rollbackPriceDataUsagesByPriceDataId

      void rollbackPriceDataUsagesByPriceDataId(Map<String,Integer> quantityByPriceDataIdMap, String rollbackReason, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Performs the rollback for PriceData and PriceDataUsageDetail.

      This mainly includes adding back the PriceData.getAvailableQuantity() and archiving the PriceDataUsageDetails.

      Parameters:
      quantityByPriceDataIdMap - a map containing the entries that represent the quantity to be added back for a specific priceDataId
      rollbackReason - the reason for rollback
      contextInfo - the context info
    • rollbackExpiredPriceDataUsage

      void rollbackExpiredPriceDataUsage(Duration outdatedPriceDataUsageDetailTimeout, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
      Performs the rollback for PriceData and PriceDataUsageDetail where PriceDataUsageDetail are older than specified date and has flag revertible as true
      Parameters:
      outdatedPriceDataUsageDetailTimeout - - timeout that will be subtracted from NOW to get the moment when PriceDataUsageDetail is considered expired
      contextInfo - the context info