Ejemplo n.º 1
0
        public async Task <IEnumerable <IKycDocument> > GetOneEachTypeAsync(string clientId)
        {
            var partitionKey = KycDocumentEntity.GeneratePartitionKey(clientId);
            var docs         = (await _tableStorage.GetDataAsync(partitionKey)).ToList();

            var result       = new List <IKycDocument>();
            var latestIdCard =
                docs.OrderByDescending(x => x.DateTime).FirstOrDefault(x => x.Type == KycDocumentTypes.IdCard);

            if (latestIdCard != null)
            {
                result.Add(latestIdCard);
            }
            var latestSelfie =
                docs.OrderByDescending(x => x.DateTime).FirstOrDefault(x => x.Type == KycDocumentTypes.Selfie);

            if (latestSelfie != null)
            {
                result.Add(latestSelfie);
            }
            var latestProofOfAddress =
                docs.OrderByDescending(x => x.DateTime).FirstOrDefault(x => x.Type == KycDocumentTypes.ProofOfAddress);

            if (latestProofOfAddress != null)
            {
                result.Add(latestProofOfAddress);
            }

            return(result);
        }
Ejemplo n.º 2
0
        public async Task <IKycDocument> AddAsync(IKycDocument kycDocument)
        {
            var newDocument = KycDocumentEntity.Create(kycDocument);
            await _tableStorage.InsertAsync(newDocument);

            return(newDocument);
        }
Ejemplo n.º 3
0
        public async Task <IKycDocument> DeleteAsync(string clientId, string documentId)
        {
            var partitionKey = KycDocumentEntity.GeneratePartitionKey(clientId);
            var rowKey       = KycDocumentEntity.GenerateRowKey(documentId);

            return(await _tableStorage.DeleteAsync(partitionKey, rowKey));
        }
Ejemplo n.º 4
0
        public async Task <IEnumerable <IKycDocument> > GetAsync(string clientId)
        {
            var partitionKey = KycDocumentEntity.GeneratePartitionKey(clientId);

            return(await _tableStorage.GetDataAsync(partitionKey));
        }