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

Examples

Evgen Kytonin edited this page Apr 5, 2021 · 18 revisions

examples

Страница описывает примеры использование библиотеки Justin API

Data

getRaw

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->getRaw()

);

getData

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->getData()

);

getStatus

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->getStatus()

);

getResult

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->getResult()

);

getError

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->getError()

);

getErrors

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->getErrors()

);

getMessage

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->getMessage()

);

totalRecords

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->totalRecords()

);

fields

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->fields()

);

first

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->fields()->first()

);

last

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->fields()->last()

);

typeDepart

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->typeDepart()

);

areaRegion

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->areaRegion()

);

street

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->street()

);

counterpart

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('login')->equal('Ваш логин')->keySeller()->fields()->counterpart()

);

order

Пример 1

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

$justin->setKey('Ваш ключ API');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа
    ')->getStatusHistoryF()->fields()->order()
    // $justin
    //     ->name('orderNumber')
    //     ->like('201810165')
    //     ->name('TTN')
    //     ->equal('75106031300725001')
    //     ->getStatusHistoryF()
    //     ->getRaw()

);

Пример 2

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа
    ')->getStatusHistory()->fields()->order()

);

statusOrder

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа
    ')->getStatusHistory()->fields()->statusOrder()

);

senderID

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

$justin->setKey('Ваш ключ API');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа
    ')->getStatusHistoryF()->fields()->senderID()

);

getUUID()

Пример 1

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

$justin->setKey('Ваш ключ API');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа
    ')->getStatusHistoryF()->fields()->senderID()->getUUID()

);

Пример 2

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->fields()->getUUID()

);

getCode

Пример 1

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listCities()->fields()->getCode()

);

Пример 2

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->fields()->getCode()

);

getDescr

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listCities()->fields()->getDescr()

);

getSCOATOU

Пример 1

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listRegions()->fields()->getSCOATOU()

);

Пример 2

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->getSCOATOU('region')
    // $justin->listDepartmentsLang()->fields()->getSCOATOU('city')
    // $justin->listDepartmentsLang()->fields()->getSCOATOU('locality')
    // $justin->listDepartmentsLang()->fields()->getSCOATOU('area')

);

getRegionSCOATOU

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->getRegionSCOATOU()

);

getCitySCOATOU

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->getCitySCOATOU()

);

getLocalitySCOATOU

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->getLocalitySCOATOU()

);

getAreaRegionSCOATOU

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->getAreaRegionSCOATOU()

);

getType

Пример 1

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->city()->getType()

);

Пример 2

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listCities()->fields()->owner()->geType()

);

branchID

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->branchID()

);

getAddress

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getAddress()

);

getPosition

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getPosition()

);

getWeightLimit

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getWeightLimit()

);

getQuereVisit

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getQuereVisit()

);

getAgent

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getAgent()

);

getPayCard

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getPayCard()

);

getAcceptPay

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getAcceptPay()

);

getPostmat

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getPostmat()

);

getCodeHolding

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getCodeHolding()

);

getShedulerID

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getShedulerID()

);

getID

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartments()->fields()->getID()

);

getEnum

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->typeDepart()->getEnum()

);

getValue

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->typeDepart()->getValue()

);

getDepartNumber

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->getDepartNumber()

);

getHouseNumber

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->listDepartmentsLang()->fields()->getHouseNumber()

);

getLogin

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('login')->equal('Ваш логин')->keySeller()->fields()->getLogin()

);

getStatusDate

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа')->getStatusHistory()->fields()->getStatusDate()
);

getOrderNumber

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа')->getStatusHistory()->fields()->getOrderNumber()
);

getClientNumber

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа')->getStatusHistory()->fields()->getClientNumber()
);

getTTN

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа')->getStatusHistory()->fields()->getTTN()
);

getDDepartment

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа')->getStatusHistory()->fields()->getDDepartment()
);

getADepartment

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('orderNumber')->equal('ИД заказа')->getStatusHistory()->fields()->getADepartment()
);

ttn

include_once 'vendor/autoload.php';

use Justin\Order;

$order = new Order('RU', true);

$order = ...

print_r(

    $order->fields()->ttn()

);

number

include_once 'vendor/autoload.php';

use Justin\Order;

$order = new Order('RU', true);

$order = ...

print_r(

    $order->fields()->number()

);

