Skip to content

Commit

Permalink
KDV Oranlarında Yapılan Değişiklikler
Browse files Browse the repository at this point in the history
  • Loading branch information
mlevent committed Jul 15, 2023
1 parent 5d40a31 commit 22e63fe
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/getDocuments.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
$gib = (new Gib())->setTestCredentials('33333310', '1')
->login();

$documents = $gib//->onlyUnsigned() // imzalanmamış belgeler
$documents = $gib//->onlyUnsigned() // imzalanmamış belgeler
//->onlySigned() // imzalanmış belgeler
//->onlyDeleted() // silinmiş belgeler
//->onlyInvoice() // faturalar
Expand Down
1 change: 1 addition & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function __construct(string $url, ?array $parameters = null, bool $post =
$this->response = $response;
}
}
//if (!$this->response || (isset($this->response['data']) && !is_array($this->response['data'])) || isset($this->response['error']) || !empty($this->response['data']['hata'])) {
if (!$this->response || isset($this->response['error']) || !empty($this->response['data']['hata'])) {
throw new ApiException('İstek başarısız oldu.', $parameters, $this->response, $request->getStatusCode());
}
Expand Down
13 changes: 6 additions & 7 deletions src/Gib.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,20 +424,19 @@ public function getDownloadURL(string $uuid, bool $signed = true): string
* @param string|null $fileName
* @return string|boolean
*/
public function saveToDisk(string $uuid, string $dirName = null, string $fileName = null): string|bool
public function saveToDisk(string $uuid, ?string $dirName = null, ?string $fileName = null): string|bool
{
$saveDir = realpath($dirName ?? '.' . DIRECTORY_SEPARATOR);
$fullDir = join(DIRECTORY_SEPARATOR, [$saveDir, $fileName ?? $uuid]) . '.zip';
$options = [
'http' => [
'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
]
];

if (!$saveDir) {
throw new InvalidArgumentException("Geçersiz dosya yolu: {$dirName}");
}

$options = array(
'http' => array(
'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36'
)
);
if (file_put_contents($fullDir, file_get_contents($this->getDownloadURL($uuid), false, stream_context_create($options)))) {
return $fullDir;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/InvoiceItemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function __construct(
public string $gtip = '',
) {
// KDV oranı
if (!in_array($this->kdvOrani, [0,1,8,18])) {
if (!in_array($this->kdvOrani, [0,1,8,10,18,20])) {
throw new InvalidArgumentException('Geçersiz KDV oranı.', $this);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Models/SelfEmployedReceiptItemModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function __construct(
public float $netAlinan = 0,
) {
// KDV oranı
if (!in_array($this->kdvOrani, [0,1,8,18])) {
if (!in_array($this->kdvOrani, [0,1,8,10,18,20])) {
throw new InvalidArgumentException('Geçersiz KDV oranı.', $this);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Traits/ImportableTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function modelMap(array $data): array
// içe aktarılan veride eksik olan ancak modelde default bulunan parametreler
} else {
if (!$param->isDefaultValueAvailable()) {
throw new InvalidArgumentException('Modele eksik parametre iletildi.', $data, $constructParameters);
throw new InvalidArgumentException("Parametre eksik gönderildi: {$param->name}", $data, $constructParameters);
}
$newData[$param->name] = $param->getDefaultValue();
}
Expand Down

0 comments on commit 22e63fe

Please sign in to comment.