Skip to content

Commit 4743652

Browse files
Added mdpClassic and mdpSpectrum attributes to order entities + Orders documentation
1 parent 57a4e83 commit 4743652

File tree

8 files changed

+481
-51
lines changed

8 files changed

+481
-51
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## 4.0.0-beta.4 - 2021-11-25
8+
9+
### Added
10+
11+
- `mdpClassic` and `mdpSpectrum` attributes to `BasicOrder` and `Order` entities
12+
- `Order` client documentation
13+
714
## 4.0.0-beta.3 - 2021-11-25
815

916
### Added

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,5 +135,4 @@ List of custom Exceptions thrown in this client can be found [here](doc/Exceptio
135135

136136
### This is still a Beta release, and some features are missing or incomplete
137137

138-
- [ ] Order client documentation and examples
139138
- [ ] Transports v2 support

doc/Order.md

Lines changed: 257 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,262 @@
44

55
To see example of initialization, please look at [Implementation](../README.md#implementation) part of our [README](../README.md)
66

7-
## TODO add documentation
7+
## Get list of orders
8+
9+
Method expects [?Filter](../src/Filter/Filter.php) and returns [BasicOrderList](../src/Order/Entity/BasicOrderList.php) containing [BasicOrder](../src/Order/Entity/BasicOrder.php) entity.
10+
11+
```php
12+
/** @var MpApiClient\Common\Interfaces\OrderClientInterface $orderClient */
13+
$orderList = $orderClient->list(null);
14+
echo json_encode($orderList, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
15+
```
16+
17+
Example above prints out
18+
19+
```json
20+
{
21+
"paging": {
22+
"total": 940,
23+
"pages": 10,
24+
"size": 40,
25+
"page": 10
26+
},
27+
"data": [
28+
{
29+
"id": 10085339302,
30+
"purchaseId": 100853393,
31+
"customerId": 1089641061,
32+
"customer": "Firstname Surname",
33+
"cod": 154,
34+
"paymentType": "A",
35+
"shipDate": "2021-11-25 00:00:00",
36+
"trackingNumber": null,
37+
"trackingUrl": null,
38+
"deliveredAt": null,
39+
"status": "open",
40+
"confirmed": false,
41+
"test": false,
42+
"mdp": true,
43+
"mdpSpectrum": true,
44+
"mdpClassic": false
45+
},
46+
{
47+
"id": 10085192603,
48+
"purchaseId": 100851926,
49+
"customerId": 1100012571,
50+
"customer": "Firstname Surname",
51+
"cod": 479,
52+
"paymentType": "A",
53+
"shipDate": "2021-11-24 00:00:00",
54+
"trackingNumber": null,
55+
"trackingUrl": null,
56+
"deliveredAt": null,
57+
"status": "open",
58+
"confirmed": false,
59+
"test": false,
60+
"mdp": true,
61+
"mdpSpectrum": true,
62+
"mdpClassic": false
63+
},
64+
{
65+
"id": 10084686702,
66+
"purchaseId": 100846867,
67+
"customerId": 1095774003,
68+
"customer": "Firstname Surname",
69+
"cod": 488,
70+
"paymentType": "A",
71+
"shipDate": "2021-11-19 00:00:00",
72+
"trackingNumber": null,
73+
"trackingUrl": null,
74+
"deliveredAt": null,
75+
"status": "open",
76+
"confirmed": false,
77+
"test": false,
78+
"mdp": true,
79+
"mdpSpectrum": true,
80+
"mdpClassic": false
81+
},
82+
...
83+
]
84+
}
85+
```
86+
87+
## Get order detail
88+
89+
Method expects `order` ID and returns [Order](../src/Order/Entity/Order.php) entity.
90+
91+
```php
92+
/** @var MpApiClient\Common\Interfaces\OrderClientInterface $orderClient */
93+
$orderDetail = $orderClient->get(12345678901);
94+
echo json_encode($orderDetail, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
95+
```
96+
97+
Example above prints out
98+
99+
```json
100+
{
101+
"id": 12345678901,
102+
"purchaseId": 123456789,
103+
"currency": "CZK",
104+
"deliveryPrice": 29,
105+
"codPrice": 39,
106+
"cod": 1867,
107+
"discount": 0,
108+
"paymentType": "A",
109+
"deliveryMethod": "20",
110+
"deliveryMethodId": "23",
111+
"branchId": 23,
112+
"branches": {
113+
"branchId": 23,
114+
"secondaryBranchId": null,
115+
"lastChange": null
116+
},
117+
"trackingNumber": null,
118+
"trackingUrl": null,
119+
"shipDate": "2019-07-25 00:00:00",
120+
"deliveryDate": "2019-07-26 00:00:00",
121+
"deliveredAt": null,
122+
"firstDeliveryAttempt": null,
123+
"customer": {
124+
"customerId": 1101334728,
125+
"name": "Firstname Surname",
126+
"company": null,
127+
"phone": "+420721123456",
128+
"email": "[email protected]",
129+
"street": "Pražská 121",
130+
"city": "Pelhřimov",
131+
"zip": "39301",
132+
"country": "CZ"
133+
},
134+
"confirmed": false,
135+
"status": "open",
136+
"items": [
137+
{
138+
"id": "pCL00275",
139+
"articleId": 100001054382,
140+
"quantity": 1,
141+
"price": 1799,
142+
"vat": 21,
143+
"commission": 15,
144+
"title": "Chloé - EDP 75 ml",
145+
"serialNumbers": []
146+
}
147+
],
148+
"test": false,
149+
"mdp": true,
150+
"mdpClassic": true,
151+
"mdpSpectrum": false,
152+
"readyToReturn": false,
153+
"shipped": null,
154+
"open": "2019-07-25 16:12:14",
155+
"blocked": "2019-07-25 16:07:31",
156+
"lost": null,
157+
"returned": null,
158+
"cancelled": null,
159+
"delivered": null,
160+
"shipping": null,
161+
"ulozenkaStatusHistory": []
162+
}
163+
```
164+
165+
## Get order statistics
166+
167+
Method expects `order` ID and returns [Stats](../src/Order/Entity/Stats.php) entity.
168+
169+
```php
170+
/** @var MpApiClient\Common\Interfaces\OrderClientInterface $orderClient */
171+
$orderDetail = $orderClient->stats(10);
172+
echo json_encode($orderDetail, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
173+
```
174+
175+
Example above prints out
176+
177+
```json
178+
{
179+
"blocked": 49,
180+
"open": 8,
181+
"shipping": 0,
182+
"shipped": 0,
183+
"cancelled": 1,
184+
"delivered": 0,
185+
"lost": 0,
186+
"returned": 0
187+
}
188+
```
189+
190+
## Confirm order
191+
192+
Method expects `order` ID and does not return anything.
193+
194+
```php
195+
/** @var MpApiClient\Common\Interfaces\OrderClientInterface $orderClient */
196+
$orderClient->confirmOrder(1234567890);
197+
```
198+
199+
## Change order status
200+
201+
Method expects `order` ID and [StatusRequest](../src/Order/DTO/StatusRequest.php) DTO and does not return anything.
202+
203+
```php
204+
/** @var MpApiClient\Common\Interfaces\OrderClientInterface $orderClient */
205+
$statusRequest = new StatusRequest(StatusEnum::shipping());
206+
$statusRequest->setTracking('ABC123456', 'https://tracking.company.com/id/ABC123456');
207+
$orderClient->setStatus(1234567890, $statusRequest);
208+
```
209+
210+
## Set tracking for shipped order
211+
212+
Method expects `order` ID and [StatusRequest](../src/Order/DTO/StatusRequest.php) DTO and does not return anything.
213+
214+
```php
215+
/** @var MpApiClient\Common\Interfaces\OrderClientInterface $orderClient */
216+
$tracking = new Tracking('ABC123456', 'https://tracking.company.com/id/ABC123456');
217+
$orderClient->setTracking(1234567890, $tracking);
218+
```
219+
220+
## Set serial numbers for order item
221+
222+
Method expects `order` and `orderItem` IDs and variable amount of serial numbers and does not return anything.
223+
224+
```php
225+
/** @var MpApiClient\Common\Interfaces\OrderClientInterface $orderClient */
226+
$orderClient->setItemSerialNumbers(1234567890, 1234567, 'SN12345', 'SN23456');
227+
```
228+
229+
## Print labels for multiple orders
230+
231+
Method expects [ShippingLabelRequest](../src/Order/DTO/ShippingLabelRequest.php) DTO and returns [Labels](../src/Order/Entity/Labels.php) entity.
232+
233+
```php
234+
/** @var MpApiClient\Common\Interfaces\OrderClientInterface $orderClient */
235+
$labelRequest = new ShippingLabelRequest(ShippingLabelRequest::TYPE_PDF, 1, 4);
236+
$labelRequest->addLabel(123456666, 2);
237+
$labelRequest->addLabel(123456777, 1);
238+
$labels = $orderClient->createShippingLabels($labelRequest);
239+
echo json_encode($labels, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
240+
```
241+
242+
Example above prints out
243+
244+
```json
245+
{
246+
"orders": [
247+
{
248+
"orderId": 123456666,
249+
"barcodes": [
250+
"14IS50856666*001001",
251+
"14IS50856666*001002"
252+
]
253+
},
254+
{
255+
"orderId": 123456777,
256+
"barcodes": [
257+
"14IS50857777*001001"
258+
]
259+
}
260+
],
261+
"labelsRaw": "JVBERi0xLjQKJeLjz9MKMyAwI....PgpzdGFydHhyZWYKNTAyNTcKJSVFT0Y="
262+
}
263+
```
8264

9265
### See more examples [here](../example/Order.php)

0 commit comments

Comments
 (0)