public override int GetHashCode() { unchecked { var hashCode = Billing != null?Billing.GetHashCode() : 0; hashCode = (hashCode * 397) ^ (CartHash != null ? CartHash.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CartTax != null ? CartTax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CreatedVia != null ? CreatedVia.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Currency != null ? Currency.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CustomerId; hashCode = (hashCode * 397) ^ (CustomerIpAddress != null ? CustomerIpAddress.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CustomerNote != null ? CustomerNote.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CustomerUserAgent != null ? CustomerUserAgent.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DiscountTax != null ? DiscountTax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DiscountTotal != null ? DiscountTotal.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Id; hashCode = (hashCode * 397) ^ (Number != null ? Number.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OrderKey != null ? OrderKey.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ParentId; hashCode = (hashCode * 397) ^ (PaymentMethod != null ? PaymentMethod.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PaymentMethodTitle != null ? PaymentMethodTitle.GetHashCode() : 0); hashCode = (hashCode * 397) ^ PricesIncludeTax.GetHashCode(); hashCode = (hashCode * 397) ^ (Shipping != null ? Shipping.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ShippingTax != null ? ShippingTax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ShippingTotal != null ? ShippingTotal.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Total != null ? Total.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TotalTax != null ? TotalTax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TransactionId != null ? TransactionId.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0); return(hashCode); } }
public decimal GenerateTotal(MentionDiscount mentionDiscount, DiscountTotal calculateDiscount, MessageShow tellUserWeAreDiscounting) { decimal subTotal = Items.Sum(x => x.Price); mentionDiscount(subTotal); tellUserWeAreDiscounting("We are applying discount"); return(calculateDiscount(Items, subTotal)); }
public override object Clone() { var result = base.Clone() as LineItem; result.ListPrice = ListPrice?.Clone() as Money; result.SalePrice = SalePrice?.Clone() as Money; result.DiscountAmount = DiscountAmount?.Clone() as Money; result.DiscountAmountWithTax = DiscountAmountWithTax?.Clone() as Money; result.DiscountTotal = DiscountTotal?.Clone() as Money; result.DiscountTotalWithTax = DiscountTotalWithTax?.Clone() as Money; result.ListPriceWithTax = ListPriceWithTax?.Clone() as Money; result.SalePriceWithTax = SalePriceWithTax?.Clone() as Money; result.PlacedPrice = PlacedPrice?.Clone() as Money; result.PlacedPriceWithTax = PlacedPriceWithTax?.Clone() as Money; result.ExtendedPrice = ExtendedPrice?.Clone() as Money; result.ExtendedPriceWithTax = ExtendedPriceWithTax?.Clone() as Money; result.TaxTotal = TaxTotal?.Clone() as Money; if (Discounts != null) { result.Discounts = new List <Discount>(Discounts.Select(x => x.Clone() as Discount)); } if (TaxDetails != null) { result.TaxDetails = new List <TaxDetail>(TaxDetails.Select(x => x.Clone() as TaxDetail)); } if (DynamicProperties != null) { result.DynamicProperties = new MutablePagedList <DynamicProperty>(DynamicProperties.Select(x => x.Clone() as DynamicProperty)); } if (ValidationErrors != null) { result.ValidationErrors = new List <ValidationError>(ValidationErrors.Select(x => x.Clone() as ValidationError)); } return(result); }
public override object Clone() { var result = base.Clone() as ShoppingCart; result.HandlingTotal = HandlingTotal?.Clone() as Money; result.HandlingTotalWithTax = HandlingTotalWithTax?.Clone() as Money; result.DiscountAmount = DiscountAmount?.Clone() as Money; result.Total = Total?.Clone() as Money; result.SubTotal = SubTotal?.Clone() as Money; result.SubTotalWithTax = SubTotalWithTax?.Clone() as Money; result.ShippingPrice = ShippingPrice?.Clone() as Money; result.ShippingPriceWithTax = ShippingPriceWithTax?.Clone() as Money; result.ShippingTotal = ShippingTotal?.Clone() as Money; result.ShippingTotalWithTax = ShippingTotalWithTax?.Clone() as Money; result.PaymentPrice = PaymentPrice?.Clone() as Money; result.PaymentPriceWithTax = PaymentPriceWithTax?.Clone() as Money; result.PaymentTotal = PaymentTotal?.Clone() as Money; result.PaymentTotalWithTax = PaymentTotalWithTax?.Clone() as Money; result.HandlingTotal = HandlingTotal?.Clone() as Money; result.HandlingTotalWithTax = HandlingTotalWithTax?.Clone() as Money; result.DiscountTotal = DiscountTotal?.Clone() as Money; result.DiscountTotalWithTax = DiscountTotalWithTax?.Clone() as Money; result.TaxTotal = TaxTotal?.Clone() as Money; if (Discounts != null) { result.Discounts = new List <Discount>(Discounts.Select(x => x.Clone() as Discount)); } if (TaxDetails != null) { result.TaxDetails = new List <TaxDetail>(TaxDetails.Select(x => x.Clone() as TaxDetail)); } if (DynamicProperties != null) { result.DynamicProperties = new List <DynamicProperty>(DynamicProperties.Select(x => x.Clone() as DynamicProperty)); } if (ValidationErrors != null) { result.ValidationErrors = new List <ValidationError>(ValidationErrors.Select(x => x.Clone() as ValidationError)); } if (Addresses != null) { result.Addresses = new List <Address>(Addresses.Select(x => x.Clone() as Address)); } if (Items != null) { result.Items = new List <LineItem>(Items.Select(x => x.Clone() as LineItem)); } if (Payments != null) { result.Payments = new List <Payment>(Payments.Select(x => x.Clone() as Payment)); } if (Shipments != null) { result.Shipments = new List <Shipment>(Shipments.Select(x => x.Clone() as Shipment)); } if (Coupons != null) { result.Coupons = new List <Coupon>(Coupons.Select(x => x.Clone() as Coupon)); } if (AvailablePaymentMethods != null) { result.AvailablePaymentMethods = new List <PaymentMethod>(AvailablePaymentMethods.Select(x => x.Clone() as PaymentMethod)); } return(result); }