Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Commit

Permalink
Updated examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sanmai committed Nov 3, 2020
1 parent dceb445 commit dc0e1cc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/050_Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
/** @var \YDeliverySDK\Client $client */
$client = $builder->build();

$request = new LocationRequest('Новосибирская область, Новосибирск');
$request = new LocationRequest($argv[1]);

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

Expand Down
2 changes: 1 addition & 1 deletion examples/110_CreateAndSubmitOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
}

foreach ($response as $order) {
\var_dump($order->orderId);
echo "Confirmed order: {$order->orderId}\n";
}

$response = $client->sendOrderLabelRequest(new OrderLabelRequest($order->orderId));
Expand Down
9 changes: 9 additions & 0 deletions examples/120_OrdersSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

declare(strict_types=1);

use CommonSDK\Types\HTTPErrorResponse;
use Tests\YDeliverySDK\Integration\DebuggingLogger;
use YDeliverySDK\Requests\OrdersSearchRequest;

Expand Down Expand Up @@ -65,6 +66,10 @@
foreach ($orders as $order) {
echo "Page {$orders->pageNumber}\t{$order->id}\t{$order->status}\t{$order->comment}\n";

if (!\is_string($order->comment)) {
continue;
}

if (\strpos($order->comment, 'тестовый заказ') === false) {
continue;
}
Expand All @@ -76,6 +81,10 @@
$response = $client->makeDeleteOrderRequest($order->id);

if ($response->hasErrors()) {
if ($response instanceof HTTPErrorResponse) {
echo $response->getBody();
}

// Обрабатываем ошибки
foreach ($response->getMessages() as $message) {
if ($message->getErrorCode() !== '') {
Expand Down

0 comments on commit dc0e1cc

Please sign in to comment.