Skip to content
Merged
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
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@

### Added

- Added service `Services\Sale\Delivery\Service\Delivery` with support methods,
see [sale.delivery.* methods](https://github.com/bitrix24/b24phpsdk/issues/255):
- `add` adds a delivery service
- `update` updates a delivery service
- `getlist` returns a list of delivery services
- `delete` deletes a delivery service
- `configUpdate` updates delivery service settings
- `configGet` returns delivery service settings
- Added service `Services\Sale\DeliveryRequest\Service\DeliveryRequest` with support methods,
see [sale.delivery.request.* methods](https://github.com/bitrix24/b24phpsdk/issues/255):
- `update` updates the delivery request
- `sendMessage` creates notifications for the delivery request
- `delete` deletes the delivery request
- Added service `Services\Sale\DeliveryExtraService\Service\DeliveryExtraService` with support methods,
see [sale.delivery.extra.service.* methods](https://github.com/bitrix24/b24phpsdk/issues/255):
- `add` adds a delivery service
- `update` updates a delivery service
- `get` returns information about all services of a specific delivery service
- `delete` deletes a delivery service
- Added service `Services\Sale\DeliveryHandler\Service\DeliveryHandler` with support methods,
see [sale.delivery.handler.* methods](https://github.com/bitrix24/b24phpsdk/issues/255):
- `add` adds a delivery service handler
- `update` updates the delivery service handler
- `list` returns a list of delivery service handlers
- `delete` deletes a delivery service handler
- Added service `Services\Disk\Service\Disk` with support methods,
see [disk service methods](https://github.com/bitrix24/b24phpsdk/issues/265):
- `getVersion` returns the version by identifier
Expand Down Expand Up @@ -104,7 +129,6 @@
- `list` returns a list of shipment property values
- `delete` deletes a shipment property value
- `getFields` returns the fields and settings for shipment property values

- Added service `Services\Sale\ShipmentItem\Service\ShipmentItem` with support methods,
see [sale.shipmentitem.* methods](https://github.com/bitrix24/b24phpsdk/issues/250):
- `add` adds a new shipment item
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ help:
@echo "test-integration-calendar-event - run Calendar Event integration tests"
@echo "test-integration-calendar-resource - run Calendar Resource integration tests"
@echo "test-integration-sale-basket-property - run BasketProperty integration tests"
@echo "test-integration-sale-delivery - run Delivery integration tests"
@echo "test-integration-sale-delivery-extra-service - run DeliveryExtraService integration tests"
@echo "test-integration-scope-paysystem - run Payment System integration tests"
@echo "test-integration-sale-payment-item-basket - run PaymentItemBasket integration tests"
@echo "test-integration-sale-payment-item-shipment - run PaymentItemShipment integration tests"
Expand Down Expand Up @@ -381,6 +383,17 @@ integration_tests_sale:
integration_tests_sale_payment:
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_sale_payment

.PHONY: test-integration-sale-delivery-handler
test-integration-sale-delivery-handler:
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_sale_delivery_handler

.PHONY: test-integration-sale-delivery
test-integration-sale-delivery:
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_sale_delivery

.PHONY: test-integration-sale-delivery-extra-service
test-integration-sale-delivery-extra-service:
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_sale_delivery_extra_service
.PHONY: integration_tests_sale_payment_item_basket
integration_tests_sale_payment_item_basket:
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_sale_payment_item_basket
Expand Down
9 changes: 9 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,15 @@
<testsuite name="integration_tests_sale_order">
<directory>./tests/Integration/Services/Sale/Order/</directory>
</testsuite>
<testsuite name="integration_tests_sale_delivery_handler">
<directory>./tests/Integration/Services/Sale/DeliveryHandler/Service/</directory>
</testsuite>
<testsuite name="integration_tests_sale_delivery">
<directory>./tests/Integration/Services/Sale/Delivery/Service/</directory>
</testsuite>
<testsuite name="integration_tests_sale_delivery_extra_service">
<directory>./tests/Integration/Services/Sale/DeliveryExtraService/Service/</directory>
</testsuite>
<testsuite name="integration_tests_core-list">
<file>./tests/Integration/Core/BatchTraversableListTest.php</file>
</testsuite>
Expand Down
32 changes: 32 additions & 0 deletions src/Services/Sale/Delivery/Result/DeliveriesResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*/

declare(strict_types=1);

namespace Bitrix24\SDK\Services\Sale\Delivery\Result;

use Bitrix24\SDK\Core\Exceptions\BaseException;
use Bitrix24\SDK\Core\Result\AbstractResult;

/**
* List of deliveries result for sale.delivery.getlist
*/
class DeliveriesResult extends AbstractResult
{
/**
* @return DeliveryItemResult[]
* @throws BaseException
*/
public function getDeliveries(): array
{
$items = [];
foreach ($this->getCoreResponse()->getResponseData()->getResult() as $item) {
$items[] = new DeliveryItemResult($item);
}

return $items;
}
}
53 changes: 53 additions & 0 deletions src/Services/Sale/Delivery/Result/DeliveryAddResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*/

declare(strict_types=1);

namespace Bitrix24\SDK\Services\Sale\Delivery\Result;

use Bitrix24\SDK\Core\Contracts\AddedItemIdResultInterface;
use Bitrix24\SDK\Core\Exceptions\BaseException;
use Bitrix24\SDK\Core\Result\AbstractResult;

/**
* Result for sale.delivery.add
*/
class DeliveryAddResult extends AbstractResult implements AddedItemIdResultInterface
{
/**
* @throws BaseException
*/
public function getId(): int
{
return (int)$this->getCoreResponse()->getResponseData()->getResult()['parent']['ID'];
}

/**
* @throws BaseException
*/
public function getParent(): DeliveryItemResult
{
return new DeliveryItemResult($this->getCoreResponse()->getResponseData()->getResult()['parent']);
}

/**
* @return DeliveryItemResult[]
* @throws BaseException
*/
public function getProfiles(): array
{
$items = [];
$result = $this->getCoreResponse()->getResponseData()->getResult();

if (isset($result['profiles']) && is_array($result['profiles'])) {
foreach ($result['profiles'] as $item) {
$items[] = new DeliveryItemResult($item);
}
}

return $items;
}
}
27 changes: 27 additions & 0 deletions src/Services/Sale/Delivery/Result/DeliveryConfigGetResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*/

declare(strict_types=1);

namespace Bitrix24\SDK\Services\Sale\Delivery\Result;

use Bitrix24\SDK\Core\Exceptions\BaseException;
use Bitrix24\SDK\Core\Result\AbstractResult;

/**
* Result for sale.delivery.config.get
*/
class DeliveryConfigGetResult extends AbstractResult
{
/**
* @return array<array{CODE: string, VALUE: mixed}>
* @throws BaseException
*/
public function getConfig(): array
{
return $this->getCoreResponse()->getResponseData()->getResult();
}
}
27 changes: 27 additions & 0 deletions src/Services/Sale/Delivery/Result/DeliveryItemResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*/

declare(strict_types=1);

namespace Bitrix24\SDK\Services\Sale\Delivery\Result;

use Bitrix24\SDK\Core\Result\AbstractItem;

/**
* Class DeliveryItemResult
*
* @property-read int|null $ID
* @property-read int|null $PARENT_ID
* @property-read string|null $NAME
* @property-read string|null $ACTIVE
* @property-read string|null $DESCRIPTION
* @property-read string|null $CURRENCY
* @property-read int|null $SORT
* @property-read int|null $LOGOTYPE
*/
class DeliveryItemResult extends AbstractItem
{
}
Loading