public Guid ExportOrder(ActiveCommerce.Orders.Order order) { var serviceOrder = new Services.Order { CustomerEmail = order.BuyerCustomerParty.Party.Contact.ElectronicMail, CustomerName = order.BuyerCustomerParty.Party.PartyName, Billing = ConvertAddress((Address)order.BuyerCustomerParty.Party.PostalAddress), Shipping = ConvertAddress((Address)order.DefaultDelivery.DeliveryParty.PostalAddress) }; var lines = new List <Services.OrderLine>(); foreach (var line in order.OrderLines) { var newLine = new Services.OrderLine { ProductId = line.LineItem.Item.Code, Price = line.LineItem.Price.PriceAmount.Value, Quantity = (uint)line.LineItem.Quantity }; lines.Add(newLine); } serviceOrder.OrderLines = lines.ToArray(); serviceOrder.Total = order.AnticipatedMonetaryTotal.TaxInclusiveAmount.Value; serviceOrder.TaxTotal = order.TaxTotal.TaxAmount.Value; var shippingCharges = order.AllowanceCharge.Cast <AllowanceCharge>().Where(x => x.ChargeIndicator && x.ShippingIndicator); serviceOrder.ShippingCost = shippingCharges.Sum(x => x.Amount.Value); var client = new Services.OrderServiceClient(); var id = client.CreateOrder(serviceOrder); Sitecore.Diagnostics.Log.Warn("Successfully exported order {0}".FormatWith(id), this); return(id); }
protected virtual PaymentMeans GetPayment(ActiveCommerce.Orders.Legacy.Order source, ActiveCommerce.Orders.Order destination) { var means = CreatePaymentMeans(source) ?? OrderFactory.CreatePaymentMeans(); means.PaymentChannelCode = source.PaymentSystem.Code; means.PaymentMeansCode = source.PaymentSystem.Code; means.PaymentMeansTitle = source.PaymentSystem.Title; means.PaymentDueDate = source.OrderDate; means.PaymentID = source.TransactionNumber; means.PaymentStatus = PaymentStatus.Succeeded.ToString(); means.TransactionNumber = source.TransactionNumber; means.Order = destination; return(means); }