Skip to content

Commit 8a51519

Browse files
committed
order readme, fix after merge conflict
1 parent 1a55227 commit 8a51519

File tree

4 files changed

+76
-70
lines changed

4 files changed

+76
-70
lines changed

README.md

Lines changed: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,27 @@ $response = $client->update($entityId, $data);
7979
$response = $api->country()->getAll();
8080
```
8181

82+
### Credit Notes Endpoint
83+
```php
84+
$voucherList = $api->creditNote()->getVoucherListClient(); // see VoucherlistClient Documentation
85+
$response = $api->creditNote()->get($entityId);
86+
$response = $api->creditNote()->create($data);
87+
$response = $api->creditNote()->create($data, true); // finalized
88+
$response = $api->creditNote()->document($entityId); // get document ID
89+
$response = $api->creditNote()->document($entityId, true); // get file content
90+
$response = $api->creditNote()->document($entityId, true, 'image/*'); // accept only images
91+
$response = $api->creditNote()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
92+
```
93+
8294
### Deliverys Notes Endpoint
8395
```php
8496
$voucherList = $api->deliveryNote()->getVoucherListClient(); // see VoucherlistClient Documentation
8597
$response = $api->deliveryNote()->get($entityId);
8698
$response = $api->deliveryNote()->create($data);
8799
$response = $api->deliveryNote()->document($entityId); // get document ID
88100
$response = $api->deliveryNote()->document($entityId, true); // get file content
89-
```
90-
91-
### Invoices Endpoint
92-
```php
93-
$voucherList = $api->invoice()->getVoucherListClient(); // see VoucherlistClient Documentation
94-
$response = $api->invoice()->get($entityId);
95-
$response = $api->invoice()->create($data);
96-
$response = $api->invoice()->document($entityId); // get document ID
97-
$response = $api->invoice()->document($entityId, true); // get file content
98-
$response = $api->invoice()->document($entityId, true, 'image/*'); // accept only images
99-
$response = $api->invoice()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
101+
$response = $api->deliveryNote()->document($entityId, true, 'image/*'); // accept only images
102+
$response = $api->deliveryNote()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
100103
```
101104

102105
### Down Payment Invoices Endpoint
@@ -110,50 +113,43 @@ $response = $api->downPaymentInvoice()->document($entityId, true, 'image/*'); //
110113
$response = $api->downPaymentInvoice()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
111114
```
112115

113-
### Order Confirmation Endpoint
116+
### Event Subscriptions Endpooint
114117
```php
115-
$voucherList = $api->orderConfirmation()->getVoucherListClient(); // see VoucherlistClient Documentation
116-
$response = $api->orderConfirmation()->get($entityId);
117-
$response = $api->orderConfirmation()->create($data);
118-
$response = $api->orderConfirmation()->document($entityId); // get document ID
119-
$response = $api->orderConfirmation()->document($entityId, true); // get file content
120-
$response = $api->orderConfirmation()->document($entityId, true, 'image/*'); // accept only images
121-
$response = $api->orderConfirmation()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
118+
// TODO: get
119+
$response = $api->voucher()->create($data);
120+
$response = $api->voucher()->delete($entityId);
121+
$response = $api->voucher()->getAll();
122122
```
123123

124-
### Quotation Endpoint
124+
### File Endpoint
125125
```php
126-
$voucherList = $api->quotation()->getVoucherListClient(); // see VoucherlistClient Documentation
127-
$response = $api->quotation()->get($entityId);
128-
$response = $api->quotation()->create($data);
129-
$response = $api->quotation()->document($entityId); // get document ID
130-
$response = $api->quotation()->document($entityId, true); // get file content
131-
$response = $api->quotation()->document($entityId, true, 'image/*'); // accept only images
132-
$response = $api->quotation()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
126+
$response = $api->file()->upload($filePath, $voucherType);
127+
$response = $api->file()->get($entityId); // accept every file
128+
$response = $api->file()->get($entityId, 'image/*'); // accept only images
129+
$response = $api->file()->get($entityId, 'application/xml'); // get XRechung XML File (if possible)
133130
```
134131

