Skip to content

Commit

Permalink
Update Gib.php
Browse files Browse the repository at this point in the history
  • Loading branch information
mlevent committed Jan 4, 2023
1 parent 19a410b commit b356e6e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/Gib.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Mlevent\Fatura\Enums\DocumentType;
use Mlevent\Fatura\Enums\ObjectionMethod;
use Mlevent\Fatura\Enums\Type;
use Mlevent\Fatura\Exceptions\ApiException;
use Mlevent\Fatura\Exceptions\InvalidArgumentException;
use Mlevent\Fatura\Exceptions\InvalidFormatException;
Expand Down Expand Up @@ -475,15 +476,16 @@ public function getAll(string $startDate, string $endDate): array
/**
* getAllIssuedToMe
*/
public function getAllIssuedToMe(string $startDate, string $endDate): array
public function getAllIssuedToMe(string $startDate, string $endDate, string $hourlySearch = 'NONE'): array
{
if (!FormatValidator::date($startDate) || !FormatValidator::date($endDate)) {
throw new InvalidFormatException('Tarih geçerli formatta değil.');
}
$response = new Client($this->getGateway('dispatch'),
$this->setParams(['EARSIV_PORTAL_ADIMA_KESILEN_BELGELERI_GETIR', 'RG_ALICI_TASLAKLAR'], [
'baslangic' => $startDate,
'bitis' => $endDate,
'baslangic' => $startDate,
'bitis' => $endDate,
'hourlySearchInterval' => $hourlySearch,
])
);
return $this->filterDocuments($response->get('data'));
Expand All @@ -492,8 +494,10 @@ public function getAllIssuedToMe(string $startDate, string $endDate): array
/**
* filterDocuments
*/
protected function filterDocuments(array $documents): array
protected function filterDocuments(?array $documents): array
{
if (is_null($documents)) return [];

if (sizeof($this->filters)) {
array_map(function ($key, $val) use (&$documents){
$documents = array_filter($documents, function ($document) use ($key, $val) {
Expand Down Expand Up @@ -715,4 +719,4 @@ public function getGateway(string $path): string
? self::API['gateways']['test']
: self::API['gateways']['prod']) . self::API['paths'][$path];
}
}
}

0 comments on commit b356e6e

Please sign in to comment.