예제 #1
0
        /// <summary>
        /// Envia la petición al servidor
        /// </summary>
        /// <param name="signature"></param>
        /// <param name="updatedSignatureType"></param>
        /// <returns></returns>
        private VerifyResponse SendRequest(object signature, string updatedSignatureType = null)
        {
            try
            {
                VerifyRequest request = BuildRequest(signature, updatedSignatureType);

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml("<verify xmlns=\"urn:oasis:names:tc:dss:1.0:core:schema\"><dssXML xmlns=\"\"></dssXML></verify>");

                XmlNode dssXml = xmlDoc.SelectSingleNode("//dssXML");
                dssXml.InnerText = GetXmlElement <VerifyRequest>(request).OuterXml;

                SoapMessage soapMessage = new SoapMessage();
                soapMessage.Body        = xmlDoc.DocumentElement;
                soapMessage.Certificate = _certificado;

                var resp = SoapClient.SendMessage(_uriAfirma, soapMessage, true);

                VerifyResponse respuesta = DeserializeXml <VerifyResponse>(resp.Body.InnerText);

                return(respuesta);
            }
            catch (Exception ex)
            {
                throw new Exception("Ha ocurrido un error enviando la petición", ex);
            }
        }
        public VerifyResponse VerifyPayment(VerifyRequest verifyrequest)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;

            var url     = string.Format(Constants.Routes.VerifyTransaction, verifyrequest.reference);
            var request = new RestRequest(url, Method.GET);

            request.AddHeader("content-type", "application/x-www-form-urlencoded");
            request.AddHeader("authorization", "Bearer " + Paystack_SECRET_KEY);
            try
            {
                var response = client.Execute <VerifyResponse>(request);

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var result = JsonConvert.DeserializeObject <VerifyResponse>(response.Content);

                    return(result);
                }
                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
예제 #3
0
        public VerifyResponse VerifyTimestamp(DocumentBaseType document, Timestamp timeStamp, bool returnProcessingDetails = false)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document", "El valor no puede ser nulo.");
            }

            if (timeStamp == null)
            {
                throw new ArgumentNullException("timeStamp", "El valor no puede ser nulo.");
            }

            VerifyRequest request = BuildVerifyRequest(document, timeStamp, returnProcessingDetails);

            VerifyTimeSoapClient tsaSoapClient = new VerifyTimeSoapClient(_identity, _serverCert);

            VerifyResponse response = tsaSoapClient.verifyTimeStamp(request);

            if (ResultType.RequesterError.Equals(response.Result.ResultMajor) ||
                ResultType.ResponderError.Equals(response.Result.ResultMajor))
            {
                throw new AfirmaResultException(response.Result.ResultMajor, response.Result.ResultMinor, response.Result.ResultMessage.Value);
            }

            return(response);
        }
예제 #4
0
        private VerifyRequest BuildVerifyRequest(DocumentBaseType document, Timestamp timeStamp, bool returnProcessingDetails)
        {
            VerifyRequest vr = new VerifyRequest();

            IntegraAfirmaNet.Schemas.ClaimedIdentity identity = new IntegraAfirmaNet.Schemas.ClaimedIdentity();
            identity.idAplicacion = _identity.ApplicationId;

            vr.OptionalInputs = new AnyType();

            if (returnProcessingDetails)
            {
                vr.OptionalInputs.Any = new XmlElement[] { GetXmlElement(identity), GetXmlElement("<dss:ReturnProcessingDetails xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\"/>") };
            }
            else
            {
                vr.OptionalInputs.Any = new XmlElement[] { GetXmlElement(identity) };
            }

            vr.SignatureObject      = new SignatureObject();
            vr.SignatureObject.Item = timeStamp;
            vr.InputDocuments       = new InputDocuments();
            vr.InputDocuments.Items = new object[] { document };

            return(vr);
        }
예제 #5
0
        public async Task <VerifyResponse> Verify(VerifyRequest data)
        {
            var response = await _client.TryExecute <BlankResponse>(HttpMethod.Post, "/v1/Verify", data);

            switch (response.responseStatusCode)
            {
            case 200:
                return(new VerifyResponse());

            case 477:
                throw new InvalidIdentityException(response.responseStatusCode);

            case 472:
            case 473:
            case 475:
                throw new DuplicateVerificationException(response.responseStatusCode);

            case 471:
            case 474:
            case 476:
                throw new PaymentTransactionNotFoundException(response.responseStatusCode);

            default:
                throw response.exception;
            }
        }
