Skip to content

Commit

Permalink
Some fix for Sparkasse for parsing the transaction price and transact…
Browse files Browse the repository at this point in the history
…ion debit/credit
  • Loading branch information
sven-codeculture committed Jun 11, 2015
1 parent a742cc6 commit 91dd222
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 91dd222

Please sign in to comment.