Class PurchaseProcessor
Handles the processing of purchase request items.
Inherited Members
Namespace: Mediachase.Commerce.InventoryService.BusinessLogic
Assembly: Mediachase.Commerce.dll
Version: 10.8.0Syntax
public class PurchaseProcessor : RequestItemProcessor
Constructors
PurchaseProcessor(InventoryRequest, InventoryRequestItem, OperationKeySerializer, RecordState)
Creates a new instance of PurchaseProcessor for a a request item that is already being processed. This is used by the PurchaseOrPreorderProcessor when the item will be processed as a preorder.
Declaration
public PurchaseProcessor(InventoryRequest request, InventoryRequestItem requestItem, OperationKeySerializer operationKeySerializer, RecordState recordState)
Parameters
Type | Name | Description |
---|---|---|
InventoryRequest | request | The request containing the item to process. |
InventoryRequestItem | requestItem | The request item to process. |
OperationKeySerializer | operationKeySerializer | The OperationKeySerializer for encoding and decoding operation keys. |
RecordState | recordState | The RecordState value for the request. |
PurchaseProcessor(InventoryRequest, InventoryRequestItem, OperationKeySerializer, RecordStateSet)
Creates a new instance of PurchaseProcessor.
Declaration
public PurchaseProcessor(InventoryRequest request, InventoryRequestItem requestItem, OperationKeySerializer operationKeySerializer, RecordStateSet recordStateSet)
Parameters
Type | Name | Description |
---|---|---|
InventoryRequest | request | The request containing the item to process. |
InventoryRequestItem | requestItem | The request item to process. |
OperationKeySerializer | operationKeySerializer | The OperationKeySerializer for encoding and decoding operation keys. |
RecordStateSet | recordStateSet | The collection of RecordState values for the request. |
Methods
Apply()
Applies the request item to the appropriate RecordState.
Declaration
public override void Apply()
Overrides
Remarks
The purchase request item will be marked as a failure if the request date is before PurchaseAvailableUtc, if the catalog entry is not found, or if the warehouse cannot be determined.
Otherwise, the requested quantity will be decremented from PurchaseAvailableQuantity and added to PreorderRequestedQuantity.
GetResponseItems(Boolean)
Returns the final InventoryResponseItem instances for the item (typically, only one unless the operation is a split). CreateDefaultResponseItem(InventoryRequestItem, Boolean, RecordState, String, InventoryResponseType, InventoryResponseTypeInfo) can be used to generate response items in most cases.
Declaration
public override InventoryResponseItem[] GetResponseItems(bool isOverallSuccess)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isOverallSuccess | True if all items wer successful, false if any item returned false from Validate(). |
Returns
Type | Description |
---|---|
InventoryResponseItem[] |
Overrides
Validate()
Validates that the request item is successful.
Declaration
public override bool Validate()
Returns
Type | Description |
---|---|
System.Boolean | True if the request item is successful; otherwise, false. |
Overrides
Remarks
The purchase request item will be successful if the conditions in Apply() are met, and the final PurchaseAvailableQuantity is greater than or equal to zero.