Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
aahmetgaliev committed Jul 24, 2019
0 parents commit 8234671
Show file tree
Hide file tree
Showing 22 changed files with 2,251 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea/*
vendor/*
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
The MIT License

Copyright (c) 2019 Ainur Ahmetgaliev (https://github.com/ainurqa95)
Copyright (c) 2019 Evgeniy Glazunov (https://github.com/eglazunov)
Copyright (c) 2019 Anton Vorontsov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
84 changes: 84 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
API PICKPOINT CONNECTOR

```bash
composer require sch-group/pickpoint
```
Example

$config = [
'host' => '',
'login' => '',
'password' => '',
'ikn' => '',
];

$defaultPackageSize = new PackageSize(20, 20,20); // может быть null

$senderDestination = new SenderDestination('Москва', 'Московская обл.'); // Адрес отправителя

$client = new PickPointConnector(new PickPointConf($config), $senderDestination, $defaultPackageSize);

$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->setSum(500.00);

$invoice->setDeliveryMode('standard');

$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 = $this->client->createShipment($invoice);

32 changes: 32 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "sch-group/pickpoint",
"description": "Russian PickPoint delivery service api connector",
"type": "library",
"require": {
"php": "^7.0",
"guzzlehttp/guzzle": "^6.2",
"predis/predis": "^1.1.1"
},
"require-dev": {
"predis/predis": "1.1.1",
"piwik/ini": "^2.0",
"phpunit/phpunit": "~6.5.5"
},
"license": "MIT",
"authors": [
{
"name": "aahmetgaliev",
"email": "[email protected]"
}
],
"autoload": {
"psr-4": {
"PickPointSdk\\" : "src/"
}
},
"autoload-dev": {
"psr-4": {
"PickPointSdk\\Tests\\": "tests/"
}
}
}
166 changes: 166 additions & 0 deletions src/Components/Address.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
<?php


namespace PickPointSdk\Components;


class Address
{
private $cityName;

private $regionName;

private $address;

private $fio;

private $postCode;

private $organization;

private $phoneNumber; // required

private $comment;

/**
* @return mixed
*/
public function getCityName()
{
return $this->cityName;
}

/**
* @param mixed $cityName
*/
public function setCityName($cityName)
{
$this->cityName = $cityName;
}

/**
* @return mixed
*/
public function getRegionName()
{
return $this->regionName;
}

/**
* @param mixed $regionName
*/
public function setRegionName($regionName)
{
$this->regionName = $regionName;
}

/**
* @return mixed
*/
public function getAddress()
{
return $this->address;
}

/**
* @param mixed $address
*/
public function setAddress($address)
{
$this->address = $address;
}

/**
* @return mixed
*/
public function getFio()
{
return $this->fio;
}

/**
* @param mixed $fio
*/
public function setFio($fio)
{
$this->fio = $fio;
}

/**
* @return mixed
*/
public function getPostCode()
{
return $this->postCode;
}

/**
* @param mixed $postCode
*/
public function setPostCode($postCode)
{
$this->postCode = $postCode;
}

/**
* @return mixed
*/
public function getOrganization()
{
return $this->organization;
}

/**
* @param mixed $organization
*/
public function setOrganization($organization)
{
$this->organization = $organization;
}

/**
* @return mixed
*/
public function getPhoneNumber()
{
return $this->phoneNumber;
}

/**
* @param mixed $phoneNumber
*/
public function setPhoneNumber($phoneNumber)
{
$this->phoneNumber = $phoneNumber;
}

/**
* @return mixed
*/
public function getComment()
{
return $this->comment;
}

/**
* @param mixed $comment
*/
public function setComment($comment)
{
$this->comment = $comment;
}

public function getArray()
{
return [
'CityName' => $this->getCityName() ?? '',
'RegionName' => $this->getRegionName() ?? '',
'Address' => $this->getAddress() ?? '',
'FIO' => $this->getFio() ?? '',
'PostCode' => $this->getPostCode() ?? '',
'Organization' => $this->getOrganization() ?? '',
'PhoneNumber' => $this->getPhoneNumber() ?? '',
'Comment' => $this->getComment() ?? ''
];
}
}
Loading

0 comments on commit 8234671

Please sign in to comment.