Beispiel #1
0
        public void Test_Users_CreateKycPageFromBytes()
        {
            try
            {
                UserNaturalDTO john        = this.GetJohn();
                KycDocumentDTO kycDocument = this.GetNewKycDocument();

                string   workingDirectory = Environment.CurrentDirectory;
                FileInfo assemblyFileInfo = new FileInfo(workingDirectory);
                FileInfo fi    = assemblyFileInfo.Directory.GetFiles("TestKycPageFile.png", SearchOption.AllDirectories).Single();
                byte[]   bytes = File.ReadAllBytes(fi.FullName);
                Api.Users.CreateKycPage(john.Id, kycDocument.Id, bytes);
                Api.Users.CreateKycPage(john.Id, kycDocument.Id, bytes);

                var result = Api.Kyc.GetDocumentConsultations(kycDocument.Id);

                Assert.AreEqual(2, result.Count);
                Assert.IsInstanceOf <DateTime>(result.First().ExpirationDate);
                Assert.IsInstanceOf <String>(result.First().Url);
                Assert.IsNotEmpty(result.First().Url);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #2
0
        public async Task Test_Users_SaveKycDocument()
        {
            try
            {
                UserNaturalDTO john = await this.GetJohn();

                KycDocumentDTO kycDocument = await this.GetJohnsKycDocument();

                Assembly assembly         = Assembly.GetExecutingAssembly();
                FileInfo assemblyFileInfo = new FileInfo(assembly.Location);
                FileInfo fi = assemblyFileInfo.Directory.GetFiles("TestKycPageFile.png").Single();

                await this.Api.Users.CreateKycPage(john.Id, kycDocument.Id, fi.FullName);

                KycDocumentPutDTO kycDocumentPut = new KycDocumentPutDTO
                {
                    Status = KycStatus.VALIDATION_ASKED
                };

                KycDocumentDTO result = await this.Api.Users.UpdateKycDocument(john.Id, kycDocumentPut, kycDocument.Id);

                Assert.IsNotNull(result);
                Assert.IsTrue(kycDocument.Type == result.Type);
                Assert.IsTrue(result.Status == KycStatus.VALIDATION_ASKED);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_SaveKycDocument()
        {
            try
            {
                UserNaturalDTO john        = this.GetJohn();
                KycDocumentDTO kycDocument = this.GetJohnsKycDocument();

                string   workingDirectory = Environment.CurrentDirectory;
                FileInfo assemblyFileInfo = new FileInfo(workingDirectory);
                FileInfo fi = assemblyFileInfo.Directory.GetFiles("TestKycPageFile.png", SearchOption.AllDirectories).Single();

                this.Api.Users.CreateKycPage(john.Id, kycDocument.Id, fi.FullName);

                KycDocumentPutDTO kycDocumentPut = new KycDocumentPutDTO
                {
                    Status = KycStatus.VALIDATION_ASKED
                };

                KycDocumentDTO result = this.Api.Users.UpdateKycDocument(john.Id, kycDocumentPut, kycDocument.Id);

                Assert.IsNotNull(result);
                Assert.IsTrue(kycDocument.Type == result.Type);
                Assert.IsTrue(result.Status == KycStatus.VALIDATION_ASKED);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #4
0
        public async Task Test_Users_CreateKycPageFromBytes()
        {
            try
            {
                UserNaturalDTO john = await this.GetJohn();

                KycDocumentDTO kycDocument = await this.GetNewKycDocument();

                Assembly assembly         = Assembly.GetExecutingAssembly();
                FileInfo assemblyFileInfo = new FileInfo(assembly.Location);
                FileInfo fi    = assemblyFileInfo.Directory.GetFiles("TestKycPageFile.png").Single();
                byte[]   bytes = File.ReadAllBytes(fi.FullName);
                await Api.Users.CreateKycPage(john.Id, kycDocument.Id, bytes);

                await Api.Users.CreateKycPage(john.Id, kycDocument.Id, bytes);

                var result = await Api.Kyc.GetDocumentConsultations(kycDocument.Id);

                Assert.AreEqual(2, result.Count);
                Assert.IsInstanceOf <DateTime>(result.First().ExpirationDate);
                Assert.IsInstanceOf <String>(result.First().Url);
                Assert.IsNotEmpty(result.First().Url);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #5
0
        protected async Task <KycDocumentDTO> GetJohnsKycDocument()
        {
            if (BaseTest._johnsKycDocument == null)
            {
                String johnsId = this.GetJohn().Result.Id;

                BaseTest._johnsKycDocument = await this.Api.Users.CreateKycDocument(johnsId, KycDocumentType.IDENTITY_PROOF);
            }

            return(BaseTest._johnsKycDocument);
        }
Beispiel #6
0
        protected KycDocumentDTO GetJohnsKycDocument()
        {
            if (BaseTest._johnsKycDocument == null)
            {
                String johnsId = this.GetJohn().Id;

                BaseTest._johnsKycDocument = this.Api.Users.CreateKycDocument(johnsId, KycDocumentType.IDENTITY_PROOF);
            }

            return(BaseTest._johnsKycDocument);
        }
        public void Test_Users_CreateKycPageFromFile()
        {
            try
            {
                UserNaturalDTO john        = this.GetJohn();
                KycDocumentDTO kycDocument = this.GetNewKycDocument();

                String filePath = "TestKycPageFile.png";
                this.Api.Users.CreateKycPage(john.Id, kycDocument.Id, filePath);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #8
0
        public async Task Test_Users_CreateKycDocument()
        {
            try
            {
                KycDocumentDTO kycDocument = await this.GetJohnsKycDocument();

                Assert.IsNotNull(kycDocument);
                Assert.IsTrue(kycDocument.Id.Length > 0);
                Assert.IsTrue(kycDocument.Status == KycStatus.CREATED);
                Assert.IsTrue(kycDocument.Type == KycDocumentType.IDENTITY_PROOF);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_CreateKycDocument()
        {
            try
            {
                KycDocumentDTO kycDocument = TestHelper.GetJohnsKycDocument();

                Assert.NotNull(kycDocument);
                Assert.True(kycDocument.Id.Length > 0);
                Assert.True(kycDocument.Status == KycStatus.CREATED);
                Assert.True(kycDocument.Type == KycDocumentType.IDENTITY_PROOF);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
Beispiel #10
0
        public void Test_GetKycDocument()
        {
            try
            {
                KycDocumentDTO kycDocument = this.GetJohnsKycDocument();
                KycDocumentDTO result      = this.Api.Kyc.Get(kycDocument.Id);

                Assert.IsNotNull(result);
                Assert.IsTrue(result.Id.Equals(kycDocument.Id));
                Assert.IsTrue(result.Status == kycDocument.Status);
                Assert.IsTrue(result.Type == kycDocument.Type);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #11
0
        public async Task Test_Users_CreateKycPageFromFile()
        {
            try
            {
                UserNaturalDTO john = await this.GetJohn();

                KycDocumentDTO kycDocument = await this.GetNewKycDocument();

                var assembly = Assembly.GetExecutingAssembly();
                var fi       = this.GetFileInfoOfFile(assembly.Location);

                await this.Api.Users.CreateKycPageAsync(john.Id, kycDocument.Id, fi.FullName);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public async Task Test_Users_CreateKycPageFromFile()
        {
            try
            {
                UserNaturalDTO john        = TestHelper.GetJohn();
                KycDocumentDTO kycDocument = TestHelper.GetNewKycDocument();

                Assembly assembly         = Assembly.GetExecutingAssembly();
                FileInfo assemblyFileInfo = new FileInfo(assembly.Location);
                FileInfo fi = assemblyFileInfo.Directory.GetFiles("TestKycPageFile.png").Single();

                await _objectToTest.CreateKycPage(john.Id, kycDocument.Id, fi.FullName);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
        public void Test_Users_CreateKycPageFromFile()
        {
            try
            {
                UserNaturalDTO john        = this.GetJohn();
                KycDocumentDTO kycDocument = this.GetNewKycDocument();

                string   workingDirectory = Environment.CurrentDirectory;
                FileInfo assemblyFileInfo = new FileInfo(workingDirectory);
                FileInfo fi = assemblyFileInfo.Directory.GetFiles("TestKycPageFile.png", SearchOption.AllDirectories).Single();

                this.Api.Users.CreateKycPage(john.Id, kycDocument.Id, fi.FullName);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #14
0
        public void Test_Users_CreateKycPageFromFile()
        {
            try
            {
                UserNaturalDTO john        = this.GetJohn();
                KycDocumentDTO kycDocument = this.GetNewKycDocument();

                Assembly assembly         = Assembly.GetExecutingAssembly();
                FileInfo assemblyFileInfo = new FileInfo(assembly.Location);
                FileInfo fi = assemblyFileInfo.Directory.GetFiles("TestKycPageFile.png").Single();

                this.Api.Users.CreateKycPage(john.Id, kycDocument.Id, fi.FullName);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #15
0
        public async Task Test_Users_GetKycDocuments()
        {
            ListPaginated <KycDocumentDTO> result = null;

            UserNaturalDTO john = await this.GetJohn();

            KycDocumentDTO kycDocument = await this.GetJohnsKycDocument();

            try
            {
                result = await this.Api.Users.GetKycDocuments(john.Id, null, null);

                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);


                // test sorting
                await GetNewKycDocument();

                result = null;
                ListPaginated <KycDocumentDTO> result2 = null;

                Pagination pagination = new Pagination(1, 2);
                Sort       sort       = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = await this.Api.Users.GetKycDocuments(john.Id, pagination, null, sort);

                Assert.IsNotNull(result);
                Assert.IsTrue(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = await this.Api.Users.GetKycDocuments(john.Id, pagination, null, sort);

                Assert.IsNotNull(result2);
                Assert.IsTrue(result2.Count > 0);

                Assert.IsTrue(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_GetKycDocument()
        {
            try
            {
                UserNaturalDTO john        = TestHelper.GetJohn();
                KycDocumentDTO kycDocument = TestHelper.GetJohnsKycDocument();

                KycDocumentDTO result = _objectToTest.GetKycDocument(john.Id, kycDocument.Id).Result;

                Assert.NotNull(result);
                Assert.True(kycDocument.Id == (result.Id));
                Assert.True(kycDocument.Type == (result.Type));
                Assert.True(kycDocument.CreationDate == result.CreationDate);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
        public void Test_Users_GetKycDocument()
        {
            try
            {
                UserNaturalDTO john        = this.GetJohn();
                KycDocumentDTO kycDocument = this.GetJohnsKycDocument();

                KycDocumentDTO result = this.Api.Users.GetKycDocument(john.Id, kycDocument.Id);

                Assert.IsNotNull(result);
                Assert.IsTrue(kycDocument.Id == (result.Id));
                Assert.IsTrue(kycDocument.Type == (result.Type));
                Assert.IsTrue(kycDocument.CreationDate == result.CreationDate);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #18
0
        public async Task Test_Users_CreateKycPageFromBytes()
        {
            try
            {
                UserNaturalDTO john = await this.GetJohn();

                KycDocumentDTO kycDocument = await this.GetNewKycDocument();

                Assembly assembly         = Assembly.GetExecutingAssembly();
                FileInfo assemblyFileInfo = new FileInfo(assembly.Location);
                FileInfo fi    = assemblyFileInfo.Directory.GetFiles("TestKycPageFile.png").Single();
                byte[]   bytes = File.ReadAllBytes(fi.FullName);

                await this.Api.Users.CreateKycPage(john.Id, kycDocument.Id, bytes);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
        public void Test_Users_GetKycDocuments()
        {
            ListPaginated <KycDocumentDTO> result = null;

            UserNaturalDTO john        = TestHelper.GetJohn();
            KycDocumentDTO kycDocument = TestHelper.GetJohnsKycDocument();

            try
            {
                result = _objectToTest.GetKycDocuments(john.Id, null, null).Result;

                Assert.NotNull(result);
                Assert.True(result.Count > 0);


                // test sorting
                TestHelper.GetNewKycDocument();
                result = null;
                ListPaginated <KycDocumentDTO> result2 = null;

                Pagination pagination = new Pagination(1, 2);
                Sort       sort       = new Sort();
                sort.AddField("CreationDate", SortDirection.asc);
                result = _objectToTest.GetKycDocuments(john.Id, pagination, null, sort).Result;
                Assert.NotNull(result);
                Assert.True(result.Count > 0);

                sort = new Sort();
                sort.AddField("CreationDate", SortDirection.desc);
                result2 = _objectToTest.GetKycDocuments(john.Id, pagination, null, sort).Result;
                Assert.NotNull(result2);
                Assert.True(result2.Count > 0);

                Assert.True(result[0].Id != result2[0].Id);
            }
            catch (Exception ex)
            {
                Assert.True(false, ex.Message);
            }
        }
        public void Test_Users_SaveKycDocument()
        {
            try
            {
                UserNaturalDTO john        = this.GetJohn();
                KycDocumentDTO kycDocument = this.GetJohnsKycDocument();

                KycDocumentPutDTO kycDocumentPut = new KycDocumentPutDTO
                {
                    Status = KycStatus.VALIDATION_ASKED
                };

                KycDocumentDTO result = this.Api.Users.UpdateKycDocument(john.Id, kycDocumentPut, kycDocument.Id);

                Assert.IsNotNull(result);
                Assert.IsTrue(kycDocument.Type == result.Type);
                Assert.IsTrue(result.Status == KycStatus.VALIDATION_ASKED);
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
Beispiel #21
0
 protected async Task <KycDocumentDTO> GetNewKycDocument()
 {
     BaseTest._johnsKycDocument = null;
     return(await GetJohnsKycDocument());
 }
Beispiel #22
0
 protected KycDocumentDTO GetNewKycDocument()
 {
     BaseTest._johnsKycDocument = null;
     return(GetJohnsKycDocument());
 }