public void SendVerificationCode(string phoneNumber) { var result = NumberVerify.Verify(new NumberVerify.VerifyRequest { number = phoneNumber, brand = "NexmoQS" }); RequestId = result.request_id; }
public ActionResult Cancel(string requestID) { var results = NumberVerify.Control(new NumberVerify.ControlRequest { request_id = requestID, cmd = "cancel" }); ViewBag.status = results.status; return(View()); }
public void should_control_request() { var result = NumberVerify.Control(new NumberVerify.ControlRequest { request_id = "B41F2D19-913C-4BB3-B825-624E375D2C31", cmd = "trigger_next_event" }); Assert.AreEqual("19", result.status); Assert.AreEqual("trigger_next_event", result.command); }
public ActionResult Search(string requestID) { var search = NumberVerify.Search(new NumberVerify.SearchRequest { request_id = requestID }); ViewBag.error_text = search.error_text; ViewBag.status = search.status; return(View()); }
public ActionResult Start(string to) { var start = NumberVerify.Verify(new NumberVerify.VerifyRequest { number = to, brand = "NexmoQS" }); Session["requestID"] = start.request_id; return(RedirectToAction("Check")); }
public void should_send_control() { SetExpect($"{ApiUrl}/verify/control/json?request_id=B41F2D19-913C-4BB3-B825-624E375D2C31&cmd=cancel&api_key={ApiKey}&api_secret={ApiSecret}&", "{\"status\":\"0\",\"command\":\"cancel\"}"); var results = NumberVerify.Control(new NumberVerify.ControlRequest { request_id = "B41F2D19-913C-4BB3-B825-624E375D2C31", cmd = "cancel" }); Assert.AreEqual("0", results.status); Assert.AreEqual("cancel", results.command); }
public string CheckVerificationCode(string code) { var result = NumberVerify.Check(new NumberVerify.CheckRequest { request_id = RequestId, code = code }); if (result.status == "0") { return("Verification Sucessful"); } else { return(result.error_text); } }
public ActionResult Check(string code) { var result = NumberVerify.Check(new NumberVerify.CheckRequest { request_id = Session["requestID"].ToString(), code = code }); if (result.status == "0") { ViewBag.Message = "Verification Sucessful"; } else { ViewBag.Message = result.error_text; } return(View()); }
public void should_send_control() { var resp = new Mock <IWebResponse>(); resp.Setup(e => e.GetResponseStream()).Returns(new MemoryStream(Encoding.UTF8.GetBytes("{\"status\":\"0\",\"command\":\"cancel\"}"))); _request.Setup(e => e.GetResponse()).Returns(resp.Object); var results = NumberVerify.Control(new NumberVerify.ControlRequest { request_id = "B41F2D19-913C-4BB3-B825-624E375D2C31", cmd = "cancel" }); _mock.Verify(h => h.CreateHttp(new Uri( string.Format("{0}/verify/control/json?request_id=B41F2D19-913C-4BB3-B825-624E375D2C31&cmd=cancel&api_key={1}&api_secret={2}&", ApiUrl, ApiKey, ApiSecret))), Times.Once); Assert.AreEqual("0", results.status); Assert.AreEqual("cancel", results.command); }