Skip to content

Commit

Permalink
Merge pull request #84 from vekkon/document-service
Browse files Browse the repository at this point in the history
New Document Service
  • Loading branch information
vienthuong authored Feb 5, 2024
2 parents a784218 + a710c73 commit 471f0a0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Service/DocumentService.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Vin\ShopwareSdk\Service;

class DocumentService extends ApiService
{
private const DOCUMENT_DOWNLOAD_ENDPOINT = '/api/_action/document/%s/%s?download=1';
private const INVOICE_DOCUMENT_CREATE_ENDPOINT = '/api/_action/document/invoice/create';

Check failure on line 8 in src/Service/DocumentService.php

View workflow job for this annotation

GitHub Actions / phpstan

Constant Vin\ShopwareSdk\Service\DocumentService::INVOICE_DOCUMENT_CREATE_ENDPOINT is unused.

public function downloadDocumentPdfByIdAndDeepLink($documentId, $documentDeeplink)

Check failure on line 10 in src/Service/DocumentService.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Vin\ShopwareSdk\Service\DocumentService::downloadDocumentPdfByIdAndDeepLink() has no return type specified.

Check failure on line 10 in src/Service/DocumentService.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Vin\ShopwareSdk\Service\DocumentService::downloadDocumentPdfByIdAndDeepLink() has parameter $documentDeeplink with no type specified.

Check failure on line 10 in src/Service/DocumentService.php

View workflow job for this annotation

GitHub Actions / phpstan

Method Vin\ShopwareSdk\Service\DocumentService::downloadDocumentPdfByIdAndDeepLink() has parameter $documentId with no type specified.
{
$path = sprintf(self::DOCUMENT_DOWNLOAD_ENDPOINT, $documentId, $documentDeeplink);

$response = $this->httpClient->get(
$this->getFullUrl($path),
[
'headers' => $this->getBasicHeaders(),
]
);

return $response->getBody()->getContents();
}
}

0 comments on commit 471f0a0

Please sign in to comment.