Example #1
0
 /**
  * Parse the given string into an array of Banking\Statement objects.
  *
  * @param string               $string
  * @param Banking\Mt940\Engine $engine
  *
  * @return \Kingsquare\Banking\Statement[]
  */
 public function parse($string, Banking\Mt940\Engine $engine = null)
 {
     if (!empty($string)) {
         // load engine
         if ($engine === null) {
             $engine = Banking\Mt940\Engine::__getInstance($string);
         }
         $this->engine = $engine;
         if ($this->engine instanceof Banking\Mt940\Engine) {
             // parse using the engine
             $this->engine->loadString($string);
             return $this->engine->parse();
         }
     }
     return [];
 }
Example #2
0
 /**
  * Overloaded: Rabo encapsulates the description with /REMI/ for SEPA
  * @inheritdoc
  */
 protected function sanitizeDescription($string)
 {
     //	echo "string 1: ".$string;
     $description = stripFirstLine($string);
     //   	echo "description 1: ".$description;
     $description = parent::sanitizeDescription($description);
     //     	echo "description 2: ".$description;
     return $description;
 }
Example #3
0
 /**
  * @inheritdoc
  */
 protected function parseTransactionDescription()
 {
     $description = parent::parseTransactionDescription();
     $accountIsInDescription = strpos($description, 'REK:');
     if ($accountIsInDescription !== false) {
         return trim(substr($description, 0, $accountIsInDescription));
     }
     $name = $this->parseTransactionAccountName();
     $accountNameIsInDescription = strpos($description, $name);
     if ($accountNameIsInDescription !== false) {
         return trim(substr($description, 0, $accountNameIsInDescription - 6));
     }
     return $description;
 }
Example #4
0
 /**
  * Overloaded: ABN Amro shows the GIRO and fixes newlines etc
  * @inheritdoc
  */
 protected function parseTransactionAccountName()
 {
     $results = parent::parseTransactionAccountName();
     if ($results !== '') {
         return $results;
     }
     $results = [];
     if (preg_match('/:86:(GIRO|BGC\\.)\\s+[\\d]+ (.+)/', $this->getCurrentTransactionData(), $results) && !empty($results[2])) {
         return $this->sanitizeAccountName($results[2]);
     }
     if (preg_match('/:86:.+\\n(.*)\\n/', $this->getCurrentTransactionData(), $results) && !empty($results[1])) {
         return $this->sanitizeAccountName($results[1]);
     }
     return '';
 }
Example #5
0
 /**
  * Overloaded: Mollie encapsulates the description with /REMI/ for SEPA
  * @inheritdoc
  */
 protected function sanitizeDescription($string)
 {
     $description = parent::sanitizeDescription($string);
     $sanitizedDescription = "";
     if (strpos($description, '/REMI/') !== false && preg_match('/\\/REMI\\/(.+?)\\//s', $description, $results) && !empty($results[1])) {
         //    echo $results[1];
         $sanitizedDescription = $results[1];
     }
     if (strpos($description, '/EREF/') !== false && preg_match('/\\/EREF\\/((.+|\\n)+)/s', $description, $results) && !empty($results[1])) {
         //    echo $results[1];
         //  echo "\n".strpos($results[1],'NOTPROVIDED')."\n";
         if (!(strpos($results[1], 'NOTPROVIDED') > -1)) {
             $sanitizedDescription = $sanitizedDescription . " - " . $results[1];
         }
     }
     return $sanitizedDescription;
 }
Example #6
0
 /**
  * Overloaded: Sparkasse uses 62M and 62F.
  *
  * {@inheritdoc}
  */
 protected function parseStatementEndPrice()
 {
     return parent::parseStatementPrice('62[FM]');
 }
Example #7
0
 /**
  * In Triodos everything is put into :86: field with '>\d{2}' seperators
  * This method parses that out and returns the array
  *
  * @return array
  */
 private function getDescriptionParts()
 {
     $parts = explode('>', parent::parseTransactionDescription());
     array_shift($parts);
     // remove 000 prefix
     return $parts;
 }
Example #8
0
 /**
  * Overloaded: ING encapsulates the description with /REMI/ for SEPA
  * @inheritdoc
  */
 protected function sanitizeDescription($string)
 {
     $description = parent::sanitizeDescription($string);
     if (strpos($description, '/REMI/USTD//') !== false && preg_match('#/REMI/USTD//(.*?)/#s', $description, $results) && !empty($results[1])) {
         return $results[1];
     }
     if (strpos($description, '/REMI/STRD/CUR/') !== false && preg_match('#/REMI/STRD/CUR/(.*?)/#s', $description, $results) && !empty($results[1])) {
         return $results[1];
     }
     return $description;
 }
Example #9
0
 /**
  * Overloaded: Rabo encapsulates the description with /REMI/ for SEPA
  * @inheritdoc
  */
 protected function sanitizeDescription($string)
 {
     $description = parent::sanitizeDescription($string);
     if (strpos($description, '/REMI/') !== false && preg_match('#/REMI/(.*?)/(ISDT|CSID|RTRN)/#s', $description, $results) && !empty($results[1])) {
         return $results[1];
     }
     if (strpos($description, '/EREF/') !== false && preg_match('#/EREF/(.*?)/(ORDP)/#s', $description, $results) && !empty($results[1])) {
         return $results[1];
     }
     return $description;
 }
Example #10
0
 /**
  * Overloaded: ABN encapsulates the description with /REMI/ for SEPA
  * @inheritdoc
  */
 protected function sanitizeDescription($string)
 {
     $description = parent::sanitizeDescription($string);
     if (strpos($description, 'OMSCHRIJVING:') !== false && preg_match('/.*OMSCHRIJVING:(.*?)(KENMERK|IBAN):/', $description, $results) && !empty($results[1])) {
         return $results[1];
     }
     if (strpos($description, '/REMI/') !== false && preg_match('#/REMI/(.*?)/(EREF|IBAN)/#s', $description, $results) && !empty($results[1])) {
         return $results[1];
     }
     if (strpos($description, '/EREF/') !== false && preg_match('#/EREF/(.*?)/(ORDP)/#s', $description, $results) && !empty($results[1])) {
         return $results[1];
     }
     return $description;
 }