private static TaxJarOrder ToTaxJarOrders(OCLineItem lineItem, string orderID) { return(new TaxJarOrder() { TransactionId = $"OrderID:|{orderID}|LineItemID:|{lineItem.ID}", Shipping = 0, // will create separate lines for shipping FromCity = lineItem.ShipFromAddress.City, FromZip = lineItem.ShipFromAddress.Zip, FromState = lineItem.ShipFromAddress.State, FromCountry = lineItem.ShipFromAddress.Country, FromStreet = lineItem.ShipFromAddress.Street1, ToCity = lineItem.ShippingAddress.City, ToZip = lineItem.ShippingAddress.Zip, ToState = lineItem.ShippingAddress.State, ToCountry = lineItem.ShippingAddress.Country, ToStreet = lineItem.ShippingAddress.Street1, LineItems = new List <TaxJarLineItem> { new TaxJarLineItem() { Id = lineItem.ID, Quantity = lineItem.Quantity, UnitPrice = lineItem.UnitPrice ?? 0, Description = lineItem.Product.Name, ProductIdentifier = lineItem.Product.ID, } } }); }
private static TaxJarOrder ToTaxJarOrders(ShipEstimate shipEstimate, OCLineItem lineItem, string orderID) { var selectedShipMethod = shipEstimate.ShipMethods.First(x => x.ID == shipEstimate.SelectedShipMethodID); return(new TaxJarOrder() { TransactionId = $"OrderID:|{orderID}|ShippingEstimateID:|{shipEstimate.ID}", Shipping = 0, // will create separate lines for shipping FromCity = lineItem.ShipFromAddress.City, FromZip = lineItem.ShipFromAddress.Zip, FromState = lineItem.ShipFromAddress.State, FromCountry = lineItem.ShipFromAddress.Country, FromStreet = lineItem.ShipFromAddress.Street1, ToCity = lineItem.ShippingAddress.City, ToZip = lineItem.ShippingAddress.Zip, ToState = lineItem.ShippingAddress.State, ToCountry = lineItem.ShippingAddress.Country, ToStreet = lineItem.ShippingAddress.Street1, LineItems = new List <TaxJarLineItem> { new TaxJarLineItem() { Id = shipEstimate.ID, Quantity = 1, UnitPrice = selectedShipMethod.Cost, Description = selectedShipMethod.Name, ProductIdentifier = "shipping_code", } } }); }