/// <summary>
        /// Verify callerId by providing calling number and verificationCode received on phone.
        /// </summary>
        /// <param name="request">request object</param>
        /// <returns>true or false depending on whether verification was successful or not.</returns>
        /// <exception cref="BadRequestException">          in case HTTP response code is 400 - Bad request, the request was formatted improperly.</exception>
        /// <exception cref="UnauthorizedException">        in case HTTP response code is 401 - Unauthorized, API Key missing or invalid.</exception>
        /// <exception cref="AccessForbiddenException">     in case HTTP response code is 403 - Forbidden, insufficient permissions.</exception>
        /// <exception cref="ResourceNotFoundException">    in case HTTP response code is 404 - NOT FOUND, the resource requested does not exist.</exception>
        /// <exception cref="InternalServerErrorException"> in case HTTP response code is 500 - Internal Server Error.</exception>
        /// <exception cref="CallfireApiException">         in case HTTP response code is something different from codes listed above.</exception>
        /// <exception cref="CallfireClientException">      in case error has occurred in client.</exception>
        public bool?VerifyCallerId(CallerIdVerificationRequest request)
        {
            Validate.NotBlank(request.CallerId, "callerid cannot be blank");
            string path = ME_CALLERIDS_VERIFY_PATH.ReplaceFirst(ClientConstants.PLACEHOLDER, request.CallerId);

            return(Convert.ToBoolean(Client.Post <object>(path, request)));
        }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new CallerIdVerificationRequest
     {
         CallerId         = "12132000384",
         VerificationCode = "1234"
     };
     bool?verified = client.MeApi.VerifyCallerId(request);
 }
        public void VerifyCallerId()
        {
            var request = new CallerIdVerificationRequest
            {
                CallerId         = "12132212384",
                VerificationCode = "123"
            };
            var verified = Client.MeApi.VerifyCallerId(request);

            Console.WriteLine("verified: " + verified);
        }
Beispiel #4
0
        public void VerifyCallerId()
        {
            string requestJson  = GetJsonPayload("/account/meApi/request/verifyCallerId.json");
            string responseJson = GetJsonPayload("/account/meApi/response/verifyCallerId.json");
            var    restRequest  = MockRestResponse(responseJson);

            var request = new CallerIdVerificationRequest
            {
                CallerId         = "1234567890",
                VerificationCode = "1234"
            };
            bool?verified = Client.MeApi.VerifyCallerId(request);

            Assert.That(Serializer.Serialize(verified), Is.EqualTo(responseJson));
            Assert.AreEqual(Method.POST, restRequest.Value.Method);

            var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody);

            Assert.That(requestBodyParam.Value, Is.EqualTo(requestJson));
            Assert.That(restRequest.Value.Resource, Is.StringContaining(request.CallerId));
        }