Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Дополнен пример для DeliveryRequest, CS
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Jan 19, 2021
1 parent 530d2c8 commit ff0d3ab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
7 changes: 6 additions & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ foreach ($response as $location) {
```php
use CdekSDK\Common;
use CdekSDK\Requests;
use CdekSDK\Responses\DeliveryResponse;

$order = new Common\Order([
'Number' => 'TEST-123456',
Expand Down Expand Up @@ -384,8 +385,12 @@ $request->addOrder($order);

$response = $client->sendDeliveryRequest($request);

if ($response->hasErrors() && !$response instanceof DeliveryResponse) {
// обработка ошибок в общем случае
}

if ($response->hasErrors()) {
// обработка ошибок
// обработка ошибок отдельных заказов

foreach ($response->getErrors() as $order) {
// заказы с ошибками
Expand Down
7 changes: 6 additions & 1 deletion examples/070_DeliveryRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
declare(strict_types=1);
use CdekSDK\Common;
use CdekSDK\Requests;
use CdekSDK\Responses\DeliveryResponse;

$client = new \CdekSDK\CdekClient('account', 'password');

Expand Down Expand Up @@ -73,8 +74,12 @@

$response = $client->sendDeliveryRequest($request);

if ($response->hasErrors() && !$response instanceof DeliveryResponse) {
// обработка ошибок в общем случае
}

if ($response->hasErrors()) {
// обработка ошибок
// обработка ошибок отдельных заказов

foreach ($response->getErrors() as $order) {
// заказы с ошибками
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/DeliveryRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
use CdekSDK\Responses\DeleteResponse;
use CdekSDK\Responses\FileResponse;
use CdekSDK\Responses\InfoReportResponse;
use CdekSDK\Responses\JsonErrorResponse;
use CdekSDK\Responses\StatusReportResponse;
use CdekSDK\Responses\UpdateResponse;
use CdekSDK\Responses\JsonErrorResponse;

/**
* @covers \CdekSDK\Requests\DeliveryRequest
Expand Down

0 comments on commit ff0d3ab

Please sign in to comment.