예제 #6
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            var user = await _userManager.GetUserAsync(User);

            var userId   = _userManager.GetUserId(User);
            var userName = user.UserName;
            var reason   = Input.ReasonVerifyUser;

            if (reason == null)
            {
                reason = "Wil geverifieerd worden aub.";
            }

            VerifyRequest verifyRequest = new VerifyRequest()
            {
                Date     = DateTime.Now,
                Reason   = reason,
                UserId   = userId,
                UserName = userName
            };

            _verifyRequestManager.CreateVerifyRequest(verifyRequest);

            return(RedirectToPage());
        }
예제 #7
0
        public async Task <IActionResult> Post(VerifyRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (request.SourceType == VerifyRequest.SourceTypeEnum.ImageFile)
            {
                var task = new ImageFileVerifyBackgroundTask
                {
                    Title           = request.Title,
                    SourcePath      = request.SourcePath,
                    DestinationPath = request.DestinationPath
                };
                var handler =
                    new ImageFileVerifyBackgroundTaskHandler(loggerFactory, progressHubContext);
                await backgroundTaskQueue.QueueBackgroundWorkItemAsync(handler.Handle, task);

                return(Ok());
            }

            await workerService.EnqueueAsync(new PhysicalDriveVerifyBackgroundTask
            {
                Title           = request.Title,
                SourcePath      = request.SourcePath,
                DestinationPath = request.DestinationPath
            });

            return(Ok());
        }
예제 #8
0
        /// <summary>
        /// Verify the signature of a message.
        /// </summary>
        /// <returns>If verification was successful it will return true.</returns>
        public async Task <bool> VerifySignedMessage(string externalAddress, string message, string signature)
        {
            try
            {
                Guard.Null(externalAddress, nameof(externalAddress), "External Address Cannot Be NULL/Empty!");
                Guard.Null(message, nameof(message), "Message Cannot Be NULL/Empty!");
                Guard.Null(signature, nameof(signature), "Signature Cannot Be NULL/Empty!");

                VerifyRequest request = new VerifyRequest
                {
                    externalAddress = externalAddress,
                    message         = message,
                    signature       = signature
                };

                bool response = await base.SendPostJSON <bool>("api/Wallet/verifysignature", request);

                return(response);
            }
            catch (Exception ex)
            {
                logger.LogCritical(
                    $"An Error '{ex.Message}' Occured When Verifying a Signed Message: 'Addy: {externalAddress}', Msg: '{message}', Sig: '{signature}'",
                    ex);
                throw;
            }
        }
        /// <summary>
        /// Number Verify: Generate and send a PIN to your user. You use the request_id in the response for the Verify Check.
        /// </summary>
        /// <param name="request">Verify request</param>
        /// <param name="creds">(Optional) Overridden credentials for only this request</param>
        /// <returns></returns>
        public static VerifyResponse Verify(VerifyRequest request, Credentials creds = null)
        {
            var response = ApiRequest.DoGetRequestWithQueryParameters <VerifyResponse>(ApiRequest.GetBaseUriFor(typeof(NumberVerify), "/verify/json"), ApiRequest.AuthType.Query, request, creds);

            ValidateVerifyResponse(response);
            return(response);
        }
예제 #10
0
        public async Task Verify_POST_Should_Error_When_User_Does_Not_Exist()
        {
            var controller = BuildController(out var serviceProvider);

            var mockUser = new Mock <ClaimsPrincipal>();

            mockUser.SetupGet(mu => mu.Identity.IsAuthenticated).Returns(false);

            controller.ControllerContext = new ControllerContext()
            {
                HttpContext = new DefaultHttpContext()
                {
                    User = mockUser.Object
                }
            };

            var request = new VerifyRequest
            {
                Email      = "*****@*****.**",
                Token      = "token",
                Password   = "******",
                RePassword = "******"
            };

            controller.ValidateRequest(request);

            var result = await controller.Verify(request);

            result.Should().NotBeNull();
            result.Should().BeOfType <ViewResult>();
            controller.ModelState.IsValid.Should().BeFalse();
        }
