Пример #1
0
        void AddReply(SmsSendRecord send, string body)
        {
            var reply = Entity.Create <ReplyRecord>();

            reply.RrReply     = body;
            reply.RrReplyDate = DateTime.UtcNow;
            reply.RrToSend    = send.As <SendRecord>();
            reply.Save();

            EventLog.Application.WriteInformation($"SMS matched and reply created");
        }
Пример #2
0
        public void HandleStatusUpdate(string status, string errorCode, string expectedStatus, string expectedErrorMessage)
        {
            var notifier = new TwilioNotifier();

            notifier.Save();

            var messageSid = _rand.Next().ToString();
            var receiver   = new TwilioSmsReceiver();

            var send = new SmsSendRecord {
                SsrMessageSid = messageSid
            };

            send.Save();

            bool handled = receiver.HandleStatusUpdate(notifier.Id, messageSid, status, errorCode);

            Assert.That(handled, Is.True);

            var send2 = Entity.Get <SmsSendRecord>(send.Id);

            Assert.That(send2.SsrDeliveryStatus, Is.EqualTo(expectedStatus));
            Assert.That(send2.SrErrorMessage, Is.EqualTo(expectedErrorMessage));
        }
Пример #3
0
 TwilioSms CreateMatchingReply(TwilioNotifier notifier, SmsSendRecord send, string body = "Unimportant")
 {
     return(CreateSms(accountSid: notifier.TpAccountSid, from: send.SsrTo, to: send.SsrFrom, body: body));
 }
Пример #4
0
 /// <summary>
 /// 写入手机信息
 /// </summary>
 /// <param name="moduleName"></param>
 /// <param name="code"></param>
 /// <param name="receiveMobile"></param>
 public static void SetCode(string moduleName, string code, string receiveMobile)
 {
     var item = new SmsSendRecord() { Mobile = receiveMobile, Code = code, ModuleName = moduleName };
     SmsSendRecordManage.Instance.Add(item);
 }