PHP code example of cvxvp / rpost

1. Go to this page and download the library: Download cvxvp/rpost library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cvxvp / rpost example snippets



  $CategoryList = new \LapayGroup\RussianPost\CategoryList();
  $categoryList = $CategoryList->parseToArray();


  $CategoryList = new \LapayGroup\RussianPost\CategoryList();
  $CategoryList->setCategoryDelete([100,200,300]);
  $categoryList = $CategoryList->parseToArray();


try {
  $objectId = 2020; // Письмо с объявленной ценностью
  // Минимальный набор параметров для расчета стоимости отправления
  $params = [
              'weight' => 20, // Вес в граммах
              'sumoc' => 10000, // Сумма объявленной ценности в копейках
              'from' => 109012 // Почтовый индекс места отправления
              ];

  // Список ID дополнительных услуг 
  // 2 - Заказное уведомление о вручении 
  // 21 - СМС-уведомление о вручении
  $services = [2,21];

  $TariffCalculation = new \LapayGroup\RussianPost\TariffCalculation();
  $calcInfo = $TariffCalculation->calculate($objectId, $params, $services);
}

catch (\LapayGroup\RussianPost\Exceptions\RussianPostTarrificatorException $e) {
    // Обработка ошибок тарификатора 
    $errors = $e->getErrors(); // Массив вида [['msg' => 'текст ошибки', 'code' => код ошибки]]
}

catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
    // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
    // Обработка нештатной ситуации
}



    use Monolog\Logger;
    use Monolog\Handler\StreamHandler;
    
    $log = new Logger('name');
    $log->pushHandler(new StreamHandler('log.txt', Logger::INFO));
    
    // Логирование расчета тарифа
    $tariffCalculation = new \LapayGroup\RussianPost\TariffCalculation();
    $tariffCalculation->setLogger($log);
    
    $res = $tariffCalculation->calculate(23030, ['from' => 101000, 'to' => 101000, 'weight' => 100, 'sumoc' => 0]);
    
    
    // Логирования API отправки
    $otpravkaApi = new \LapayGroup\RussianPost\Providers\OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $otpravkaApi->setLogger($log);
    
    $addressList = new \LapayGroup\RussianPost\AddressList();
    $addressList->add('115551 Кширское шоссе 94-1, 1');
    $result = $otpravkaApi->clearAddress($addressList);
    
    
    // Логирование API трекинга
    $config['auth']['tracking']['login'] = 'login';
    $config['auth']['tracking']['password'] = 'password';
    
    $Tracking = new \LapayGroup\RussianPost\Providers\Tracking('single', $config);
    $Tracking->setLogger($log);
    
    $result = $Tracking->getOperationsByRpo('10944022440321');


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\Tracking;
  
  $Tracking = new Tracking('single', Yaml::parse(file_get_contents('path_to_config.yaml')));
  $result = $Tracking->getOperationsByRpo('10944022440321');


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\Tracking;
  
  $Tracking = new Tracking('single', Yaml::parse(file_get_contents('path_to_config.yaml')));
  $result = $Tracking->getNpayInfo('10944022440321');


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\Tracking;
  
  $Tracking = new Tracking('pack', Yaml::parse(file_get_contents('path_to_config.yaml')));
  $result = $Tracking->getTickets(['10944022440321', '11172522364055', '10944022490302']);


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\Tracking;
  
  $Tracking = new Tracking('pack', Yaml::parse(file_get_contents('path_to_config.yaml')));
  $result = $Tracking->getOperationsByTicket('20180506151902355WANVOUGROWKXUN');


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\OtpravkaApi;
  
  try {
      $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
      
      $addressList = new \LapayGroup\RussianPost\AddressList();
      $addressList->add('115551 Кширское шоссе 94-1, 1');
      $result = $otpravkaApi->clearAddress($addressList);
      
      /*
      Array
      (
          [0] => Array
              (
                  [address-type] => DEFAULT
                  [corpus] => 1
                  [house] => 94
                  [id] => 0
                  [index] => 115551
                  [original-address] => 115551 Кширское шоссе 94-1, 1
                  [place] => г. Москва
                  [quality-code] => GOOD
                  [region] => г. Москва
                  [room] => 1
                  [street] => шоссе Каширское
                  [validation-code] => VALIDATED
              )
      
      )
     */
  }
              
  catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
      // Обработка ошибочного ответа от API ПРФ
  }
      
  catch (\Exception $e) {
      // Обработка нештатной ситуации
  }


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\OtpravkaApi;
  
  try {
      $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
      
      $fioList = new \LapayGroup\RussianPost\FioList();
      $fioList->add('Иванов Петр игоревич');
      $result = $otpravkaApi->clearFio($fioList);
      
      /*
       Array
       (
           [0] => Array
               (
                   [id] => 0
                   [middle-name] => Игоревич
                   [name] => Петр
                   [original-fio] => Иванов Петр игоревич
                   [quality-code] => EDITED
                   [surname] => Иванов
               )
       
       )
       */
  }
              
  catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
      // Обработка ошибочного ответа от API ПРФ
  }
      
  catch (\Exception $e) {
      // Обработка нештатной ситуации
  }


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\OtpravkaApi;
  
  try {
      $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
      
      $phoneList = new \LapayGroup\RussianPost\PhoneList();
      $phoneList->add('9260120935');
      $result = $otpravkaApi->clearPhone($phoneList);
      
      /*
       Array
         (
             [0] => Array
                 (
                     [id] => 0
                     [original-phone] => 9260120935
                     [phone-city-code] => 926
                     [phone-country-code] => 7
                     [phone-extension] =>
                     [phone-number] => 0120935
                     [quality-code] => GOOD
                 )
         
         )
       */
  }
            
  catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
      // Обработка ошибочного ответа от API ПРФ
  }
    
  catch (\Exception $e) {
      // Обработка нештатной ситуации
  }

use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

$OtpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
$list = $OtpravkaApi->shippingPoints();


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\OtpravkaApi;
  use LapayGroup\RussianPost\ParcelInfo;
  
  try {
      $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
      
      $parcelInfo = new ParcelInfo();
      $parcelInfo->setIndexFrom($list[0]['operator-postcode']); // Индекс пункта сдачи из функции $OtpravkaApi->shippingPoints()
      $parcelInfo->setIndexTo(644015);
      $parcelInfo->setMailCategory('ORDINARY'); // https://otpravka.pochta.ru/specification#/enums-base-mail-category
      $parcelInfo->setMailType('POSTAL_PARCEL'); // https://otpravka.pochta.ru/specification#/enums-base-mail-type
      $parcelInfo->setWeight(1000);
      $parcelInfo->setFragile(true);
    
      $tariffInfo = $otpravkaApi->getDeliveryTariff($parcelInfo);
      echo $tariffInfo->getTotalRate()/100 . ' руб.';
      
      /*
       LapayGroup\RussianPost\TariffInfo Object
       (
           [totalRate:LapayGroup\RussianPost\TariffInfo:private] => 30658
           [totalNds:LapayGroup\RussianPost\TariffInfo:private] => 6132
           [aviaRate:LapayGroup\RussianPost\TariffInfo:private] => 0
           [aviaNds:LapayGroup\RussianPost\TariffInfo:private] => 0
           [deliveryMinDays:LapayGroup\RussianPost\TariffInfo:private] => 1
           [deliveryMaxDays:LapayGroup\RussianPost\TariffInfo:private] => 3
           [fragileRate:LapayGroup\RussianPost\TariffInfo:p rivate] => 7075
           [fragileNds:LapayGroup\RussianPost\TariffInfo:private] => 1415
           [groundRate:LapayGroup\RussianPost\TariffInfo:private] => 30658
           [groundNds:LapayGroup\RussianPost\TariffInfo:private] => 6132
           [insuranceRate:LapayGroup\RussianPost\TariffInfo:private] => 0
           [insuranceNds:LapayGroup\RussianPost\TariffInfo:private] => 0
           [noticeRate:LapayGroup\RussianPost\TariffInfo:private] => 0
           [noticeNds:LapayGroup\RussianPost\TariffInfo:private] => 0
           [oversizeRate:LapayGroup\RussianPost\TariffInfo:private] => 0
           [oversizeNds:LapayGroup\RussianPost\TariffInfo:private] => 0
       )
       */
  }
          
  catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
      // Обработка ошибочного ответа от API ПРФ
  }
  
  catch (\Exception $e) {
      // Обработка нештатной ситуации
  }


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\OtpravkaApi;
  use LapayGroup\RussianPost\ParcelInfo;
  
  try {
      $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
      
      $parcelInfo = new ParcelInfo();
      $parcelInfo->setIndexFrom($list[0]['operator-postcode']); // Индекс пункта сдачи из функции $OtpravkaApi->shippingPoints()
      $parcelInfo->setMailCategory('ORDINARY'); // https://otpravka.pochta.ru/specification#/enums-base-mail-category
      $parcelInfo->setWeight(1000);
      $parcelInfo->setFragile(true);
      
      // Параметры только для ЕКОМ
      $parcelInfo->setMailType('ECOM'); // Вид РПО ЕКОМ https://otpravka.pochta.ru/specification#/enums-base-mail-type
      $parcelInfo->setDeliveryPointindex(644015); // Вместо индекса назначения указывается индекс ПВЗ
      $parcelInfo->setEntriesType('SALE_OF_GOODS'); // Категория вложения https://otpravka.pochta.ru/specification#/enums-base-entries-type
      $parcelInfo->setFunctionalityChecking(true); // Признак услуги проверки работоспособности
      $parcelInfo->setGoodsValue(1588000); // Стоимость
      $parcelInfo->setWithFitting(true); // Признак услуги 'Возможность примерки'
    
      $tariffInfo = $otpravkaApi->getDeliveryTariff($parcelInfo);
      echo $tariffInfo->getTotalRate()/100 . ' руб.';
      
      /*
       LapayGroup\RussianPost\TariffInfo Object
       (
           [functionalityCheckingRate:LapayGroup\RussianPost\TariffInfo:private] => 30658
           [functionalityCheckingNds:LapayGroup\RussianPost\TariffInfo:private] => 6132
           [withFittingRate:LapayGroup\RussianPost\TariffInfo:private] => 0
           [withFittingNds:LapayGroup\RussianPost\TariffInfo:private] => 0
       )
       */
  }
          
  catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
      // Обработка ошибочного ответа от API ПРФ
  }
  
  catch (\Exception $e) {
      // Обработка нештатной ситуации
  }


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\OtpravkaApi;
  
  try {
      $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
      $res = $otpravkaApi->getDeliveryPeriod(\LapayGroup\RussianPost\PostType::EMS, 115551, 115551);
      
      /*
       Array
       (
           [version] => 1.2.10.28
           [date] => 20190621
           [datefirst] => 20190411
           [posttype] => 7
           [posttypename] => EMS
           [from] => 115551
           [fromname] => МОСКВА 551
           [to] => 115551
           [toname] => МОСКВА 551
           [route] => 43-45000000-45000000
           [routename] => МОСКВА 551-МОСКВА 551
           [delivery] => Array
               (
                   [min] => 1
                   [max] => 1
               )
       
       )
       */
  }
          
  catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
      // Обработка ошибочного ответа от API ПРФ
  }
  
  catch (\Exception $e) {
      // Обработка нештатной ситуации
  }



  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\OtpravkaApi;
  try {
      $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
      $result = $otpravkaApi->getBalance();
      
      /*
       Array
       (
           [balance] => 0
           [balance-date] => 2019-06-21
           [work-with-balance] => 1
       )
       */
    }
        
    catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
        // Обработка ошибочного ответа от API ПРФ
    }
    
    catch (\Exception $e) {
        // Обработка нештатной ситуации
    }


  use Symfony\Component\Yaml\Yaml;
  use LapayGroup\RussianPost\Providers\OtpravkaApi;
  
  $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
  
  $recepient = new \LapayGroup\RussianPost\Entity\Recipient();
  $recepient->setAddress('650905 ЯГУНОВСКИЙ, КЕМЕРОВСКАЯ ОБЛАСТЬ, УЛ БЕЛОЗЕРНАЯ, ДОМ 21,КВ 1');
  $recepient->setName('Иванов Петр Николаевич');
  $recepient->setPhone('79260112367');
  
  try {
      $res = $otpravkaApi->untrustworthyRecipient($recepient);
      /*
       Array
       (  
           [raw-address] => 650905 ЯГУНОВСКИЙ, КЕМЕРОВСКАЯ ОБЛАСТЬ, УЛ БЕЛОЗЕРНАЯ,ДОМ 21,КВ 1
           [raw-full-name] => Иванов Петр Николаевич
           [raw-telephone] => 79260112367
           [unreliability] => RELIABLE
       )
       */
  }
  
  catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
      // Обработка ошибочного ответа от API ПРФ
  }
  
  catch (\Exception $e) {
      // Обработка нештатной ситуации
  }
  
  
  // Обработка списка получателей
  $recepients[0] = $recepient;
  $recepients[1] = $recepient;
  
  try {
        $res = $otpravkaApi->untrustworthyRecipients($recepients);
        /*
         Array
         (
             [0] => Array
                 (
                     [raw-address] => 650905 ЯГУНОВСКИЙ, КЕМЕРОВСКАЯ ОБЛАСТЬ, УЛ БЕЛОЗЕРНАЯ,ДОМ 21,КВ 1
                     [raw-full-name] => Иванов Петр Николаевич
                     [raw-telephone] => 79260112367
                     [unreliability] => RELIABLE
                 ),
             [1] => Array
                  (
                      [raw-address] => 650905 ЯГУНОВСКИЙ, КЕМЕРåОВСКАЯ ОБЛАСТЬ, УЛ БЕЛОЗЕРНАЯ,ДОМ 21,КВ 1
                      [raw-full-name] => Иванов Петр Николаевич
                      [raw-telephone] => 79260112367
                      [unreliability] => RELIABLE
                  )
         )
         */
    }
    
    catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
        // Обработка ошибочного ответа от API ПРФ
    }
    
    catch (\Exception $e) {
        // Обработка нештатной ситуации
    }


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $pvz_list = $otpravkaApi->getPvzList();
    /*
    Array
    (
        [0] => Array
            (
                [address] => Array
                    (
                        [addressType] => DEFAULT
                        [house] => 186
                        [index] => 656067
                        [manualInput] =>
                        [place] => г. Барнаул
                        [region] => край Алтайский
                        [street] => ул. Попова
                    )
    
                [brand-name] => Почта России
                [card-payment] =>
                [cash-payment] =>
                [closed] =>
                [contents-checking] => 1
                [delivery-point-index] => 656067
                [delivery-point-type] => DELIVERY_POINT
                [functionality-checking] =>
                [id] => 33815
                [latitude] => 53.341753
                [legal-name] => УФПС Алтайского края - филиал ФГУП "Почта России", Барнаульский почтамт, Отделение почтовой связи Барнаул  656067
                [legal-short-name] => БАРНАУЛ 67
                [longitude] => 83.667594
                [partial-redemption] =>
                [temporary-closed] =>
                [with-fitting] =>
                [work-time] => Array
                    (
                        [0] => пн, открыто: 08:00 - 20:00
                        [1] => вт, открыто: 08:00 - 20:00
                        [2] => ср, открыто: 08:00 - 20:00
                        [3] => чт, открыто: 08:00 - 20:00
                        [4] => пт, открыто: 08:00 - 20:00
                        [5] => сб, открыто: 09:00 - 18:00
                        [6] => вс, выходной
                    )
    
            )
    
        [1] => Array
            (
                [address] => Array
                    (
                        [addressType] => DEFAULT
                        [corpus] => 2
                        [house] => 8
                        [index] => 119526
                        [manualInput] =>
                        [place] => г. Москва
                        [region] => г. Москва
                        [street] => ул. 26-ти Бакинских Комиссаров
                    )
    
                [brand-name] => Почта России
                [card-payment] =>
                [cash-payment] =>
                [closed] =>
                [contents-checking] => 1
                [delivery-point-index] => 119526
                [delivery-point-type] => DELIVERY_POINT
                [functionality-checking] =>
                [id] => 35009
                [latitude] => 55.659170
                [legal-name] => УФПС г. Москвы-филиал ФГУП Почта России ММП 6 ОПС 526
                [legal-short-name] => МОСКВА 526
                [longitude] => 37.491359
                [partial-redemption] =>
                [temporary-closed] =>
                [with-fitting] =>
                [work-time] => Array
                    (
                        [0] => пн, открыто: 08:00 - 20:00
                        [1] => вт, открыто: 08:00 - 20:00
                        [2] => ср, открыто: 08:00 - 20:00
                        [3] => чт, открыто: 08:00 - 20:00
                        [4] => пт, открыто: 08:00 - 20:00
                        [5] => сб, открыто: 09:00 - 18:00
                        [6] => вс, открыто: 09:00 - 14:00
                    )
    
            )
    */
}
    