135-
### Voucher Endpoint
132+
### Invoices Endpoint
136133
```php
137-
$response = $api->voucher()->get($entityId);
138-
$response = $api->voucher()->create($data);
139-
$response = $api->voucher()->update($entityId, $data);
140-
$response = $api->voucher()->document($entityId); // get document ID
141-
$response = $api->voucher()->document($entityId, true); // get file content
142-
$response = $api->voucher()->document($entityId, true, 'image/*'); // accept only images
143-
$response = $api->voucher()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
144-
$response = $api->voucher()->upload($entitiyId, $filepath);
134+
$voucherList = $api->invoice()->getVoucherListClient(); // see VoucherlistClient Documentation
135+
$response = $api->invoice()->get($entityId);
136+
$response = $api->invoice()->create($data);
137+
$response = $api->invoice()->create($data, true); // finalized
138+
$response = $api->invoice()->document($entityId); // get document ID
139+
$response = $api->invoice()->document($entityId, true); // get file content
140+
$response = $api->invoice()->document($entityId, true, 'image/*'); // accept only images
141+
$response = $api->invoice()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
145142
```
146143

147-
148-
### Credit Notes Endpoint
144+
### Order Confirmation Endpoint
149145
```php
150-
$voucherList = $api->creditNote()->getVoucherListClient(); // see VoucherlistClient Documentation
151-
$response = $api->creditNote()->get($entityId);
152-
$response = $api->creditNote()->create($data);
153-
$response = $api->creditNote()->document($entityId); // get document ID
154-
$response = $api->creditNote()->document($entityId, true); // get file content
155-
$response = $api->creditNote()->document($entityId, true, 'image/*'); // accept only images
156-
$response = $api->creditNote()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
146+
$voucherList = $api->orderConfirmation()->getVoucherListClient(); // see VoucherlistClient Documentation
147+
$response = $api->orderConfirmation()->get($entityId);
148+
$response = $api->orderConfirmation()->create($data);
149+
$response = $api->orderConfirmation()->document($entityId); // get document ID
150+
$response = $api->orderConfirmation()->document($entityId, true); // get file content
151+
$response = $api->orderConfirmation()->document($entityId, true, 'image/*'); // accept only images
152+
$response = $api->orderConfirmation()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
157153
```
158154

159155
### Payment Endpoint
@@ -176,6 +172,18 @@ $response = $api->postingCategory()->getAll();
176172
$response = $api->profile()->get();
177173
```
178174

175+
### Quotation Endpoint
176+
```php
177+
$voucherList = $api->quotation()->getVoucherListClient(); // see VoucherlistClient Documentation
178+
$response = $api->quotation()->get($entityId);
179+
$response = $api->quotation()->create($data);
180+
$response = $api->quotation()->create($data, true); // finalized
181+
$response = $api->quotation()->document($entityId); // get document ID
182+
$response = $api->quotation()->document($entityId, true); // get file content
183+
$response = $api->quotation()->document($entityId, true, 'image/*'); // accept only images
184+
$response = $api->quotation()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
185+
```
186+
179187
### Recurring Templates Endpoint
180188
```php
181189

@@ -193,6 +201,17 @@ $response = $client->getPage(0);
193201
$response = $api->recurringTemplate()->get($entityId);
194202
```
195203

204+
### Voucher Endpoint
205+
```php
206+
$response = $api->voucher()->get($entityId);
207+
$response = $api->voucher()->create($data);
208+
$response = $api->voucher()->update($entityId, $data);
209+
$response = $api->voucher()->document($entityId); // get document ID
210+
$response = $api->voucher()->document($entityId, true); // get file content
211+
$response = $api->voucher()->document($entityId, true, 'image/*'); // accept only images
212+
$response = $api->voucher()->document($entityId, true, 'application/xml'); // get XRechung XML File (if possible)
213+
$response = $api->voucher()->upload($entitiyId, $filepath);
214+
```
196215

197216
### Voucherlist Endpoint
198217
```php
@@ -239,15 +258,6 @@ $client->updatedDateTo = new \DateTime('2023-12-01');
239258
$response = $client->getPage(0);
240259
```
241260

242-
### File Endpoint
243-
```php
244-
$response = $api->file()->upload($filePath, $voucherType);
245-
$response = $api->file()->get($entityId); // accept every file
246-
$response = $api->file()->get($entityId, 'image/*'); // accept only images
247-
$response = $api->file()->get($entityId, 'application/xml'); // get XRechung XML File (if possible)
248-
```
249-
250-
251261
### get JSON from Success and Error Response
252262

253263
```php

