Skip to content

Commit

Permalink
added new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aahmetgaliev committed Jul 24, 2019
1 parent 8234671 commit 52812c0
Show file tree
Hide file tree
Showing 5 changed files with 357 additions and 69 deletions.
71 changes: 39 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ API PICKPOINT CONNECTOR
```bash
composer require sch-group/pickpoint
```
Example
Примеры:

```
$config = [
'host' => '',
'login' => '',
Expand All @@ -20,65 +21,71 @@ $client = new PickPointConnector(new PickPointConf($config), $senderDestination,
$points = $client->getPoints(); // получить массив поставматов
// Цены за доставку
```
Цены за доставку

```
$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('+79274269594');

$invoice->setEmail('[email protected]');

$invoice->setPostageType('unpiad');

$invoice->setGettingType('sc');

$invoice->setPostageType('unpiad'); // paid or unpaid
$invoice->setGettingType('sc'); // courier or sc
$invoice->setSum(500.00);

$invoice->setDeliveryMode('standard');

$invoice->setDeliveryMode('standard'); // stanadard or priority
$packageSize = new PackageSize(20, 20, 20);

$invoice->setPackageSize($packageSize);

$product = new Product();

$product->setDescription('Test product');

$product->setPrice(200);

$product->setQuantity(1);

$product->setName('Tovar 1');

$product->setProductCode('1231');

$invoice->setProducts([$product]);

$address = new Address();

$address->setCityName('Казань');

$address->setPhoneNumber('+79274269594');

$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]);
$response = $this->client->createShipment($invoice);
```
Одновременное создание реестра и печать
```
$invoice = $client->createShipmentWithInvoice($invoice);
$invoiceNumber = $invoice->getInvoiceNumber();
$pdfByteCode = $this->client->makeReceiptAndPrint(array($invoiceNumber));
```
Проверка статуса отправлений

```
$invoiceNumber = $invoice->getInvoiceNumber();
$status = $client->getStatus($invoiceNumber);
```
20 changes: 19 additions & 1 deletion src/Contracts/DeliveryConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,23 @@ public function getPoints();
/**
* Returns invoice data and create shipment/order in delivery service
* @param Invoice $invoice
* @param bool $returnInvoiceNumberOnly
* @return mixed
*/
public function createShipment(Invoice $invoice);

/**
* @param Invoice $invoice
* @return mixed
*/
public function createShipmentWithInvoice(Invoice $invoice) : Invoice;
/**
* Returns current delivery status
* @param string $invoiceNumber
* @param string $orderNumber
* @return mixed
*/
public function getStatus(string $invoiceNumber);
public function getStatus(string $invoiceNumber, string $orderNumber = '');

/**
* @param string $invoiceNumber
Expand Down Expand Up @@ -58,6 +65,17 @@ public function calculateObjectedPrices(ReceiverDestination $receiverDestination
*/
public function printLabel(array $invoiceNumbers);

/**
* @param array $invoiceNumbers
* @return mixed
*/
public function makeReceipt(array $invoiceNumbers);

/**
* @param array $invoiceNumbers
* @return mixed
*/
public function makeReceiptAndPrint(array $invoiceNumbers);
/**
* Print reestr/receipt
* @param string $identifier
Expand Down
Loading

0 comments on commit 52812c0

Please sign in to comment.