public void SmsRoundTrip(bool nullFields) { var expected = new NotificationSms("123", nullFields ? null : "ImATextMessage"); var serialized = JsonConvert.SerializeObject(expected); var result = (NotificationSms)JsonConvert.DeserializeObject <Notification>(serialized); Assert.AreEqual(expected.PhoneNumber, result.PhoneNumber); Assert.AreEqual(expected.Message, result.Message); }
public override async Task <OperationResult <string> > SendCodeAsync(string content, string to, CancellationToken cancellationToken) { SendNotification notif = new SendNotification(); var smsSetting = await unitOfWork.SettingRepository.Get <AddSMSSetting>(SettingEnum.SMSSetting.EnumToString(), cancellationToken); NotificationSms smsSend = new NotificationSms(notif); var sendSms = await smsSend.Send(smsSetting.Result.LineNumber, smsSetting.Result.userApikey, to, content, smsSetting.Result.secretKey); if (sendSms.Success) { return(OperationResult <string> .BuildSuccessResult("Success Send SMS")); } return(OperationResult <string> .BuildFailure("Fail Send SMS")); }
public override async Task <OperationResult <string> > SendCodeAsync(string content, string to, CancellationToken cancellationToken) { SendNotification notif = new SendNotification(); var smsSetting = await unitOfWork.SettingRepository.Get <AddSMSSetting>(SettingEnum.SMSSetting.EnumToString(), cancellationToken); var emailSetting = await unitOfWork.SettingRepository.Get <AddEmailSetting>(SettingEnum.EmailSetting.EnumToString(), cancellationToken); NotificationSms smsSend = new NotificationSms(notif); NotificationEmail emailSend = new NotificationEmail(smsSend); var sendSms = await smsSend.Send(smsSetting.Result.LineNumber, smsSetting.Result.userApikey, to, content, smsSetting.Result.secretKey); if (sendSms.Success) { // var sendEmail = await emailSend.Send(emailSetting.Result.From, "Email Confirm Code", content, emailSetting.Result.Username, emailSetting.Result.Password, to, emailSetting.Result.Port, emailSetting.Result.SmtpServer); } return(OperationResult <string> .BuildFailure("Fail Send SMS")); }
/// <summary> /// Send a rate limited SMS notification triggered duing live trading from a user algorithm. /// </summary> /// <param name="notification"></param> public void Sms(NotificationSms notification) { // }