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 Summary
Modifier and TypeMethodDescriptionvoid
markPriceDataUsagesRevertible
(@NonNull String transactionRefType, @NonNull String transactionRefId, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Sets revertible=true toPriceDataUsageDetail
identified by transactionRefType and transactionRefIdcom.broadleafcommerce.pricing.client.domain.usage.RecordPriceDataUsageResponse
recordPriceDataUsage
(com.broadleafcommerce.pricing.client.domain.usage.RecordPriceDataUsageRequest request, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Records price data usages.void
rollbackExpiredPriceDataUsage
(Duration outdatedPriceDataUsageDetailTimeout, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs the rollback forPriceData
andPriceDataUsageDetail
wherePriceDataUsageDetail
are older than specified date and has flag revertible as truevoid
rollbackPriceDataUsages
(String transactionReferenceType, String transactionReferenceId, String rollbackReason, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs the rollback forPriceData
andPriceDataUsageDetail
.void
rollbackPriceDataUsagesByPriceDataId
(Map<String, Integer> quantityByPriceDataIdMap, String rollbackReason, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs the rollback forPriceData
andPriceDataUsageDetail
.
-
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
- theRecordPriceDataUsageRequest
containing the usages to recordcontextInfo
- 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 forPriceData
andPriceDataUsageDetail
.This mainly includes adding back the
PriceData.getAvailableQuantity()
and archiving thePriceDataUsageDetails
.- Parameters:
transactionReferenceType
- the transactionReferenceType of the details to rollbacktransactionReferenceId
- the transactionReferenceId of the details to rollbackrollbackReason
- the reason for rollbackcontextInfo
- 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 toPriceDataUsageDetail
identified by transactionRefType and transactionRefId- Parameters:
transactionRefType
- the transactionRefType to restrict querytransactionRefId
- the transactionRefId to restrict querycontextInfo
- the context info
-
rollbackPriceDataUsagesByPriceDataId
void rollbackPriceDataUsagesByPriceDataId(Map<String, Integer> quantityByPriceDataIdMap, String rollbackReason, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs the rollback forPriceData
andPriceDataUsageDetail
.This mainly includes adding back the
PriceData.getAvailableQuantity()
and archiving thePriceDataUsageDetails
.- Parameters:
quantityByPriceDataIdMap
- a map containing the entries that represent the quantity to be added back for a specific priceDataIdrollbackReason
- the reason for rollbackcontextInfo
- the context info
-
rollbackExpiredPriceDataUsage
void rollbackExpiredPriceDataUsage(Duration outdatedPriceDataUsageDetailTimeout, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) Performs the rollback forPriceData
andPriceDataUsageDetail
wherePriceDataUsageDetail
are older than specified date and has flag revertible as true- Parameters:
outdatedPriceDataUsageDetailTimeout
- - timeout that will be subtracted from NOW to get the moment whenPriceDataUsageDetail
is considered expiredcontextInfo
- the context info
-