public InvoiceModel ConvertToInvoiceModel(MemberInvoice memberInvoice, string locale) { var invoiceConverter = new InvoiceConverter(); var invoiceLoader = new InvoiceLoader(invoiceConverter); var invoiceProvider = new InvoiceProvider(invoiceLoader, invoiceLoader, invoiceConverter); return(new InvoiceModel { Address = memberInvoice.Address != null?ConvertToInvoiceAddress(memberInvoice.Address) : null, CreatedDate = memberInvoice.CreatedDate, CustomerId = memberInvoice.CustomerId, Email = memberInvoice.Email, MemberInvoiceNumber = memberInvoice.MemberInvoiceNumber, FirstName = memberInvoice.FirstName, LastName = memberInvoice.LastName, Id = memberInvoice.Id, InvoiceDate = memberInvoice.InvoiceDate, Phone = memberInvoice.Phone, OrderId = memberInvoice.OrderId, Status = memberInvoice.Status.ToString(), Total = memberInvoice.Price != null ? memberInvoice.Price.TotalDue : 0, DisplayTotal = memberInvoice.Price != null?memberInvoice.Price.TotalDue.FormatPrice() : "0.00", Notes = memberInvoice.Notes, MemberId = memberInvoice.MemberId.ToUpper(), TotalVolumePoints = memberInvoice.Price != null ? memberInvoice.Price.TotalVolumePoints : 0, Type = memberInvoice.InvoiceType.ToString(), ShippingMethod = memberInvoice.ShippingMethod, InvoiceShipToAddress = memberInvoice.InvoiceShipToAddress, PricingType = memberInvoice.PriceType, OrderSource = memberInvoice.OrderSource, Source = memberInvoice.Source, ReceiptChannel = memberInvoice.ReceiptChannel, DisplayReceiptChannel = invoiceProvider.GetDisplayReceiptChannel(locale, memberInvoice.ReceiptChannel.ToString()), IsFaceToFace = memberInvoice.IsFaceToFace, InvoicePrice = memberInvoice.Price != null?ConvertToInvoicePrice(memberInvoice.Price) : null, IsGdoMemberPricing = memberInvoice.InvoiceType.ToString() == "Distributor", Vat = (string.IsNullOrEmpty(memberInvoice.Vat) && locale.Substring(3) == "GB") ? (string) HttpContext.GetLocalResourceObject("/Views/Invoice/Display.cshtml", "VatEmptyValue", CultureInfo.CurrentCulture) : memberInvoice.Vat, ApplicationCountryCode = memberInvoice.ApplicationCountryCode, DisplayInvoiceStatus = invoiceProvider.GetDisplayInvoiceStatus(locale, memberInvoice.Status.ToString()), DisplayPaymentType = invoiceProvider.GetDisplayPaymentType(locale, memberInvoice.PaymentType.ToString()), DisplayInvoiceType = invoiceProvider.GetDisplayInvoiceType(locale, memberInvoice.InvoiceType.ToString()), isProfitable = memberInvoice.IsProfitable, isPurchased = memberInvoice.IsPurchased, PaymentType = memberInvoice.PaymentType, }); }
public InvoiceLoader(InvoiceConverter invoiceConverter) { _invoiceConverter = invoiceConverter; }