定制 jackmartin/justin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jackmartin/justin

最新稳定版本:v1.5.5

Composer 安装命令:

composer require jackmartin/justin

包简介

Library Justin API

README 文档

README

header

Описание

Latest Stable Version Total Downloads License

PHP класс для работы с API Justin

Read this in other language: English, Русский, Український

Wiki - Описание работы библиотеки

Тестирование

Документация

API documentation

Telegram Поддержка API

Требования

  • PHP 5.6 или выше
  • Composer

Composer

composer require jackmartin/justin

Библиотеки

Guzzle

Основные методы API

  1. Настройка подключения
  2. Получить текущий статус заказа:
  3. Получить список областей
  4. Получить список областных районов
  5. Получить список населенных пунктов
  6. Получить список районов населенных пунктов
  7. Получить список улиц города
  8. Получить список типов отделений
  9. Получить список отделений.
  10. Получить расписание работы отделения. (Старый метод)
  11. Создать новый заказ(Отправление)
  12. Отмена заказа
  13. Получить список статусов заказа
  14. Получить ключ торговца(senderID)
  15. Получить историю движения отправления
  16. Получить историю статусов заказа.
  17. Получить список заказов за указанный период
  18. Получить информацию о заказе
  19. Создать стикер заказа
  20. Калькулятор стоимости услуг

Примеры

__construct()

use Justin\Justin;

include_once 'vendor/autoload.php';

$justin = new Justin('RU', true, 'v2', 30, 30, 'Europe/Kiev');

currentStatus()

include_once 'vendor/autoload.php';

use Justin\Justin;

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

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

print_r(

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

);

listRegions()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

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

);

listAreasRegion()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

    $justin->listAreasRegion()

);

listCities()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

    $justin->listCities()

);

listCityRegion()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

    $justin->listCityRegion()

);

listStreetsCity()

use Justin\Justin;

include_once 'vendor/autoload.php';

$justin = new Justin('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()

);

branchTypes()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

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

);

listDepartments()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

    $justin->listDepartments()

);

listDepartmentsLang()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

    $justin->listDepartmentsLang()

);

branchSchedule()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

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

);

cancelOrder()

include_once 'vendor/autoload.php';

use Justin\Justin;

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


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

print_r(

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

);

listStatuses()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

    $justin->listStatuses()

);

keySeller()

use Justin\Justin;

include_once 'vendor/autoload.php';

$justin = new Justin('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()

);

trackingHistory()

include_once 'vendor/autoload.php';

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()

);

getStatusHistoryF()

use Justin\Justin;

include_once 'vendor/autoload.php';

$justin = new Justin('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()

);

createOrder()

Пример 1

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')
    ->requirePickup(true)
    ->senderBranchID(

        '2100102032'

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

        '2100108028'

    )
    ->volume('0.02')
    ->weight('10')
    ->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('Ваш ключ');

$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()

);

listOrders()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

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

);

orderInfo()

use Justin\Justin;

include_once 'vendor/autoload.php';

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

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

print_r(

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

);

createSticker()

use Justin\Justin;

include_once 'vendor/autoload.php';

$justin = new Justin('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

    // )

);

Стикер пример

Sticker

calculatePriceService()

use Justin\Justin;

include_once 'vendor/autoload.php';

$justin = new Justin('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()

);

统计信息

  • 总下载量: 9.02k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 3
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-22