public virtual Payment ToModel(Payment payment) { if (payment == null) { throw new ArgumentNullException(nameof(payment)); } payment.InjectFrom(this); if (!TaxDetails.IsNullOrEmpty()) { payment.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); } if (!Discounts.IsNullOrEmpty()) { payment.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); } if (!Addresses.IsNullOrEmpty()) { payment.BillingAddress = Addresses.First().ToModel(AbstractTypeFactory <Address> .TryCreateInstance()); } return(payment); }
public virtual LineItem ToModel(LineItem lineItem) { if (lineItem == null) { throw new ArgumentNullException(nameof(lineItem)); } lineItem.Id = Id; lineItem.CreatedBy = CreatedBy; lineItem.CreatedDate = CreatedDate; lineItem.ModifiedBy = ModifiedBy; lineItem.ModifiedDate = ModifiedDate; lineItem.ListPrice = ListPrice; lineItem.ListPriceWithTax = ListPriceWithTax; lineItem.SalePrice = SalePrice; lineItem.SalePriceWithTax = SalePriceWithTax; lineItem.Fee = Fee; lineItem.FeeWithTax = FeeWithTax; lineItem.DiscountAmount = DiscountAmount; lineItem.DiscountAmountWithTax = DiscountAmountWithTax; lineItem.Quantity = Quantity; lineItem.TaxTotal = TaxTotal; lineItem.TaxPercentRate = TaxPercentRate; lineItem.Weight = Weight; lineItem.Height = Height; lineItem.Width = Width; lineItem.MeasureUnit = MeasureUnit; lineItem.WeightUnit = WeightUnit; lineItem.Length = Length; lineItem.TaxType = TaxType; lineItem.IsReadOnly = IsReadOnly; lineItem.ValidationType = ValidationType; lineItem.PriceId = PriceId; lineItem.LanguageCode = LanguageCode; lineItem.IsReccuring = IsReccuring; lineItem.IsGift = IsGift; lineItem.ImageUrl = ImageUrl; lineItem.ProductId = ProductId; lineItem.ProductType = ProductType; lineItem.ShipmentMethodCode = ShipmentMethodCode; lineItem.RequiredShipping = RequiredShipping; lineItem.ProductType = ProductType; lineItem.FulfillmentLocationCode = FulfillmentLocationCode; lineItem.Note = Comment; if (!Discounts.IsNullOrEmpty()) { lineItem.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); } if (!TaxDetails.IsNullOrEmpty()) { lineItem.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); } return(lineItem); }
public virtual Payment ToModel(Payment payment) { if (payment == null) { throw new ArgumentNullException(nameof(payment)); } payment.Id = Id; payment.OuterId = OuterId; payment.CreatedBy = CreatedBy; payment.CreatedDate = CreatedDate; payment.ModifiedBy = ModifiedBy; payment.ModifiedDate = ModifiedDate; payment.Amount = Amount; payment.PaymentGatewayCode = PaymentGatewayCode; payment.Price = Price; payment.PriceWithTax = PriceWithTax; payment.DiscountAmount = DiscountAmount; payment.DiscountAmountWithTax = DiscountAmountWithTax; payment.TaxType = TaxType; payment.TaxPercentRate = TaxPercentRate; payment.TaxTotal = TaxTotal; payment.Total = Total; payment.TotalWithTax = TotalWithTax; //TODO //payment.Purpose = Purpose; payment.Currency = Currency; if (!TaxDetails.IsNullOrEmpty()) { payment.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); } if (!Discounts.IsNullOrEmpty()) { payment.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); } if (!Addresses.IsNullOrEmpty()) { payment.BillingAddress = Addresses.First().ToModel(AbstractTypeFactory <Address> .TryCreateInstance()); } payment.DynamicProperties = DynamicPropertyObjectValues.GroupBy(g => g.PropertyId).Select(x => { var property = AbstractTypeFactory <DynamicObjectProperty> .TryCreateInstance(); property.Id = x.Key; property.Name = x.FirstOrDefault()?.PropertyName; property.Values = x.Select(v => v.ToModel(AbstractTypeFactory <DynamicPropertyObjectValue> .TryCreateInstance())).ToArray(); return(property); }).ToArray(); return(payment); }
public virtual Payment ToModel(Payment payment) { if (payment == null) { throw new ArgumentNullException(nameof(payment)); } payment.Id = Id; payment.CreatedBy = CreatedBy; payment.CreatedDate = CreatedDate; payment.ModifiedBy = ModifiedBy; payment.ModifiedDate = ModifiedDate; payment.Amount = Amount; payment.PaymentGatewayCode = PaymentGatewayCode; payment.Price = Price; payment.PriceWithTax = PriceWithTax; payment.DiscountAmount = DiscountAmount; payment.DiscountAmountWithTax = DiscountAmountWithTax; payment.TaxType = TaxType; payment.TaxPercentRate = TaxPercentRate; payment.TaxTotal = TaxTotal; payment.Total = Total; payment.TotalWithTax = TotalWithTax; //TODO //payment.Purpose = Purpose; payment.OuterId = OuterId; payment.Currency = Currency; if (!TaxDetails.IsNullOrEmpty()) { payment.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); } if (!Discounts.IsNullOrEmpty()) { payment.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); } if (!Addresses.IsNullOrEmpty()) { payment.BillingAddress = Addresses.First().ToModel(AbstractTypeFactory <Address> .TryCreateInstance()); } return(payment); }
public virtual LineItem ToModel(LineItem lineItem) { if (lineItem == null) { throw new ArgumentNullException(nameof(lineItem)); } lineItem.InjectFrom(this); lineItem.Note = Comment; if (!Discounts.IsNullOrEmpty()) { lineItem.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); } if (!TaxDetails.IsNullOrEmpty()) { lineItem.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); } return(lineItem); }
public virtual Shipment ToModel(Shipment shipment) { if (shipment == null) { throw new ArgumentNullException(nameof(shipment)); } shipment.Id = Id; shipment.CreatedBy = CreatedBy; shipment.CreatedDate = CreatedDate; shipment.ModifiedBy = ModifiedBy; shipment.ModifiedDate = ModifiedDate; shipment.Fee = Fee; shipment.FeeWithTax = FeeWithTax; shipment.FulfillmentCenterId = FulfillmentCenterId; shipment.ShipmentMethodCode = ShipmentMethodCode; shipment.Total = Total; shipment.TotalWithTax = TotalWithTax; shipment.TaxTotal = TaxTotal; shipment.Price = Price; shipment.PriceWithTax = PriceWithTax; shipment.DiscountAmount = DiscountAmount; shipment.DiscountAmountWithTax = DiscountAmountWithTax; shipment.TaxPercentRate = TaxPercentRate; shipment.Currency = Currency; shipment.WeightUnit = WeightUnit; shipment.Weight = WeightValue; shipment.Height = DimensionHeight; shipment.Length = DimensionLength; shipment.WeightUnit = DimensionUnit; shipment.Weight = DimensionWidth; shipment.TaxType = TaxType; shipment.ShipmentMethodOption = ShipmentMethodOption; //TODO //shipment.TaxIncluded = TaxIncluded; //shipment.MeasureUnit = if (!Addresses.IsNullOrEmpty()) { shipment.DeliveryAddress = Addresses.First().ToModel(AbstractTypeFactory <Address> .TryCreateInstance()); } if (!Discounts.IsNullOrEmpty()) { shipment.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); } if (!Items.IsNullOrEmpty()) { shipment.Items = Items.Select(x => x.ToModel(AbstractTypeFactory <ShipmentItem> .TryCreateInstance())).ToList(); } if (!TaxDetails.IsNullOrEmpty()) { shipment.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); } shipment.DynamicProperties = DynamicPropertyObjectValues.GroupBy(g => g.PropertyId).Select(x => { var property = AbstractTypeFactory <DynamicObjectProperty> .TryCreateInstance(); property.Id = x.Key; property.Name = x.FirstOrDefault()?.PropertyName; property.Values = x.Select(v => v.ToModel(AbstractTypeFactory <DynamicPropertyObjectValue> .TryCreateInstance())).ToArray(); return(property); }).ToArray(); return(shipment); }
public virtual LineItem ToModel(LineItem lineItem) { if (lineItem == null) { throw new ArgumentNullException(nameof(lineItem)); } lineItem.Id = Id; lineItem.CreatedBy = CreatedBy; lineItem.CreatedDate = CreatedDate; lineItem.ModifiedBy = ModifiedBy; lineItem.ModifiedDate = ModifiedDate; lineItem.ListPrice = ListPrice; lineItem.ListPriceWithTax = ListPriceWithTax; lineItem.SalePrice = SalePrice; lineItem.SalePriceWithTax = SalePriceWithTax; lineItem.Fee = Fee; lineItem.FeeWithTax = FeeWithTax; lineItem.DiscountAmount = DiscountAmount; lineItem.DiscountAmountWithTax = DiscountAmountWithTax; lineItem.Quantity = Quantity; lineItem.TaxTotal = TaxTotal; lineItem.TaxPercentRate = TaxPercentRate; lineItem.Weight = Weight; lineItem.Height = Height; lineItem.Width = Width; lineItem.MeasureUnit = MeasureUnit; lineItem.WeightUnit = WeightUnit; lineItem.Length = Length; lineItem.TaxType = TaxType; lineItem.IsReadOnly = IsReadOnly; lineItem.ValidationType = ValidationType; lineItem.PriceId = PriceId; lineItem.LanguageCode = LanguageCode; lineItem.IsReccuring = IsReccuring; lineItem.IsGift = IsGift; lineItem.ImageUrl = ImageUrl; lineItem.ProductId = ProductId; lineItem.ProductType = ProductType; lineItem.ShipmentMethodCode = ShipmentMethodCode; lineItem.RequiredShipping = RequiredShipping; lineItem.ProductType = ProductType; lineItem.FulfillmentLocationCode = FulfillmentLocationCode; lineItem.Note = Comment; lineItem.CatalogId = CatalogId; lineItem.CategoryId = CategoryId; lineItem.Currency = Currency; lineItem.Name = Name; lineItem.Sku = Sku; if (!Discounts.IsNullOrEmpty()) { lineItem.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory <Discount> .TryCreateInstance())).ToList(); } if (!TaxDetails.IsNullOrEmpty()) { lineItem.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory <TaxDetail> .TryCreateInstance())).ToList(); } lineItem.DynamicProperties = DynamicPropertyObjectValues.GroupBy(g => g.PropertyId).Select(x => { var property = AbstractTypeFactory <DynamicObjectProperty> .TryCreateInstance(); property.Id = x.Key; property.Name = x.FirstOrDefault()?.PropertyName; property.Values = x.Select(v => v.ToModel(AbstractTypeFactory <DynamicPropertyObjectValue> .TryCreateInstance())).ToArray(); return(property); }).ToArray(); return(lineItem); }