data

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

        $justin->name('Depart')->equal('1a4df005-5d8d-11e8-80be-525400fb7782')->branchSchedule()->fields()->data()
        // $justin->name('Depart')->equal('1a4df005-5d8d-11e8-80be-525400fb7782')->branchSchedule()->fields()->startWork()
        // $justin->name('Depart')->equal('1a4df005-5d8d-11e8-80be-525400fb7782')->branchSchedule()->fields()->workDay()

);

numberEN

use Justin\Justin;

include_once 'vendor/autoload.php';

$justin = new Justin('RU', true);

$justin->setKey('Ваш ключ');

print_r(

    $justin->listOrders('20190410')->fields()->numberEN()
    // $justin->listOrders('20190410')->fields()->numberKIS()
    // $justin->listOrders('20190410')->fields()->numberTTN()
    // $justin->listOrders('20190410')->fields()->sender()
    // $justin->listOrders('20190410')->fields()->receiver()
    // $justin->listOrders('20190410')->fields()->phoneSender()
    // $justin->listOrders('20190410')->fields()->phoneReceiver()
    // $justin->listOrders('20190410')->fields()->dateStatus()
    // $justin->listOrders('20190410')->fields()->statusUUID()
);

senderCity

use Justin\Justin;

include_once 'vendor/autoload.php';

$justin = new Justin('RU', true);

$justin->setKey('Ваш ключ');

print_r(

    $justin->orderInfo('5093')->fields()->senderCity()
    // $justin->orderInfo('5093')->fields()->senderCompany()
    // $justin->orderInfo('5093')->fields()->addressPickup()
    // $justin->orderInfo('5093')->fields()->requirePickup()
    // $justin->orderInfo('5093')->fields()->senderBranch()
    // $justin->orderInfo('5093')->fields()->receiverContact()
    // $justin->orderInfo('5093')->fields()->countPlace()
    // $justin->orderInfo('5093')->fields()->volume()
    // $justin->orderInfo('5093')->fields()->weight()
    // $justin->orderInfo('5093')->fields()->costDeclared()
    // $justin->orderInfo('5093')->fields()->deliveryAmount()
    // $justin->orderInfo('5093')->fields()->redeliveryAmount()
    // $justin->orderInfo('5093')->fields()->orderAmount()
    // $justin->orderInfo('5093')->fields()->redeliveryPay()
    // $justin->orderInfo('5093')->fields()->redeliveryPayer()
    // $justin->orderInfo('5093')->fields()->deliveryPay()
    // $justin->orderInfo('5093')->fields()->deliveryPayer()
    // $justin->orderInfo('5093')->fields()->orderPay()
    // $justin->orderInfo('5093')->fields()->deliveryType()
    // $justin->orderInfo('5093')->fields()->codType()
    // $justin->orderInfo('5093')->fields()->cardNumber()
    // $justin->orderInfo('5093')->fields()->cargoList()->marking()
    // $justin->orderInfo('5093')->fields()->cargoList()->width()
    // $justin->orderInfo('5093')->fields()->cargoList()->height()
    // $justin->orderInfo('5093')->fields()->cargoList()->depth()
    // $justin->orderInfo('5093')->fields()->addDescription()

);

description

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->branchTypes()->fields()->description()

);

Filter

filter

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->filter(

        [

            'name'       => 'descr',

            'comparison' => 'equal',

            'leftValue'  => 'Одесская',

        ]

    )->listRegions()->getRaw()

);

limit

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->limit(1)->listRegions()->getRaw()

);

name

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('descr')->leftValue('Одесская')->equal()->listRegions()->getRaw()

);

equal

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('descr')->equal('Одесская')->listRegions()->getRaw()

);

not

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('descr')->not('Одесская')->listRegions()->getRaw()

);

less

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('code')->less('000000008')->listRegions()->getRaw()

);

more

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('code')->more('000000008')->listRegions()->getRaw()

);

in

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('code')->in(['000000008', '000000009'])->listRegions()->getRaw()

);

between

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('code')->between(['000000008', '000000010'])->listRegions()->getRaw()

);

notIn

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('code')->notIn(['000000008', '000000010'])->listRegions()->getRaw()

);

lessEqual

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('code')->lessEqual('000000010')->listRegions()->getRaw()

);

moreEqual

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('code')->moreEqual('000000010')->listRegions()->getRaw()

);

like

include_once 'vendor/autoload.php';

use Justin\Justin;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

print_r(

    $justin->name('descr')->like('Одес')->listRegions()->getRaw()

);

Order

Пример 1

include_once 'vendor/autoload.php';

use Justin\Justin;

$order = new Justin('RU', true);

$order->setKey('Ваш ключ API');

