@@ -25,7 +25,6 @@ class Statementor extends \Ease\Sand
2525 use \Ease \Logger \Logging;
2626 public \DateTime $ since ;
2727 public \DateTime $ until ;
28- private string $ scope ;
2928
3029 /**
3130 * DateTime Formating eg. 2021-08-01T10:00:00.0Z.
@@ -36,6 +35,7 @@ class Statementor extends \Ease\Sand
3635 * DateTime Formating eg. 2021-08-01T10:00:00.0Z.
3736 */
3837 public static string $ dateFormat = 'Y-m-d ' ;
38+ private string $ scope ;
3939 private string $ accountNumber = '' ;
4040
4141 public function __construct (string $ accountNumber = '' , string $ scope = '' )
@@ -65,12 +65,11 @@ public function setAccountNumber($accountNumber)
6565 }
6666
6767 /**
68- * Obtain Statements from RB .
68+ * Obtain Statements from ČSas .
6969 *
70- * @param string $currencyCode CZK,USD etc
71- * @param string $statementLine
70+ * @param string $format pdf, xml, xml-data, abo-standard, abo-internal, abo-standard-extended, abo-internal-extended, csv-comma, csv-semicolon, mt940
7271 */
73- public function getStatements ($ currencyCode = 'CZK ' , $ statementLine = ' MAIN ' ): array
72+ public function getStatements ($ format = 'pdf ' ): array
7473 {
7574 $ apiInstance = new \SpojeNet \CSas \Accounts \DefaultApi ();
7675 $ page = 0 ;
@@ -79,16 +78,7 @@ public function getStatements($currencyCode = 'CZK', $statementLine = 'MAIN'): a
7978
8079 try {
8180 do {
82- $ requestBody = new Model \GetStatementsRequest ([
83- 'accountNumber ' => $ this ->accountNumber ,
84- 'page ' => ++$ page ,
85- 'size ' => 60 ,
86- 'currency ' => $ currencyCode ,
87- 'statementLine ' => $ statementLine ,
88- 'dateFrom ' => $ this ->since ->format (self ::$ dateFormat ),
89- 'dateTo ' => $ this ->until ->format (self ::$ dateFormat )]);
90-
91- $ result = $ apiInstance ->getAccountStatements ($ requestBody , $ page );
81+ $ result = $ apiInstance ->getAccountStatements ($ this ->getAccountNumber (), $ this ->getSince ()->format ('Y-m-d ' ), $ this ->getUntil ()->format ('Y-m-d ' ), $ format );
9282
9383 if (empty ($ result )) {
9484 $ this ->addStatusMessage (sprintf (_ ('No transactions from %s to %s ' ), $ this ->since ->format (self ::$ dateFormat ), $ this ->until ->format (self ::$ dateFormat )));
@@ -210,7 +200,9 @@ public function setScope($scope): \DatePeriod
210200 $ this ->since = $ this ->since ->setTime (0 , 0 );
211201 $ this ->until = $ this ->until ->setTime (23 , 59 , 59 , 999 );
212202 }
203+
213204 $ this ->scope = $ scope ;
205+
214206 return $ this ->getScope ();
215207 }
216208
@@ -278,8 +270,8 @@ public function getUntil(): \DateTime
278270 return $ this ->until ;
279271 }
280272
281- public function getAccountNumber (): string {
273+ public function getAccountNumber (): string
274+ {
282275 return $ this ->accountNumber ;
283276 }
284-
285277}
0 commit comments