예제 #11
0
        /// <summary>
        /// Verifies a digital signature that was generated by the [Sign](https://docs.cloud.oracle.com/api/#/en/key/latest/SignedData/Sign) operation
        /// by using the public key of the same asymmetric key that was used to sign the data. If you want to validate the
        /// digital signature outside of the service, you can do so by using the public key of the asymmetric key.
        ///
        /// </summary>
        /// <param name="request">The request object containing the details to send. Required.</param>
        /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param>
        /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param>
        /// <returns>A response object containing details about the completed operation</returns>
        /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/keymanagement/Verify.cs.html">here</a> to see an example of how to use Verify API.</example>
        public async Task <VerifyResponse> Verify(VerifyRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default)
        {
            logger.Trace("Called verify");
            Uri                uri            = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/20180608/verify".Trim('/')));
            HttpMethod         method         = new HttpMethod("POST");
            HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request);

            requestMessage.Headers.Add("Accept", "application/json");
            GenericRetrier      retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration);
            HttpResponseMessage responseMessage;

            try
            {
                if (retryingClient != null)
                {
                    responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false);
                }
                else
                {
                    responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false);
                }
                this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage);

                return(Converter.FromHttpResponseMessage <VerifyResponse>(responseMessage));
            }
            catch (Exception e)
            {
                logger.Error($"Verify failed with error: {e.Message}");
                throw;
            }
        }
예제 #12
0
        public void GetHashcodeTest()
        {
            List <string> consentForDataSources = new List <string>();

            VerifyRequest verifyRequest1 = new VerifyRequest(countryCode: "test-countryCode", dataFields: new DataFields(personInfo: new PersonInfo(firstGivenName: "test-firstGivenName")));

            verifyRequest1.AcceptTruliooTermsAndConditions = true;
            verifyRequest1.Demo                  = true;
            verifyRequest1.CallBackUrl           = "test-callBackUrl";
            verifyRequest1.Timeout               = 1000;
            verifyRequest1.CleansedAddress       = true;
            verifyRequest1.ConfigurationName     = "test-configurationName";
            verifyRequest1.CustomerReferenceID   = "test-customerReferenceID";
            verifyRequest1.VerboseMode           = true;
            verifyRequest1.ConsentForDataSources = consentForDataSources;

            VerifyRequest verifyRequest2 = new VerifyRequest(countryCode: "test-countryCode", dataFields: new DataFields(personInfo: new PersonInfo(firstGivenName: "test-firstGivenName")));

            verifyRequest2.AcceptTruliooTermsAndConditions = true;
            verifyRequest2.Demo                  = true;
            verifyRequest2.CallBackUrl           = "test-callBackUrl";
            verifyRequest2.Timeout               = 1000;
            verifyRequest2.CleansedAddress       = true;
            verifyRequest2.ConfigurationName     = "test-configurationName";
            verifyRequest2.CustomerReferenceID   = "test-customerReferenceID";
            verifyRequest2.VerboseMode           = true;
            verifyRequest2.ConsentForDataSources = consentForDataSources;

            Assert.Equal(verifyRequest1.GetHashCode(), verifyRequest2.GetHashCode());
        }
예제 #13
0
        public async Task Verify_POST_Should_Redirect_To_Default_App_Url_When_User_Is_Authenticated()
        {
            var controller = BuildController(out var serviceProvider);

            controller.ControllerContext = new ControllerContext()
            {
                HttpContext = new DefaultHttpContext()
                {
                    User = new ClaimsPrincipal(new ClaimsIdentity(new Claim[]
                    {
                        new Claim(ClaimTypes.Name, "example name"),
                        new Claim(ClaimTypes.NameIdentifier, "1"),
                        new Claim("custom-claim", "example claim value"),
                    }, "mock"))
                }
            };

            var request = new VerifyRequest
            {
                Email      = "*****@*****.**",
                Token      = "token",
                Password   = "******",
                RePassword = "******"
            };

            controller.ValidateRequest(request);

            var result = await controller.Verify(request);

            result.Should().BeOfType <RedirectResult>();
            ((RedirectResult)result).Url.Should().Be("DefaultAppUrl");
        }
예제 #14
0
        /// <summary>
        /// The verification call for the Trulioo API V1
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <VerifyResult> VerifyAsync(VerifyRequest request)
        {
            var resource = new ResourceName("verify");
            var response = await _context.PostAsync <VerifyResult>(_verificationNamespace, resource, request).ConfigureAwait(false);

            return(response);
        }
