コード例 #1
0
        public async Task YotiClientEngine_PerformAmlCheckAsync()
        {
            var    keyPair = GetKeyPair();
            string sdkId   = "fake-sdk-id";

            FakeHttpRequester httpRequester = new FakeHttpRequester((httpClient, httpMethod, uri, headers, byteContent) =>
            {
                return(Task.FromResult(new Response
                {
                    Success = true,
                    StatusCode = 200,
                    Content = "{\"on_fraud_list\":true,\"on_pep_list\":false,\"on_watch_list\":false}"
                }));
            });

            YotiClientEngine engine     = new YotiClientEngine(httpRequester);
            AmlProfile       amlProfile = TestTools.Aml.CreateStandardAmlProfile();

            AmlResult amlResult = await engine.PerformAmlCheckAsync(sdkId, keyPair, YotiConstants.DefaultYotiApiUrl, amlProfile);

            Assert.IsNotNull(amlResult);
            Assert.IsTrue(amlResult.IsOnFraudList());
            Assert.IsFalse(amlResult.IsOnPepList());
            Assert.IsFalse(amlResult.IsOnWatchList());
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: getyoti/yoti-dotnet-sdk
        private static void Main()
        {
            Console.WriteLine("Yoti AML Example");

            CheckForEnvPresence();

            string sdkId = Environment.GetEnvironmentVariable("YOTI_CLIENT_SDK_ID");

            Console.WriteLine(string.Format("sdkId='{0}'", sdkId));

            string yotiKeyFilePath = Environment.GetEnvironmentVariable("YOTI_KEY_FILE_PATH");

            Console.WriteLine(
                string.Format(
                    "yotiKeyFilePath='{0}'",
                    yotiKeyFilePath));

            using (StreamReader privateKeyStream = File.OpenText(yotiKeyFilePath))
            {
                var yotiClient = new YotiClient(sdkId, privateKeyStream);

                AmlProfile amlProfile;
                if (DotNetEnv.Env.GetBool("USA_EXAMPLE", fallback: false))
                {
                    amlProfile = CreateUsaProfile();
                }
                else
                {
                    amlProfile = CreateGbrProfile();
                }

                AmlResult amlResult = yotiClient.PerformAmlCheck(amlProfile);

                Console.WriteLine(string.Format(
                                      "{0}{0}Completing check for AML profile: '{1}'",
                                      Environment.NewLine,
                                      JsonConvert.SerializeObject(amlProfile, Formatting.Indented)));

                Console.WriteLine(string.Format(
                                      "{0}{0}Result:",
                                      Environment.NewLine));
                Console.WriteLine(string.Format("Is on PEP list: {0}", amlResult.IsOnPepList()));
                Console.WriteLine(string.Format("Is on Fraud list: {0}", amlResult.IsOnFraudList()));
                Console.WriteLine(string.Format("Is on Watch list: {0}", amlResult.IsOnWatchList()));
            }
        }
コード例 #3
0
        public async Task PerformAmlCheckAsyncShouldReturnCorrectValues()
        {
            Mock <HttpMessageHandler> handlerMock = SetupMockMessageHandler(
                HttpStatusCode.OK,
                "{\"on_fraud_list\":true,\"on_pep_list\":false,\"on_watch_list\":false}");

            var engine = new YotiClientEngine(new HttpClient(handlerMock.Object));

            AmlProfile amlProfile = TestTools.Aml.CreateStandardAmlProfile();

            AmlResult amlResult = await engine.PerformAmlCheckAsync(
                SdkId, _keyPair,
                new Uri(Constants.Api.DefaultYotiApiUrl),
                amlProfile);

            Assert.IsNotNull(amlResult);
            Assert.IsTrue(amlResult.IsOnFraudList());
            Assert.IsFalse(amlResult.IsOnPepList());
            Assert.IsFalse(amlResult.IsOnWatchList());
        }