catch (\InvalidArgumentException $e) {
  // Обработка ошибки заполнения параметров
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;
use LapayGroup\RussianPost\Entity\Order;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    
    $orders = [];
    $order = new Order();
    $order->setIndexTo(115551);
    $order->setPostOfficeCode(109012);
    $order->setGivenName('Иван');
    $order->setHouseTo('92');
    $order->setCorpusTo('3');
    $order->setMass(1000);
    $order->setOrderNum('2');
    $order->setPlaceTo('Москва');
    $order->setRecipientName('Иванов Иван');
    $order->setRegionTo('Москва');
    $order->setStreetTo('Каширское шоссе');
    $order->setRoomTo('1');
    $order->setSurname('Иванов');
    $orders[] = $order->asArr();
    
    $result = $otpravkaApi->createOrders($orders);
    
    // Успешный ответ
    /*Array
    (
        [result-ids] => Array
            (
                [0] => 115322331
            )
    
    )
    */
    
    // Ответ с ошибкой
    /*Array
    (
        [errors] => Array
            (
                [0] => Array
                    (
                        [error-codes] => Array
                            (
                                [0] => Array
                                    (
                                        [code] => EMPTY_INDEX_TO
                                        [description] => Почтовый индекс не указан
                                    )
    
                            )
    
                        [position] => 0
                    )
    
            )
    
    )*/
}
    
catch (\InvalidArgumentException $e) {
  // Обработка ошибки заполнения параметров
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;
use LapayGroup\RussianPost\Entity\Order;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    
    $orders = [];
    $order = new Order();
    $order->setIndexTo(115551);
    $order->setPostOfficeCode(109012);
    $order->setGivenName('Иван');
    $order->setHouseTo('92');
    $order->setCorpusTo('3');
    $order->setMass(1000);
    $order->setOrderNum('2');
    $order->setPlaceTo('Москва');
    $order->setRecipientName('Иванов Иван');
    $order->setRegionTo('Москва');
    $order->setStreetTo('Каширское шоссе');
    $order->setRoomTo('1');
    $order->setSurname('Иванов');
    $orders[] = $order->asArr();
    
    $result = $otpravkaApi->createOrdersV2($orders);
    
    // Успешный ответ
    /*Array
    (
        [orders] => Array
            (
                [barcode] => 80093053624992
                [order-num] => 3
                [result-id] => 310115153
            )
    )*/
    
    // Ответ с ошибкой
    /*Array
    (
        [errors] => Array
            (
                [0] => Array
                    (
                        [error-codes] => Array
                            (
                                [0] => Array
                                    (
                                        [code] => EMPTY_INDEX_TO
                                        [description] => Почтовый индекс не указан
                                    )
    
                            )
    
                        [position] => 0
                    )
    
            )
    
    )*/
}
    
catch (\InvalidArgumentException $e) {
  // Обработка ошибки заполнения параметров
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;
use LapayGroup\RussianPost\Entity\Order;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    
    $order = new Order();
    $order->setIndexTo(115551);
    $order->setPostOfficeCode(109012);
    $order->setGivenName('Иван');
    $order->setHouseTo('92');
    $order->setCorpusTo('3');
    $order->setMass(1000);
    $order->setOrderNum('333'); // Меняем внутренний номер заказа
    $order->setPlaceTo('Москва');
    $order->setRecipientName('Иванов Иван');
    $order->setRegionTo('Москва');
    $order->setStreetTo('Каширское шоссе');
    $order->setRoomTo('1');
    $order->setSurname('Иванов');
    
    $result = $otpravkaApi->editOrder($order, 115322331);
    
    // Успешный ответ
    /*Array
    (
        [result-ids] => Array
            (
                [0] => 115322331
            )
    
    )
    */
    
    // Ответ с ошибкой
    /*Array
      (
          [error-codes] => Array
              (
                  [0] => Array
                      (
                          [code] => EMPTY_INDEX_TO
                          [description] => Почтовый индекс не указан
                      )

              )

          [position] => 0
      )*/
}
    
