diff --git a/.gitignore b/.gitignore index b840dac..0df0b70 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor test.php *.cache +*.txt diff --git a/src/Api/AuthenticatedApi.php b/src/Api/AuthenticatedApi.php index bb142a1..3fa2adb 100644 --- a/src/Api/AuthenticatedApi.php +++ b/src/Api/AuthenticatedApi.php @@ -2,7 +2,10 @@ namespace IPay\Api; +use IPay\Entity\Account; use IPay\Entity\Customer; +use IPay\Entity\Transaction; +use League\ObjectMapper\IterableList; /** * @extends AbstractApi @@ -16,4 +19,39 @@ public function customer(): Customer $this->post('/getCustomerDetails')['customerInfo'], ); } + + /** + * @return IterableList + */ + public function accounts(): IterableList + { + return $this->objectMapper->hydrateObjects( + Account::class, + $this->post('/getEntitiesAndAccounts')['accounts'], + ); + } + + /** + * @return IterableList + */ + public function historyTransactions( + string $accountNumber, + \DateTimeInterface $startDate, + \DateTimeInterface $endDate = new \DateTime(), + int $pageNumber = 0, + int $maxResult = 999999999, + ): IterableList { + $parameters = get_defined_vars(); + + foreach ($parameters as &$value) { + if ($value instanceof \DateTimeInterface) { + $value = $value->format('Y-m-d'); + } + } + + return $this->objectMapper->hydrateObjects( + Transaction::class, + $this->post('/getHistTransactions', $parameters)['transactions'] + ); + } } diff --git a/src/Entity/Account.php b/src/Entity/Account.php new file mode 100644 index 0000000..f96e1c8 --- /dev/null +++ b/src/Entity/Account.php @@ -0,0 +1,28 @@ +