项目作者: sch-group

项目描述 :
Pickpoint delivery api connector
高级语言: PHP
项目地址: git://github.com/sch-group/pickpoint-sdk.git
创建时间: 2019-07-24T09:11:55Z
项目社区:https://github.com/sch-group/pickpoint-sdk

开源协议:MIT License

下载


API PICKPOINT PHP SDK

https://pickpoint.ru/sales/api/

@ainurecm telegram

  1. composer require sch-group/pickpoint

Примеры:

Инициализация

  1. $config = [
  2. 'host' => '',
  3. 'login' => '',
  4. 'password' => '',
  5. 'ikn' => '',
  6. ];
  7. $pickPointConf = new PickPointConf($config['host'], $config['login'], $config['password'], $config['ikn']);
  8. $defaultPackageSize = new PackageSize(20, 20,20); // может быть null
  9. $senderDestination = new SenderDestination('Москва', 'Московская обл.'); // Адрес отправителя
  10. $client = new PickPointConnector($pickPointConf, $senderDestination, $defaultPackageSize);
  11. Так же можно добавить кэширование, для ускорения запроса на авторизацию
  12. $redisCacheConf = [
  13. 'host' => '127.0.0.1',
  14. 'port' => 6379
  15. ];
  16. $client = new PickPointConnector($pickPointConf, $senderDestination, $defaultPackageSize, $redisCacheConf);

Получение массива постаматов

  1. $points = $client->getPoints(); // get postamats list

Цены за доставку

  1. $receiverDestination = new ReceiverDestination('Санкт-Петербург', 'Ленинградская обл.');
  2. $prices = $client->calculatePrices($receiverDestination); // вернет массив с ценами и тарифами
  3. $tariffPrice = $client->calculateObjectedPrices($receiverDestination); // Вернет объект с ценами
  4. $commonStandardPrice = $tariffPrice->getStandardCommonPrice(); // получить общую цену с тарифом стандарт

Создание отправления

  1. $invoice = new Invoice();
  2. $invoice->setSenderCode('order: 123456');
  3. $invoice->setPostamatNumber('5602-009');
  4. $invoice->setDescription('Custom zakaz');
  5. $invoice->setRecipientName('Саша');
  6. $invoice->setMobilePhone('+79274269590');
  7. $invoice->setEmail('kek@mail.ru');
  8. $invoice->setGettingType('sc'); // courier or sc
  9. $invoice->setSum(500.00);
  10. $invoice->setDeliveryMode('standard'); // stanadard or priority
  11. $packageSize = new PackageSize(20, 20, 20);
  12. $invoice->setPackageSize($packageSize);
  13. $product = new Product('number 234', 'Test', 2, 100);
  14. $address = new Address();
  15. $address->setCityName('Казань');
  16. $address->setPhoneNumber('+79274269590');
  17. $invoice->setClientReturnAddress($address);
  18. $response = $client->createShipment($invoice);

Печать наклейки

  1. $invoice = $client->createShipmentWithInvoice($invoice);
  2. $invoiceNumber = $invoice->getInvoiceNumber();
  3. $pdfByteCode = $client->printLabel(array($invoiceNumber));

Создание реестра и печать

  1. $invoice = $client->createShipmentWithInvoice($invoice);
  2. $invoiceNumber = $invoice->getInvoiceNumber();
  3. $reestr = $client->makeReceipt(array($invoiceNumber));
  4. $pdfByteCode = $client->rintReceipt($reestr[0]);

Одновременное создание реестра и печать

  1. $invoice = $client->createShipmentWithInvoice($invoice);
  2. $invoiceNumber = $invoice->getInvoiceNumber();
  3. $pdfByteCode = $client->makeReceiptAndPrint(array($invoiceNumber));

Удалить инвойс из реестра

  1. $remove = $client->removeInvoiceFromReceipt($invoiceNumber);

Проверка статуса отправлений

  1. $invoiceNumber = $invoice->getInvoiceNumber();
  2. $status = $client->getStatus($invoiceNumber);
  3. $status->getState();
  4. $status->getStateText();

Получить все статусы

  1. $states = $client->getStates();

Отмена отправления

  1. $senderCode = $invoice->getSenderCode(); // order id
  2. $cancelResponse = $client->cancelInvoice($invoiceNumber);
  3. или
  4. $cancelResponse = $client->cancelInvoice('', $senderCode); // отмена с собственным id заказа

Информация об отправлении

  1. $response = $client->shipmentInfo($invoiceNumber);
  2. $response = $client->shipmentInfo('', $senderCode);

Вызов курьера

  1. $senderDestination = new SenderDestination('Москва', 'Московская обл.', '', 992);
  2. $courierCall = new CourierCall(
  3. $senderDestination->getCity(),
  4. $senderDestination->getCityId(),
  5. $senderDestination->getAddress(),
  6. 'Тестов Тест',
  7. '+79274269594',
  8. new \DateTime('tomorrow + 1 day'),
  9. 12 * 60, // from 12:00,
  10. 17 * 60, // to 17:00
  11. 1, // 1 заказ,
  12. 1, // 10 кг
  13. 'Это тестовый вызов, пожалуйста не приезжайте'
  14. );
  15. $callCourier = $client->callCourier($courierCall);
  16. $courierOrderNumber = $callCourier->getCallOrderNumber();

Отмена вызова курьера

  1. $cancelResponse = $client->cancelCourierCall($courierOrderNumber);

История изменения отправления

  1. $response = $client->getInvoicesTrackHistory([$invoiceNumber]);
  2. $states = $client->getInvoiceStatesTrackHistory($invoiceNumber);
  3. $lastSates = $client->getInvoicesLastStates([$invoiceNumber]);

Обновление полей отправления

  1. $updateInvoice->setInvoiceNumber($invoice->getInvoiceNumber());
  2. $updateInvoice->setRecipientName("Кек чебурек");
  3. $updateInvoice->setSum(20.32);
  4. $updateInvoice->setMobilePhone('+745642411');
  5. $response = $client->updateShipment($updateInvoice);