예제 #1
0
        /*
         * Get the questions set from Blockscore
         */
        private void HandleQuestionSet(BlockScoreResponse verifyUsResult, BlockscoreAPI blockscore)
        {
            if (!string.IsNullOrEmpty(verifyUsResult.id))
            {
                lblquestionrequest.Text = "verification_id = " + verifyUsResult.id.ToString();

                BlockScoreQuestionsResponse questionSet = GetQuestionSet(blockscore);

                lblquestionresponse.Text = GetblockscoreQuestionsResponseoutput(questionSet);

                CheckAnswers(blockscore, questionSet);
            }
        }
예제 #2
0
        /*
         * Verify US ID
         */
        private static BlockScoreResponse VerifyUs(BlockscoreAPI blockscore,
                                                   BlockScoreVerifyDomesticRequest blockScoreVerifyInternationlRequest)
        {
            BlockScoreResponse verifyUsResult = null;

            try
            {
                verifyUsResult = blockscore.VerifyUs(blockScoreVerifyInternationlRequest);
            }
            catch (Exception e)
            {
                throw new Exception("Caught exception: " + e.Message + "\n");
            }
            return(verifyUsResult);
        }
예제 #3
0
        /*
         * Ouput Blockscore Response object to a string
         */
        private string GetblockscoreResponseoutput(BlockScoreResponse blockscoreresponse)
        {
            string strreturn = "";

            strreturn += "<br/>id = " + blockscoreresponse.id;
            strreturn += "<br/>verification_id = " + blockscoreresponse.verification_id;
            strreturn += "<br/>question_set_id = " + blockscoreresponse.question_set_id;
            if (blockscoreresponse.error != null)
            {
                strreturn += "<br/>error_code = " + blockscoreresponse.error.code;
                strreturn += "<br/>error_message = " + blockscoreresponse.error.message;
                strreturn += "<br/>error_type = " + blockscoreresponse.error.type;
            }

            return(strreturn);
        }
예제 #4
0
        /*
         * Ouput Blockscore Questions Request object to a string
         */
        private string GetblockscoreQuestionsRequestoutput(BlockScoreResponse questionset, List <BlockScoreAnswer> answerlist)
        {
            string strreturn = "";

            strreturn += "verification_id = " + questionset.verification_id;
            strreturn += "<br/>question_set_id = " + questionset.question_set_id;
            strreturn += "<br/>answers : ";

            foreach (BlockScoreAnswer tempanswer in answerlist)
            {
                strreturn += "<div class='Tab1'>";
                strreturn += "<br/> answer_id = " + tempanswer.answer_id;
                strreturn += "<br/> question_id = " + tempanswer.question_id;
                strreturn += "</div>";
            }


            return(strreturn);
        }
예제 #5
0
        public void VerifyInternational()
        {
            //Instantiate new BlockscoreAPI object
            BlockscoreAPI blockscore = new BlockscoreAPI();

            //Prepare a request for an International ID.  For this example sample values are entered
            BlockScoreVerifyInternationalRequest blockScoreInternationlRequest = GetBlockScoreInternationalRequest();

            //Call Blockscore /verifications and return results
            BlockScoreResponse verifyInternationalResult = VerifyInternational(blockscore, blockScoreInternationlRequest);

            //Output the request and response values
            lblverificationrequest.Text  = GetblockscoreInternationalRequestoutput(blockScoreInternationlRequest);
            lblverificationresponse.Text = GetblockscoreResponseoutput(verifyInternationalResult);

            //Hide the Questions panel as there are no questions for international IDs
            pnlquestions.Visible = false;
            //Display the verifications panel
            pnlverifications.Visible = true;
        }
예제 #6
0
        /*
         * Verify the Answers with Blockscore
         */
        private void CheckAnswers(BlockscoreAPI blockscore, BlockScoreResponse questionSet)
        {
            if (!string.IsNullOrEmpty(questionSet.question_set_id))
            {
                try
                {
                    var random = new Random();

                    List <BlockScoreAnswer> answerlist = new List <BlockScoreAnswer>
                    {
                        new BlockScoreAnswer {
                            question_id = "1", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                        new BlockScoreAnswer {
                            question_id = "2", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                        new BlockScoreAnswer {
                            question_id = "3", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                        new BlockScoreAnswer {
                            question_id = "4", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                        new BlockScoreAnswer {
                            question_id = "5", answer_id = random.Next(1, 5).ToString(CultureInfo.InvariantCulture)
                        },
                    };

                    lblquestionscorerequest.Text = GetblockscoreQuestionsRequestoutput(questionSet, answerlist);

                    BlockScoreQuestionsScoreResponse blockscorequestionscoreresponse = blockscore.CheckQuestionAnswers(answerlist);

                    lblquestionscoreresponse.Text = GetblockscoreQuestionsScoreResponseoutput(blockscorequestionscoreresponse);
                }
                catch (Exception e)
                {
                    throw new Exception("Caught exception: " + e.Message + "\n");
                }
            }
        }
예제 #7
0
        public void VerifyUs()
        {
            //Instantiate new BlockscoreAPI object
            BlockscoreAPI blockscore = new BlockscoreAPI();

            //Prepare a request for a Domestic ID.  For this example sample values are entered
            BlockScoreVerifyDomesticRequest blockScoreDomesticRequest = GetBlockScoreDomesticRequest();

            //Call Blockscore /verifications and return results
            BlockScoreResponse verifyUsResult = VerifyUs(blockscore, blockScoreDomesticRequest);

            //Output the request and response values
            lblverificationrequest.Text  = GetblockscoreDomesticRequestoutput(blockScoreDomesticRequest);
            lblverificationresponse.Text = GetblockscoreResponseoutput(verifyUsResult);

            //Display the Questions panel as there are questions for US IDs
            pnlquestions.Visible = true;
            //Display the verifications panel
            pnlverifications.Visible = true;

            // Question Set Retrieval
            HandleQuestionSet(verifyUsResult, blockscore);
        }