public InqueryHistoryStatusChangedToParsedDomainEvent(InqueryHistory inqueryHistory) => InqueryHistory = inqueryHistory;
public async Task Handle(NewInqueryRequestReceivedIntegrationEvent @event) { logger.CreateLogger(nameof(@event)).LogTrace($"new inquiry request received {@event.AggregateId}."); logger.CreateLogger(nameof(@event)).LogTrace($"new inquiry request received organization email {@event.AgentEmail}."); //1. Let caller know that we have started the processing //2. send the request to zapier to parse the mail, //3. send the parsed result to agent for further action var newInqueryProcessStartedIntegrationEvent = new NewInqueryProcessStartedIntegrationEvent(); eventBus.Publish(newInqueryProcessStartedIntegrationEvent); //string id, string customerEmail, string message, string subject, string agentEmail, AgentInfo agentInfo var inqueryHistory = new InqueryHistory(@event.AggregateId, (InquiryType)(@event.InquiryType), @event.PlainText, @event.Body, @event.Subject, @event.AgentEmail, new Domain.AgentInfo() { Address = @event.AgentInfo.Address, City = @event.AgentInfo.City, State = @event.AgentInfo.State, Zip = @event.AgentInfo.Zip, Email = @event.AgentInfo.Email, Firstname = @event.AgentInfo.Firstname, Lastname = @event.AgentInfo.Lastname, Company = @event.AgentInfo.Company, Country = @event.AgentInfo.Country, Phone = @event.AgentInfo.Phone, Logo = @event.AgentInfo.Logo, Id = @event.AgentInfo.Id, Facebook = @event.AgentInfo.Facebook, Instagram = @event.AgentInfo.Instagram, Twitter = @event.AgentInfo.Twitter, LinkedIn = @event.AgentInfo.LinkedIn, IntegrationEmail = @event.AgentInfo.IntegrationEmail, }, new Domain.AgentInquiryInfo { SpreadsheetId = @event.AgentInquiryInfo?.SpreadsheetId, SpreadsheetName = @event.AgentInquiryInfo?.SpreadsheetName, SpreadsheetUrl = @event.AgentInquiryInfo?.SpreadsheetUrl, TypeFormUrl = @event.AgentInquiryInfo?.TypeFormUrl, MortgageShareableUrl = @event.AgentInquiryInfo?.MortgageShareableUrl, LandlordShareableUrl = @event.AgentInquiryInfo?.LandlordShareableUrl, VendorShareableUrl = @event.AgentInquiryInfo?.VendorShareableUrl, AggregateShareableUrl = @event.AgentInquiryInfo?.AggregateShareableUrl, AggregateShareableId = @event.AgentInquiryInfo?.AggregateShareableId, }, new Domain.AgentAutoresponderTemplateInfo { AgentAutoresponderTemplateId = @event.AgentAutoresponderTemplateInfo.AgentAutoresponderTemplateId, CustomerAutoresponderTemplateId = @event.AgentAutoresponderTemplateInfo.CustomerAutoresponderTemplateId }, new OrganizationInfo { OrganizationEmail = @event.OrganizationEmail }); await inqueryHistoryRepository.AddAsync(inqueryHistory); await mediator.DispatchDomainEventsAsync(inqueryHistory); }