diff --git a/src/Read/Transaction.php b/src/Read/Transaction.php index 50a71fb..a0bec0c 100644 --- a/src/Read/Transaction.php +++ b/src/Read/Transaction.php @@ -8,13 +8,13 @@ class Transaction #[Column(id: 0)] public \DateTimeImmutable $moveDate; - #[Column(id: 1)] - public float $amount; - /** @deprecated use amount */ #[Column(id: 1)] public float $volume; + #[Column(id: 1)] + public float $amount; + #[Column(id: 2)] public string $toAccount; diff --git a/src/Read/TransactionFactory.php b/src/Read/TransactionFactory.php index d578af0..e752a7c 100644 --- a/src/Read/TransactionFactory.php +++ b/src/Read/TransactionFactory.php @@ -31,14 +31,14 @@ public function create(\stdClass $source): object $method = 'set' . ucfirst($propertyName); if (method_exists($transaction, $method)) { $transaction->$method($value); - } elseif(property_exists($transaction, $propertyName)) { + } elseif (property_exists($transaction, $propertyName)) { $transaction->$propertyName = $this->castValue($value, $type); } else { throw new InvalidArgument(sprintf('Missing property "%s" or method "%s" for set value.', $propertyName, $method)); } } - return $transaction; + return $this->backCompatibility($transaction); } @@ -95,4 +95,18 @@ protected function customFormat(mixed $value, \ReflectionNamedType $type): mixed throw new InvalidArgument(sprintf('Values "%s" does not have support type "%s".', strval($value), $type->getName())); } + + /** + * @template T of object + * @param T $transaction + * @return T + */ + protected function backCompatibility(object $transaction): object + { + assert($transaction instanceof Transaction); + $transaction->volume = $transaction->amount; + + return $transaction; + } + } diff --git a/tests/data/2015-01-01-2015-04-16-transactions.srlz b/tests/data/2015-01-01-2015-04-16-transactions.srlz index d70fdfd..bf4d60a 100644 --- a/tests/data/2015-01-01-2015-04-16-transactions.srlz +++ b/tests/data/2015-01-01-2015-04-16-transactions.srlz @@ -1 +1 @@ -a:10:{i:0;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-01-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:1.39;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:7963750704;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7139752765;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:1;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-01-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-0.2;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:7963750704;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7139752766;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:2;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-06 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-4002;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0558";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";s:7:"pujčka";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:7973780617;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7142478437;s:7:"comment";s:7:"pujčka";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:3;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:0.25;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8002557848;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7149201885;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:4;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-0.03;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8002557848;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7149201886;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:5;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-17 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:4002;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0558";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:32:"Příjem převodem uvnitř banky";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:17:"Matějček, Milan";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8027586581;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7155451447;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:6;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:0.69;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8046702508;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7159895102;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:7;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-0.1;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8046702508;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7159895103;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:8;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-03 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-1280;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";s:14:"boty + čepice";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";s:14:"boty + čepice";s:13:"instructionId";i:8053184881;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7161812099;s:7:"comment";s:14:"boty + čepice";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:9;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-15 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-1;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0308";s:14:"variableSymbol";s:3:"123";s:14:"specificSymbol";s:2:"55";s:4:"note";s:14:"Test poznámka";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";s:11:"Test zprava";s:13:"instructionId";i:8068116285;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7165272749;s:7:"comment";s:14:"Test poznámka";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}} \ No newline at end of file +a:10:{i:0;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-01-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:1.39;s:6:"amount";d:1.39;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:7963750704;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7139752765;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:1;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-01-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-0.2;s:6:"amount";d:-0.2;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:7963750704;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7139752766;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:2;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-06 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-4002;s:6:"amount";d:-4002;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0558";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";s:7:"pujčka";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:7973780617;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7142478437;s:7:"comment";s:7:"pujčka";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:3;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:0.25;s:6:"amount";d:0.25;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8002557848;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7149201885;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:4;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-0.03;s:6:"amount";d:-0.03;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8002557848;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7149201886;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:5;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-17 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:4002;s:6:"amount";d:4002;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0558";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:32:"Příjem převodem uvnitř banky";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:17:"Matějček, Milan";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8027586581;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7155451447;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:6;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:0.69;s:6:"amount";d:0.69;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8046702508;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7159895102;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:7;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-0.1;s:6:"amount";d:-0.1;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8046702508;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7159895103;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:8;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-03 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-1280;s:6:"amount";d:-1280;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";s:14:"boty + čepice";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";s:14:"boty + čepice";s:13:"instructionId";i:8053184881;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7161812099;s:7:"comment";s:14:"boty + čepice";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:9;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-15 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-1;s:6:"amount";d:-1;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0308";s:14:"variableSymbol";s:3:"123";s:14:"specificSymbol";s:2:"55";s:4:"note";s:14:"Test poznámka";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";s:11:"Test zprava";s:13:"instructionId";i:8068116285;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7165272749;s:7:"comment";s:14:"Test poznámka";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}} \ No newline at end of file diff --git a/tests/data/2015-2-transactions.srlz b/tests/data/2015-2-transactions.srlz index e1e56a8..5ae1350 100644 --- a/tests/data/2015-2-transactions.srlz +++ b/tests/data/2015-2-transactions.srlz @@ -1 +1 @@ -O:31:"h4kuna\Fio\Read\TransactionList":2:{s:4:"info";O:8:"stdClass":14:{s:9:"accountId";s:10:"2000282668";s:6:"bankId";s:4:"2010";s:8:"currency";s:3:"CZK";s:4:"iban";s:24:"CZ0620100000002000282668";s:3:"bic";s:11:"FIOBCZPPXXX";s:14:"openingBalance";d:4102.04;s:14:"closingBalance";d:100.26;s:9:"dateStart";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-01 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:7:"dateEnd";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:8:"yearList";i:2015;s:6:"idList";i:2;s:6:"idFrom";i:7142478437;s:4:"idTo";i:7149201886;s:14:"idLastDownload";N;}s:12:"transactions";a:3:{i:0;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-06 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-4002;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0558";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";s:7:"pujčka";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:7973780617;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7142478437;s:7:"comment";s:7:"pujčka";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:1;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:0.25;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8002557848;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7149201885;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:2;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-0.03;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8002557848;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7149201886;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}}} \ No newline at end of file +O:31:"h4kuna\Fio\Read\TransactionList":2:{s:4:"info";O:8:"stdClass":14:{s:9:"accountId";s:10:"2000282668";s:6:"bankId";s:4:"2010";s:8:"currency";s:3:"CZK";s:4:"iban";s:24:"CZ0620100000002000282668";s:3:"bic";s:11:"FIOBCZPPXXX";s:14:"openingBalance";d:4102.04;s:14:"closingBalance";d:100.26;s:9:"dateStart";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-01 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:7:"dateEnd";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:8:"yearList";i:2015;s:6:"idList";i:2;s:6:"idFrom";i:7142478437;s:4:"idTo";i:7149201886;s:14:"idLastDownload";N;}s:12:"transactions";a:3:{i:0;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-06 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-4002;s:6:"amount";d:-4002;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0558";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";s:7:"pujčka";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:7973780617;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7142478437;s:7:"comment";s:7:"pujčka";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:1;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:0.25;s:6:"amount";d:0.25;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8002557848;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7149201885;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:2;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-02-28 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+01:00";}s:6:"volume";d:-0.03;s:6:"amount";d:-0.03;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8002557848;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7149201886;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}}} \ No newline at end of file diff --git a/tests/data/last-transactions.srlz b/tests/data/last-transactions.srlz index 668f2eb..b08df2d 100644 --- a/tests/data/last-transactions.srlz +++ b/tests/data/last-transactions.srlz @@ -1 +1 @@ -O:31:"h4kuna\Fio\Read\TransactionList":2:{s:4:"info";O:8:"stdClass":14:{s:9:"accountId";s:10:"2000282668";s:6:"bankId";s:4:"2010";s:8:"currency";s:3:"CZK";s:4:"iban";s:24:"CZ0620100000002000282668";s:3:"bic";s:11:"FIOBCZPPXXX";s:14:"openingBalance";d:4102.26;s:14:"closingBalance";d:2821.85;s:9:"dateStart";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:7:"dateEnd";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-15 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:8:"yearList";N;s:6:"idList";N;s:6:"idFrom";i:7159895102;s:4:"idTo";i:7165272749;s:14:"idLastDownload";i:7155451447;}s:12:"transactions";a:4:{i:0;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:0.69;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8046702508;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7159895102;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:1;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-0.1;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8046702508;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7159895103;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:2;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-03 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-1280;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";s:14:"boty + čepice";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";s:14:"boty + čepice";s:13:"instructionId";i:8053184881;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7161812099;s:7:"comment";s:14:"boty + čepice";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:3;O:27:"h4kuna\Fio\Read\Transaction":20:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-15 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-1;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0308";s:14:"variableSymbol";s:3:"123";s:14:"specificSymbol";s:2:"55";s:4:"note";s:14:"Test poznámka";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";s:11:"Test zprava";s:13:"instructionId";i:8068116285;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7165272749;s:7:"comment";s:14:"Test poznámka";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}}} \ No newline at end of file +O:31:"h4kuna\Fio\Read\TransactionList":2:{s:4:"info";O:8:"stdClass":14:{s:9:"accountId";s:10:"2000282668";s:6:"bankId";s:4:"2010";s:8:"currency";s:3:"CZK";s:4:"iban";s:24:"CZ0620100000002000282668";s:3:"bic";s:11:"FIOBCZPPXXX";s:14:"openingBalance";d:4102.26;s:14:"closingBalance";d:2821.85;s:9:"dateStart";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:7:"dateEnd";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-15 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:8:"yearList";N;s:6:"idList";N;s:6:"idFrom";i:7159895102;s:4:"idTo";i:7165272749;s:14:"idLastDownload";i:7155451447;}s:12:"transactions";a:4:{i:0;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:0.69;s:6:"amount";d:0.69;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:16:"Připsaný úrok";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8046702508;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7159895102;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:1;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-03-31 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-0.1;s:6:"amount";d:-0.1;s:9:"toAccount";s:0:"";s:8:"bankCode";s:0:"";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";N;s:4:"type";s:21:"Odvod daně z úroků";s:7:"whoDone";s:0:"";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:0:"";s:8:"currency";s:3:"CZK";s:9:"messageTo";N;s:13:"instructionId";i:8046702508;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7159895103;s:7:"comment";N;s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:2;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-03 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-1280;s:6:"amount";d:-1280;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:0:"";s:14:"variableSymbol";s:0:"";s:14:"specificSymbol";s:0:"";s:4:"note";s:14:"boty + čepice";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";s:14:"boty + čepice";s:13:"instructionId";i:8053184881;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7161812099;s:7:"comment";s:14:"boty + čepice";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}i:3;O:27:"h4kuna\Fio\Read\Transaction":21:{s:8:"moveDate";O:17:"DateTimeImmutable":3:{s:4:"date";s:26:"2015-04-15 00:00:00.000000";s:13:"timezone_type";i:1;s:8:"timezone";s:6:"+02:00";}s:6:"volume";d:-1;s:6:"amount";d:-1;s:9:"toAccount";s:10:"2000242017";s:8:"bankCode";s:4:"2010";s:14:"constantSymbol";s:4:"0308";s:14:"variableSymbol";s:3:"123";s:14:"specificSymbol";s:2:"55";s:4:"note";s:14:"Test poznámka";s:4:"type";s:30:"Platba převodem uvnitř banky";s:7:"whoDone";s:17:"Matějček, Milan";s:13:"nameAccountTo";s:0:"";s:8:"bankName";s:15:"Fio banka, a.s.";s:8:"currency";s:3:"CZK";s:9:"messageTo";s:11:"Test zprava";s:13:"instructionId";i:8068116285;s:19:"advancedInformation";s:0:"";s:6:"moveId";i:7165272749;s:7:"comment";s:14:"Test poznámka";s:3:"bic";s:0:"";s:14:"payerReference";s:0:"";}}} \ No newline at end of file diff --git a/tests/src/Unit/FioReadTest.php b/tests/src/Unit/FioReadTest.php index c36c529..427cbe2 100644 --- a/tests/src/Unit/FioReadTest.php +++ b/tests/src/Unit/FioReadTest.php @@ -69,14 +69,14 @@ public function testMovementId(): void Assert::same('hgfedcba', $token); $data = $fioRead->movementId(2, 2015); - Assert::equal(loadResult('raw://2015-2-transactions.srlz', $data), serialize($data)); + Assert::equal(loadResult('raw://2015-2-transactions.srlz'), serialize($data)); } public function testLastDownload(): void { $data = $this->fioRead->lastDownload(); - Assert::equal(loadResult('raw://last-transactions.srlz', $data), serialize($data)); + Assert::equal(loadResult('raw://last-transactions.srlz'), serialize($data)); foreach ($data as $transaction) { Assert::type(Transaction::class, $transaction);