Code (PHP) pasted on 2019-01-17, 20:34 Raw Source
- <?php
- namespace LyraFinances\filter;
- use LyraFinances\exceptions\BadPaymentEntryException;
- use LyraFinances\interfaces\Filter;
- use LyraFinances\models\Payment;
- /**
- * Class VolksbankCsvFilter
- * @todo this one is difficult; you've to read out the file header.
- * @package LyraFinances\filter
- */
- class VolksbankCsvFilter extends AbstractCsvFilter implements Filter
- {
- /**
- * @var int
- */
- protected $skipLines = 13;
- /**
- * @var int
- */
- protected $cols = 13;
- /**
- * @var array
- */
- protected $skippedLines = [];
- /**
- * @var array
- */
- protected $fields = [
- 'Buchungstag',
- 'Valuta',
- 'Auftraggeber/Zahlungsempfänger',
- 'Empfänger/Zahlungspflichtiger',
- 'Konto-Nr.',
- 'IBAN',
- 'BLZ',
- 'BIC',
- 'Vorgang/Verwendungszweck',
- 'Kundenreferenz',
- 'Währung',
- 'Umsatz',
- ' '
- ];
- /**
- * @param array $csv
- *
- * @return Payment
- * @throws \Exception
- */
- {
- /**
- * some information, like the account are within the header of the file.
- */
- throw new BadPaymentEntryException();
- }
- $payment = new Payment();
- $payment->setAccount($this->skippedLines[5][1]);
- $payment->setText($text);
- $payment->setRecipientPayer($csv[3]);
- $amount = $this->getFloatFromMoney($csv[11]);
- if ($csv[12] == 'S') {
- $amount = -($amount);
- }
- $payment->setAmount($amount);
- return new Payment();
- }
- }
- <?php
- namespace LyraFinances\filter;
- use LyraFinances\interfaces\Filter;
- use LyraFinances\models\Payment;
- /**
- * Class SparkasseCsvFilter
- * @package LyraFinances\filter
- */
- class SparkasseCsvFilter extends AbstractCsvFilter implements Filter
- {
- /**
- * @var int
- */
- protected $skipLines = 1;
- /**
- * @var int
- */
- protected $cols = 17;
- /**
- * @var array
- */
- protected $fields = [
- 'Auftragskonto',
- 'Buchungstag',
- 'Valutadatum',
- 'Buchungstext',
- 'Verwendungszweck',
- 'Glaeubiger ID',
- 'Mandatsreferenz',
- 'Kundenreferenz (End-to-End)',
- 'Sammlerreferenz',
- 'Lastschrift Ursprungsbetrag',
- 'Auslagenersatz Ruecklastschrift',
- 'Beguenstigter/Zahlungspflichtiger',
- 'Kontonummer/IBAN',
- 'BIC (SWIFT-Code)',
- 'Betrag',
- 'Waehrung',
- 'Info'
- ];
- /**
- * @param array $csv
- *
- * @return Payment
- * @throws \Exception
- */
- {
- $payment = new Payment();
- $payment->setAccount($csv[0]);
- $payment->setText($csv[4]);
- $payment->setRecipientPayer($csv[12]);
- $payment->setAmount($this->getFloatFromMoney($csv[14]));
- return $payment;
- }
- }