Skip to content
This repository has been archived by the owner on Jul 21, 2021. It is now read-only.

Добавление многоместного отправления #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Api/ShippingEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ShippingEndpoint{
private $addCourierPackages;
private $addDeliveryPointPackages;
private $addPackage;
private $addMultiPlacePackage;
private $addPackageExport;
private $addPickup;
private $addProduct;
Expand Down Expand Up @@ -52,6 +53,12 @@ class ShippingEndpoint{
public function addPackage(){
return $this->addPackage = new ShippingRequest\AddPackage();
}

public function addMultiPlacePackage()
{
return $this->addMultiPlacePackage = new ShippingRequest\AddMultiPlacePackage();
}

public function addPackageExport(){
return $this->addPackageExport = new ShippingRequest\AddPackageExport();
}
Expand Down
84 changes: 84 additions & 0 deletions src/Api/ShippingEndpoint/Fields/AddMultiPlacePackage/Package.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?php

namespace ShiptorRussiaApiClient\Client\Api\ShippingEndpoint\Fields\AddMultiPlacePackage;

use ShiptorRussiaApiClient\Client\Core\Fields\Custom;

class Package extends Custom
{
protected function setFields()
{
$this->getFieldsCollection()
->String("external_id")->add()
->Number("length")->setRequired()->add()
->Number("width")->setRequired()->add()
->Number("height")->setRequired()->add()
->Number("weight")->setRequired()->add()
->Number("cod")->setRequired()->add()
->Number("declared_cost")->setRequired()->add()
->Custom("products", PackageProduct::class)->setMulty()->setRequired()->add()
->String("photos")->setMulty()->add()
;
}

protected function checkSingleValue($value)
{
return is_array($value);
}

public function convertValue($value)
{
return (array)$value;
}

public function setExternalId($externalId)
{
$this->getFieldsCollection()->get("external_id")->setValue($externalId);
return $this;
}

public function setLength($length)
{
$this->getFieldsCollection()->get("length")->setValue($length);
return $this;
}

public function setWidth($width)
{
$this->getFieldsCollection()->get("width")->setValue($width);
return $this;
}

public function setHeight($height)
{
$this->getFieldsCollection()->get("height")->setValue($height);
return $this;
}

public function setWeight($weight)
{
$this->getFieldsCollection()->get("weight")->setValue($weight);
return $this;
}

public function setCod($cod)
{
$this->getFieldsCollection()->get("cod")->setValue($cod);
return $this;
}

public function setDeclaredCost($cost)
{
$this->getFieldsCollection()->get("declared_cost")->setValue($cost);
return $this;
}

/**
* @return PackageProduct
*/
public function newProduct()
{
/** @noinspection PhpPossiblePolymorphicInvocationInspection */
return $this->getFieldsCollection()->get("products")->_new();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

namespace ShiptorRussiaApiClient\Client\Api\ShippingEndpoint\Fields\AddMultiPlacePackage;

use ShiptorRussiaApiClient\Client\Core\Fields\Custom;

class PackageProduct extends Custom
{
protected function setFields()
{
$this->getFieldsCollection()
->String("shopArticle")->setRequired()->add()
->String("name")->add()
->Number("count")->setRequired()->add()
->Number("price")->setRequired()->add()
->Number("vat")->add()
->String("supplier_INN")->add()
->String("supplier_name")->add()
->String("supplier_phone")->add()
->String("mark_code")->add()
;
}

protected function checkSingleValue($value)
{
return is_array($value);
}

public function convertValue($value)
{
return (array)$value;
}

public function setShopArticle($shopArticle)
{
$this->getFieldsCollection()->get("shopArticle")->setValue($shopArticle);
return $this;
}

public function setName($name)
{
$this->getFieldsCollection()->get("name")->setValue($name);
return $this;
}

public function setCount($count)
{
$this->getFieldsCollection()->get("count")->setValue($count);
return $this;
}

public function setPrice($price)
{
$this->getFieldsCollection()->get("price")->setValue($price);
return $this;
}

public function setVat($vat)
{
$this->getFieldsCollection()->get("vat")->setValue($vat);
return $this;
}

public function setSupplierInn($inn)
{
$this->getFieldsCollection()->get("supplier_INN")->setValue($inn);
return $this;
}

public function setSupplierName($name)
{
$this->getFieldsCollection()->get("supplier_name")->setValue($name);
return $this;
}

public function setSupplierPhone($phone)
{
$this->getFieldsCollection()->get("supplier_phone")->setValue($phone);
return $this;
}

public function setMarkCode($code)
{
$this->getFieldsCollection()->get("mark_code")->setValue($code);
return $this;
}
}
87 changes: 87 additions & 0 deletions src/Api/ShippingEndpoint/Fields/AddMultiPlacePackage/Product.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php

namespace ShiptorRussiaApiClient\Client\Api\ShippingEndpoint\Fields\AddMultiPlacePackage;

use ShiptorRussiaApiClient\Client\Core\Fields\Custom;

class Product extends Custom
{
protected function setFields()
{
$this->getFieldsCollection()
->String("shopArticle")->setRequired()->add()
->String("name")->add()
->Number("count")->setRequired()->add()
->Number("price")->setRequired()->add()
->Number("vat")->add()
->String("supplier_INN")->add()
->String("supplier_name")->add()
->String("supplier_phone")->add()
->String("mark_code")->add()
;
}

protected function checkSingleValue($value)
{
return is_array($value);
}

public function convertValue($value)
{
return (array)$value;
}

public function setShopArticle($shopArticle)
{
$this->getFieldsCollection()->get("shopArticle")->setValue($shopArticle);
return $this;
}

public function setName($name)
{
$this->getFieldsCollection()->get("name")->setValue($name);
return $this;
}

public function setCount($count)
{
$this->getFieldsCollection()->get("count")->setValue($count);
return $this;
}

public function setPrice($price)
{
$this->getFieldsCollection()->get("price")->setValue($price);
return $this;
}

public function setVat($vat)
{
$this->getFieldsCollection()->get("vat")->setValue($vat);
return $this;
}

public function setSupplierInn($inn)
{
$this->getFieldsCollection()->get("supplier_INN")->setValue($inn);
return $this;
}

public function setSupplierName($name)
{
$this->getFieldsCollection()->get("supplier_name")->setValue($name);
return $this;
}

public function setSupplierPhone($phone)
{
$this->getFieldsCollection()->get("supplier_phone")->setValue($phone);
return $this;
}

public function setMarkCode($code)
{
$this->getFieldsCollection()->get("mark_code")->setValue($code);
return $this;
}
}
52 changes: 52 additions & 0 deletions src/Api/ShippingEndpoint/Fields/AddMultiPlacePackage/Service.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace ShiptorRussiaApiClient\Client\Api\ShippingEndpoint\Fields\AddMultiPlacePackage;

use ShiptorRussiaApiClient\Client\Core\Fields\Custom;

class Service extends Custom
{
protected function setFields()
{
$this->getFieldsCollection()
->String("shopArticle")->setRequired()->add()
->Number("count")->setRequired()->add()
->Number("price")->setRequired()->add()
->Number("vat")->add()
;
}

protected function checkSingleValue($value)
{
return is_array($value);
}

public function convertValue($value)
{
return (array)$value;
}

public function setShopArticle($article)
{
$this->getFieldsCollection()->get("shopArticle")->setValue($article);
return $this;
}

public function setCount($count)
{
$this->getFieldsCollection()->get("count")->setValue($count);
return $this;
}

public function setPrice($price)
{
$this->getFieldsCollection()->get("price")->setValue($price);
return $this;
}

public function setVat($vat)
{
$this->getFieldsCollection()->get("vat")->setValue($vat);
return $this;
}
}
Loading