/// <summary>
        /// Retrieves response for the input records request.
        /// Accepts the city and state province records request as input and returns postal codes.
        /// </summary>
        /// <param name="request">Required - GetPostalCodesAPIRequest request (object filled with input and option) </param>
        /// <returns>GetPostalCodesAPIResponse</returns>
        public GetPostalCodesAPIResponse GetPostalCodes(GetPostalCodesAPIRequest request)
        {
            UrlMaker      urlMaker   = UrlMaker.getInstance();
            StringBuilder urlBuilder = new StringBuilder(urlMaker.getAbsoluteUrl(identifyAddressUrl));
            string        url        = urlBuilder.ToString() + getPostalCodesUrl;

            String requestString = Utility.ObjectToJson <GetPostalCodesAPIRequest>(request);

            return(Utility.processAPIRequest <GetPostalCodesAPIResponse>(url, requestString));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Matches the input record request.
        /// Accepts the record request as input and returns matched records
        /// </summary>
        /// <param name="request">Required - ValidateEmailAddressAPIRequest request (object filled with input and option) </param>
        /// <returns>ValidateEmailAddressAPIResponse</returns>
        public ValidateEmailAddressAPIResponse ValidateEmailAddress(ValidateEmailAddressAPIRequest request)
        {
            UrlMaker      urlMaker   = UrlMaker.getInstance();
            StringBuilder urlBuilder = new StringBuilder(urlMaker.getAbsoluteUrl(IdentifyEmailUrl));
            string        url        = urlBuilder.ToString() + ValidateEmailAddressUrl;

            String requestString = Utility.ObjectToJson <ValidateEmailAddressAPIRequest>(request);

            return(Utility.processAPIRequest <ValidateEmailAddressAPIResponse>(url, requestString));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Matches the input record request.
        /// Accepts the record request as input and returns matched records
        /// </summary>
        /// <param name="request">Required - ExtractEntitiesAPIRequest request (object filled with input and option) </param>
        /// <returns>ExtractEntitiesAPIResponse</returns>
        public ExtractEntitiesAPIResponse ExtractEntities(ExtractEntitiesAPIRequest request)
        {
            UrlMaker      urlMaker   = UrlMaker.getInstance();
            StringBuilder urlBuilder = new StringBuilder(urlMaker.getAbsoluteUrl(IdentifyExtractUrl));
            string        url        = urlBuilder.ToString() + ExtractEntitiesUrl;

            String requestString = Utility.ObjectToJson <ExtractEntitiesAPIRequest>(request);

            return(Utility.processAPIRequest <ExtractEntitiesAPIResponse>(url, requestString));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Matches the input record request in asynchronous mode.
        /// Response can be retrieved by subscribing to event ValidateEmailAddressFinishedEvent.
        /// Accepts the record request as input and returns matched records
        /// </summary>
        /// <param name="request">Required - ValidateEmailAddressAPIRequest request (object filled with input and option) </param>
        public void ValidateEmailAddressAsync(ValidateEmailAddressAPIRequest request)
        {
            UrlMaker      urlMaker   = UrlMaker.getInstance();
            StringBuilder urlBuilder = new StringBuilder(urlMaker.getAbsoluteUrl(IdentifyEmailUrl));
            string        url        = urlBuilder.ToString() + ValidateEmailAddressUrl;

            String requestString = Utility.ObjectToJson <ValidateEmailAddressAPIRequest>(request);
            processAPIRequestDelegate <ValidateEmailAddressAPIResponse> delegateApiRequest = new processAPIRequestDelegate <ValidateEmailAddressAPIResponse>(Utility.processAPIRequest <ValidateEmailAddressAPIResponse>);

            delegateApiRequest.BeginInvoke(url, requestString, new AsyncCallback(WorkflowCompletedCallbackValidateEmailAddress), null);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Matches the input record request in asynchronous mode.
        /// Response can be retrieved by subscribing to event IdentifyAPIRequestFinishedEvent.
        /// Accepts the record request as input and returns matched records
        /// </summary>
        /// <param name="request">Required - CheckGlobalWatchListAPIRequest request (object filled with input and option) </param>
        public void CheckGlobalWatchListAsync(CheckGlobalWatchListAPIRequest request)
        {
            UrlMaker      urlMaker   = UrlMaker.getInstance();
            StringBuilder urlBuilder = new StringBuilder(urlMaker.getAbsoluteUrl(identifyRiskUrl));
            string        url        = urlBuilder.ToString() + checkGlobalWatchListUrl;

            String requestString = Utility.ObjectToJson <CheckGlobalWatchListAPIRequest>(request);
            processAPIRequestDelegate <CheckGlobalWatchListAPIResponse> delegateApiRequest = new processAPIRequestDelegate <CheckGlobalWatchListAPIResponse>(Utility.processAPIRequest <CheckGlobalWatchListAPIResponse>);

            delegateApiRequest.BeginInvoke(url, requestString, new AsyncCallback(WorkflowCompletedCallbackCheckGlobalWatchList), null);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Matches the input record request.
        /// Accepts the record request as input and returns matched records
        /// </summary>
        /// <param name="request">Required - CheckGlobalWatchListAPIRequest request (object filled with input and option) </param>
        /// <returns>CheckGlobalWatchListAPIResponse</returns>
        public CheckGlobalWatchListAPIResponse CheckGlobalWatchList(CheckGlobalWatchListAPIRequest request)
        {
            UrlMaker      urlMaker   = UrlMaker.getInstance();
            StringBuilder urlBuilder = new StringBuilder(urlMaker.getAbsoluteUrl(identifyRiskUrl));
            string        url        = urlBuilder.ToString() + checkGlobalWatchListUrl;


            String requestString = Utility.ObjectToJson <CheckGlobalWatchListAPIRequest>(request);

            return(Utility.processAPIRequest <CheckGlobalWatchListAPIResponse>(url, requestString));
        }
        /// <summary>
        /// Retrieves response for the input records request in asynchronous mode.
        /// Response can be retrieved by subscribing to event GetCityStateProvinceFinishedEvent.
        /// Accepts the postal code records request as input and returns city and state province
        /// </summary>
        /// <param name="request">Required - GetCityStateProvinceAPIRequest request (object filled with input and option) </param>
        public void GetCityStateProvinceAsync(GetCityStateProvinceAPIRequest request)
        {
            UrlMaker      urlMaker   = UrlMaker.getInstance();
            StringBuilder urlBuilder = new StringBuilder(urlMaker.getAbsoluteUrl(identifyAddressUrl));
            string        url        = urlBuilder.ToString() + getCityStateProvinceUrl;

            String requestString = Utility.ObjectToJson <GetCityStateProvinceAPIRequest>(request);
            processAPIRequestDelegate <GetCityStateProvinceAPIResponse> delegateApiRequest = new processAPIRequestDelegate <GetCityStateProvinceAPIResponse>(Utility.processAPIRequest <GetCityStateProvinceAPIResponse>);

            delegateApiRequest.BeginInvoke(url, requestString, new AsyncCallback(WorkflowCompletedCallbackGetCityStateProvince), null);
        }
Ejemplo n.º 8
0
        public BasicAuthServiceImpl(String token, String url)
        {
            authToken = token;

            if (url.Equals(""))
            {
                UrlMaker.getInstance().setUrlStrategy(new UrlMaker.UrlStrategy());
            }
            else
            {
                UrlMaker.getInstance().setUrlStrategy(new UrlStrategyTest(url));
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets the authentication token.
        /// </summary>
        /// <returns></returns>
        public override String getAuthenticationToken()
        {
            String authToken = getToken();
            JavaScriptSerializer serializer = new JavaScriptSerializer();

            Debug.WriteLine("It seems token is not generated yet, Going for OAuth mechanism");
            // Token is not generated yet
            if (authToken == null && tokenRegeneration)
            {
                try{
                    UrlMaker maker = UrlMaker.getInstance();
                    String   url   = maker.getAbsoluteUrl(oAuthUrl);

                    String authHeader = Constants.BASIC + Convert.ToBase64String(Encoding.UTF8.GetBytes(consumerKey + ":" + consumerSecretKey));
                    Uri    uri        = new Uri(url);

                    using (ExtendedWebClient webClient = new ExtendedWebClient())
                    {
                        NameValueCollection headers = new NameValueCollection();

                        headers.Add(Constants.AUTH_HEADER, authHeader);
                        webClient.Headers.Add(headers);

                        string jsonResponse = webClient.UploadString(url, Constants.GRANT_TYPE + "=" + Constants.CLIENT_CREDENTIALS);

                        OAuthServiceResponse oAuthServiceResponse = serializer.Deserialize <OAuthServiceResponse>(jsonResponse);
                        authToken = Constants.BEARER + oAuthServiceResponse.access_token;
                    }
                }

                catch (Exception e) {
                    Debug.WriteLine("Unexpected Exception while generating token, so Invalidating the Authentication Token" + e);
                    invalidateIdentifyServiceManagerInstance();
                    throw new SdkException(new SdkInternalError(e.Message));
                }
            }

            return(authToken);
        }