Пример #1
0
        private async Task <ExtractOFX> GenerateExtract(IFormFile file)
        {
            string result = await GetOFXXmlString(file);

            ExtractOFX extractOFX = ConvertToExtract(result);

            extractOFX.Name = file.FileName;

            return(extractOFX);
        }
Пример #2
0
 public static Extract ToDomain(this ExtractOFX source) =>
 source == null ? null : new Extract()
 {
     BankAccount  = source.BankInfo?.Statement?.BankStatementResponse?.BankAccount?.ToDomain(),
     FinalDate    = source.BankInfo?.Statement?.BankStatementResponse?.BankTransactionsData?.EndDate,
     InitialDate  = source.BankInfo?.Statement?.BankStatementResponse?.BankTransactionsData?.StartDate,
     Transactions = source.BankInfo?.Statement?.BankStatementResponse?.BankTransactionsData?.Transactions?.Select(t => t.ToDomain()).ToList(),
     Balance      = source.BankInfo?.Statement?.BankStatementResponse?.Balance?.ToDomain(),
     Currency     = source.BankInfo?.Statement.BankStatementResponse.Currency,
     Name         = source.Name
 };
Пример #3
0
        /// <summary>
        /// Converts string to xml and then convert to Extract
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private static ExtractOFX ConvertToExtract(string result)
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(result);

            XmlReader     docReader  = new XmlNodeReader(doc);
            XmlSerializer t          = new XmlSerializer(typeof(ExtractOFX));
            ExtractOFX    extractOFX = (ExtractOFX)t.Deserialize(docReader);

            return(extractOFX);
        }