PHP code example of jackmartin / justin

1. Go to this page and download the library: Download jackmartin/justin 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/ */

    

jackmartin / justin example snippets


use Justin\Justin;

in('RU', true, 'v2', 30, 30, 'Europe/Kiev');



use Justin\Justin;

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

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

print_r(

    $justin->currentStatus('201971185')->getData()

);

use Justin\Justin;

in('RU', true);

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

print_r(

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

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->listAreasRegion()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->listCities()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->listCityRegion()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->listStreetsCity(

        [

            [

                'name'       => 'objectOwner',

                'comparison' => 'equal',

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

            ]

        ]

    )

    // $justin->name('objectOwner')->leftValue('32b69b95-9018-11e8-80c1-525400fb7782')->equal()->listStreetsCity()
    // $justin->name('objectOwner')->equal('32b69b95-9018-11e8-80c1-525400fb7782')->listStreetsCity()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->branchTypes()->getData()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->listDepartments()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->listDepartmentsLang()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin
    ->name('Depart')
    ->equal('1a4df005-5d8d-11e8-80be-525400fb7782')
    ->branchSchedule()
    ->getData()

);



use Justin\Justin;

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


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

print_r(

    $justin->cancelOrder('Код заказа')->getData()

);


use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->listStatuses()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->keySeller(

        [

            [

                'name'       => 'login',

                'comparison' => 'equal',

                'leftValue'  => 'test',

            ],

        ]

    )
    
    // $justin->name('login')->leftValue('test')->equal()->keySeller()
    // $justin->name('login')->equal('test')->keySeller()

);



use Justin\Justin;

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

print_r(

    $justin->trackingHistory('201810165')->getData()
    // $justin->trackingHistory('201810165')->fields()->orderNumber()
    // $justin->trackingHistory('201810165')->fields()->orderDescr()
    // $justin->trackingHistory('201810165')->fields()->status()
    // $justin->trackingHistory('201810165')->fields()->date()
    // $justin->trackingHistory('201810165')->fields()->time()
    // $justin->trackingHistory('201810165')->fields()->dateAdded()
    // $justin->trackingHistory('201810165')->fields()->deparNumber()
    // $justin->trackingHistory('201810165')->fields()->deparAddress()

);

use Justin\Justin;

in('RU', true);

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

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

print_r(

    $justin->getStatusHistoryF(

        [

            'name'       => 'orderNumber',

            'comparison' => 'equal',

            'leftValue'  => '000000004',

        ]

    )

    // $justin->name('orderNumber')->leftValue('000000004')->equal()->getStatusHistory()
    // $justin->name('orderNumber')->equal('000000004')->getStatusHistory()

);

include_once 'vendor/autoload.php';

use Justin\Justin;

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

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

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

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

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

include_once 'vendor/autoload.php';

use Justin\Justin;

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

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

$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_,

        'redelivery_payment_is_

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->listOrders('20190505')->getData()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->orderInfo('Ваш номер заказа')->getData()

);

use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->createSticker(

        null, '400144837', __DIR__ . '/' . time() . '.pdf', null, false

    )

    // $justin->createSticker(

    //     [400144837, 400144837], null, __DIR__ . '/t.pdf', null, false

    // )

);


use Justin\Justin;

in('RU', true);

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

print_r(

    $justin->calculatePriceService([

        'point_a_locality_uuid' => 'e7ebcef9-dbfb-11e7-80c6-00155dfbfb00',
        'point_b_locality_uuid' => 'e7ebcef9-dbfb-11e7-80c6-00155dfbfb00',
        'weight'                => 35.0,
        'cargo_details'         => [
            [
                'cargo_description' => 'fdd20d8b-1375-11eb-a2e5-0050569bda1b',
                'amount'            => 0,
            ],
     
            [
                'cargo_description' => 'bed96769-1386-11eb-a2e5-0050569bda1b',
                'amount'            => 1,
            ],
     
        ],
        'cargo_places_array'    => [
      
            [
                'weight' => 10,
                'width'  => 2,
                'height' => 1,
                'depth'  => 1,
            ],
      
            [
                'weight' => 5,
                'width'  => 1,
                'height' => 1,
                'depth'  => 1,
            ],
      
      ],

    ])->getData()

);