static BookingSummaryNotificationData.BookingData CreateBookingData(Booking booking) => new BookingSummaryNotificationData.BookingData { ReferenceCode = booking.ReferenceCode, Accommodation = booking.AccommodationName, Location = $"{booking.Location.Country}, {booking.Location.Locality}", LeadingPassenger = GetLeadingPassengerFormattedName(booking), Amount = MoneyFormatter.ToCurrencyString(booking.TotalPrice, booking.Currency), DeadlineDate = DateTimeFormatters.ToDateString(booking.DeadlineDate), CheckInDate = DateTimeFormatters.ToDateString(booking.CheckInDate), CheckOutDate = DateTimeFormatters.ToDateString(booking.CheckOutDate), Status = EnumFormatters.FromDescription(booking.Status) };
public Task <Result> SendInvoice(int bookingId, string email, int agentId) { // TODO: hardcoded to be removed with UEDA-20 var addresses = new List <string> { email }; addresses.AddRange(_options.CcNotificationAddresses); return(_bookingDocumentsService.GetActualInvoice(bookingId, agentId) .Bind(invoice => { var(registrationInfo, data) = invoice; var invoiceData = new InvoiceData { Number = registrationInfo.Number, BuyerDetails = data.BuyerDetails, InvoiceDate = DateTimeFormatters.ToDateString(registrationInfo.Date), InvoiceItems = data.InvoiceItems .Select(i => new InvoiceData.InvoiceItem { Number = i.Number, Price = FormatPrice(i.Price), Total = FormatPrice(i.Total), AccommodationName = i.AccommodationName, RoomDescription = i.RoomDescription, RoomType = EnumFormatters.FromDescription(i.RoomType), DeadlineDate = DateTimeFormatters.ToDateString(i.DeadlineDate), MainPassengerName = PersonNameFormatters.ToMaskedName(i.MainPassengerFirstName, i.MainPassengerLastName) }) .ToList(), TotalPrice = FormatPrice(data.TotalPrice), CurrencyCode = EnumFormatters.FromDescription(data.TotalPrice.Currency), ReferenceCode = data.ReferenceCode, SellerDetails = data.SellerDetails, PayDueDate = DateTimeFormatters.ToDateString(data.PayDueDate), CheckInDate = DateTimeFormatters.ToDateString(data.CheckInDate), CheckOutDate = DateTimeFormatters.ToDateString(data.CheckOutDate), PaymentStatus = EnumFormatters.FromDescription(data.PaymentStatus) }; return _mailSender.Send(_options.InvoiceTemplateId, addresses, invoiceData); })); }