예제 #1
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;
        }
예제 #2
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);
        }
예제 #3
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);
            }
        }
예제 #4
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");
                }
            }
        }
예제 #5
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;
 }
예제 #6
0
 /*
 * Verify International ID
 */
 private static BlockScoreResponse VerifyInternational(BlockscoreAPI blockscore, BlockScoreVerifyInternationalRequest blockScoreVerifyInternationlRequest)
 {
     BlockScoreResponse verifyIntlResult;
     try
     {
         verifyIntlResult = blockscore.VerifyIntl(blockScoreVerifyInternationlRequest);
     }
     catch (Exception e)
     {
         throw new Exception("Caught exception:" + e.Message);
     }
     return verifyIntlResult;
 }
예제 #7
0
 /*
 * Get the questions set from Blockscore
 */
 private static BlockScoreQuestionsResponse GetQuestionSet(BlockscoreAPI blockscore)
 {
     BlockScoreQuestionsResponse questionSet;
     try
     {
         questionSet = blockscore.QuestionSet();
     }
     catch (Exception e)
     {
         throw new Exception("Caught exception: " + e.Message + "\n");
     }
     return questionSet;
 }