Skip to content

Commit

Permalink
Merge pull request #14 from sven-codeculture/master
Browse files Browse the repository at this point in the history
Some fix for Sparkasse for parsing the transaction price and transaction debit/credit
  • Loading branch information
fruitl00p committed Jun 11, 2015
2 parents a742cc6 + 91dd222 commit 55169f8
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/Parser/Banking/Mt940/Engine/Spk.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,38 @@ protected function parseStatementEndPrice()
return '';
}

/**
* Overloaded: Sparkasse can have the 3rd character of the currencyname after the C/D
* @inheritdoc
*/
protected function parseTransactionPrice()
{
$results = array();
if (preg_match('/^:61:.*[CD].?([\d,\.]+)N/i', $this->getCurrentTransactionData(), $results)
&& !empty($results[1])
) {
return $this->sanitizePrice($results[1]);
}

return 0;
}

/**
* Overloaded: Sparkasse can have the 3rd character of the currencyname after the C/D and an "R" for cancellation befor the C/D
* @inheritdoc
*/
protected function parseTransactionDebitCredit()
{
$results = array();
if (preg_match('/^:61:\d+R?([CD]).?\d+/', $this->getCurrentTransactionData(), $results)
&& !empty($results[1])
) {
return $this->sanitizeDebitCredit($results[1]);
}

return '';
}

/**
* Overloaded: Sparkasse does not have a header line
* @inheritdoc
Expand Down

0 comments on commit 55169f8

Please sign in to comment.