Package net.sf.ofx4j.domain.data.common

Examples of net.sf.ofx4j.domain.data.common.Transaction


          if (endDate.before(date)) {
            endDate = date;
          }

          Transaction transaction = new Transaction();

          transaction.setTransactionType(TransactionType.OTHER);
          transaction.setDatePosted(date);
          transaction.setId(id);
          transaction.setCheckNumber(id);
          transaction.setReferenceNumber(id);
          double amount = formatter.parse(amountInReals).doubleValue();
          brazilianRealsAmount = brazilianRealsAmount + amount;

          if (amount == 0) {
            amount = formatter.parse(amountInDollars).doubleValue();
            transaction.setCurrency(new Currency());
            dolarsAmount = dolarsAmount + amount;
          }
          transaction.setAmount(-1 * amount);
          transaction.setMemo(description);

          transactions.add(transaction);
        }
        pattern = Pattern.compile("X\\s*(\\d+(\\.|,)\\d\\d\\d?\\d?)");
        matcher = pattern.matcher(line);
        while (matcher.find()) {
          exchangeRate = Float.parseFloat(matcher.group(1).replace(',', '.'));
        }
        pattern = Pattern.compile("Modalidade      : (.{30})");
        matcher = pattern.matcher(line);
        while (matcher.find()) {
          accountKey = matcher.group(1).trim();
        }
      }
    }

    for (Transaction transaction : transactions) {
      Currency currency = transaction.getCurrency();
      if (currency != null) {
        transaction.setCurrency(null);
        double temp = exchangeRate * transaction.getAmount();
        transaction.setAmount(temp);
      }
    }

    return transactions;
  }
View Full Code Here

TOP

Related Classes of net.sf.ofx4j.domain.data.common.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.