private Task SendDetailedBookingNotification(AccommodationBookingInfo bookingInfo, NotificationTypes notificationType) { var details = bookingInfo.BookingDetails; var notificationData = CreateNotificationData(bookingInfo, details); return(_notificationService.Send(messageData: notificationData, notificationType: notificationType)); }
// TODO: hardcoded to be removed with UEDA-20 public async Task NotifyBookingFinalized(AccommodationBookingInfo bookingInfo) { var agentNotificationTemplate = _options.BookingFinalizedTemplateId; await SendDetailedBookingNotification(bookingInfo, bookingInfo.AgentInformation.AgentEmail, agentNotificationTemplate); var adminNotificationTemplate = _options.ReservationsBookingFinalizedTemplateId; await SendDetailedBookingNotification(bookingInfo, _options.CcNotificationAddresses, adminNotificationTemplate); }
private Task SendDetailedBookingNotification(AccommodationBookingInfo bookingInfo, string recipient, SlimAgentContext agent, NotificationTypes notificationType) { var details = bookingInfo.BookingDetails; var notificationData = CreateNotificationData(bookingInfo, details); return(_notificationService.Send(agent: agent, messageData: notificationData, notificationType: notificationType, email: recipient)); }
private static BookingNotificationData CreateNotificationData(AccommodationBookingInfo bookingInfo, AccommodationBookingDetails details) { return(new BookingNotificationData { AgentName = bookingInfo.AgentInformation.AgentName, BookingDetails = new BookingNotificationData.Details { AccommodationName = details.AccommodationName, CheckInDate = DateTimeFormatters.ToDateString(details.CheckInDate), CheckOutDate = DateTimeFormatters.ToDateString(details.CheckOutDate), DeadlineDate = DateTimeFormatters.ToDateString(details.DeadlineDate), Location = details.Location, NumberOfNights = details.NumberOfNights, NumberOfPassengers = details.NumberOfPassengers, ReferenceCode = details.ReferenceCode, RoomDetails = details.RoomDetails.Select(d => { var maskedPassengers = d.Passengers.Where(p => p.IsLeader) .Select(p => { var firstName = p.FirstName.Length == 1 ? "*" : p.FirstName.Substring(0, 1); return new Pax(p.Title, p.LastName, firstName); }) .ToList(); return new BookingNotificationData.BookedRoomDetails { ContractDescription = d.ContractDescription, MealPlan = d.MealPlan, Passengers = maskedPassengers, Price = MoneyFormatter.ToCurrencyString(d.Price.Amount, d.Price.Currency), Type = EnumFormatters.FromDescription(d.Type), Remarks = d.Remarks }; }).ToList(), Status = EnumFormatters.FromDescription(details.Status), SupplierReferenceCode = details.AgentReference, ContactInfo = details.ContactInfo, }, AgencyName = bookingInfo.AgentInformation.AgencyName, PaymentStatus = EnumFormatters.FromDescription(bookingInfo.PaymentStatus), Price = MoneyFormatter.ToCurrencyString(bookingInfo.TotalPrice.Amount, bookingInfo.TotalPrice.Currency), CancellationPenalty = MoneyFormatter.ToCurrencyString(bookingInfo.CancellationPenalty.Amount, bookingInfo.CancellationPenalty.Currency), Supplier = bookingInfo.Supplier is null ? string.Empty : EnumFormatters.FromDescription(bookingInfo.Supplier.Value), });
// TODO: hardcoded to be removed with UEDA-20 public async Task NotifyBookingFinalized(AccommodationBookingInfo bookingInfo, SlimAgentContext agent) { await SendDetailedBookingNotification(bookingInfo, bookingInfo.AgentInformation.AgentEmail, agent, NotificationTypes.BookingFinalized); await SendDetailedBookingNotification(bookingInfo, NotificationTypes.BookingFinalized); }
public async Task NotifyAdminsStatusChanged(AccommodationBookingInfo bookingInfo) { // TODO: remove when we have appropriate admin panel booking monitoring await SendDetailedBookingNotification(bookingInfo, NotificationTypes.BookingStatusChangedToPendingOrWaitingForResponse); }