catch (\InvalidArgumentException $e) {
  // Обработка ошибки заполнения параметров
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->deleteOrders([115322331]);
    /* 
    Array Успешный ответ
    (
        [result-ids] => Array
            (
                [0] => 115322331
            )
    )
    
    Array Ответ с ошибкой
    (
        [errors] => Array
            (
                [0] => Array
                    (
                        [error-code] => NOT_FOUND
                        [position] => 0
                    )
    
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->findOrderByShopId(1);
    /*
    Array
    (
        [0] => Array
            (
                [address-type-to] => DEFAULT
                // По умолчанию выбран динамический ДТИ. Для изменения диапазона ДТИ нужно обратиться в службу поддержки Почты России
                [barcode] => 80082240994512
                [corpus-to] => 3
                [delivery-time] => Array
                    (
                        [max-days] => 1
                    )
    
                [given-name] => Иван
                [ground-rate] => 16500
                [ground-rate-with-vat] => 19800
                [ground-rate-wo-vat] => 16500
                [house-to] => 92
                [id] => 115322331
                [index-to] => 115551
                [mail-category] => ORDINARY
                [mail-direct] => 643
                [mail-rank] => WO_RANK
                [mail-type] => POSTAL_PARCEL
                [manual-address-input] =>
                [mass] => 1000
                [mass-rate] => 16500
                [mass-rate-with-vat] => 19800
                [mass-rate-wo-vat] => 16500
                [order-num] => 1
                [payment-method] => CASHLESS
                [place-to] => Москва
                [postmarks] => Array
                    (
                        [0] => NONSTANDARD
                    )
    
                [postoffice-code] => 109012
                [recipient-name] => Иванов Иван
                [region-to] => Москва
                [room-to] => 1
                [str-index-to] => 115551
                [street-to] => Каширское шоссе
                [surname] => Иванов
                [total-rate-wo-vat] => 16500
                [total-vat] => 3300
                [transport-type] => SURFACE
                [version] => 0
        )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->findOrderById(115322331);
    /*
    Array
    (
        [address-type-to] => DEFAULT
        [barcode] => 80082240994512
        [corpus-to] => 3
        [delivery-time] => Array
            (
                [max-days] => 1
            )
    
        [given-name] => Иван
        [ground-rate] => 16500
        [ground-rate-with-vat] => 19800
        [ground-rate-wo-vat] => 16500
        [house-to] => 92
        [id] => 115322331
        [index-to] => 115551
        [mail-category] => ORDINARY
        [mail-direct] => 643
        [mail-rank] => WO_RANK
        [mail-type] => POSTAL_PARCEL
        [manual-address-input] =>
        [mass] => 1000
        [mass-rate] => 16500
        [mass-rate-with-vat] => 19800
        [mass-rate-wo-vat] => 16500
        [order-num] => 1
        [payment-method] => CASHLESS
        [place-to] => Москва
        [postmarks] => Array
            (
                [0] => NONSTANDARD
            )
    
        [postoffice-code] => 109012
        [recipient-name] => Иванов Иван
        [region-to] => Москва
        [room-to] => 1
        [str-index-to] => 115551
        [street-to] => Каширское шоссе
        [surname] => Иванов
        [total-rate-wo-vat] => 16500
        [total-vat] => 3300
        [transport-type] => SURFACE
        [version] => 0
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->returnToNew([115527611]);
    /*
    Array Успешный ответ
    (
        [result-ids] => Array
            (
                [0] => 115527611
            )
    
    )

    Array Ответ с ошибкой
    (
        [errors] => Array
            (
                [0] => Array
                    (
                        [error-code] => NOT_FOUND
                        [position] => 0
                    )
    
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->createBatch([115527611], new DateTimeImmutable('2019-09-20'));
    /*
     Array Успешный ответ
        (
        [batches] => Array
            (
                [0] => Array
                    (
                        [batch-name] => 24
                        [batch-status] => CREATED
                        [batch-status-date] => 2019-09-03T11:37:17.589Z
                        [combined-batch-mail-types] => Array
                            (
                                [0] => POSTAL_PARCEL
                            )
    
                        [courier-order-statuses] => Array
                            (
                                [0] => NOT_REQUIRED
                            )
    
                        [international] =>
                        [list-number-date] => 2019-09-20
                        [mail-category] => COMBINED
                        [mail-category-text] => Комбинированно
                        [mail-rank] => WO_RANK
                        [mail-type] => COMBINED
                        [mail-type-text] => Комбинированно
                        [payment-method] => CASHLESS
                        [postmarks] => Array
                            (
                                [0] => NONSTANDARD
                            )
    
                        [postoffice-code] => 109012
                        [postoffice-name] => ОПС 109012
                        [shipment-avia-rate-sum] => 0
                        [shipment-avia-rate-vat-sum] => 0
                        [shipment-completeness-checking-rate-sum] => 0
                        [shipment-completeness-checking-rate-vat-sum] => 0
                        [shipment-contents-checking-rate-sum] => 0
                        [shipment-contents-checking-rate-vat-sum] => 0
                        [shipment-count] => 1
                        [shipment-ground-rate-sum] => 16500
                        [shipment-ground-rate-vat-sum] => 3300
                        [shipment-insure-rate-sum] => 0
                        [shipment-insure-rate-vat-sum] => 0
                        [shipment-inventory-rate-sum] => 0
                        [shipment-inventory-rate-vat-sum] => 0
                        [shipment-mass] => 1000
                        [shipment-mass-rate-sum] => 16500
                        [shipment-mass-rate-vat-sum] => 3300
                        [shipment-notice-rate-sum] => 0
                        [shipment-notice-rate-vat-sum] => 0
                        [shipment-sms-notice-rate-sum] => 0
                        [shipment-sms-notice-rate-vat-sum] => 0
                        [shipping-notice-type] => SIMPLE
                        [transport-type] => SURFACE
                        [use-online-balance] =>
                        [wo-mass] =>
                    )
            )
    
        [result-ids] => Array
            (
                [0] => 115527611
            )
    )
    
    Array Ответ с ошибкой
    (
        [errors] => Array
            (
                [0] => Array
                    (
                        [error-code] => NOT_FOUND
                        [error-description] => Отправление не найдено
                        [position] => 0
                    )
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->changeBatchSendingDay(25, new DateTimeImmutable('2019-09-08'));
    
}
catch (\InvalidArgumentException $e) {
    // Обработка ошибки
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->moveOrdersToBatch('24', [115685148]);
    /*Array
    (
        [result-ids] => Array
            (
                [0] => 115685148
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->findBatchByName('24');
    /*
    Array
      (
          [batch-name] => 24
          [batch-status] => CREATED
          [batch-status-date] => 2019-09-03T11:37:17.589Z
          [combined-batch-mail-types] => Array
              (
                  [0] => POSTAL_PARCEL
              )
      
          [courier-order-statuses] => Array
              (
                  [0] => NOT_REQUIRED
              )
      
          [international] =>
          [list-number-date] => 2019-09-16
          [mail-category] => COMBINED
          [mail-category-text] => Комбинированно
          [mail-rank] => WO_RANK
          [mail-type] => COMBINED
          [mail-type-text] => Комбинированно
          [payment-method] => CASHLESS
          [postmarks] => Array
              (
                  [0] => NONSTANDARD
              )
      
          [postoffice-code] => 109012
          [postoffice-name] => ОПС 109012
          [shipment-avia-rate-sum] => 0
          [shipment-avia-rate-vat-sum] => 0
          [shipment-completeness-checking-rate-sum] => 0
          [shipment-completeness-checking-rate-vat-sum] => 0
          [shipment-contents-checking-rate-sum] => 0
          [shipment-contents-checking-rate-vat-sum] => 0
          [shipment-count] => 2
          [shipment-ground-rate-sum] => 33000
          [shipment-ground-rate-vat-sum] => 6600
          [shipment-insure-rate-sum] => 0
          [shipment-insure-rate-vat-sum] => 0
          [shipment-inventory-rate-sum] => 0
          [shipment-inventory-rate-vat-sum] => 0
          [shipment-mass] => 2000
          [shipment-mass-rate-sum] => 33000
          [shipment-mass-rate-vat-sum] => 6600
          [shipment-notice-rate-sum] => 0
          [shipment-notice-rate-vat-sum] => 0
          [shipment-sms-notice-rate-sum] => 0
          [shipment-sms-notice-rate-vat-sum] => 0
          [shipping-notice-type] => SIMPLE
          [transport-type] => SURFACE
          [use-online-balance] =>
          [wo-mass] =>
      )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->findOrderByRpo(80083740712514);
    /*
    Array
    (
        [0] => Array
            (
                [address-type-to] => DEFAULT
                [barcode] => 80083740712514
                [batch-category] => COMBINED
                [batch-name] => 24
                [batch-status] => CREATED
                [completeness-checking] =>
                [corpus-to] => 3
                [delivery-time] => Array
                    (
                        [max-days] => 1
                    )
    
                [given-name] => Иван
                [ground-rate] => 16500
                [ground-rate-with-vat] => 19800
                [ground-rate-wo-vat] => 16500
                [house-to] => 92
                [id] => 115527611
                [index-to] => 115551
                [legal-hid] => 15b12c4c-96ff-4548-8e15-aeab82c8e927
                [mail-category] => ORDINARY
                [mail-direct] => 643
                [mail-rank] => WO_RANK
                [mail-type] => POSTAL_PARCEL
                [manual-address-input] =>
                [mass] => 1000
                [mass-rate] => 16500
                [mass-rate-with-vat] => 19800
                [mass-rate-wo-vat] => 16500
                [order-num] => 223
                [payment-method] => CASHLESS
                [place-to] => Москва
                [pochtaid-hid] => 816284
                [postmarks] => Array
                    (
                        [0] => NONSTANDARD
                    )
    
                [postoffice-code] => 109012
                [recipient-name] => Иванов Иван
                [region-to] => Москва
                [room-to] => 1
                [str-index-to] => 115551
                [street-to] => Каширское шоссе
                [surname] => Иванов
                [total-rate-wo-vat] => 16500
                [total-vat] => 3300
                [transport-type] => SURFACE
                [version] => 0
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $orders = []; // Массив заказов
    $result = $otpravkaApi->addOrdersToBatch('24', $orders); // Ответ аналогичен созданию заказов
}

catch (\InvalidArgumentException $e) {
  // Обработка ошибки заполнения параметров
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->deleteOrdersInBatch([115527611]);
    /*
     Array Успешный ответ
    (
        [result-ids] => Array
            (
                [0] => 115685148
            )
    )
   
    Array Ответ с ошибкой
    (
        [errors] => Array
            (
                [0] => Array
                    (
                        [error-code] => NOT_FOUND
                        [position] => 0
                    )
    
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->getOrdersInBatch(25);
    /*
    Array
    (
        [0] => Array
            (
                [address-type-to] => DEFAULT
                [barcode] => 80084740397510
                [batch-category] => COMBINED
                [batch-name] => 25
                [batch-status] => CREATED
                [completeness-checking] =>
                [corpus-to] => 3
                [delivery-time] => Array
                    (
                        [max-days] => 1
                    )
    
                [given-name] => Иван
                [ground-rate] => 16500
                [ground-rate-with-vat] => 19800
                [ground-rate-wo-vat] => 16500
                [house-to] => 92
                [human-operation-name] => Присвоен трек-номер
                [id] => 115689758
                [index-to] => 115551
                [last-oper-attr] => ID_ASSIGNED
                [last-oper-date] => 2019-09-03T11:48:20.759Z
                [last-oper-type] => ID_ASSIGNMENT
                [legal-hid] => 15b12c4c-96ff-4548-8e15-aeab82c8e927
                [mail-category] => ORDINARY
                [mail-direct] => 643
                [mail-rank] => WO_RANK
                [mail-type] => POSTAL_PARCEL
                [manual-address-input] =>
                [mass] => 1000
                [mass-rate] => 16500
                [mass-rate-with-vat] => 19800
                [mass-rate-wo-vat] => 16500
                [order-num] => 2
                [payment-method] => CASHLESS
                [place-to] => Москва
                [pochtaid-hid] => 816284
                [postmarks] => Array
                    (
                        [0] => NONSTANDARD
                    )
    
                [postoffice-code] => 109012
                [recipient-name] => Иванов Иван
                [region-to] => Москва
                [room-to] => 1
                [str-index-to] => 115551
                [street-to] => Каширское шоссе
                [surname] => Иванов
                [total-rate-wo-vat] => 16500
                [total-vat] => 3300
                [transport-type] => SURFACE
                [version] => 1
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->getAllBatches(); // Может вызываться с фильтрами
    /*
    Array
    (
        [0] => Array
            (
                [batch-name] => 24
                [batch-status] => CREATED
                [batch-status-date] => 2019-09-03T11:37:17.589Z
                [combined-batch-mail-types] => Array
                    (
                        [0] => POSTAL_PARCEL
                    )
    
                [courier-order-statuses] => Array
                    (
                        [0] => NOT_REQUIRED
                    )
    
                [international] =>
                [list-number-date] => 2019-09-16
                [mail-category] => COMBINED
                [mail-category-text] => Комбинированно
                [mail-rank] => WO_RANK
                [mail-type] => COMBINED
                [mail-type-text] => Комбинированно
                [payment-method] => CASHLESS
                [postmarks] => Array
                    (
                        [0] => NONSTANDARD
                    )
    
                [postoffice-address] => ул Никольская, д.7-9, стр.3, г Москва
                [postoffice-code] => 109012
                [postoffice-name] => ОПС 109012
                [shipment-avia-rate-sum] => 0
                [shipment-avia-rate-vat-sum] => 0
                [shipment-completeness-checking-rate-sum] => 0
                [shipment-completeness-checking-rate-vat-sum] => 0
                [shipment-contents-checking-rate-sum] => 0
                [shipment-contents-checking-rate-vat-sum] => 0
                [shipment-count] => 1
                [shipment-ground-rate-sum] => 16500
                [shipment-ground-rate-vat-sum] => 3300
                [shipment-insure-rate-sum] => 0
                [shipment-insure-rate-vat-sum] => 0
                [shipment-inventory-rate-sum] => 0
                [shipment-inventory-rate-vat-sum] => 0
                [shipment-mass] => 1000
                [shipment-mass-rate-sum] => 16500
                [shipment-mass-rate-vat-sum] => 3300
                [shipment-notice-rate-sum] => 0
                [shipment-notice-rate-vat-sum] => 0
                [shipment-sms-notice-rate-sum] => 0
                [shipment-sms-notice-rate-vat-sum] => 0
                [shipping-notice-type] => SIMPLE
                [transport-type] => SURFACE
                [use-online-balance] =>
                [wo-mass] =>
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->findOrderInBatch(115689758);
    /*
    Array
    (
        [address-type-to] => DEFAULT
        [barcode] => 80084740397510
        [batch-category] => COMBINED
        [batch-name] => 25
        [batch-status] => CREATED
        [completeness-checking] =>
        [corpus-to] => 3
        [delivery-time] => Array
            (
                [max-days] => 1
            )
    
        [given-name] => Иван
        [ground-rate] => 16500
        [ground-rate-with-vat] => 19800
        [ground-rate-wo-vat] => 16500
        [house-to] => 92
        [human-operation-name] => Присвоен трек-номер
        [id] => 115689758
        [index-to] => 115551
        [last-oper-attr] => ID_ASSIGNED
        [last-oper-date] => 2019-09-03T11:48:20.759Z
        [last-oper-type] => ID_ASSIGNMENT
        [legal-hid] => 15b12c4c-96ff-4548-8e15-aeab82c8e927
        [mail-category] => ORDINARY
        [mail-direct] => 643
        [mail-rank] => WO_RANK
        [mail-type] => POSTAL_PARCEL
        [manual-address-input] =>
        [mass] => 1000
        [mass-rate] => 16500
        [mass-rate-with-vat] => 19800
        [mass-rate-wo-vat] => 16500
        [order-num] => 2
        [payment-method] => CASHLESS
        [place-to] => Москва
        [pochtaid-hid] => 816284
        [postmarks] => Array
            (
                [0] => NONSTANDARD
            )
    
        [postoffice-code] => 109012
        [recipient-name] => Иванов Иван
        [region-to] => Москва
        [room-to] => 1
        [str-index-to] => 115551
        [street-to] => Каширское шоссе
        [surname] => Иванов
        [total-rate-wo-vat] => 16500
        [total-vat] => 3300
        [transport-type] => SURFACE
        [version] => 1
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $otpravkaApi->sendingF103form(28);
}

catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->generateDocPackage(28, OtpravkaApi::PRINT_FILE);
    /*
    GuzzleHttp\Psr7\UploadedFile Object
    (
        [clientFilename:GuzzleHttp\Psr7\UploadedFile:private] => all-pdf.zip
        [clientMediaType:GuzzleHttp\Psr7\UploadedFile:private] => application/zip; charset=UTF-8
        [error:GuzzleHttp\Psr7\UploadedFile:private] => 0
        [file:GuzzleHttp\Psr7\UploadedFile:private] =>
        [moved:GuzzleHttp\Psr7\UploadedFile:private] =>
        [size:GuzzleHttp\Psr7\UploadedFile:private] => 290398
        [stream:GuzzleHttp\Psr7\UploadedFile:private] => GuzzleHttp\Psr7\Stream Object
            (
                [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #56
                [size:GuzzleHttp\Psr7\Stream:private] => 290398
                [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                [readable:GuzzleHttp\Psr7\Stream:private] => 1
                [writable:GuzzleHttp\Psr7\Stream:private] => 1
                [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                    (
                    )
    
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->generateDocF7p(123645924, OtpravkaApi::PRINT_FILE, new DateTimeImmutable('now'));
    /*
    GuzzleHttp\Psr7\UploadedFile Object
    (
        [clientFilename:GuzzleHttp\Psr7\UploadedFile:private] => f7p.pdf
        [clientMediaType:GuzzleHttp\Psr7\UploadedFile:private] => application/pdf; charset=UTF-8
        [error:GuzzleHttp\Psr7\UploadedFile:private] => 0
        [file:GuzzleHttp\Psr7\UploadedFile:private] =>
        [moved:GuzzleHttp\Psr7\UploadedFile:private] =>
        [size:GuzzleHttp\Psr7\UploadedFile:private] => 99776
        [stream:GuzzleHttp\Psr7\UploadedFile:private] => GuzzleHttp\Psr7\Stream Object
            (
                [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #56
                [size:GuzzleHttp\Psr7\Stream:private] => 99776
                [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                [readable:GuzzleHttp\Psr7\Stream:private] => 1
                [writable:GuzzleHttp\Psr7\Stream:private] => 1
                [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                    (
                    )
    
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->generateDocF112ek(123645924, OtpravkaApi::PRINT_FILE);
    /*
    GuzzleHttp\Psr7\UploadedFile Object
    (
        [clientFilename:GuzzleHttp\Psr7\UploadedFile:private] => f112.pdf
        [clientMediaType:GuzzleHttp\Psr7\UploadedFile:private] => application/pdf; charset=UTF-8
        [error:GuzzleHttp\Psr7\UploadedFile:private] => 0
        [file:GuzzleHttp\Psr7\UploadedFile:private] =>
        [moved:GuzzleHttp\Psr7\UploadedFile:private] =>
        [size:GuzzleHttp\Psr7\UploadedFile:private] => 149702
        [stream:GuzzleHttp\Psr7\UploadedFile:private] => GuzzleHttp\Psr7\Stream Object
            (
                [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #56
                [size:GuzzleHttp\Psr7\Stream:private] => 149702
                [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                [readable:GuzzleHttp\Psr7\Stream:private] => 1
                [writable:GuzzleHttp\Psr7\Stream:private] => 1
                [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                    (
                    )
    
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    // Генерация печатных форм до формирования партии
    $result = $otpravkaApi->generateDocOrderPrintForm(123645924, OtpravkaApi::PRINT_FILE, false, new DateTimeImmutable('now'));
    // Генерация печатных форм после формирования партии
    $result = $otpravkaApi->generateDocOrderPrintForm(123645924, OtpravkaApi::PRINT_FILE, true, new DateTimeImmutable('now'));

    /*
    GuzzleHttp\Psr7\UploadedFile Object
    (
        [clientFilename:GuzzleHttp\Psr7\UploadedFile:private] => form.pdf
        [clientMediaType:GuzzleHttp\Psr7\UploadedFile:private] => application/pdf; charset=UTF-8
        [error:GuzzleHttp\Psr7\UploadedFile:private] => 0
        [file:GuzzleHttp\Psr7\UploadedFile:private] =>
        [moved:GuzzleHttp\Psr7\UploadedFile:private] =>
        [size:GuzzleHttp\Psr7\UploadedFile:private] => 251338
        [stream:GuzzleHttp\Psr7\UploadedFile:private] => GuzzleHttp\Psr7\Stream Object
            (
                [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #70
                [size:GuzzleHttp\Psr7\Stream:private] => 251338
                [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                [readable:GuzzleHttp\Psr7\Stream:private] => 1
                [writable:GuzzleHttp\Psr7\Stream:private] => 1
                [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                    (
                    )
    
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->generateDocF103(28, OtpravkaApi::PRINT_FILE);
    /*
    GuzzleHttp\Psr7\UploadedFile Object
    (
        [clientFilename:GuzzleHttp\Psr7\UploadedFile:private] => f103.pdf
        [clientMediaType:GuzzleHttp\Psr7\UploadedFile:private] => application/pdf; charset=UTF-8
        [error:GuzzleHttp\Psr7\UploadedFile:private] => 0
        [file:GuzzleHttp\Psr7\UploadedFile:private] =>
        [moved:GuzzleHttp\Psr7\UploadedFile:private] =>
        [size:GuzzleHttp\Psr7\UploadedFile:private] => 131856
        [stream:GuzzleHttp\Psr7\UploadedFile:private] => GuzzleHttp\Psr7\Stream Object
            (
                [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #74
                [size:GuzzleHttp\Psr7\Stream:private] => 131856
                [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                [readable:GuzzleHttp\Psr7\Stream:private] => 1
                [writable:GuzzleHttp\Psr7\Stream:private] => 1
                [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                    (
                    )
    
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->sendingF103form(28); // return boolean
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->generateDocCheckingAct(28, OtpravkaApi::PRINT_FILE);
    // TODO если у Вас есть пример ответа, просьба приложить его через pull request :)
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->generateReturnLabel(123456, OtpravkaApi::PRINT_FILE, OtpravkaApi::PRINT_TYPE_PAPER);
    // TODO если у Вас есть пример ответа, просьба приложить его через pull request :)
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->archivingBatch([25]);
    /*
    Array    (

        [0] => Array
            (
                [batch-name] => 25
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->unarchivingBatch([25]);
    /*
    Array Успешный ответ
    (
        [0] => Array
            (
                [batch-name] => 25
            )
    
    )
    
    Array Ответ с ошибкой
    (
        [0] => Array
            (
                [batch-name] => 26
                [error-code] => NOT_FOUND
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->getArchivedBatches();
    /*
    Array
    (
        [0] => Array
            (
                [batch-name] => 25
                [batch-status] => ARCHIVED
                [batch-status-date] => 2019-09-03T13:17:59.237Z
                [combined-batch-mail-types] => Array
                    (
                        [0] => POSTAL_PARCEL
                    )
    
                [courier-order-statuses] => Array
                    (
                        [0] => NOT_REQUIRED
                    )
    
                [international] =>
                [list-number-date] => 2019-09-08
                [mail-category] => COMBINED
                [mail-category-text] => Комбинированно
                [mail-rank] => WO_RANK
                [mail-type] => COMBINED
                [mail-type-text] => Комбинированно
                [payment-method] => CASHLESS
                [postmarks] => Array
                    (
                        [0] => NONSTANDARD
                    )
    
                [postoffice-address] => ул Никольская, д.7-9, стр.3, г Москва
                [postoffice-code] => 109012
                [postoffice-name] => ОПС 109012
                [shipment-avia-rate-sum] => 0
                [shipment-avia-rate-vat-sum] => 0
                [shipment-completeness-checking-rate-sum] => 0
                [shipment-completeness-checking-rate-vat-sum] => 0
                [shipment-contents-checking-rate-sum] => 0
                [shipment-contents-checking-rate-vat-sum] => 0
                [shipment-count] => 1
                [shipment-ground-rate-sum] => 16500
                [shipment-ground-rate-vat-sum] => 3300
                [shipment-insure-rate-sum] => 0
                [shipment-insure-rate-vat-sum] => 0
                [shipment-inventory-rate-sum] => 0
                [shipment-inventory-rate-vat-sum] => 0
                [shipment-mass] => 1000
                [shipment-mass-rate-sum] => 16500
                [shipment-mass-rate-vat-sum] => 3300
                [shipment-notice-rate-sum] => 0
                [shipment-notice-rate-vat-sum] => 0
                [shipment-sms-notice-rate-sum] => 0
                [shipment-sms-notice-rate-vat-sum] => 0
                [shipping-notice-type] => SIMPLE
                [transport-type] => SURFACE
                [use-online-balance] =>
                [wo-mass] =>
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->searchPostOfficeByIndex(115551, 0, 0);
    /*
    Array
    (
        [address-source] => Домодедовская ул, 20, к.3, стр.2
        [distance] => 7059103.1165241
        [holidays] => Array
            (
            )
    
        [is-closed] =>
        [is-private-category] =>
        [is-temporary-closed] =>
        [latitude] => 55.612772
        [longitude] => 37.704862
        [postal-code] => 115551
        [region] => Москва г
        [settlement] => Москва
        [type-code] => ГОПС
        [type-id] => 8
        [working-hours] => Array
            (
                [0] => Array
                    (
                        [begin-worktime] => 08:00:00.000
                        [end-worktime] => 20:00:00.000
                        [lunches] => Array
                            (
                            )
    
                        [weekday-id] => 1
                    )
    
                [1] => Array
                    (
                        [begin-worktime] => 08:00:00.000
                        [end-worktime] => 20:00:00.000
                        [lunches] => Array
                            (
                            )
    
                        [weekday-id] => 2
                    )
    
                [2] => Array
                    (
                        [begin-worktime] => 08:00:00.000
                        [end-worktime] => 20:00:00.000
                        [lunches] => Array
                            (
                            )
    
                        [weekday-id] => 3
                    )
    
                [3] => Array
                    (
                        [begin-worktime] => 08:00:00.000
                        [end-worktime] => 20:00:00.000
                        [lunches] => Array
                            (
                            )
    
                        [weekday-id] => 4
                    )
    
                [4] => Array
                    (
                        [begin-worktime] => 08:00:00.000
                        [end-worktime] => 20:00:00.000
                        [lunches] => Array
                            (
                            )
    
                        [weekday-id] => 5
                    )
    
                [5] => Array
                    (
                        [begin-worktime] => 09:00:00.000
                        [end-worktime] => 18:00:00.000
                        [lunches] => Array
                            (
                            )
    
                        [weekday-id] => 6
                    )
    
                [6] => Array
                    (
                        [begin-worktime] => 09:00:00.000
                        [end-worktime] => 14:00:00.000
                        [lunches] => Array
                            (
                            )
    
                        [weekday-id] => 7
                    )
    
            )
    
        [works-on-saturdays] => 1
        [works-on-sundays] => 1
        [phones] => Array
            (
                [0] => Array
                    (
                        [is-fax] =>
                        [phone-number] => 1000000
                        [phone-town-code] => 800
                        [phone-type-name] => Прочее
                    )
    
            )
    
        [service-groups] => Array
            (
                [0] => Array
                    (
                        [group-id] => 2101
                        [group-name] => Почтовые услуги
                    )
    
                [1] => Array
                    (
                        [group-id] => 2315
                        [group-name] => Коммерческие услуги
                    )
    
                [2] => Array
                    (
                        [group-id] => 2259
                        [group-name] => Финансовые услуги
                    )
    
            )
    
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->searchPostOfficeByAddress('Санкт-Петербург, улица Победы, 15к1');
    /*
    Array
    (
        [is-matched] =>
        [postoffices] => Array
            (
                [0] => 196070
            )
    
    )
    */
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->getPostOfficeServices(196070);
    $result = $otpravkaApi->getPostOfficeServices(196070, 2101); // С фильтром по группе
    /*
    Array
    (
        [0] => Array
            (
                [code] => 1090900
                [group-id] => 2101
                [name] => Хранение и возврат почтовых отправлений, периодических изданий: Абонирование ячейки абонементного почтового шкафа, Возврат посылок, Возврат РПО (кроме посылок), Хранение РПО в ОПС
            )
    
        [1] => Array
            (
                [code] => 1090200
                [group-id] => 2101
                [name] => Информирование отправителей и получателей РПО, ЕМS -отправлений об их статусе: SMS-уведомление, Заказное уведомление о вручении внутреннего  РПО, Простое уведомление о вручении внутреннего РПО, Простое уведомление о получении международного почтового отправления, Электронное уведомление о вручении внутреннего РПО
            )
    
        [2] => Array
            (
                [code] => 1090100
                [group-id] => 2101
                [name] => Доставка и оказание услуг по адресу расположения (проживания) клиента: Доставка посылок и мелких пакетов по местонахождению клиента
            )
    */
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->searchPostOfficeByCoordinates($params); // $params - массив параметров поиска
    /*
        Ответ аналогичен функции searchPostOfficeByIndex только список.
    */
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->getPostalCodesInLocality('Екатеринбург');
    /*
    Array
    (
        [0] => 620000
        [1] => 620002
        [2] => 620004
        [3] => 620007
        [4] => 620010
        [5] => 620012
    */
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    $result = $otpravkaApi->getPostOfficeFromPassport(\LapayGroup\RussianPost\Enum\OpsObjectType::OPS);
    /*
    GuzzleHttp\Psr7\UploadedFile Object
    (
        [clientFilename:GuzzleHttp\Psr7\UploadedFile:private] => OPS02_May_2020.zip.octet-stream
        [clientMediaType:GuzzleHttp\Psr7\UploadedFile:private] => application/octet-stream; charset=UTF-8
        [error:GuzzleHttp\Psr7\UploadedFile:private] => 0
        [file:GuzzleHttp\Psr7\UploadedFile:private] =>
        [moved:GuzzleHttp\Psr7\UploadedFile:private] =>
        [size:GuzzleHttp\Psr7\UploadedFile:private] => 4203382
        [stream:GuzzleHttp\Psr7\UploadedFile:private] => GuzzleHttp\Psr7\Stream Object
            (
                [stream:GuzzleHttp\Psr7\Stream:private] => Resource id #56
                [size:GuzzleHttp\Psr7\Stream:private] => 4203382
                [seekable:GuzzleHttp\Psr7\Stream:private] => 1
                [readable:GuzzleHttp\Psr7\Stream:private] => 1
                [writable:GuzzleHttp\Psr7\Stream:private] => 1
                [uri:GuzzleHttp\Psr7\Stream:private] => php://temp
                [customMetadata:GuzzleHttp\Psr7\Stream:private] => Array
                    (
                    )
    
            )
    )*/
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

$otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
$result = $otpravkaApi->returnShipment(123456, \LapayGroup\RussianPost\Enum\MailType::UNDEFINED);

// Успешный ответ
/*Array
(
    [return-barcode] => 1234567890 // ШПИ возвратного отправления
)

// Ответ с ошибкой
/*Array
(
    [errors] => Array
        (
            [0] => Array
                (
                    [code] => DIRECT_SHIPMENT_NOT_FOUND
                    [description] => Прямое отправление не найдено
                )

        )

)*/


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    
    $addressFrom = new \LapayGroup\RussianPost\Entity\AddressReturn();
    $addressFrom->setAddressType(\LapayGroup\RussianPost\Enum\AddressType::DEFAULT);
    $addressFrom->setIndex(125009);
    $addressFrom->setPlace('Москва');
    $addressFrom->setRegion('Москва');

    $addressTo = new \LapayGroup\RussianPost\Entity\AddressReturn();
    $addressTo->setAddressType(\LapayGroup\RussianPost\Enum\AddressType::DEFAULT);
    $addressTo->setIndex(115551);
    $addressTo->setPlace('Москва');
    $addressTo->setRegion('Москва');

    $return_shipment = new \LapayGroup\RussianPost\Entity\ReturnShipment();
    $return_shipment->setMailType(\LapayGroup\RussianPost\Enum\MailType::UNDEFINED);
    $return_shipment->setSenderName('Иванов Иван');
    $return_shipment->setRecipientName('Петров Петр');
    $return_shipment->setOrderNum(1234);
    $return_shipment->setAddressFrom($addressFrom);
    $return_shipment->setAddressTo($addressTo);

    $result = $otpravkaApi->createReturnShipment([$return_shipment->asArr()]);
    
    // Успешный ответ
    // TODO добавьте в PR, если у кого есть реальный пример, пожалуйста :-)
    
    // Ответ с ошибкой
    /*Array
    (
        [0] => Array
        (
            [errors] => Array
            (
                [0] => Array
                (
                    [code] => FREE_ER_ADDRESS_NOT_ENABLED
                    [description] => Свободный ввод адреса не доступен
                        )

                )

            [position] => 0
        )
    )*/
}
    
