Skip to content

Commit

Permalink
Merge pull request #22 from Morning-Train/feature/pdf-response
Browse files Browse the repository at this point in the history
Feature/pdf response
  • Loading branch information
mschadegg authored Mar 19, 2024
2 parents 300508e + 61521d5 commit f926142
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Classes/EconomicResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class EconomicResponse
{
protected int $statusCode;

protected array $body;
protected array|string $body;

public function __construct(int $statusCode, array $body)
public function __construct(int $statusCode, mixed $body)
{
$this->statusCode = $statusCode;
$this->body = $body;
Expand All @@ -19,7 +19,7 @@ public function getStatusCode(): int
return $this->statusCode;
}

public function getBody(): array
public function getBody(): mixed
{
return $this->body;
}
Expand Down
7 changes: 7 additions & 0 deletions src/DTOs/Invoice/Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
namespace Morningtrain\Economic\DTOs\Invoice;

use Morningtrain\Economic\Abstracts\Resource;
use Morningtrain\Economic\Classes\EconomicResponse;
use Morningtrain\Economic\Services\EconomicApiService;

class Pdf extends Resource
{
public ?string $download;

public function getPdfContent(): EconomicResponse
{
return EconomicApiService::get($this->download)->getBody();
}
}

0 comments on commit f926142

Please sign in to comment.