parseBankStatement

Example
                   parseBankStatement: function (context) {

            var accountStatement = context.output.createNewAccountStatement();
            accountStatement.accountMappingKey = defaultAccountMappingKey;
            log.debug({
               title: 'Adding a new account statement',
               details: accountStatement
            });

            var accountStatementId = context.output.addAccountStatement({"parsedAccountStatement":accountStatement});
            log.debug({
               title: 'New account statement ID',
               details: accountStatementId
            });

            var statementFile = context.input.file;

            var statementLineIterator = statementFile.lines.iterator();
            statementLineIterator.next();
            statementLineIterator.each(function (line) {
               log.debug({
                  title: 'Read a line from the statement',
                  details: line.value
               });

               var partsOfCSVLine = line.value.split(',');
               var transaction = context.output.createNewTransaction();
               transaction.accountStatementId = accountStatementId;
               var rawDate = partsOfCSVLine[0];
               transaction.date = rawDate.substring(6, 10) + '-' + rawDate.substring(0, 2) + '-' + rawDate.substring(3, 5);
               transaction.amount = partsOfCSVLine[4];
               transaction.transactionMappingKey = partsOfCSVLine[3];
               transaction.transactionNumber = partsOfCSVLine[2];
               transaction.payee = partsOfCSVLine[1];
               transaction.currency = "USD";
               transaction.memo = partsOfCSVLine[5];
               transaction.customerRawId = partsOfCSVLine[6];
               transaction.customerName = partsOfCSVLine[7];
               transaction.invoices = partsOfCSVLine[8].split(',');

               log.debug({
                  title: 'Adding a new transaction',
                  details: transaction
               });

               context.output.addTransaction({"parsedTransaction":transaction});
               return true;
            });

         }, 

        

Related Topics

Bank Statement Parser Plug-in Interface Definition
BankStatementParserInput
BankStatementParserOutput
getStandardTransactionCodes

General Notices