예제 #15
0
        public async Task WatchlistDetailsResponseNoExceptionThrownTest_TECH9_103()
        {
            using (var client = new TruliooApiClient(new Context(_username, _password)
            {
                Host = _hostEndpoint
            }))
            {
                var request = new VerifyRequest
                {
                    AcceptTruliooTermsAndConditions = true,
                    VerboseMode       = true,
                    Demo              = false,
                    ConfigurationName = "Identity Verification",
                    CountryCode       = "DE",
                    DataFields        = new DataFields
                    {
                        PersonInfo = new PersonInfo
                        {
                            FirstGivenName = "test",
                            FirstSurName   = "test",
                            YearOfBirth    = 1980
                        }
                    }
                };

                var response = await client.Verification.VerifyAsync(request);

                Assert.NotNull(response);
            }
        }
예제 #16
0
        private VerifyRequest BuildRequest(IEnumerable <object> inputDocuments, SignatureObject signatureObject,
                                           IEnumerable <XmlElement> optionalInputs)
        {
            VerifyRequest vr = new VerifyRequest();

            ClaimedIdentity identity = new ClaimedIdentity();

            identity.Name = new NameIdentifierType()
            {
                Value = _identity.ApplicationId
            };

            List <XmlElement> optionalInputsList = new List <XmlElement>();

            optionalInputsList.Add(GetXmlElement(identity));

            foreach (var optionalInput in optionalInputs)
            {
                optionalInputsList.Add(optionalInput);
            }

            vr.OptionalInputs     = new AnyType();
            vr.OptionalInputs.Any = optionalInputsList.ToArray();

            if (inputDocuments != null)
            {
                vr.InputDocuments       = new InputDocuments();
                vr.InputDocuments.Items = inputDocuments.ToArray();
            }
            vr.SignatureObject = signatureObject;

            return(vr);
        }
예제 #17
0
        /// <summary>
        /// Calling this method will perform a verification. If your account includes address cleansing set the CleansedAddress flag to get
        /// additional address information in the result.  You can query configuration to get what fields are available to you in each country.
        /// It is also possible to get sample requests from the customer portal. If you are configured for a sandbox account make sure to call Get Test Entities to get test data for a country you want to try. Sandbox accounts only use these test entities and so trying to verify with any other data will result in no matches being found.
        /// </summary>
        /// <param name="body">Required parameter: Example: </param>
        /// <return>Returns the Models.VerifyResult response from the API call</return>
        public VerifyResult CreateVerify(VerifyRequest body)
        {
            Task <VerifyResult> t = CreateVerifyAsync(body);

            TaskHelper.RunTaskSynchronously(t);
            return(t.GetAwaiter().GetResult());
        }
예제 #18
0
        /// <inheritdoc />
        public async Task <VerifyResponse> VerifyAsync(VerifyRequest request, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrWhiteSpace(request.Secret))
            {
                if (string.IsNullOrWhiteSpace(_recaptchaOptions?.SecretKey))
                {
                    throw new SecretKeyNotSpecifiedException();
                }

                request.Secret = _recaptchaOptions.SecretKey;
            }

            if (string.IsNullOrWhiteSpace(request.Response))
            {
                throw new EmptyCaptchaAnswerException();
            }

            try
            {
                return(await _recaptchaClient.VerifyAsync(request, cancellationToken));
            }
            catch (ApiException e)
            {
                throw new HttpRequestException(e);
            }
        }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();
            VerifyRequest request;

            try
            {
                request = new VerifyRequest
                {
                    NamespaceName        = NamespaceName,
                    ScheduledTaskId      = ScheduledTaskId,
                    ShouldIncludeResults = ShouldIncludeResults,
                    OpcRequestId         = OpcRequestId,
                    OpcRetryToken        = OpcRetryToken
                };

                response = client.Verify(request).GetAwaiter().GetResult();
                WriteOutput(response, response.VerifyOutput);
                FinishProcessing(response);
            }
            catch (Exception ex)
            {
                TerminatingErrorDuringExecution(ex);
            }
        }
