Skip to content

Commit

Permalink
v1.2.1 - Fixed PDF methods
Browse files Browse the repository at this point in the history
  • Loading branch information
theposeidonas committed Oct 7, 2024
1 parent 006cb05 commit eecee6e
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 25 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
### Changelog

#### V1.2.1

**7 Ekim 2024**

- EArchive, EBill ve ESmm modüllerindeki PDF fonksiyonları düzeltildi.
- İlgili testler düzeltildi
- Github Actions dosyası düzeltildi.


#### V1.2.0-beta

**5 Ekim 2024**
Expand Down
4 changes: 4 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ Parasut::StockMovement(); // Stock Movement https://apidocs.parasut.
Parasut::Category(); // Category https://apidocs.parasut.com/#tag/ItemCategories
Parasut::Tag(); // Tag https://apidocs.parasut.com/#tag/Tags

/* Other */
Parasut::ApiHome(); // Api Home https://apidocs.parasut.com/#tag/ApiHome
Parasut::TrackableJob(); // Trackable Job https://apidocs.parasut.com/#tag/TrackableJobs
Parasut::Webhook(); // Webhooks https://apidocs.parasut.com/#tag/Webhooks
```

_Apart from these, to check the stock level of products, you need to use ```Parasut::Product()->inventory($id); ```_
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ Parasut::StockMovement(); // Stok Hareketi https://apidocs.parasut.
/* Ayarlar */
Parasut::Category(); // Kategori https://apidocs.parasut.com/#tag/ItemCategories
Parasut::Tag(); // Etiket https://apidocs.parasut.com/#tag/Tags

/* Other */
Parasut::ApiHome(); // Api Home https://apidocs.parasut.com/#tag/ApiHome
Parasut::TrackableJob(); // Trackable Job https://apidocs.parasut.com/#tag/TrackableJobs
Parasut::Webhook(); // Webhooks https://apidocs.parasut.com/#tag/Webhooks
```

_Bunlar dışında kalan, ürünlerin stok seviyesini kontrol etmek için ```Parasut::Product()->inventory($id); ``` kullanmanız gerekir._
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Paraşüt v4 API for Laravel Projects",
"keywords": ["laravel", "Parasut", "Paraşüt"],
"license": "MIT",
"version": "v1.2.0",
"version": "v1.2.1",
"authors": [
{
"name": "Baran Arda",
Expand Down
7 changes: 1 addition & 6 deletions src/Models/Formalization/EArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ public function showPDF(string $id): array
'Content-Type' => 'application/json',
])->get($this->serviceUrl.'/'.$id.'/pdf');

return [
'success' => $response->successful(),
'error' => !$response->successful(),
'body' => $response->body(),
'status' => $response->status()
];
return $this->handleResponse($response);
}

}
7 changes: 1 addition & 6 deletions src/Models/Formalization/EBill.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,7 @@ public function showPDF(string $id): array
'Content-Type' => 'application/pdf',
])->get($this->serviceUrl.'/'.$id.'/pdf');

return [
'success' => $response->successful(),
'error' => !$response->successful(),
'body' => $response->body(),
'status' => $response->status()
];
return $this->handleResponse($response);
}


Expand Down
7 changes: 1 addition & 6 deletions src/Models/Formalization/ESmm.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,7 @@ public function showPDF(string $id): array
'Authorization' => 'Bearer '.$this->token,
'Content-Type' => 'application/pdf',
])->get($this->serviceUrl.'/'.$id.'/pdf');
return [
'success' => $response->successful(),
'error' => !$response->successful(),
'body' => $response->body(),
'status' => $response->status()
];
return $this->handleResponse($response);
}

}
6 changes: 4 additions & 2 deletions tests/Feature/FormalizationTest/EArchiveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ public function test_show_earchive()
public function test_show_earchive_pdf()
{
Http::fake([
config('parasut.api_url').config('parasut.company_id').'/e_archives/1/pdf' => Http::response('PDF content', 200)
config('parasut.api_url').config('parasut.company_id').'/e_archives/1/pdf' => Http::response([
'data' => ['id' => '1', 'type' => 'e_document_pdfs', 'attributes' => ['url' => 'pdf-url123.pdf', 'expires_at'=>'2024-10-07T09:57:49Z']]
], 200)
]);

$response = $this->eArchive->showPDF('1');

$this->assertTrue($response['success']);
$this->assertEquals('PDF content', $response['body']);
$this->assertEquals('pdf-url123.pdf', $response['body']->data->attributes->url);
}
}
6 changes: 4 additions & 2 deletions tests/Feature/FormalizationTest/EBillTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ public function test_show_ebill()
public function test_show_ebill_pdf()
{
Http::fake([
config('parasut.api_url').config('parasut.company_id').'/e_invoices/1/pdf' => Http::response('PDF content', 200)
config('parasut.api_url').config('parasut.company_id').'/e_invoices/1/pdf' => Http::response([
'data' => ['id' => '1', 'type' => 'e_document_pdfs', 'attributes' => ['url' => 'pdf-url123.pdf', 'expires_at'=>'2024-10-07T09:57:49Z']]
], 200)
]);

$response = $this->eBill->showPDF('1');

$this->assertTrue($response['success']);
$this->assertEquals('PDF content', $response['body']);
$this->assertEquals('pdf-url123.pdf', $response['body']->data->attributes->url);
}
}
6 changes: 4 additions & 2 deletions tests/Feature/FormalizationTest/ESmmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ public function test_show_esmm()
public function test_show_esmm_pdf()
{
Http::fake([
config('parasut.api_url').config('parasut.company_id').'/e_smms/1/pdf' => Http::response('PDF content', 200)
config('parasut.api_url').config('parasut.company_id').'/e_smms/1/pdf' => Http::response([
'data' => ['id' => '1', 'type' => 'e_document_pdfs', 'attributes' => ['url' => 'pdf-url123.pdf', 'expires_at'=>'2024-10-07T09:57:49Z']]
], 200)
]);

$response = $this->eSmm->showPDF('1');

$this->assertTrue($response['success']);
$this->assertEquals('PDF content', $response['body']);
$this->assertEquals('pdf-url123.pdf', $response['body']->data->attributes->url);
}
}

0 comments on commit eecee6e

Please sign in to comment.