Class PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>
Represents the data required for an order price calculation request.
public abstract record PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress> : IPriceCalculationRequest where TCalculationRequestItem : IPriceCalculationRequestItem<ProductIdentifier>, new() where TCalculationRequestAddress : AddressDto
Type Parameters
TCalculationRequestItemCalculation request item type.
TCalculationRequestAddressAddress for the calculation type.
- Inheritance
-
objectPriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>
- Implements
- Derived
- Extension Methods
Remarks
Inherit from this type if you need to change the TCalculationRequestItem or TCalculationRequestAddress generic types used in the calculation request.
If you are using the default item type (ProductIdentifier) and address type (AddressDto), inherit from PriceCalculationRequest instead.
Constructors
PriceCalculationRequestBase()
protected PriceCalculationRequestBase()
PriceCalculationRequestBase(PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>)
protected PriceCalculationRequestBase(PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress> original)
Parameters
originalPriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>
Properties
BillingAddress
public TCalculationRequestAddress BillingAddress { get; init; }
Property Value
- TCalculationRequestAddress
CalculationDate
Date and time when discounts and taxes are to be valid.
public DateTime CalculationDate { get; init; }
Property Value
- DateTime
CustomerId
Identifier for the customer placing the order. May be used for customer-specific pricing, discounts, or loyalty tracking.
public int? CustomerId { get; init; }
Property Value
- int?
Remarks
null if the customer is not known or not provided.
EqualityContract
protected virtual Type EqualityContract { get; }
Property Value
- Type
Items
Items of calculation request.
public ICollection<TCalculationRequestItem> Items { get; init; }
Property Value
- ICollection<TCalculationRequestItem>
LanguageName
Language name.
public string LanguageName { get; init; }
Property Value
- string
Remarks
The language name is used for product data localization during product data retrieval via IProductDataRetriever<TProductIdentifier, TProductData>.
PaymentMethodId
Identifier for the selected payment method. Can affect transaction fees or eligibility for certain promotions.
public int? PaymentMethodId { get; init; }
Property Value
- int?
Remarks
null if the payment method is not known or not provided.
ShippingAddress
public TCalculationRequestAddress ShippingAddress { get; init; }
Property Value
- TCalculationRequestAddress
ShippingMethodId
Identifier for the chosen shipping method. Used to calculate delivery costs and estimated delivery times.
public int? ShippingMethodId { get; init; }
Property Value
- int?
Remarks
null if the shipping method is not known or not provided.
Methods
AddNewItem(ProductIdentifier, decimal)
Internal "setter" for the ProductIdentifier to enable to use contravariance "out" in the IPriceCalculationRequestItem<TProductIdentifier> interface to support inherited subclasses of ProductIdentifier in the IPriceCalculationRequestItem<TProductIdentifier> interface.
public void AddNewItem(ProductIdentifier productIdentifier, decimal quantity)
Parameters
productIdentifierProductIdentifierquantitydecimal
Equals(PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>?)
public virtual bool Equals(PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>? other)
Parameters
otherPriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>
Returns
- bool
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
- bool
GetHashCode()
public override int GetHashCode()
Returns
- int
PrintMembers(StringBuilder)
protected virtual bool PrintMembers(StringBuilder builder)
Parameters
builderStringBuilder
Returns
- bool
ToString()
public override string ToString()
Returns
- string
Operators
operator ==(PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>?, PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>?)
public static bool operator ==(PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>? left, PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>? right)
Parameters
leftPriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>rightPriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>
Returns
- bool
operator !=(PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>?, PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>?)
public static bool operator !=(PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>? left, PriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>? right)
Parameters
leftPriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>rightPriceCalculationRequestBase<TCalculationRequestItem, TCalculationRequestAddress>
Returns
- bool