예제 #1
0
파일: Ing.php 프로젝트: VIISON/jejik-mt940
 /**
  * Create a Transaction from MT940 transaction text lines
  *
  * ING only provides a book date, not a valuation date. This
  * is opposite from standard MT940 so the AbstractReader will read it
  * as a valueDate. This must be corrected.
  *
  * ING does sometimes supplies a book date inside the description.
  *
  * @param array $lines The transaction text at offset 0 and the description at offset 1
  * @return \Jejik\MT940\Transaction
  */
 protected function transaction(array $lines)
 {
     $transaction = parent::transaction($lines);
     $transaction->setBookDate($transaction->getValueDate())->setValueDate(null);
     if (preg_match('/transactiedatum: (\\d{2}-\\d{2}-\\d{4})/', $lines[1], $match)) {
         $valueDate = \DateTime::createFromFormat('d-m-Y', $match[1]);
         $valueDate->setTime(0, 0, 0);
         $transaction->setValueDate($valueDate);
     }
     return $transaction;
 }
예제 #2
0
파일: Ing.php 프로젝트: avido/mt940
 /**
  * Create a Transaction from MT940 transaction text lines
  *
  * ING only provides a book date, not a valuation date. This
  * is opposite from standard MT940 so the AbstractReader will read it
  * as a valueDate. This must be corrected.
  *
  * ING does sometimes supplies a book date inside the description.
  *
  * @param array $lines The transaction text at offset 0 and the description at offset 1
  * @return \Jejik\MT940\Transaction
  */
 protected function transaction(array $lines)
 {
     $transaction = parent::transaction($lines);
     // If a bookdate was provided, do not switch the value and book dates
     // Since 2014 this should be the case as the 2nd subfield in tag 61 is the book date
     if (is_null($transaction->getBookDate())) {
         $transaction->setBookDate($transaction->getValueDate())->setValueDate(null);
         if (preg_match('/transactiedatum: (\\d{2}-\\d{2}-\\d{4})/', $lines[1], $match)) {
             $valueDate = \DateTime::createFromFormat('d-m-Y', $match[1]);
             $valueDate->setTime(0, 0, 0);
             $transaction->setValueDate($valueDate);
         }
     }
     return $transaction;
 }