Skip to content

Commit

Permalink
Merge pull request #31 from iDeaDe/1.2.3
Browse files Browse the repository at this point in the history
Актуализация структур
  • Loading branch information
khalturinsky authored Mar 3, 2023
2 parents f3ff625 + 04966b7 commit 8a33f66
Show file tree
Hide file tree
Showing 14 changed files with 1,069 additions and 6 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
ApiShip SDK Change Log
==========================

1.2.3 2023-03-03
--------------------
- Актуализированы поля запросов и ответов:
- Калькулятор:
- в запросе помечены устаревшими поля weight, width, height, length
- в ответ добавлены поля tariffProviderId, feesIncluded, insuranceFee, cashServiceFee
- Создание заказа:
- в запрос добавлен объект returnAddress
- в Item добавлены поля companyName, companyInn, companyPhone
- в Recipient добавлены lat и lng
- в Sender добавлены lat, lng, companyInn, addressString
- Статусы заказа:
- добавлены поля в orderInfo: providerKey и trackingUrl
- Список точек:
- добавлены regionType, cityType, community, communityGuid, communityType, worktime, fittingRoom, metro и extra

1.2.2 2022-08-18
--------------------
- Фикс. Добавлено поле deliveryCostOriginal для тарифов до ПВЗ
Expand Down
14 changes: 12 additions & 2 deletions src/Api/Calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ public function calculate(CalculatorRequest $request, $headers = [])
if (isset($item->tariffs)) {
foreach ($item->tariffs as $itemTariff) {
$calculatorItemTariff = new Tariff();
$calculatorItemTariff->setTariffId(isset($itemTariff->tariffId) ? $itemTariff->tariffId : null)
$calculatorItemTariff
->setTariffProviderId($itemTariff->tariffProviderId ?? null)
->setTariffId(isset($itemTariff->tariffId) ? $itemTariff->tariffId : null)
->setTariffName(isset($itemTariff->tariffName) ? $itemTariff->tariffName : null)
->setFrom(isset($itemTariff->from) ? $itemTariff->from : null)
->setDeliveryCost(isset($itemTariff->deliveryCost) ? $itemTariff->deliveryCost : null)
->setDeliveryCostOriginal($itemTariff->deliveryCostOriginal ?? null)
->setFeesIncluded($itemTariff->feesIncluded ?? null)
->setInsuranceFee($itemTariff->insuranceFee ?? null)
->setCashServiceFee($itemTariff->cashServiceFee ?? null)
->setDaysMin(isset($itemTariff->daysMin) ? $itemTariff->daysMin : null)
->setDaysMax(isset($itemTariff->daysMax) ? $itemTariff->daysMax : null)
->setPickupTypes(isset($itemTariff->pickupTypes) ? $itemTariff->pickupTypes : [])
Expand All @@ -56,11 +61,16 @@ public function calculate(CalculatorRequest $request, $headers = [])
if (isset($item->tariffs)) {
foreach ($item->tariffs as $itemTariff) {
$calculatorItemTariff = new Tariff();
$calculatorItemTariff->setTariffId(isset($itemTariff->tariffId) ? $itemTariff->tariffId : null)
$calculatorItemTariff
->setTariffProviderId($itemTariff->tariffProviderId ?? null)
->setTariffId(isset($itemTariff->tariffId) ? $itemTariff->tariffId : null)
->setTariffName(isset($itemTariff->tariffName) ? $itemTariff->tariffName : null)
->setFrom(isset($itemTariff->from) ? $itemTariff->from : null)
->setDeliveryCost(isset($itemTariff->deliveryCost) ? $itemTariff->deliveryCost : null)
->setDeliveryCostOriginal($itemTariff->deliveryCostOriginal ?? null)
->setFeesIncluded($itemTariff->feesIncluded ?? null)
->setInsuranceFee($itemTariff->insuranceFee ?? null)
->setCashServiceFee($itemTariff->cashServiceFee ?? null)
->setDaysMin(isset($itemTariff->daysMin) ? $itemTariff->daysMin : null)
->setDaysMax(isset($itemTariff->daysMax) ? $itemTariff->daysMax : null)
->setPointIds(isset($itemTariff->pointIds) ? $itemTariff->pointIds : [])
Expand Down
8 changes: 8 additions & 0 deletions src/Entity/Request/CalculatorRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public function setTo(To $to)
}

/**
* @deprecated
* @return float
* @throws RequiredParameterException
*/
Expand All @@ -167,6 +168,7 @@ public function getWeight()
}

/**
* @deprecated
* @param float $weight
*
* @return CalculatorRequest
Expand All @@ -178,6 +180,7 @@ public function setWeight($weight)
}

/**
* @deprecated
* @return int
* @throws RequiredParameterException
*/
Expand All @@ -194,6 +197,7 @@ public function getWidth()
}

/**
* @deprecated
* @param int $width
*
* @return CalculatorRequest
Expand All @@ -205,6 +209,7 @@ public function setWidth($width)
}

/**
* @deprecated
* @return int
* @throws RequiredParameterException
*/
Expand All @@ -221,6 +226,7 @@ public function getHeight()
}

