public virtual async Task<IMessageDeliveryResult> Send(byte[] fileContent, string filetype, SendModel sendModel) { var recipient = new RecipientById(IdentificationType.DigipostAddress, sendModel.DigipostAddress); var primaryDocument = new Document(sendModel.Subject, filetype, fileContent) { SensitivityLevel = sendModel.SensitivityOption, AuthenticationLevel = sendModel.AuthenticationOption }; if (sendModel.SmsAfterHour) primaryDocument.SmsNotification = new SmsNotification(int.Parse(sendModel.SmsAfterHours)); var m = new Message(recipient, primaryDocument); IMessageDeliveryResult result = null; try { result = await GetClient().SendMessageAsync(m); } catch (ClientResponseException e) { var errorMessage = e.Error; Logger.Error("> Error." + errorMessage); throw; } return result; }
private static messagerecipient RecipientDataTransferObjectFromRecipientById(RecipientById recipient) { return(new messagerecipient { ItemElementName = recipient.IdentificationType.ToItemChoiceType1(), Item = recipient.Id }); }
public void SendOnBehalfOfOrganization() { var broker = new Broker(12345); var sender = new Sender(67890); var digitalRecipient = new RecipientById(IdentificationType.PersonalIdentificationNumber, "311084xxxx"); var primaryDocument = new Document(subject: "Attachment", fileType: "txt", path: @"c:\...\document.txt"); var clientConfig = new ClientConfig(broker, Environment.Production); var message = new Message(sender, digitalRecipient, primaryDocument); var result = client.SendMessage(message); }
public void SimpleConstructor() { //Arrange const string testPerson = "ola.nordmann#2233"; var recipientById = new RecipientById( IdentificationType.DigipostAddress, testPerson); //Act //Assert Assert.Equal(IdentificationType.DigipostAddress, recipientById.IdentificationType); Assert.Equal(testPerson, recipientById.Id); }
public void RecipientById() { //Arrange var source = new RecipientById( IdentificationType.DigipostAddress, "ola.nordmann#2233" ); var expectedDto = new messagerecipient { ItemElementName = ItemChoiceType1.digipostaddress, Item = "ola.nordmann#2233", printdetails = null //TODO: Implementer print! }; //Act var actualDto = DataTransferObjectConverter.ToDataTransferObject(source); //Assert Comparator.AssertEqual(expectedDto, actualDto); }
public virtual async Task<IMessageDeliveryResult> Send(byte[] fileContent, string filetype, string subject,IdentificationType identification, string identificationValue, SensitivityLevel sensitivity = SensitivityLevel.Normal, AuthenticationLevel authentication = AuthenticationLevel.Password, SmsNotification smsNotification = null,PrintDetails printDetails= null) { var recipient = new RecipientById(identification, identificationValue); var primaryDocument = new Document(subject, filetype, fileContent) { SensitivityLevel = sensitivity, AuthenticationLevel = authentication }; if (smsNotification != null) primaryDocument.SmsNotification = smsNotification; var m = new Message(recipient, primaryDocument); if (printDetails != null) m.PrintDetails = printDetails; return await GetClient().SendMessageAsync(m); }
private static identification IdentificationDataTransferObjectFromIdentificationById(RecipientById recipientById) { return(new identification { ItemElementName = recipientById.IdentificationType.ToItemChoiceType(), Item = recipientById.Id }); }