Beispiel #1
0
        public override DTO.ServiceResponse BuildResponse(XElement parsedOfx)
        {
            Parse.OfxResponseBuilder responseBuilder = new Parse.OfxResponseBuilder();
            var response = responseBuilder.BuildStatementResponse(parsedOfx, m_statementParameters.DateStart, m_statementParameters.DateEnd);

            return(response);
        }
        protected override DTO.ServiceResponse ProcessScrape(string outputPath, string debugID)
        {
            DTO.ServiceResponse response = null;
            string statementFilePath     = Path.Combine(outputPath, "statement.qfx");
            string noStatementFilePath   = Path.Combine(outputPath, "empty_statement.txt");

            if (File.Exists(statementFilePath))
            {
                string statementOfx            = File.ReadAllText(statementFilePath);
                Parse.OfxToXmlParser parser    = new Parse.OfxToXmlParser(statementOfx);
                XElement             parsedOfx = parser.Parse();

                Parse.OfxResponseBuilder responseBuilder = new Parse.OfxResponseBuilder();
                response = responseBuilder.BuildStatementResponse(parsedOfx, m_statementParameters.DateStart, m_statementParameters.DateEnd);
            }
            else if (File.Exists(noStatementFilePath))
            {
                response = new DTO.StatementResponse(HttpStatusCode.OK);
            }
            else
            {
                response = new DTO.ResponseError(HttpStatusCode.BadRequest)
                {
                    friendly_error = "An error occured when atempting to get account statement.",
                    detailed_error = "statement file missing"
                };
            }

            return(response);
        }