Example #1
0
        public static List <Movimento> getTransactions(string path)
        {
            string[]               linhas = File.ReadAllLines(path);
            Business.TipoServico   serv = null;
            Business.TipoTransacao tt = null;
            DateTime               data = new DateTime(1900, 1, 1);
            bool             validacaoReportRendimento = false, validacaoReportID = false;
            List <Movimento> movtos = new List <Movimento>();
            List <Movimento> movimentos = new List <Movimento>();
            int contador = 1, contadorLinhas = 1;


            foreach (string linha in linhas)
            {
                contadorLinhas += 1;

                if (linha.Contains("REPORTING FOR:      9000410201 BANCO RENDIMENT"))
                {
                    validacaoReportRendimento = true;

                    if (data == new DateTime(1900, 1, 1))
                    {
                        data = getData(linha.Substring(123, 10).TrimEnd().TrimStart());
                    }
                    else
                    {
                        continue;
                    }
                }
                if (linha.Contains(" REPORTING FOR:      9000410202"))
                {
                    validacaoReportRendimento = false;
                }

                if (linha.Contains("REPORT ID:  VSS-910"))
                {
                    validacaoReportID = true;
                }


                if (linha.Substring(0, 15) == "   NO DEFERMENT")
                {
                    contador += 1;
                }

                if (linha.Substring(0, 21).ToUpper() == "   TOTAL NO DEFERMENT")
                {
                    contador = 1;
                    validacaoReportRendimento = false;
                    validacaoReportID         = false;
                }

                if (validacaoReportRendimento && contador > 1 && validacaoReportID &&
                    (linha.Substring(0, 20) == "       ORIGINAL SALE" || linha.Substring(0, 15) == "       ORIGINAL")
                    )
                {
                    serv = new TipoServico("VISA DEBITO NACIONAL");
                    tt   = new TipoTransacao(String.Concat(linha.Substring(0, 20).TrimEnd().TrimStart()));


                    movtos.Add(new Movimento(serv,
                                             data
                                             ,
                                             tt,
                                             Convert.ToInt32(linha.Substring(58, 6).Replace(",", "").Replace(".", "").TrimEnd().TrimStart()),
                                             Math.Round((Convert.ToDouble(linha.Substring(64, 19).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(83, 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(85, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(105, 2),
                                             0,
                                             Math.Round((Convert.ToDouble(linha.Substring(107, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(127, 2),
                                             path,
                                             data

                                             )
                               );


                    contador += 1;
                }
            }

            foreach (Movimento m in movtos)
            {
                var mov = (from m1 in movimentos
                           where m1.Arquivo == m.Arquivo
                           where m1.ProcessingDate == m.ProcessingDate
                           where m1.InterchangeFee == m.InterchangeFee
                           where m1.ProcessingCharge == m.ProcessingCharge
                           where m1.Quantidade == m.Quantidade
                           where m1.Servico == m.Servico
                           where m1.PaymentAmount == m.PaymentAmount
                           where m1.TipoInterchangeFee == m.TipoInterchangeFee
                           where m1.TipoPaymentAmount == m.TipoPaymentAmount
                           where m1.TipoTransactionAmount == m.TipoTransactionAmount
                           where m1.Transacao == m.Transacao
                           where m1.TransactionAmount == m.TransactionAmount
                           select m).ToList <Movimento>();

                if (mov.Count == 0)
                {
                    movimentos.Add(m);
                }
                else
                {
                    continue;
                }
            }

            movimentos.Where(x => x.TipoTransactionAmount == "CR").ToList <Movimento>().ForEach(s => s.TipoTransactionAmount = "+");
            movimentos.Where(x => x.TipoTransactionAmount == "DB").ToList <Movimento>().ForEach(s => s.TipoTransactionAmount = "-");
            movimentos.Where(x => x.TipoInterchangeFee == "CR").ToList <Movimento>().ForEach(s => s.TipoInterchangeFee       = "+");
            movimentos.Where(x => x.TipoInterchangeFee == "DB").ToList <Movimento>().ForEach(s => s.TipoInterchangeFee       = "-");
            movimentos.Where(x => x.TipoPaymentAmount == "CR").ToList <Movimento>().ForEach(s => s.TipoPaymentAmount         = "+");
            movimentos.Where(x => x.TipoPaymentAmount == "DB").ToList <Movimento>().ForEach(s => s.TipoPaymentAmount         = "-");


            return(movimentos.OrderBy(x => x.ProcessingDate).ThenBy(x => x.Transacao).ThenBy(x => x.Quantidade).ToList <Movimento>());
        }
Example #2
0
        public static List <Movimento> getTransactionsInternacional(string path)
        {
            string[]               linhas = File.ReadAllLines(path);
            Business.TipoServico   serv = null;
            Business.TipoTransacao tt = null;
            bool             validacaoReportRendimento = false, validacaoReportID = false;
            List <Movimento> movtos    = new List <Movimento>();
            List <Movimento> movtosAux = new List <Movimento>();
            int      contador          = 1;
            DateTime data = new DateTime();

            #region ###### VSS-115 #########

            foreach (string linha in linhas)
            {
                if (linha.Contains("REPORTING FOR:      9000410201 BANCO RENDIMENT"))
                {
                    validacaoReportRendimento = true;
                    data = getData(linha.Substring(123, 10).TrimEnd().TrimStart());
                }
                if (linha.Contains(" REPORTING FOR:      9000410202"))
                {
                    validacaoReportRendimento = false;
                }

                if (linha.Contains("REPORT ID:  VSS-115"))
                {
                    validacaoReportID = true;
                }


                if (linha.Substring(0, 22) == " ACQUIRER TRANSACTIONS")
                {
                    contador += 1;
                }

                if (linha.Substring(0, 28).ToUpper() == " FINAL SETTLEMENT NET AMOUNT")
                {
                    contador = 1;
                    validacaoReportRendimento = false;
                    validacaoReportID         = false;
                }

                if (validacaoReportRendimento && contador > 1 && validacaoReportID &&
                    (linha.Substring(0, 18) == " TOTAL INTERCHANGE" || linha.Substring(0, 6) == " TOTAL"
                    )
                    )
                {
                    serv = new TipoServico("VISA CREDITO INTERNACIONAL");
                    tt   = new TipoTransacao(String.Concat(linha.Substring(0, 18).TrimEnd().TrimStart()));


                    movtosAux.Add(new Movimento(serv,
                                                getData(linha.Substring(23, 7))
                                                ,
                                                tt,
                                                Convert.ToInt32(linha.Substring(30, 12).Replace(",", "").Replace(".", "").TrimEnd().TrimStart()),
                                                Math.Round((Convert.ToDouble(linha.Substring(42, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                                linha.Substring(62, 2),
                                                Math.Round((Convert.ToDouble(linha.Substring(64, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                                linha.Substring(84, 2),
                                                Math.Round((Convert.ToDouble(linha.Substring(86, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                                Math.Round((Convert.ToDouble(linha.Substring(106, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                                linha.Substring(128, 2),
                                                path

                                                )
                                  );


                    contador += 1;
                }
            }
            #endregion

            #region ######### VSS-120 ##########



            #endregion

            return(movtos.OrderBy(x => x.ProcessingDate).ThenBy(x => x.Transacao).ThenBy(x => x.Quantidade).ToList <Movimento>());
        }
Example #3
0
        public static List <Movimento> getTransactionsFeeNacional(string path)
        {
            string[]               linhas = File.ReadAllLines(path);
            Business.TipoServico   serv = null;
            Business.TipoTransacao tt = null;
            bool             validacaoReportRendimento = false, validacaoReportID = false;
            List <Movimento> movtos = new List <Movimento>();
            int      contador       = 1;
            DateTime data = new DateTime();


            foreach (string linha in linhas)
            {
                if (linha.Contains("REPORTING FOR:      9000410201 BANCO RENDIMENT"))
                {
                    validacaoReportRendimento = true;
                    data = getData(linha.Substring(123, 10).TrimEnd().TrimStart());
                }

                if (linha.Contains("REPORT ID:  VSS-600"))
                {
                    validacaoReportID = true;
                }

                if (linha.Contains(" REPORTING FOR:      9000410202"))
                {
                    validacaoReportRendimento = false;
                }

                if (linha.Substring(0, 13) == " 02-DAY DEFER")
                {
                    contador += 1;
                }

                if (linha.Substring(0, 19).ToUpper() == " TOTAL 02-DAY DEFER")
                {
                    contador = 1;
                    validacaoReportRendimento = false;
                    validacaoReportID         = false;
                }

                if (validacaoReportRendimento && contador > 1 && validacaoReportID &&
                    (linha.Substring(0, 21) == "   TOTAL 02-DAY DEFER"
                    )
                    )
                {
                    serv = new TipoServico("VISA FEE COLLECTION");
                    tt   = new TipoTransacao(String.Concat("FEE - ", linha.Substring(0, 21).TrimEnd().TrimStart()));

                    movtos.Add(new Movimento(serv,
                                             getData(linha.Substring(23, 7)),
                                             tt,
                                             Convert.ToInt32(linha.Substring(30, 12).Replace(",", "").Replace(".", "").TrimEnd().TrimStart()),
                                             Math.Round((Convert.ToDouble(linha.Substring(42, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(62, 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(64, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(84, 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(86, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(106, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(128, 2),
                                             path

                                             )
                               );


                    contador += 1;
                }
            }

            return(movtos.OrderBy(x => x.ProcessingDate).ThenBy(x => x.Transacao).ThenBy(x => x.Quantidade).ToList <Movimento>());
        }
Example #4
0
        public static List <Movimento> getTransactionsD27Nacional(string path)
        {
            string[] linhas = File.ReadAllLines(path);
            string   d27    = String.Empty;

            Business.TipoServico   serv = null;
            Business.TipoTransacao tt = null;
            bool             validacaoReportRendimento = false, validacaoReportID = false;
            List <Movimento> movtos = new List <Movimento>();
            int      contador       = 1;
            DateTime data = new DateTime();


            foreach (string linha in linhas)
            {
                if (linha.Contains("REPORTING FOR:      9000410201 BANCO RENDIMENT"))
                {
                    validacaoReportRendimento = true;
                    data = getData(linha.Substring(123, 10).TrimEnd().TrimStart());
                }
                if (linha.Contains(" REPORTING FOR:      9000410202"))
                {
                    validacaoReportRendimento = false;
                }

                if (linha.Contains("REPORT ID:  VSS-600"))
                {
                    validacaoReportID = true;
                    continue;
                }


                if (linha.Substring(0, 13) == " 27-DAY DEFER")
                {
                    contador += 1;
                }

                if (linha.Substring(0, 19).ToUpper() == " TOTAL 27-DAY DEFER")
                {
                    contador = 1;
                    validacaoReportRendimento = false;
                    validacaoReportID         = false;
                    data = new DateTime();
                }

                if (validacaoReportRendimento && contador > 1 && validacaoReportID &&
                    (linha.Substring(0, 18) == "     ORIGINAL SALE" || linha.Substring(0, 18) == "     ORIGINAL     "
                    )
                    )
                {
                    switch (linha.Substring(0, 18))
                    {
                    case "     ORIGINAL SALE":
                    {
                        d27 = "PURCHASE";
                        break;
                    }

                    case "     ORIGINAL     ":
                    {
                        d27 = "MERCHANDISE CREDIT";
                        break;
                    }
                    }

                    serv = new TipoServico("VISA CREDITO NACIONAL");
                    tt   = new TipoTransacao(String.Concat("D27 - ", d27));


                    movtos.Add(new Movimento(serv,
                                             getData(linha.Substring(23, 7))
                                             ,
                                             tt,
                                             Convert.ToInt32(linha.Substring(30, 12).Replace(",", "").Replace(".", "").TrimEnd().TrimStart()),
                                             Math.Round((Convert.ToDouble(linha.Substring(42, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(62, 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(64, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(84, 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(86, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(106, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(128, 2),
                                             path

                                             )
                               );


                    contador += 1;
                }
            }

            return(movtos.OrderBy(x => x.ProcessingDate).ThenBy(x => x.Transacao).ThenBy(x => x.Quantidade).ToList <Movimento>());
        }
Example #5
0
        public static List <Movimento> getTransactionsChargeBackNacional(string path)
        {
            string[]               linhas = File.ReadAllLines(path);
            Business.TipoServico   serv = null;
            Business.TipoTransacao tt = null;
            bool             validacaoReportRendimento = false, validacaoReportID = false, validaDisputFin = false;
            List <Movimento> movtos = new List <Movimento>();
            int      contador = 1, contadorLinhas = 1, contadorReportID = 0;
            DateTime data = new DateTime();


            foreach (string linha in linhas)
            {
                contadorLinhas += 1;

                if (linha.Contains("REPORTING FOR:      9000410201 BANCO RENDIMENT"))
                {
                    validacaoReportRendimento = true;
                    data = getData(linha.Substring(123, 10).TrimEnd().TrimStart());
                }
                if (linha.Contains(" REPORTING FOR:      9000410202"))
                {
                    validacaoReportRendimento = false;
                }

                if (linha.Substring(0, 12) == " DISPUTE FIN" && validacaoReportRendimento)
                {
                    contador += 1;
                }

                if (linha.Contains("REPORT ID:  VSS-600"))
                {
                    validacaoReportID = true;
                    contadorReportID += 1;
                }

                if (linha.Substring(0, 12) == " DISPUTE FIN")
                {
                    validaDisputFin = true;
                }

                if (linha.Substring(0, 28).ToUpper() == " TOTAL ACQUIRER TRANSACTIONS")
                {
                    contador                  = 1;
                    contadorReportID          = 1;
                    validacaoReportRendimento = false;
                    validacaoReportID         = false;
                    validaDisputFin           = false;
                }

                if (validacaoReportRendimento && contador > 1 && validacaoReportID && validacaoReportID && validaDisputFin &&
                    (linha.Substring(0, 16) == "     DISPUTE FIN")
                    )
                {
                    serv = new TipoServico("VISA CREDITO NACIONAL");
                    tt   = new TipoTransacao(String.Concat("CHARGEBACK - ", linha.Substring(0, 18).TrimEnd().TrimStart()));



                    movtos.Add(new Movimento(serv,
                                             getData(linha.Substring(23, 7)),
                                             tt,
                                             Convert.ToInt32(linha.Substring(30, 12).Replace(",", "").Replace(".", "").TrimEnd().TrimStart()),
                                             Math.Round((Convert.ToDouble(linha.Substring(42, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(62, 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(64, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(84, 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(86, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             Math.Round((Convert.ToDouble(linha.Substring(106, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                             linha.Substring(128, 2),
                                             path

                                             )
                               );


                    contador += 1;
                }
            }

            return(movtos.OrderBy(x => x.ProcessingDate).ThenBy(x => x.Transacao).ThenBy(x => x.Quantidade).ToList <Movimento>());
        }
Example #6
0
        public static List <Movimento> getMovimentos(string path)
        {
            string[]               linhas = File.ReadAllLines(path);
            Business.TipoServico   serv   = null;
            Business.TipoTransacao tt     = null;
            DateTime               data   = new DateTime();
            string serviceID = String.Empty;
            List <Business.Master.Credito.Movimento> movtos = new List <Business.Master.Credito.Movimento>();
            int contador = 1;

            foreach (string linha in linhas)
            {
                if (linha.ToUpper().Contains("BUSINESS SERVICE LEVEL:"))
                {
                    serv = new Business.TipoServico(linha.Substring(25, 20).TrimEnd().TrimStart());
                    data = new DateTime(Convert.ToInt32(linha.Substring(62, 4)), Convert.ToInt32(linha.Substring(67, 2)), Convert.ToInt32(linha.Substring(70, 2)));
                }
                if (linha.ToUpper().Contains("BUSINESS SERVICE ID:"))
                {
                    serviceID = linha.Substring(22, 20).TrimEnd().TrimStart();
                }
                if (linha.Contains("------------ --------------- --- -------- -------------------------- ------- ----------------------- -------"))
                {
                    continue;
                }
                if (linha.Substring(14, 11).TrimEnd().TrimStart() == "PURCHASE" || linha.Substring(14, 11).TrimEnd().TrimStart() == "CREDIT")
                {
                    if (contador == 1)
                    {
                        switch (linha.Substring(1, 12).TrimEnd().TrimStart())
                        {
                        case "FIRST PRES.":
                        {
                            tt = new Business.TipoTransacao("FIRST PRES.");
                            break;
                        }

                        case "FIRST C/B -F":
                        {
                            tt = new Business.TipoTransacao("FIRST C/B –F");
                            break;
                        }

                        case "FEE COLL –MBG":
                        {
                            tt = new Business.TipoTransacao("FEE COLL –MBG");
                            break;
                        }

                        case "SEC. PRES.-F":
                        {
                            tt = new Business.TipoTransacao("SEC. PRES.-F");
                            break;
                        }
                        }
                    }


                    movtos.Add(new Business.Master.Credito.Movimento
                               (
                                   serv,
                                   data,
                                   tt,
                                   linha.Substring(14, 15).TrimEnd().TrimStart(),
                                   Convert.ToInt32(linha.Substring(36, 6).TrimEnd().TrimStart()),
                                   Math.Round((Convert.ToDouble(linha.Substring(43, 23).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                   linha.Substring(67, 2),
                                   linha.Substring(70, 7),
                                   Math.Round((Convert.ToDouble(linha.Substring(78, 20).TrimEnd().TrimStart().Replace(",", "").Replace(".", "")) / 100), 2),
                                   linha.Substring(99, 2),
                                   linha.Substring(102, 7),
                                   serviceID,
                                   path
                               )
                               );

                    contador += 1;
                }

                if (linha.Contains("FIRST PRES.  TOTAL") || linha.Contains("FEE COLL –MBG  TOTAL") ||
                    linha.Contains("SEC. PRES.-F TOTAL") || linha.Contains("FIRST C/B –F TOTAL")
                    )
                {
                    contador = 1;
                    //serv = new TipoServico();
                    //tt = new TipoTransacao();
                }
            }

            movtos.Where(x => x.TipoReconAmount == "CR").ToList <Movimento>().ForEach(s => s.TipoReconAmount = "+");
            movtos.Where(x => x.TipoReconAmount == "DR").ToList <Movimento>().ForEach(s => s.TipoReconAmount = "-");
            movtos.Where(x => x.TipoFee == "CR").ToList <Movimento>().ForEach(s => s.TipoFee = "+");
            movtos.Where(x => x.TipoFee == "DR").ToList <Movimento>().ForEach(s => s.TipoFee = "-");


            return(movtos.OrderBy(x => x.Arquivo).ThenBy(x => x.Servico).ThenBy(x => x.Transacao).ThenBy(x => x.ServiceID).ToList <Movimento>());
        }