Exemple #1
0
        public void NullAmlProfileShouldThrowException()
        {
            YotiClient client = CreateYotiClient();

            var aggregateException = Assert.ThrowsException <AggregateException>(() =>
            {
                client.PerformAmlCheck(amlProfile: null);
            });

            Assert.IsTrue(TestTools.Exceptions.IsExceptionInAggregateException <ArgumentNullException>(aggregateException));
        }
        public void YotiClient_PerformAmlCheck_NullAmlProfile_ThrowsException()
        {
            string sdkId            = "fake-sdk-id";
            var    privateStreamKey = GetValidKeyStream();

            YotiClient client = new YotiClient(sdkId, privateStreamKey);

            AggregateException aggregateException = Assert.ThrowsException <AggregateException>(() =>
            {
                AmlResult amlResult = client.PerformAmlCheck(amlProfile: null);
            });

            Assert.IsTrue(Exceptions.IsExceptionInAggregateException <ArgumentNullException>(aggregateException));
        }
Exemple #3
0
        public void NullAmlAddressShouldThrowException()
        {
            YotiClient client = CreateYotiClient();

            var amlProfile = new AmlProfile(
                givenNames: "Edward Richard George",
                familyName: "Heath",
                amlAddress: null);

            var aggregateException = Assert.ThrowsException <AggregateException>(() =>
            {
                client.PerformAmlCheck(amlProfile: amlProfile);
            });

            Assert.IsTrue(TestTools.Exceptions.IsExceptionInAggregateException <JsonSerializationException>(aggregateException));
        }
Exemple #4
0
        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()));
            }
        }
        public void YotiClient_PerformAmlCheck_NullFamilyName_ThrowsException()
        {
            string sdkId            = "fake-sdk-id";
            var    privateStreamKey = GetValidKeyStream();

            YotiClient client = new YotiClient(sdkId, privateStreamKey);

            AmlProfile amlProfile = new AmlProfile(
                givenNames: "Edward Richard George",
                familyName: null,
                amlAddress: TestTools.Aml.CreateStandardAmlAddress());

            AggregateException aggregateException = Assert.ThrowsException <AggregateException>(() =>
            {
                AmlResult amlResult = client.PerformAmlCheck(amlProfile: amlProfile);
            });

            Assert.IsTrue(Exceptions.IsExceptionInAggregateException <JsonSerializationException>(aggregateException));
        }