예제 #20
0
        /// <summary>
        /// Calling this method will perform a verification. If your account includes address cleansing set the CleansedAddress flag to get
        /// additional address information in the result.  You can query configuration to get what fields are available to you in each country.
        /// It is also possible to get sample requests from the customer portal. If you are configured for a sandbox account make sure to call Get Test Entities to get test data for a country you want to try. Sandbox accounts only use these test entities and so trying to verify with any other data will result in no matches being found.
        /// </summary>
        /// <param name="body">Required parameter: Example: </param>
        /// <return>Returns the Models.VerifyResult response from the API call</return>
        public async Task <VerifyResult> CreateVerifyAsync(VerifyRequest body)
        {
            //validating required parameters
            if (null == body)
            {
                throw new ArgumentNullException(nameof(body), "The parameter \"body\" is a required parameter and cannot be null.");
            }

            //the base uri for api requests
            var baseUri = Configuration.GetBaseURI();

            //prepare query string for API call
            var queryBuilder = new StringBuilder(baseUri);

            queryBuilder.Append("/{mode}/verifications/v1/verify");

            var parameters = new Dictionary <string, object> {
                { "mode", Configuration.Mode.ToFriendlyString() }
            };

            //process optional template parameters
            APIHelper.AppendUrlWithTemplateParameters(queryBuilder, parameters);


            //validate and preprocess url
            var queryUrl = APIHelper.CleanUrl(queryBuilder);

            //append request with appropriate headers and parameters
            var headers = new Dictionary <string, string>
            {
                { "user-agent", "Trulioo C# SDK" },
                { "accept", "application/json" },
                { "content-type", "application/json; charset=utf-8" },
                { "x-trulioo-api-key", Configuration.XTruliooApiKey }
            };

            //append body params
            var json = APIHelper.JsonSerialize(body);

            //prepare the API call request to fetch the response
            HttpRequest request = ClientInstance.PostBody(queryUrl, headers, json);

            //invoke request and get response
            var response = (HttpStringResponse)await ClientInstance.ExecuteAsStringAsync(request).ConfigureAwait(false);

            var context = new HttpContext(request, response);

            //handle errors defined at the API level
            ValidateResponse(response, context);

            try
            {
                return(APIHelper.JsonDeserialize <VerifyResult>(response.Body));
            }
            catch (Exception ex)
            {
                throw new APIException("Failed to parse the response: " + ex.Message, context);
            }
        }
예제 #21
0
        public void EqualsObjectCastTest()
        {
            bool          acceptTruliooTermsAndConditions = true;
            VerifyRequest verifyRequest = new VerifyRequest(countryCode: "test-countryCode", dataFields: new DataFields(personInfo: new PersonInfo(firstGivenName: "test-firstGivenName")), acceptTruliooTermsAndConditions: acceptTruliooTermsAndConditions);
            object        obj           = new VerifyRequest(countryCode: "test-countryCode", dataFields: new DataFields(personInfo: new PersonInfo(firstGivenName: "test-firstGivenName")), acceptTruliooTermsAndConditions: acceptTruliooTermsAndConditions);

            Assert.True(verifyRequest.Equals(obj));
        }
예제 #22
0
        /// <summary>
        ///     The verification call for the Trulioo API V1
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public async Task <VerifyResult> VerifyAsync(VerifyRequest request)
        {
            ResourceName resource = new ResourceName("verify");
            VerifyResult response = await this.Context.PostAsync <VerifyResult>(this._verificationNamespace, resource, request)
                                    .ConfigureAwait(continueOnCapturedContext: false);

            return(response);
        }
예제 #23
0
        public async Task <VerifyResponse> VerifyPayment(VerifyRequest request)
        {
            RestSharpCaller ApiCaller = new RestSharpCaller();

            ApiCaller.Paystack_SECRET_KEY = _payStackSecretKey;

            return(ApiCaller.VerifyPayment(request));
        }
