From 0037fcbbba690e9d68aec9ab26fd495c357b15b0 Mon Sep 17 00:00:00 2001 From: Alex Kratky Date: Tue, 31 May 2022 09:44:18 +0200 Subject: [PATCH 1/3] added currency code to filter --- src/Filter/TransactionFilter.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Filter/TransactionFilter.php b/src/Filter/TransactionFilter.php index 10c0ccc..79338ee 100644 --- a/src/Filter/TransactionFilter.php +++ b/src/Filter/TransactionFilter.php @@ -3,6 +3,7 @@ namespace ThePay\ApiClient\Filter; use ThePay\ApiClient\Model\SignableRequest; +use ThePay\ApiClient\ValueObject\CurrencyCode; class TransactionFilter implements SignableRequest { @@ -15,29 +16,41 @@ class TransactionFilter implements SignableRequest /** @var \DateTime */ private $dateTo; + /** @var CurrencyCode|null */ + private $currencyCode; + /** * TransactionFilter constructor. * @param string $accountIban * @param \DateTime $dateFrom * @param \DateTime $dateTo + * @param string|null $currencyCode */ public function __construct( $accountIban, \DateTime $dateFrom, - \DateTime $dateTo + \DateTime $dateTo, + $currencyCode = null ) { $this->accountIban = $accountIban; $this->dateFrom = $dateFrom; $this->dateTo = $dateTo; + $this->currencyCode = $currencyCode !== null ? new CurrencyCode($currencyCode) : null; } public function toArray() { - return array( + $data = array( 'account_iban' => $this->accountIban, 'date_from' => $this->dateFrom, 'date_to' => $this->dateTo, ); + + if ($this->currencyCode !== null) { + $data['currency_code'] = (string) $this->currencyCode; + } + + return $data; } /** @@ -63,4 +76,12 @@ public function getDateTo() { return $this->dateTo; } + + /** + * @return CurrencyCode|null + */ + public function getCurrencyCode() + { + return $this->currencyCode; + } } From 14027c372132153c1f94cc017d1fba6cb41431fb Mon Sep 17 00:00:00 2001 From: Alex Kratky Date: Fri, 3 Jun 2022 09:00:56 +0200 Subject: [PATCH 2/3] array shapes for TransactionFilter::toArray() --- src/Filter/TransactionFilter.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Filter/TransactionFilter.php b/src/Filter/TransactionFilter.php index 79338ee..1738d96 100644 --- a/src/Filter/TransactionFilter.php +++ b/src/Filter/TransactionFilter.php @@ -38,6 +38,9 @@ public function __construct( $this->currencyCode = $currencyCode !== null ? new CurrencyCode($currencyCode) : null; } + /** + * @return array + */ public function toArray() { $data = array( From a983044715782d4c0e05e635f55f19cebc9a71d4 Mon Sep 17 00:00:00 2001 From: Alex Kratky Date: Fri, 3 Jun 2022 09:03:03 +0200 Subject: [PATCH 3/3] fix --- src/Filter/TransactionFilter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Filter/TransactionFilter.php b/src/Filter/TransactionFilter.php index 1738d96..2ec71c9 100644 --- a/src/Filter/TransactionFilter.php +++ b/src/Filter/TransactionFilter.php @@ -39,7 +39,7 @@ public function __construct( } /** - * @return array + * @return array{account_iban:string,date_from:\DateTime,date_to:\DateTime,currency_code?:string} */ public function toArray() {