示例#1
0
        protected virtual CodaLine ParseTransactionPart1(string line)
        {
            int    sequenceNumber      = int.Parse(line.Substring(2, 4).Trim());
            int    detailNumber        = int.Parse(line.Substring(6, 4).Trim());
            string reference           = line.Substring(10, 21).Trim();
            CodaTransactionType type   = (CodaTransactionType)int.Parse(line[31].ToString());
            decimal             amount = decimal.Parse(line.Substring(32, 15).Trim()) / 1000;

            if (type == CodaTransactionType.Debit)
            {
                amount *= -1;
            }
            string   codaDate      = line.Substring(47, 6).Trim();
            DateTime?effectiveDate = null;

            if (codaDate != "000000")
            {
                effectiveDate = CodaDate.Parse(codaDate);
            }
            string            code          = line.Substring(53, 8).Trim();
            string            family        = code.Substring(1, 2).Trim();
            string            operation     = code.Substring(3, 2).Trim();
            string            category      = code.Substring(5, 3).Trim();
            CodaCommunication communication = CodaCommunication.Parse(line.Substring(61, 54).Trim(), family == "05");
            DateTime          entryDate     = CodaDate.Parse(line.Substring(115, 6).Trim());
            int statementSequenceNumber     = int.Parse(line.Substring(121, 3).Trim());
            int globalizationCode           = int.Parse(line.Substring(124, 1).Trim());

            return(new CodaTransactionPart1Line(sequenceNumber, statementSequenceNumber, detailNumber, reference, effectiveDate,
                                                entryDate, type, code, family, operation, category, communication, amount, globalizationCode));
        }
示例#2
0
        public static CodaSepaDirectDebitCommunication Parse(string communication)
        {
            DateTime settlementDate             = CodaDate.Parse(communication.Substring(0, 6));
            int      sepaType                   = int.Parse(communication.Substring(6, 1));
            int      scheme                     = int.Parse(communication.Substring(7, 1));
            int      paidReason                 = int.Parse(communication.Substring(8, 1));
            string   creditorIdentificationCode = communication.Substring(9, 35).Trim();
            string   mandateReference           = communication.Substring(44).Trim();

            return(new CodaSepaDirectDebitCommunication(communication, creditorIdentificationCode, mandateReference, paidReason, scheme, settlementDate, sepaType));
        }
示例#3
0
        protected virtual CodaLine ParseFinalState(string line)
        {
            int     sequenceNumber = int.Parse(line.Substring(1, 3).Trim());
            decimal balance        = decimal.Parse(line.Substring(42, 15).Trim()) / 1000;
            bool    isPositive     = line[41] == '0';

            if (!isPositive)
            {
                balance *= -1;
            }
            DateTime date = CodaDate.Parse(line.Substring(57, 6).Trim());

            return(new CodaFinalStateLine(sequenceNumber, date, balance));
        }
示例#4
0
        protected virtual CodaLine ParseHeader(string line)
        {
            DateTime date                 = CodaDate.Parse(line.Substring(5, 6).Trim());
            string   bankId               = line.Substring(11, 3).Trim();
            bool     isDuplicate          = line[16] == 'D';
            string   fileReference        = line.Substring(24, 10).Trim();
            string   addressee            = line.Substring(34, 26).Trim();
            string   bic                  = line.Substring(60, 11).Trim();
            string   accountId            = line.Substring(71, 11).Trim();
            string   transactionReference = line.Substring(88, 16).Trim();
            string   relatedReference     = line.Substring(104, 16).Trim();
            string   externalReference    = line.Substring(83, 5).Trim();

            return(new CodaHeaderLine(date, bankId, isDuplicate, fileReference, addressee, bic, accountId, transactionReference, relatedReference, externalReference));
        }
示例#5
0
        protected virtual CodaLine ParseInitialState(string line)
        {
            AccountNumberType accountNumberType = (AccountNumberType)int.Parse(line[1].ToString());
            int     statementSequenceNumber     = int.Parse(line.Substring(2, 3).Trim());
            string  accountInfo = line.Substring(5, 37).Trim();
            bool    isPositive  = line[42] == '0';
            decimal balance     = decimal.Parse(line.Substring(43, 15).Trim()) / 1000;

            if (!isPositive)
            {
                balance *= -1;
            }
            DateTime    date = CodaDate.Parse(line.Substring(58, 6).Trim());
            string      accountHolderName            = line.Substring(64, 26).Trim();
            string      accountDescription           = line.Substring(90, 35).Trim();
            int         paperStatementSequenceNumber = int.Parse(line.Substring(125, 3).Trim());
            BankAccount account = BankAccount.Create(accountNumberType, accountInfo, accountHolderName, accountDescription);

            return(new CodaInitialStateLine(statementSequenceNumber, account, balance, date, paperStatementSequenceNumber));
        }