/**
* @deprecated
* @param int $height
*
* @return CalculatorRequest
Expand All @@ -232,6 +238,7 @@ public function setHeight($height)
}

/**
* @deprecated
* @return int
* @throws RequiredParameterException
*/
Expand All @@ -248,6 +255,7 @@ public function getLength()
}

/**
* @deprecated
* @param int $length
*
* @return CalculatorRequest
Expand Down
18 changes: 17 additions & 1 deletion src/Entity/Request/CreateOrderRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Apiship\Entity\Request\Part\Orders\Order;
use Apiship\Entity\Request\Part\Orders\Place;
use Apiship\Entity\Request\Part\Orders\Recipient;
use Apiship\Entity\Request\Part\Orders\ReturnAddress;
use Apiship\Entity\Request\Part\Orders\Sender;
use Apiship\Exception\RequiredParameterException;

Expand All @@ -30,6 +31,10 @@ class CreateOrderRequest extends AbstractRequest
* @var Recipient Информация о получателе
*/
protected $recipient;
/**
* @var ReturnAddress
*/
protected $returnAddress;
/**
* @var Item[] Массив с вложениями
*/
Expand Down Expand Up @@ -252,4 +257,15 @@ public function addExtraParam(ExtraParam $extraParam)

return $this;
}
}

public function getReturnAddress(): ?ReturnAddress
{
return $this->returnAddress;
}

public function setReturnAddress(?ReturnAddress $returnAddress): self
{
$this->returnAddress = $returnAddress;
return $this;
}
}
48 changes: 46 additions & 2 deletions src/Entity/Request/Part/Orders/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,22 @@ class Item extends AbstractRequestPart
* @var int Количество товара
*/
protected $quantity;

/**
* @return string Код маркировки
*/
protected $markCode;
/**
* @var string Наименование компании поставщика / продавца товара
*/
protected $companyName;
/**
* @var string ИНН поставщика / продавца товара
*/
protected $companyInn;
/**
* @var string Телефон поставщика / продавца товара
*/
protected $companyPhone;

/**
* @return string
Expand Down Expand Up @@ -300,4 +311,37 @@ public function setMarkCode($markCode)
$this->markCode = $markCode;
return $this;
}
}

public function getCompanyName(): string
{
return $this->companyName;
}

public function setCompanyName(?string $companyName): self
{
$this->companyName = $companyName;
return $this;
}

public function getCompanyInn(): ?string
{
return $this->companyInn;
}

public function setCompanyInn(?string $companyInn): self
{
$this->companyInn = $companyInn;
return $this;
}

public function getCompanyPhone(): ?string
{
return $this->companyPhone;
}

public function setCompanyPhone(?string $companyPhone): self
{
$this->companyPhone = $companyPhone;
return $this;
}
}
30 changes: 30 additions & 0 deletions src/Entity/Request/Part/Orders/Recipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ class Recipient extends AbstractRequestPart
* @var string Квартира/офис
*/
protected $office;
/**
* @var float Широта
*/
protected $lat;
/**
* @var float Долгота
*/
protected $lng;
/**
* @var string ИНН компании (если юр.лицо)
*/
Expand Down Expand Up @@ -457,4 +465,26 @@ public function setAddressString($addressString)

return $this;
}

public function getLat(): ?float
{
return $this->lat;
}

public function setLat(?float $lat): self
{
$this->lat = $lat;
return $this;
}

public function getLng(): ?float
{
return $this->lng;
}

public function setLng(?float $lng): self
{
$this->lng = $lng;
return $this;
}
}
Loading

0 comments on commit 8a33f66

Please sign in to comment.