From ac7a56167f4d2ad859dee0c8c79f4c49d6b374fb Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Wed, 15 Oct 2025 09:04:12 +0200 Subject: [PATCH 1/3] Add the file endpoint to download documents --- src/Clients/Traits/DocumentClientTrait.php | 27 +++++++----------- src/Clients/Traits/FileClientTrait.php | 19 +++++++++++++ tests/Clients/CreditNoteTest.php | 33 ++++++++++------------ tests/Clients/DeliveryNoteTest.php | 33 ++++++++++------------ tests/Clients/DownPaymentInvoiceTest.php | 33 ++++++++++------------ tests/Clients/DunningTest.php | 33 ++++++++++------------ tests/Clients/InvoiceTest.php | 33 ++++++++++------------ tests/Clients/OrderConfirmationTest.php | 33 ++++++++++------------ tests/Clients/QuotationTest.php | 33 ++++++++++------------ 9 files changed, 134 insertions(+), 143 deletions(-) create mode 100644 src/Clients/Traits/FileClientTrait.php diff --git a/src/Clients/Traits/DocumentClientTrait.php b/src/Clients/Traits/DocumentClientTrait.php index 7baa134..97572bb 100644 --- a/src/Clients/Traits/DocumentClientTrait.php +++ b/src/Clients/Traits/DocumentClientTrait.php @@ -5,33 +5,26 @@ namespace Sysix\LexOffice\Clients\Traits; use Psr\Http\Message\ResponseInterface; -use Sysix\LexOffice\Clients\File; -use Sysix\LexOffice\Utils; +/** + * @deprecated use the FileClientTrait instead + */ trait DocumentClientTrait { + use FileClientTrait; + public function document(string $id, bool $asContent = false, string $acceptHeader = '*/*'): ResponseInterface { - $response = $this->api - ->newRequest('GET', $this->resource . '/' . rawurlencode($id) . '/document') - ->getResponse(); + trigger_error(__METHOD__.' should not be called anymore, in future versions this method WILL not exist', E_USER_DEPRECATED); if ($asContent === false) { - return $response; - } - - if ($response->getStatusCode() !== 200) { - return $response; - } + $response = $this->api + ->newRequest('GET', $this->resource . '/' . rawurlencode($id) . '/document') + ->getResponse(); - $content = Utils::getJsonFromResponse($response); - - if ($content === null || !is_object($content) || !property_exists($content, 'documentFileId') || !is_string($content->documentFileId)) { return $response; } - $fileClient = new File($this->api); - - return $fileClient->get($content->documentFileId, $acceptHeader); + return $this->file($id, $acceptHeader); } } diff --git a/src/Clients/Traits/FileClientTrait.php b/src/Clients/Traits/FileClientTrait.php new file mode 100644 index 0000000..1b1664f --- /dev/null +++ b/src/Clients/Traits/FileClientTrait.php @@ -0,0 +1,19 @@ +api->newRequest('GET', $this->resource . '/' . rawurlencode($id) . '/file'); + + return $this->api + ->setRequest($this->api->getRequest()->withHeader('Accept', $acceptHeader)) + ->getResponse(); + } +} diff --git a/tests/Clients/CreditNoteTest.php b/tests/Clients/CreditNoteTest.php index fd0e335..7f4754d 100644 --- a/tests/Clients/CreditNoteTest.php +++ b/tests/Clients/CreditNoteTest.php @@ -143,6 +143,8 @@ public function testGetVoucherListClient(): void public function testDocument(): void { + $this->expectDeprecationV1Warning('document'); + [$api, $stub] = $this->createClientMockObject(CreditNote::class); $response = $stub->document('resource-id'); @@ -158,13 +160,9 @@ public function testDocument(): void public function testDocumentContent(): void { - [$api, $stub] = $this->createClientMultiMockObject( - CreditNote::class, - [ - new Response(200, ['Content-Type' => 'application/json'], '{"documentFileId": "fake-id"}'), - new Response() - ] - ); + $this->expectDeprecationV1Warning('document'); + + [$api, $stub] = $this->createClientMockObject(CreditNote::class); $response = $stub->document('resource-id', true); @@ -172,24 +170,23 @@ public function testDocumentContent(): void $this->assertEquals('GET', $api->getRequest()->getMethod()); $this->assertEquals( - $api->apiUrl . '/v1/files/fake-id', + $api->apiUrl . '/v1/credit-notes/resource-id/file', $api->getRequest()->getUri()->__toString() ); } - public function testFailedDocumentContent(): void + public function testFileContent(): void { - [, $stub] = $this->createClientMultiMockObject( - CreditNote::class, - [ - new Response(500), - new Response() - ] - ); + [$api, $stub] = $this->createClientMockObject(CreditNote::class); - $response = $stub->document('resource-id', true); + $response = $stub->file('resource-id'); $this->assertInstanceOf(ResponseInterface::class, $response); - $this->assertEquals(500, $response->getStatusCode()); + + $this->assertEquals('GET', $api->getRequest()->getMethod()); + $this->assertEquals( + $api->apiUrl . '/v1/credit-notes/resource-id/file', + $api->getRequest()->getUri()->__toString() + ); } } diff --git a/tests/Clients/DeliveryNoteTest.php b/tests/Clients/DeliveryNoteTest.php index be87497..02ddbd9 100644 --- a/tests/Clients/DeliveryNoteTest.php +++ b/tests/Clients/DeliveryNoteTest.php @@ -109,6 +109,8 @@ public function testGetVoucherListClient(): void public function testDocument(): void { + $this->expectDeprecationV1Warning('document'); + [$api, $stub] = $this->createClientMockObject(DeliveryNote::class); $response = $stub->document('resource-id'); @@ -124,13 +126,9 @@ public function testDocument(): void public function testDocumentContent(): void { - [$api, $stub] = $this->createClientMultiMockObject( - DeliveryNote::class, - [ - new Response(200, ['Content-Type' => 'application/json'], '{"documentFileId": "fake-id"}'), - new Response() - ] - ); + $this->expectDeprecationV1Warning('document'); + + [$api, $stub] = $this->createClientMockObject(DeliveryNote::class); $response = $stub->document('resource-id', true); @@ -138,24 +136,23 @@ public function testDocumentContent(): void $this->assertEquals('GET', $api->getRequest()->getMethod()); $this->assertEquals( - $api->apiUrl . '/v1/files/fake-id', + $api->apiUrl . '/v1/delivery-notes/resource-id/file', $api->getRequest()->getUri()->__toString() ); } - public function testFailedDocumentContent(): void + public function testFileContent(): void { - [, $stub] = $this->createClientMultiMockObject( - DeliveryNote::class, - [ - new Response(500), - new Response() - ] - ); + [$api, $stub] = $this->createClientMockObject(DeliveryNote::class); - $response = $stub->document('resource-id', true); + $response = $stub->file('resource-id'); $this->assertInstanceOf(ResponseInterface::class, $response); - $this->assertEquals(500, $response->getStatusCode()); + + $this->assertEquals('GET', $api->getRequest()->getMethod()); + $this->assertEquals( + $api->apiUrl . '/v1/delivery-notes/resource-id/file', + $api->getRequest()->getUri()->__toString() + ); } } diff --git a/tests/Clients/DownPaymentInvoiceTest.php b/tests/Clients/DownPaymentInvoiceTest.php index 9b86a80..24361ce 100644 --- a/tests/Clients/DownPaymentInvoiceTest.php +++ b/tests/Clients/DownPaymentInvoiceTest.php @@ -58,6 +58,8 @@ public function testGetVoucherListClient(): void public function testDocument(): void { + $this->expectDeprecationV1Warning('document'); + [$api, $stub] = $this->createClientMockObject(DownPaymentInvoice::class); $response = $stub->document('resource-id'); @@ -73,13 +75,9 @@ public function testDocument(): void public function testDocumentContent(): void { - [$api, $stub] = $this->createClientMultiMockObject( - DownPaymentInvoice::class, - [ - new Response(200, ['Content-Type' => 'application/json'], '{"documentFileId": "fake-id"}'), - new Response() - ] - ); + $this->expectDeprecationV1Warning('document'); + + [$api, $stub] = $this->createClientMockObject(DownPaymentInvoice::class); $response = $stub->document('resource-id', true); @@ -87,24 +85,23 @@ public function testDocumentContent(): void $this->assertEquals('GET', $api->getRequest()->getMethod()); $this->assertEquals( - $api->apiUrl . '/v1/files/fake-id', + $api->apiUrl . '/v1/down-payment-invoices/resource-id/file', $api->getRequest()->getUri()->__toString() ); } - public function testFailedDocumentContent(): void + public function testFileContent(): void { - [, $stub] = $this->createClientMultiMockObject( - DownPaymentInvoice::class, - [ - new Response(500), - new Response() - ] - ); + [$api, $stub] = $this->createClientMockObject(DownPaymentInvoice::class); - $response = $stub->document('resource-id', true); + $response = $stub->file('resource-id'); $this->assertInstanceOf(ResponseInterface::class, $response); - $this->assertEquals(500, $response->getStatusCode()); + + $this->assertEquals('GET', $api->getRequest()->getMethod()); + $this->assertEquals( + $api->apiUrl . '/v1/down-payment-invoices/resource-id/file', + $api->getRequest()->getUri()->__toString() + ); } } diff --git a/tests/Clients/DunningTest.php b/tests/Clients/DunningTest.php index 4025639..ae61dfc 100644 --- a/tests/Clients/DunningTest.php +++ b/tests/Clients/DunningTest.php @@ -45,6 +45,8 @@ public function testPursue(): void public function testDocument(): void { + $this->expectDeprecationV1Warning('document'); + [$api, $stub] = $this->createClientMockObject(Dunning::class); $response = $stub->document('resource-id'); @@ -60,13 +62,9 @@ public function testDocument(): void public function testDocumentContent(): void { - [$api, $stub] = $this->createClientMultiMockObject( - Dunning::class, - [ - new Response(200, ['Content-Type' => 'application/json'], '{"documentFileId": "fake-id"}'), - new Response() - ] - ); + $this->expectDeprecationV1Warning('document'); + + [$api, $stub] = $this->createClientMockObject(Dunning::class); $response = $stub->document('resource-id', true); @@ -74,24 +72,23 @@ public function testDocumentContent(): void $this->assertEquals('GET', $api->getRequest()->getMethod()); $this->assertEquals( - $api->apiUrl . '/v1/files/fake-id', + $api->apiUrl . '/v1/dunnings/resource-id/file', $api->getRequest()->getUri()->__toString() ); } - public function testFailedDocumentContent(): void + public function testFileContent(): void { - [, $stub] = $this->createClientMultiMockObject( - Dunning::class, - [ - new Response(500), - new Response() - ] - ); + [$api, $stub] = $this->createClientMockObject(Dunning::class); - $response = $stub->document('resource-id', true); + $response = $stub->file('resource-id'); $this->assertInstanceOf(ResponseInterface::class, $response); - $this->assertEquals(500, $response->getStatusCode()); + + $this->assertEquals('GET', $api->getRequest()->getMethod()); + $this->assertEquals( + $api->apiUrl . '/v1/dunnings/resource-id/file', + $api->getRequest()->getUri()->__toString() + ); } } diff --git a/tests/Clients/InvoiceTest.php b/tests/Clients/InvoiceTest.php index 7926e18..2384738 100644 --- a/tests/Clients/InvoiceTest.php +++ b/tests/Clients/InvoiceTest.php @@ -143,6 +143,8 @@ public function testGetVoucherListClient(): void public function testDocument(): void { + $this->expectDeprecationV1Warning('document'); + [$api, $stub] = $this->createClientMockObject(Invoice::class); $response = $stub->document('resource-id'); @@ -158,13 +160,9 @@ public function testDocument(): void public function testDocumentContent(): void { - [$api, $stub] = $this->createClientMultiMockObject( - Invoice::class, - [ - new Response(200, ['Content-Type' => 'application/json'], '{"documentFileId": "fake-id"}'), - new Response() - ] - ); + $this->expectDeprecationV1Warning('document'); + + [$api, $stub] = $this->createClientMockObject(Invoice::class); $response = $stub->document('resource-id', true); @@ -172,24 +170,23 @@ public function testDocumentContent(): void $this->assertEquals('GET', $api->getRequest()->getMethod()); $this->assertEquals( - $api->apiUrl . '/v1/files/fake-id', + $api->apiUrl . '/v1/invoices/resource-id/file', $api->getRequest()->getUri()->__toString() ); } - public function testFailedDocumentContent(): void + public function testFileContent(): void { - [, $stub] = $this->createClientMultiMockObject( - Invoice::class, - [ - new Response(500), - new Response() - ] - ); + [$api, $stub] = $this->createClientMockObject(Invoice::class); - $response = $stub->document('resource-id', true); + $response = $stub->file('resource-id'); $this->assertInstanceOf(ResponseInterface::class, $response); - $this->assertEquals(500, $response->getStatusCode()); + + $this->assertEquals('GET', $api->getRequest()->getMethod()); + $this->assertEquals( + $api->apiUrl . '/v1/invoices/resource-id/file', + $api->getRequest()->getUri()->__toString() + ); } } diff --git a/tests/Clients/OrderConfirmationTest.php b/tests/Clients/OrderConfirmationTest.php index 05914f1..74f8dfe 100644 --- a/tests/Clients/OrderConfirmationTest.php +++ b/tests/Clients/OrderConfirmationTest.php @@ -109,6 +109,8 @@ public function testGetVoucherListClient(): void public function testDocument(): void { + $this->expectDeprecationV1Warning('document'); + [$api, $stub] = $this->createClientMockObject(OrderConfirmation::class); $response = $stub->document('resource-id'); @@ -124,13 +126,9 @@ public function testDocument(): void public function testDocumentContent(): void { - [$api, $stub] = $this->createClientMultiMockObject( - OrderConfirmation::class, - [ - new Response(200, ['Content-Type' => 'application/json'], '{"documentFileId": "fake-id"}'), - new Response() - ] - ); + $this->expectDeprecationV1Warning('document'); + + [$api, $stub] = $this->createClientMockObject(OrderConfirmation::class); $response = $stub->document('resource-id', true); @@ -138,24 +136,23 @@ public function testDocumentContent(): void $this->assertEquals('GET', $api->getRequest()->getMethod()); $this->assertEquals( - $api->apiUrl . '/v1/files/fake-id', + $api->apiUrl . '/v1/order-confirmations/resource-id/file', $api->getRequest()->getUri()->__toString() ); } - public function testFailedDocumentContent(): void + public function testFileContent(): void { - [, $stub] = $this->createClientMultiMockObject( - OrderConfirmation::class, - [ - new Response(500), - new Response() - ] - ); + [$api, $stub] = $this->createClientMockObject(OrderConfirmation::class); - $response = $stub->document('resource-id', true); + $response = $stub->file('resource-id'); $this->assertInstanceOf(ResponseInterface::class, $response); - $this->assertEquals(500, $response->getStatusCode()); + + $this->assertEquals('GET', $api->getRequest()->getMethod()); + $this->assertEquals( + $api->apiUrl . '/v1/order-confirmations/resource-id/file', + $api->getRequest()->getUri()->__toString() + ); } } diff --git a/tests/Clients/QuotationTest.php b/tests/Clients/QuotationTest.php index e2c250f..4701b8e 100644 --- a/tests/Clients/QuotationTest.php +++ b/tests/Clients/QuotationTest.php @@ -92,6 +92,8 @@ public function testGetVoucherListClient(): void public function testDocument(): void { + $this->expectDeprecationV1Warning('document'); + [$api, $stub] = $this->createClientMockObject(Quotation::class); $response = $stub->document('resource-id'); @@ -107,13 +109,9 @@ public function testDocument(): void public function testDocumentContent(): void { - [$api, $stub] = $this->createClientMultiMockObject( - Quotation::class, - [ - new Response(200, ['Content-Type' => 'application/json'], '{"documentFileId": "fake-id"}'), - new Response() - ] - ); + $this->expectDeprecationV1Warning('document'); + + [$api, $stub] = $this->createClientMockObject(Quotation::class); $response = $stub->document('resource-id', true); @@ -121,24 +119,23 @@ public function testDocumentContent(): void $this->assertEquals('GET', $api->getRequest()->getMethod()); $this->assertEquals( - $api->apiUrl . '/v1/files/fake-id', + $api->apiUrl . '/v1/quotations/resource-id/file', $api->getRequest()->getUri()->__toString() ); } - public function testFailedDocumentContent(): void + public function testFileContent(): void { - [, $stub] = $this->createClientMultiMockObject( - Quotation::class, - [ - new Response(500), - new Response() - ] - ); + [$api, $stub] = $this->createClientMockObject(Quotation::class); - $response = $stub->document('resource-id', true); + $response = $stub->file('resource-id'); $this->assertInstanceOf(ResponseInterface::class, $response); - $this->assertEquals(500, $response->getStatusCode()); + + $this->assertEquals('GET', $api->getRequest()->getMethod()); + $this->assertEquals( + $api->apiUrl . '/v1/quotations/resource-id/file', + $api->getRequest()->getUri()->__toString() + ); } } From 7d558a9ef0289eaba752120f1701e17074da7701 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Thu, 16 Oct 2025 09:33:16 +0200 Subject: [PATCH 2/3] CS --- psalm.xml | 1 + tests/Clients/DunningTest.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/psalm.xml b/psalm.xml index 1dc440d..f9d097c 100644 --- a/psalm.xml +++ b/psalm.xml @@ -18,6 +18,7 @@ + diff --git a/tests/Clients/DunningTest.php b/tests/Clients/DunningTest.php index ae61dfc..08aa910 100644 --- a/tests/Clients/DunningTest.php +++ b/tests/Clients/DunningTest.php @@ -4,7 +4,6 @@ namespace Sysix\LexOffice\Tests\Clients; -use GuzzleHttp\Psr7\Response; use Psr\Http\Message\ResponseInterface; use Sysix\LexOffice\Clients\Dunning; use Sysix\LexOffice\Tests\TestClient; From f8ea043dde1c8d11b6c6b17366ab990cbaad4df5 Mon Sep 17 00:00:00 2001 From: Sysix Date: Tue, 21 Oct 2025 22:05:37 +0200 Subject: [PATCH 3/3] update readme --- README.md | 63 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index b1431e9..567c8b5 100644 --- a/README.md +++ b/README.md @@ -8,28 +8,28 @@ ## Requirements -PHP: >= 8.1 -Extensions: +PHP: >= 8.1 +Extensions: - [Composer](https://getcomposer.org/) - [PHP-JSON](https://www.php.net/manual/en/book.json.php) - [PSR-18 HTTP-Client](https://packagist.org/providers/psr/http-client-implementation) ## Install -composer: +composer: `composer require sysix/lex-office-api` ## Usage -Search for the [official API Documentation](https://developers.lexoffice.io/docs/). +Search for the [official API Documentation](https://developers.lexoffice.io/docs/). You need an [API Key](https://app.lexoffice.de/addons/public-api) for that. ### Basic ```php // store keys in .env file -$apiKey = getenv('LEXOFFICE_API_KEY'); +$apiKey = getenv('LEXOFFICE_API_KEY'); -// in this example we are using guzzlehttp/guzzle package, it can be any PSR-18 HTTP Client +// in this example we are using guzzlehttp/guzzle package, it can be any PSR-18 HTTP Client // see: https://packagist.org/providers/psr/http-client-implementation $httpClient = \GuzzleHttp\Client(); $api = new \Sysix\LexOffice\Api($apiKey, $httpClient); @@ -37,13 +37,13 @@ $api = new \Sysix\LexOffice\Api($apiKey, $httpClient); ### Optimize your HTTP Client -This library only prepares the `\Psr\Http\Message\RequestInterface` for the HTTP Client and returns its Response. -There are almost no error checks, no caching and no rate limiting. Your PSR-18 HTTP Client should come with a way to deal with it. +This library only prepares the `\Psr\Http\Message\RequestInterface` for the HTTP Client and returns its Response. +There are almost no error checks, no caching and no rate limiting. Your PSR-18 HTTP Client should come with a way to deal with it. Here is a example with `guzzlehttp/guzzle` , `kevinrob/guzzle-cache-middleware` and `spatie/guzzle-rate-limiter-middleware`: ```php -$apiKey = getenv('LEXOFFICE_API_KEY'); +$apiKey = getenv('LEXOFFICE_API_KEY'); $stack = \GuzzleHttp\HandlerStack::create(); $stack->push(new \Kevinrob\GuzzleCache\CacheMiddleware(), 'cache'); @@ -72,7 +72,7 @@ $client->type = 'PRODUCT'; // get a page -$response = $client->getPage(0); +$response = $client->getPage(0); // other methods $response = $client->get($entityId); @@ -96,7 +96,7 @@ $client->customer = true; $client->vendor = false; // get a page -$response = $client->getPage(0); +$response = $client->getPage(0); // other methods $response = $client->get($entityId); @@ -118,9 +118,13 @@ $response = $api->creditNote()->create($data); $response = $api->creditNote()->create($data, true); // finalized $response = $api->creditNote()->pursue($precedingSalesVoucherId, $data); $response = $api->creditNote()->pursue($precedingSalesVoucherId, $data, true); // finalized +$response = $api->creditNote()->file($entityId); // get file content +$response = $api->creditNote()->file($entityId, 'application/xml'); // as XRechnung + +// deprecated methods: $response = $api->creditNote()->document($entityId); // get document ID $response = $api->creditNote()->document($entityId, true); // get file content -$response = $api->creditNote()->document($entityId, true, 'image/*'); // accept only images +$response = $api->creditNote()->document($entityId, true, 'application/xml'); // as XRechnung ``` ### Deliverys Notes Endpoint @@ -129,9 +133,11 @@ $voucherList = $api->deliveryNote()->getVoucherListClient(); // see VoucherlistC $response = $api->deliveryNote()->get($entityId); $response = $api->deliveryNote()->create($data); $response = $api->deliveryNote()->pursue($precedingSalesVoucherId, $data); +$response = $api->deliveryNote()->file($entityId); // get file content + +// deprecated methods: $response = $api->deliveryNote()->document($entityId); // get document ID $response = $api->deliveryNote()->document($entityId, true); // get file content -$response = $api->deliveryNote()->document($entityId, true, 'image/*'); // accept only images ``` ### Down Payment Invoices Endpoint @@ -139,18 +145,24 @@ $response = $api->deliveryNote()->document($entityId, true, 'image/*'); // accep $voucherList = $api->downPaymentInvoice()->getVoucherListClient(); // see VoucherlistClient Documentation $response = $api->downPaymentInvoice()->get($entityId); $response = $api->downPaymentInvoice()->create($data); +$response = $api->downPaymentInvoice()->file($entityId); // get file content +$response = $api->downPaymentInvoice()->file($entityId, 'application/xml'); // as XRechnung + +// deprecated methods: $response = $api->downPaymentInvoice()->document($entityId); // get document ID $response = $api->downPaymentInvoice()->document($entityId, true); // get file content -$response = $api->downPaymentInvoice()->document($entityId, true, 'image/*'); // accept only images +$response = $api->downPaymentInvoice()->document($entityId, true, 'application/xml'); // as XRechnung ``` ### Dunnings Endpoint ```php $response = $api->dunning()->get($entityId); $response = $api->dunning()->pursue($precedingSalesVoucherId, $data); +$response = $api->dunning()->file($entityId); // get file content + +// deprecated methods: $response = $api->dunning()->document($entityId); // get document ID $response = $api->dunning()->document($entityId, true); // get file content -$response = $api->dunning()->document($entityId, true, 'image/*'); // accept only images ``` ### Event Subscriptions Endpooint @@ -177,10 +189,13 @@ $response = $api->invoice()->create($data); $response = $api->invoice()->create($data, true); // finalized $response = $api->invoice()->pursue($precedingSalesVoucherId, $data); $response = $api->invoice()->pursue($precedingSalesVoucherId, $data, true); // finalized +$response = $api->invoice()->file($entityId); // get file content +$response = $api->invoice()->file($entityId, 'application/xml'); // as XRechnung + +// deprecated methods: $response = $api->invoice()->document($entityId); // get document ID $response = $api->invoice()->document($entityId, true); // get file content -$response = $api->invoice()->document($entityId, true, 'image/*'); // accept only images -$response = $api->invoice()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible) +$response = $api->invoice()->document($entityId, true, 'application/xml'); // as XRechung XML File ``` ### Order Confirmation Endpoint @@ -189,9 +204,11 @@ $voucherList = $api->orderConfirmation()->getVoucherListClient(); // see Voucher $response = $api->orderConfirmation()->get($entityId); $response = $api->orderConfirmation()->create($data); $response = $api->orderConfirmation()->pursue($precedingSalesVoucherId, $data); +$response = $api->orderConfirmation()->file($entityId); // get file content + +// deprecated methods: $response = $api->orderConfirmation()->document($entityId); // get document ID $response = $api->orderConfirmation()->document($entityId, true); // get file content -$response = $api->orderConfirmation()->document($entityId, true, 'image/*'); // accept only images ``` ### Payment Endpoint @@ -225,9 +242,11 @@ $voucherList = $api->quotation()->getVoucherListClient(); // see VoucherlistClie $response = $api->quotation()->get($entityId); $response = $api->quotation()->create($data); $response = $api->quotation()->create($data, true); // finalized +$response = $api->quotation()->file($entityId); // get file content + +// deprecated methods: $response = $api->quotation()->document($entityId); // get document ID $response = $api->quotation()->document($entityId, true); // get file content -$response = $api->quotation()->document($entityId, true, 'image/*'); // accept only images ``` ### Recurring Templates Endpoint @@ -252,10 +271,6 @@ $response = $api->recurringTemplate()->get($entityId); $response = $api->voucher()->get($entityId); $response = $api->voucher()->create($data); $response = $api->voucher()->update($entityId, $data); -$response = $api->voucher()->document($entityId); // get document ID -$response = $api->voucher()->document($entityId, true); // get file content -$response = $api->voucher()->document($entityId, true, 'image/*'); // accept only images -$response = $api->voucher()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible) $response = $api->voucher()->upload($entitiyId, $filepath); ``` @@ -304,7 +319,7 @@ $client->updatedDateTo = new \DateTime('2023-12-01'); $response = $client->getPage(0); ``` -## Utils +## Utils ### get JSON from Success and Error Response