예제 #24
0
        public VerifyResponse ValidateCertificate(X509Certificate2 certificate, bool includeDetails, bool returnReadableCertificateInfo)
        {
            if (certificate == null)
            {
                throw new ArgumentNullException("certificate", "El valor no puede ser nulo.");
            }

            List <XmlElement> optionalInputs = new List <XmlElement>();

            ReturnVerificationReport verificationReport = new ReturnVerificationReport();

            verificationReport.CheckOptions = new CheckOptionsType();
            verificationReport.CheckOptions.CheckCertificateStatus = true;
            verificationReport.ReportOptions = new ReportOptionsType();
            if (includeDetails)
            {
                verificationReport.ReportOptions.ReportDetailLevel = "urn:oasis:names:tc:dss:1.0:reportdetail:allDetails";
            }
            else
            {
                verificationReport.ReportOptions.ReportDetailLevel = "urn:oasis:names:tc:dss:1.0:reportdetail:noDetails";
            }

            optionalInputs.Add(GetXmlElement(verificationReport));

            if (returnReadableCertificateInfo)
            {
                optionalInputs.Add(GetXmlElement("<afxp:ReturnReadableCertificateInfo xmlns:afxp=\"urn:afirma:dss:1.0:profile:XSS:schema\"/>"));
            }

            X509DataType x509Data = new X509DataType();

            x509Data.Items            = new object[] { new X509Cert(certificate.GetRawCertData()) };
            x509Data.ItemsElementName = new ItemsChoiceType[] { ItemsChoiceType.X509Certificate };

            SignatureObject signatureObject = new SignatureObject();

            signatureObject.Item = new AnyType()
            {
                Any = new XmlElement[] { GetXmlElement(x509Data) }
            };

            VerifyRequest request = BuildRequest(null, signatureObject, optionalInputs.ToArray());

            DSSAfirmaVerifyCertificateService ds = new DSSAfirmaVerifyCertificateService(_identity, _serverCert);

            string result = ds.verify(GetXmlElement(request).OuterXml);

            VerifyResponse response = DeserializeXml <VerifyResponse>(result);

            if (!ResultType.Success.Equals(response.Result.ResultMajor))
            {
                throw new AfirmaResultException(response.Result.ResultMajor, response.Result.ResultMinor, response.Result.ResultMessage.Value);
            }

            return(response);
        }
예제 #25
0
 public async Task <IActionResult> VerifyMessage([FromBody] VerifyRequest request,
                                                 CancellationToken cancellationToken = default(CancellationToken))
 {
     return(await this.ExecuteAsAsync(request, cancellationToken, (req, token) =>
     {
         bool result =
             this.walletManager.VerifySignedMessage(request.ExternalAddress, req.Message, req.Signature);
         return this.Json(result.ToString());
     }));
 }
        public static VerifyResponse Verify(VerifyRequest request)
        {
            var jsonstring = ApiRequest.DoRequest(ApiRequest.GetBaseUriFor(typeof(NumberVerify), "/verify/json"), new Dictionary<string, string>()
            {
                {"number", request.number},
                {"brand", request.brand}
            });

            return JsonConvert.DeserializeObject<VerifyResponse>(jsonstring);
        }
예제 #27
0
        public void EqualsTest()
        {
            bool          acceptTruliooTermsAndConditions  = true;
            VerifyRequest acceptTruliooTermsAndConditions1 = new VerifyRequest(countryCode: "test-countryCode", dataFields: new DataFields(personInfo: new PersonInfo(firstGivenName: "test-firstGivenName")), acceptTruliooTermsAndConditions: acceptTruliooTermsAndConditions);

            Assert.Equal(acceptTruliooTermsAndConditions1, acceptTruliooTermsAndConditions1);
            Assert.Equal(acceptTruliooTermsAndConditions1, new VerifyRequest(countryCode: "test-countryCode", dataFields: new DataFields(personInfo: new PersonInfo(firstGivenName: "test-firstGivenName")), acceptTruliooTermsAndConditions: acceptTruliooTermsAndConditions));
            Assert.NotEqual(acceptTruliooTermsAndConditions1, new VerifyRequest(countryCode: "test-countryCode", dataFields: new DataFields(personInfo: new PersonInfo(firstGivenName: "test-firstGivenName")), acceptTruliooTermsAndConditions: !acceptTruliooTermsAndConditions));
            Assert.False(acceptTruliooTermsAndConditions1.Equals(null));
        }