catch (\InvalidArgumentException $e) {
  // Обработка ошибки заполнения параметров
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

$otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
$result = $otpravkaApi->deleteReturnShipment(123456);
   
/*Array
(
    [code] => RETURN_SHIPMENT_NOT_FOUND
    [description] => Возвратное отправление не найдено
)*/


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

try {
    $otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
    
    $addressFrom = new \LapayGroup\RussianPost\Entity\AddressReturn();
    $addressFrom->setAddressType(\LapayGroup\RussianPost\Enum\AddressType::DEFAULT);
    $addressFrom->setIndex(125009);
    $addressFrom->setPlace('Москва');
    $addressFrom->setRegion('Москва');

    $addressTo = new \LapayGroup\RussianPost\Entity\AddressReturn();
    $addressTo->setAddressType(\LapayGroup\RussianPost\Enum\AddressType::DEFAULT);
    $addressTo->setIndex(115551);
    $addressTo->setPlace('Москва');
    $addressTo->setRegion('Москва');

    $return_shipment = new \LapayGroup\RussianPost\Entity\ReturnShipment();
    $return_shipment->setMailType(\LapayGroup\RussianPost\Enum\MailType::UNDEFINED);
    $return_shipment->setSenderName('Иванов Иван');
    $return_shipment->setRecipientName('Петров Петр');
    $return_shipment->setOrderNum(1234);
    $return_shipment->setAddressFrom($addressFrom);
    $return_shipment->setAddressTo($addressTo);

    $result = $otpravkaApi->editReturnShipment($return_shipment, 123456);
    
    // Успешный ответ
    // TODO добавьте в PR, если у кого есть реальный пример, пожалуйста :-)
    
    // Ответ с ошибкой
    /* Array
    (
        [errors] => Array
            (
                [0] => Array
                    (
                        [code] => FREE_ER_ADDRESS_NOT_ENABLED
                        [description] => Свободный ввод адреса не доступен
                    )

            )

    )*/
}
    
catch (\InvalidArgumentException $e) {
  // Обработка ошибки заполнения параметров
}
        
catch (\LapayGroup\RussianPost\Exceptions\RussianPostException $e) {
  // Обработка ошибочного ответа от API ПРФ
}

catch (\Exception $e) {
  // Обработка нештатной ситуации
}


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

$otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
$list = $otpravkaApi->shippingPoints();


use Symfony\Component\Yaml\Yaml;
use LapayGroup\RussianPost\Providers\OtpravkaApi;

$otpravkaApi = new OtpravkaApi(Yaml::parse(file_get_contents('path_to_config.yaml')));
$info = $otpravkaApi->settings();