src/Api.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
use Sysix\LexOffice\Clients\VoucherList;
3131
use Sysix\LexOffice\Interfaces\ApiInterface;
3232

33-
3433
class Api implements ApiInterface
3534
{
3635
public string $apiUrl = 'https://api.lexoffice.io';

src/Interfaces/ApiInterface.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,11 @@
44

55
namespace Sysix\LexOffice\Interfaces;
66

7-
use Psr\Http\Client\ClientInterface;
87
use Psr\Http\Message\RequestInterface;
98
use Psr\Http\Message\ResponseInterface;
109

1110
interface ApiInterface
1211
{
13-
public function __construct(string $apiKey, ClientInterface $client);
14-
1512
/**
1613
* @param string[] $headers
1714
*/

tests/Clients/DeliveryNoteTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public function testGet(): void
2020

2121
$this->assertInstanceOf(ResponseInterface::class, $response);
2222

23-
$this->assertEquals('GET', $api->request->getMethod());
23+
$this->assertEquals('GET', $api->getRequest()->getMethod());
2424
$this->assertEquals(
2525
$api->apiUrl . '/v1/delivery-notes/resource-id',
26-
$api->request->getUri()->__toString()
26+
$api->getRequest()->getUri()->__toString()
2727
);
2828
}
2929

@@ -37,10 +37,10 @@ public function testCreate(): void
3737

3838
$this->assertInstanceOf(ResponseInterface::class, $response);
3939

40-
$this->assertEquals('POST', $api->request->getMethod());
40+
$this->assertEquals('POST', $api->getRequest()->getMethod());
4141
$this->assertEquals(
4242
$api->apiUrl . '/v1/delivery-notes',
43-
$api->request->getUri()->__toString()
43+
$api->getRequest()->getUri()->__toString()
4444
);
4545
}
4646

@@ -54,10 +54,10 @@ public function testGetPage(): void
5454

5555
$this->assertInstanceOf(ResponseInterface::class, $response);
5656

57-
$this->assertEquals('GET', $api->request->getMethod());
57+
$this->assertEquals('GET', $api->getRequest()->getMethod());
5858
$this->assertEquals(
5959
$api->apiUrl . '/v1/voucherlist?page=0&sort=voucherNumber%2CDESC&voucherType=deliverynote&voucherStatus=draft%2Copen%2Cpaid%2Cpaidoff%2Cvoided%2Caccepted%2Crejected&size=100',
60-
$api->request->getUri()->__toString()
60+
$api->getRequest()->getUri()->__toString()
6161
);
6262
}
6363

@@ -74,10 +74,10 @@ public function testGetAll(): void
7474

7575
$this->assertInstanceOf(ResponseInterface::class, $response);
7676

77-
$this->assertEquals('GET', $api->request->getMethod());
77+
$this->assertEquals('GET', $api->getRequest()->getMethod());
7878
$this->assertEquals(
7979
$api->apiUrl . '/v1/voucherlist?page=0&sort=voucherNumber%2CDESC&voucherType=deliverynote&voucherStatus=draft%2Copen%2Cpaid%2Cpaidoff%2Cvoided%2Caccepted%2Crejected&size=100',
80-
$api->request->getUri()->__toString()
80+
$api->getRequest()->getUri()->__toString()
8181
);
8282
}
8383

@@ -98,10 +98,10 @@ public function testDocument(): void
9898

9999
$this->assertInstanceOf(ResponseInterface::class, $response);
100100

101-
$this->assertEquals('GET', $api->request->getMethod());
101+
$this->assertEquals('GET', $api->getRequest()->getMethod());
102102
$this->assertEquals(
103103
$api->apiUrl . '/v1/delivery-notes/resource-id/document',
104-
$api->request->getUri()->__toString()
104+
$api->getRequest()->getUri()->__toString()
105105
);
106106
}
107107

@@ -119,10 +119,10 @@ public function testDocumentContent(): void
119119

120120
$this->assertInstanceOf(ResponseInterface::class, $response);
121121

122-
$this->assertEquals('GET', $api->request->getMethod());
122+
$this->assertEquals('GET', $api->getRequest()->getMethod());
123123
$this->assertEquals(
124124
$api->apiUrl . '/v1/files/fake-id',
125-
$api->request->getUri()->__toString()
125+
$api->getRequest()->getUri()->__toString()
126126
);
127127
}
128128

0 commit comments

Comments
 (0)