/** * 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 []; }
/** * 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; }
/** * @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; }
/** * 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 ''; }
/** * 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; }
/** * Overloaded: Sparkasse uses 62M and 62F. * * {@inheritdoc} */ protected function parseStatementEndPrice() { return parent::parseStatementPrice('62[FM]'); }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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; }