sch-group / pickpoint
Russian PickPoint delivery service api connector
Installs: 7 795
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 2
Forks: 5
Open Issues: 0
Requires
- php: >=7.0
- guzzlehttp/guzzle: >=6.2
- predis/predis: ^1.1.1
Requires (Dev)
- guzzlehttp/guzzle: >=6.2
- phpunit/phpunit: ~6.5.5
- piwik/ini: ^2.0
- predis/predis: 1.1.1
- dev-master
- v4.2
- v4.1
- v4.0
- v3.9
- 3.8
- v3.7
- v3.6
- v3.5
- v3.4
- v3.3
- v3.2
- v3.1
- v3.0
- v2.9.x-dev
- v2.9
- v2.8.x-dev
- v2.8
- v2.7.x-dev
- v2.7
- v2.6.x-dev
- v2.6
- v2.5.x-dev
- v2.5
- v2.4.x-dev
- v2.4
- v2.3.x-dev
- v2.3
- v2.2.x-dev
- v2.2
- v2.1.x-dev
- 2.1
- v2.0.x-dev
- v2.0
- v1.9.x-dev
- v1.9
- v1.8.x-dev
- v1.8
- v1.7.x-dev
- v1.7
- v1.6.x-dev
- v1.6
- v1.5.x-dev
- v1.5
- v1.4.x-dev
- v1.4
- v1.3.x-dev
- v1.3
- v1.2.x-dev
- v1.2
- v1.1.x-dev
- v1.1
- v1.0
This package is auto-updated.
Last update: 2025-03-01 00:43:29 UTC
README
API PICKPOINT PHP SDK
https://pickpoint.ru/sales/api/
@ainurecm telegram
composer require sch-group/pickpoint
Примеры:
Инициализация
$config = [
'host' => '',
'login' => '',
'password' => '',
'ikn' => '',
];
$pickPointConf = new PickPointConf($config['host'], $config['login'], $config['password'], $config['ikn']);
$defaultPackageSize = new PackageSize(20, 20,20); // может быть null
$senderDestination = new SenderDestination('Москва', 'Московская обл.'); // Адрес отправителя
$client = new PickPointConnector($pickPointConf, $senderDestination, $defaultPackageSize);
Так же можно добавить кэширование, для ускорения запроса на авторизацию
$redisCacheConf = [
'host' => '127.0.0.1',
'port' => 6379
];
$client = new PickPointConnector($pickPointConf, $senderDestination, $defaultPackageSize, $redisCacheConf);
Получение массива постаматов
$points = $client->getPoints(); // get postamats list
Цены за доставку
$receiverDestination = new ReceiverDestination('Санкт-Петербург', 'Ленинградская обл.');
$prices = $client->calculatePrices($receiverDestination); // вернет массив с ценами и тарифами
$tariffPrice = $client->calculateObjectedPrices($receiverDestination); // Вернет объект с ценами
$commonStandardPrice = $tariffPrice->getStandardCommonPrice(); // получить общую цену с тарифом стандарт
Создание отправления
$invoice = new Invoice();
$invoice->setSenderCode('order: 123456');
$invoice->setPostamatNumber('5602-009');
$invoice->setDescription('Custom zakaz');
$invoice->setRecipientName('Саша');
$invoice->setMobilePhone('+79274269590');
$invoice->setEmail('kek@mail.ru');
$invoice->setGettingType('sc'); // courier or sc
$invoice->setSum(500.00);
$invoice->setDeliveryMode('standard'); // stanadard or priority
$packageSize = new PackageSize(20, 20, 20);
$invoice->setPackageSize($packageSize);
$product = new Product('number 234', 'Test', 2, 100);
$address = new Address();
$address->setCityName('Казань');
$address->setPhoneNumber('+79274269590');
$invoice->setClientReturnAddress($address);
$response = $client->createShipment($invoice);
Печать наклейки
$invoice = $client->createShipmentWithInvoice($invoice);
$invoiceNumber = $invoice->getInvoiceNumber();
$pdfByteCode = $client->printLabel(array($invoiceNumber));
Создание реестра и печать
$invoice = $client->createShipmentWithInvoice($invoice);
$invoiceNumber = $invoice->getInvoiceNumber();
$reestr = $client->makeReceipt(array($invoiceNumber));
$pdfByteCode = $client->rintReceipt($reestr[0]);
Одновременное создание реестра и печать
$invoice = $client->createShipmentWithInvoice($invoice);
$invoiceNumber = $invoice->getInvoiceNumber();
$pdfByteCode = $client->makeReceiptAndPrint(array($invoiceNumber));
Удалить инвойс из реестра
$remove = $client->removeInvoiceFromReceipt($invoiceNumber);
Проверка статуса отправлений
$invoiceNumber = $invoice->getInvoiceNumber();
$status = $client->getStatus($invoiceNumber);
$status->getState();
$status->getStateText();
Получить все статусы
$states = $client->getStates();
Отмена отправления
$senderCode = $invoice->getSenderCode(); // order id
$cancelResponse = $client->cancelInvoice($invoiceNumber);
или
$cancelResponse = $client->cancelInvoice('', $senderCode); // отмена с собственным id заказа
Информация об отправлении
$response = $client->shipmentInfo($invoiceNumber);
$response = $client->shipmentInfo('', $senderCode);
Вызов курьера
$senderDestination = new SenderDestination('Москва', 'Московская обл.', '', 992);
$courierCall = new CourierCall(
$senderDestination->getCity(),
$senderDestination->getCityId(),
$senderDestination->getAddress(),
'Тестов Тест',
'+79274269594',
new \DateTime('tomorrow + 1 day'),
12 * 60, // from 12:00,
17 * 60, // to 17:00
1, // 1 заказ,
1, // 10 кг
'Это тестовый вызов, пожалуйста не приезжайте'
);
$callCourier = $client->callCourier($courierCall);
$courierOrderNumber = $callCourier->getCallOrderNumber();
Отмена вызова курьера
$cancelResponse = $client->cancelCourierCall($courierOrderNumber);
История изменения отправления
$response = $client->getInvoicesTrackHistory([$invoiceNumber]);
$states = $client->getInvoiceStatesTrackHistory($invoiceNumber);
$lastSates = $client->getInvoicesLastStates([$invoiceNumber]);
Обновление полей отправления
$updateInvoice->setInvoiceNumber($invoice->getInvoiceNumber());
$updateInvoice->setRecipientName("Кек чебурек");
$updateInvoice->setSum(20.32);
$updateInvoice->setMobilePhone('+745642411');
$response = $client->updateShipment($updateInvoice);