예제 #28
0
        public IActionResult Verify([FromBody] string body)
        {
            JObject    obj        = JObject.Parse(body);
            PersonInfo personInfo = new PersonInfo();

            personInfo.FirstGivenName = obj["firstGivenName"].ToString();
            personInfo.MiddleName     = obj["middleName"].ToString();
            personInfo.FirstSurName   = obj["firstSurName"].ToString();
            personInfo.YearOfBirth    = (int)obj["yearOfBirth"];
            personInfo.MonthOfBirth   = (int)obj["monthOfBirth"];
            personInfo.DayOfBirth     = (int)obj["dayOfBirth"];

            Location location = new Location();

            location.BuildingNumber = obj["buildingNumber"].ToString();
            location.StreetName     = obj["streetName"].ToString();
            location.StreetType     = obj["streetType"].ToString();
            location.PostalCode     = obj["postalCode"].ToString();

            Communication communication = new Communication();

            communication.Telephone    = obj["telephone"].ToString();
            communication.EmailAddress = obj["emailAddress"].ToString();

            Passport passport = new Passport();

            passport.Number = obj["passportNumber"].ToString();

            DataFields dataFields = new DataFields();

            dataFields.PersonInfo    = personInfo;
            dataFields.Location      = location;
            dataFields.Communication = communication;
            dataFields.Passport      = passport;

            VerifyRequest verifyRequest = new VerifyRequest(countryCode: "AU", dataFields: dataFields);

            verifyRequest.AcceptTruliooTermsAndConditions = true;
            verifyRequest.CleansedAddress   = false;
            verifyRequest.ConfigurationName = ConfigurationName;

            try
            {
                VerifyResult result = new VerificationsApi(config).Verify(Mode, verifyRequest);
                return(new OkObjectResult(JsonConvert.SerializeObject(result, Formatting.Indented)));
            }
            catch (ApiException e)
            {
                return(StatusCode(e.ErrorCode, new Trulioo.SampleApp.Models.ObjectResult(
                                      errorCode: e.ErrorCode,
                                      message: e.Message,
                                      operation: "VerificationsApi#Verify"
                                      )));
            }
        }
        private async Task <SecurityErrorType> DoVerifyRequest(VerifyRequest verifyRequest)
        {
            SignatureValidationResponse validationResponse = await _payAuthClient.VerifyAsync(verifyRequest);

            if (!Enum.TryParse(validationResponse.ErrorType, out SecurityErrorType verificationResult))
            {
                throw new UnrecognizedSignatureVerificationException(validationResponse.Description);
            }

            return(verificationResult);
        }
        public async Task <bool> VerifyCertificate([FromForm] VerifyRequest request)
        {
            using (var memoryStream = new MemoryStream())
            {
                await request.File.CopyToAsync(memoryStream);

                var isValidCertificate = await _mantleKeeper.KeeperFilesExistPostAsync(FolderId, memoryStream, Accuracy);

                return(isValidCertificate ?? false);
            }
        }
예제 #31
0
        public async Task <ActionResult <VerifyResponse> > Verify([FromBody] VerifyRequest query)
        {
            await Task.Run(() => this.Fsm.Verify(query.Accesscode));

            var response = new VerifyResponse(this.State)
            {
                Phonenumber = _pnonenumber,
            };

            return(new ActionResult <VerifyResponse>(response));
        }
        private ResponseBaseType DoVerification(byte[] documentData, String mimeType,
            bool returnSignerIdentity, bool returnVerificationReport)
        {
            Console.WriteLine("Verify");

            // setup the client
            SetupClient();

            String requestId = "dss-verify-request-" + Guid.NewGuid().ToString();
            VerifyRequest verifyRequest = new VerifyRequest();
            verifyRequest.RequestID = requestId;

            AnyType optionalInputs = new AnyType();
            List<XmlElement> optionalInputElements = new List<XmlElement>();
            if (returnSignerIdentity)
            {
                XmlElement e = GetElement("dss", "ReturnSignerIdentity", DSSConstants.DSS_NAMESPACE);
                optionalInputElements.Add(e);
            }

            if (returnVerificationReport)
            {
                DSSXSDNamespace.ReturnVerificationReport returnVerificationReportElement =
                    new DSSXSDNamespace.ReturnVerificationReport();
                returnVerificationReportElement.IncludeVerifier = false;
                returnVerificationReportElement.IncludeCertificateValues = true;
                returnVerificationReportElement.ReportDetailLevel =
                    "urn:oasis:names:tc:dss-x:1.0:profiles:verificationreport:reportdetail:noDetails";

                XmlElement e = ToDom("ReturnVerificationReport", DSSConstants.VR_NAMESPACE,
                    returnVerificationReportElement, typeof(DSSXSDNamespace.ReturnVerificationReport));

                optionalInputElements.Add(e);
            }

            if (optionalInputElements.Count > 0)
            {
                optionalInputs.Any = optionalInputElements.ToArray();
                verifyRequest.OptionalInputs = optionalInputs;
            }

            verifyRequest.InputDocuments = GetInputDocuments(documentData, mimeType);

            // operate
            ResponseBaseType response = this.client.verify(verifyRequest);

            // check response
            CheckResponse(response, verifyRequest.RequestID);

            return response;
        }