$newOrder = $order
    ->setNumber('52525')
    ->setDate()
    ->senderCityID(

        '32b69b95-9018-11e8-80c1-525400fb7782'

    )
    ->sender('ТОП ПРОДАЦЕЦ')
    ->senderContact('Иванов Иван')
    ->senderPhone('380524152299')
    ->addressReceipt('ул. Груша. 7')
    ->requirePickup(true)
    ->senderBranchID(

        '2100102032'

    )
    ->receiver('ТОВ Укрпочта')
    ->receiverContact('Петр 1')
    ->receiverPhone('380425831259')
    ->countPlace(1)
    ->receiverBranchID(

        '2100108028'

    )
    ->volume('0.02')
    ->weight('100')
    ->costDeclared(1500)
    ->deliveryAmount(0)
    ->redeliveryAmount(1500)
    ->orderAmount(1500)
    ->redeliveryPay(true)
    ->redeliveryPayer(1)
    ->deliveryPay(true)
    ->deliveryPayer(1)
    ->requireDelivery(false)
    ->orderPay(true)
    ->comment('Тест заказ')
    ->createOrder();

print_r(

    $newOrder->fields()->number()
    // $newOrder->fields()->ttn()
    // $newOrder->getData()
    // $newOrder->getResult()
    // $newOrder->getRaw()

);

Пример 2

include_once 'vendor/autoload.php';

use Justin\Justin;

$order = new Justin('RU', true);

$order->setKey('Ваш ключ API');

$newOrder = $order->createOrder(

    [
        'number'                         => '123456',

        'date'                           => '20171221',

        'sender_city_id'                 => '32b69b95-9018-11e8-80c1-525400fb7782',

        'sender_company'                 => 'УА ТОВ',

        'sender_contact'                 => 'Петрова Ирина',

        'sender_phone'                   => '+380991112233',

        'sender_pick_up_address'         => 'Степана Бандери, No 6',

        'pick_up_is_required'            => true,

        'sender_branch'                  => '2100102032',

        'receiver'                       => 'Петров Сергей',

        'receiver_contact'               => '',

        'receiver_phone'                 => 'Петров Сергей',

        'count_cargo_places'             => 2,

        'branch'                         => '2100108028',

        'weight'                         => 0.1,

        'volume'                         => 0.02,

        'declared_cost'                  => 1500,

        'delivery_amount'                => 0,

        'redelivery_amount'              => 1500,

        'order_amount'                   => 1500,

        'redelivery_payment_is_required' => true,

        'redelivery_payment_payer'       => 1,

        'delivery_payment_is_required'   => true,

        'delivery_payment_payer'         => 1,

        'delivery_is_required'           => false,

        'order_payment_is_required'      => true,

        'add_description'                => 'Тест API'
    ]

);

print_r(

    $newOrder->fields()->number()
    // $newOrder->fields()->ttn()
    // $newOrder->getData()
    // $newOrder->getResult()
    // $newOrder->getRaw()

);

Пример 3 (Добавление груза в массив данных грузовых мест)

$order = new Justin('RU', true);

$cargoList = $order
        ->cargoMarking('1')
        ->cargoWeight('1')
        ->cargoWidth('10')
        ->cargoHeight('15')
        ->cargoDepth('20')
        ->addCargo();

$order->cargoList()->createOrder();

Exceptions

include_once 'vendor/autoload.php';

use Justin\Justin;
use Justin\Exceptions\JustinApiException;
use Justin\Exceptions\JustinDataException;
use Justin\Exceptions\JustinFileException;
use Justin\Exceptions\JustinHttpException;
use Justin\Exceptions\JustinResponseException;
use Justin\Exceptions\JustinAuthException;

$justin = new Justin('RU', true);

$justin->setLogin('Ваш логин')->setPassword('Ваш пароль');

try {

    $justin->name('code')->equal('25')->listRegions()

} catch (JustinApiException $exception) {

    print_r(

        $exception->getResponse()

    );

} catch (JustinDataException $exception) {

    print_r(

        $exception->getResponse()

    );

} catch (JustinResponseException $exception) {

    print_r(

        $exception->getResponse()

    );
    echo "\n";
    print_r(

        $exception->getRequest()

    );

} catch (JustinHttpException $exception) {

    print_r(

        $exception->getResponse()

    );

} catch (JustinFileException $exception) {

    print_r(

        $exception->getResponse()

    );

} catch (JustinAuthException $exception) {

    print_r(

        $exception->getResponse()

    );

}