private DeliveryMailbox.Mail ConvertPackageMailItemToDeliveryMailItem(DataTransferObjects.BusinessObjects.Mail mailItem) { var mail = new DeliveryMailbox.Mail() { Attachments = CreateDeliveryAttachment(mailItem.Attachments), Body = new DeliveryMailbox.Body() { ContentType = mailItem.Body.ContentType, Text = mailItem.Body.Text }, CorrealationId = mailItem.CorrealationId, MessageHeaderId = mailItem.MessageHeaderId, MetaData = CreateDeliveryMetaData(mailItem.MetaData), Recipient = new DeliveryMailbox.Recipient() { To = mailItem.Recipient.To }, Reference = mailItem.Reference, Sender = mailItem.Sender, Subject = mailItem.Subject, SenderOrgNumber = mailItem.SenderOrgNumber, SenderOrgName = mailItem.SenderOrgName, SupInfoEmailAddress = mailItem.SupInfoEmailAddress, SupInfoPhoneNumber = mailItem.SupInfoPhoneNumber, SupInfoText = mailItem.SupInfoText, SupInfoUrI = mailItem.SupInfoUrI, CertificationBySubjectName = mailItem.CertificationBySubjectName }; return(mail); }
public string SendPackageV3(DataTransferObjects.BusinessObjects.Mail mailItem, Guid requestId) { LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.BusinessLayer.BusinessManager: incoming SendPackageV3 with RequestId: {0}", requestId)); //Transform MailItem to object of type specified by MinaMeddelandens Message webservice. var secureDelivery = GetSecureDeliveryV3(mailItem, requestId); //Create SignedDelivery and sign xmldocument and create a secureDelivery object specified in Mina meddelanden Message webservice. var signedDeliveryHandler = new SignedDeliveryHandler(); var signedDelivery = signedDeliveryHandler.GetSignedDeliveryV3(secureDelivery, ConfigHelper.SignDelivery, ConfigHelper.DefaultNamespaceV3, ConfigHelper.SigningCertificateSubjectName, requestId); //LOG to database before sending a message. var packageHandler = new PackageHandler(); //Save message in database // var databaseId = packageHandler.SavePackage(mailItem.Recipient.To, mailItem.Sender, PackageStatus.Pending, requestId); var dataManager = new DataManager(); var distributionId = dataManager.SendPackageV3(signedDelivery, requestId); //Log to database result of sending a message. DateTime?deliveryDate = null; packageHandler.UpdatePackage(distributionId, 0, PackageStatus.Pending, deliveryDate, requestId); LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.BusinessLayer.BusinessManager: leaving SendPackageV3 with RequestId: {0}", requestId)); return(distributionId); }
private bool ValidateMail(DataTransferObjects.BusinessObjects.Mail mailItem, Guid requestId) { //Validate MailItem var validateMailHelper = new ValidateMailHelper(); //Validate no script in bodytext validateMailHelper.ScriptTag(mailItem.Body.Text, requestId); //validate recipient return(validateMailHelper.Recipient(mailItem.Recipient.To, requestId, ConfigHelper.RegexValidationPersonNo, ConfigHelper.RegexValidationOrganizationNo)); }
/// <summary> /// Sends a mail directly to the mailboxoperator. /// </summary> /// <param name="mailItem"></param> /// <param name="mailBox"></param> /// <param name="requestId"></param> /// <returns></returns> public SendPackageToMailboxResponse SendPackageToMailBox(DataTransferObjects.BusinessObjects.Mail mailItem, MailBox mailBox, Guid requestId) { LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.DataLayer.DataManager: incoming SendPackageToMailBox with RequestId: {0}", requestId)); var sendMessageToMailboxRequest = new SendPackageToMailboxRequest() { Mail = ConvertPackageMailItemToDeliveryMailItem(mailItem), Mailbox = ConvertPackageMailboxToDeliveryMailbox(mailBox) }; var service = new DeliveryMailboxService(); var result = service.SendPackageToMailBox(sendMessageToMailboxRequest, requestId); LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.DataLayer.DataManager: leaving SendPackageToMailBox with RequestId: {0}", requestId)); return(result); }
/// <summary> /// Converts a Mail to a SecureDelivery. /// </summary> private SecureDelivery1 GetSecureDeliveryV3(DataTransferObjects.BusinessObjects.Mail mailItem, Guid requestId) { LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.BusinessLayer: incoming SecureDeliveryHandler GetSecureDelivery with RequestId: {0}", requestId)); var secureDeliveryHandler = new SecureDeliveryHandler(); var secureDelivery = new SecureDelivery1(); secureDelivery.Header = secureDeliveryHandler.GetSecureDeliveryHeader(mailItem.Reference, mailItem.CorrealationId, mailItem.Recipient.To, //ConfigHelper.SenderOrganizationNumber, mailItem.SenderOrgNumber, //ConfigHelper.SenderOrganizationName, mailItem.SenderOrgName, requestId); secureDelivery.Message = getSecureDeliveryMessageV3(mailItem, requestId); LogManager.LogTrace(string.Format("SE.GOV.MM.Integration.Package.BusinessLayer: leaving SecureDeliveryHandler GetSecureDelivery with RequestId: {0}", requestId)); return(secureDelivery); }