コード例 #1
0
        static SBSDKUIWorkflow DisabilityCertificate()
        {
            SBSDKAspectRatio[] ratios =
            {
                new SBSDKAspectRatio(1.0,    1.4143),
                new SBSDKAspectRatio(1.4143,    1.0),
                new SBSDKAspectRatio(1.0, 1.5715)
            };

            SBSDKUIWorkflowStep certificate = new SBSDKUIScanDisabilityCertificateWorkflowStep(
                "Disability Certificate 1/1",
                "Please scan your disability certificate.",
                ratios,
                true,
                (result) =>
            {
                SBSDKDisabilityCertificatesRecognizerResult dc = result.DisabilityCertificateResult;
                if (dc == null || !dc.RecognitionSuccessful)
                {
                    return(WorkflowError.ErrorWithCode(6, new NSString("This does not seem to be a valid certificate.")));
                }
                return(null);
            }
                );


            SBSDKUIWorkflow workflow = new SBSDKUIWorkflow(new SBSDKUIWorkflowStep[] { certificate }, "Disability Certificate", null);

            return(workflow);
        }
コード例 #2
0
        static SBSDKUIWorkflow GermanIDCard()
        {
            SBSDKAspectRatio[] ratios = { new SBSDKAspectRatio(1.0, 0.6353) };

            SBSDKUIWorkflowStep frontSide = new SBSDKUIScanMachineReadableZoneWorkflowStep(
                "German ID card 1/2",
                "Please scan the front of your id card.",
                ratios,
                true,
                (result) =>
            {
                SBSDKMachineReadableZoneRecognizerResult mrz = result.MrzResult;
                if (mrz != null && mrz.RecognitionSuccessful)
                {
                    return(WorkflowError.ErrorWithCode(1, new NSString("This does not seem to be the front side.")));
                }
                return(null);
            }
                );


            SBSDKUIWorkflowStep backSide = new SBSDKUIScanMachineReadableZoneWorkflowStep(
                "German ID card 2/2",
                "Please scan the back of your id card.",
                ratios,
                true,
                (result) =>
            {
                SBSDKMachineReadableZoneRecognizerResult mrz = result.MrzResult;
                if (mrz == null || !mrz.RecognitionSuccessful)
                {
                    return(WorkflowError.ErrorWithCode(2, new NSString("This does not seem to be the back side.")));
                }

                if (mrz.DocumentType != SBSDKMachineReadableZoneRecognizerResultDocumentType.IDCard)
                {
                    return(WorkflowError.ErrorWithCode(3, new NSString("This does not seem to be an ID card.")));
                }

                if (mrz.DocumentCodeField.Value.Length != 9 || !(mrz.IssuingStateOrOrganizationField.Value != "D"))
                {
                    return(WorkflowError.ErrorWithCode(4, new NSString("This does not seem to be an ID card.")));
                }

                return(null);
            }
                );

            SBSDKUIWorkflow workflow = new SBSDKUIWorkflow(new SBSDKUIWorkflowStep[] { frontSide, backSide }, "German ID card", null);

            return(workflow);
        }
コード例 #3
0
        static SBSDKUIWorkflow Payform()
        {
            SBSDKUIWorkflowStep payform = new SBSDKUIScanPayFormWorkflowStep(
                "Payform 1/1",
                "Please scan your SEPA payform.",
                false,
                (result) =>
            {
                SBSDKPayFormRecognitionResult payformResult = result.PayformResult;
                if (payformResult == null || payformResult.RecognizedFields.Length == 0)
                {
                    return(WorkflowError.ErrorWithCode(5, new NSString("No payform data detected.")));
                }
                return(null);
            }
                );


            SBSDKUIWorkflow workflow = new SBSDKUIWorkflow(new SBSDKUIWorkflowStep[] { payform }, "Payform", null);

            return(workflow);
        }
コード例 #4
0
        static SBSDKUIWorkflow UkrainianPassport()
        {
            SBSDKUIWorkflowStep frontSide = new SBSDKUIWorkflowStep(
                "Ukrainian passport 1/1",
                "Please scan the front of your id card.",
                null,
                true,
                false,
                null,
                (result) =>
            {
                SBSDKMachineReadableZoneRecognizer recognizer = new SBSDKMachineReadableZoneRecognizer();
                SBSDKMachineReadableZoneRecognizerResult mrz  = recognizer.RecognizePersonalIdentityFromImage(result.CapturedPage.DocumentImage);

                if (mrz == null || !mrz.RecognitionSuccessful)
                {
                    return(WorkflowError.ErrorWithCode(2, new NSString("This does not seem to be the correct page.")));
                }

                if (mrz.DocumentType != SBSDKMachineReadableZoneRecognizerResultDocumentType.Passport)
                {
                    return(WorkflowError.ErrorWithCode(3, new NSString("This does not seem to be a passport.")));
                }

                if (mrz.DocumentCodeField.Value.Length != 8 || !(mrz.IssuingStateOrOrganizationField.Value != "UKR"))
                {
                    return(WorkflowError.ErrorWithCode(4, new NSString("This does not seem to be a ukrainian passport.")));
                }

                return(null);
            }
                );


            SBSDKUIWorkflow workflow = new SBSDKUIWorkflow(new SBSDKUIWorkflowStep[] { frontSide }, "Ukrainian passport", null);

            return(workflow);
        }