Skip to content
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
6 changes: 4 additions & 2 deletions examples/calculator/test_calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
use Apiship\Entity\Request\Part\Calculator\Place;
use Apiship\Entity\Request\Part\Calculator\To;
use Apiship\Exception\ResponseException;
use Apiship\Enum\DeliveryTypes;
use Apiship\Enum\PickupTypes;

try {
$adapter = new GuzzleAdapter('test', 'test', true);
Expand All @@ -31,8 +33,8 @@
->setTo($to)
->setAssessedCost(100.6)
->setCodCost(0)
->setDeliveryTypes([1])
->setPickupTypes([1])
->setDeliveryTypes([DeliveryTypes::TO_CUSTOMER_ADDRESS])
->setPickupTypes([PickupTypes::FROM_DOOR])
->setIncludeFees(true)
->setProviderKeys(['cdek'])
->addPlace(
Expand Down
9 changes: 6 additions & 3 deletions examples/order/test_create_order.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Apiship\Entity\Request\Part\Orders\Order;
use Apiship\Entity\Request\Part\Orders\Recipient;
use Apiship\Entity\Request\Part\Orders\Sender;
use Apiship\Enum\PaymentMethods;
use Apiship\Enum\DeliveryTypes;
use Apiship\Enum\PickupTypes;
use Apiship\Exception\ResponseException;

try {
Expand All @@ -24,15 +27,15 @@
->setLength(40)
->setWidth(40)
->setWeight(1500)
->setPickupType(2)
->setDeliveryType(1)
->setPickupType(PickupTypes::SELF_DELIVERY)
->setDeliveryType(DeliveryTypes::TO_CUSTOMER_ADDRESS)
->setTariffId(9)
->setPointOutId(249)
->setPickupDate("2015-11-25")
->setDeliveryDate("2015-11-30")
->setDeliveryTimeStart("15:10")
->setDeliveryTimeEnd("18:10")
->setPaymentMethod(1);
->setPaymentMethod(PaymentMethods::CASH_PAYMENT);

$sender = (new Sender())
->setPostIndex('162604')
Expand Down
9 changes: 6 additions & 3 deletions examples/order/test_create_order_sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Apiship\Entity\Request\Part\Orders\Order;
use Apiship\Entity\Request\Part\Orders\Recipient;
use Apiship\Entity\Request\Part\Orders\Sender;
use Apiship\Enum\PaymentMethods;
use Apiship\Enum\DeliveryTypes;
use Apiship\Enum\PickupTypes;
use Apiship\Exception\ResponseException;

try {
Expand All @@ -25,8 +28,8 @@
->setLength(40)
->setWidth(40)
->setWeight(1500)
->setPickupType(2)
->setDeliveryType(1)
->setPickupType(PickupTypes::FROM_DOOR)
->setDeliveryType(DeliveryTypes::TO_CUSTOMER_ADDRESS)
->setTariffId(9)
->setPointOutId(249)
->setPickupDate("2017-12-25")
Expand All @@ -35,7 +38,7 @@
->setDeliveryDate("2017-12-30")
->setDeliveryTimeStart("15:10")
->setDeliveryTimeEnd("18:10")
->setPaymentMethod(1);
->setPaymentMethod(PaymentMethods::CASH_PAYMENT);

$sender = (new Sender())
->setPostIndex('162604')
Expand Down
18 changes: 18 additions & 0 deletions src/Enum/DeliveryTypes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Apiship\Enum;

final class DeliveryTypes
{
/**
* Доставка груза до двери клиента
* @var int
*/
public const TO_CUSTOMER_ADDRESS = 1;

/**
* Доставка груза до пункта выдачи
* @var int
*/
public const TO_DELIVERY_TERMINAL = 2;
}
24 changes: 24 additions & 0 deletions src/Enum/OperationTypes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Apiship\Enum;

final class OperationTypes
{
/**
* Прием товаров
* @var int
*/
public const GOODS_RECEPTION = 1;

/**
* Выдача товаров
* @var int
*/
public const GOODS_ISSUANCE = 2;

/**
* Прием и выдача товаров
* @var int
*/
public const GOODS_RECEPTION_AND_ISSUANCE = 3;
}
24 changes: 24 additions & 0 deletions src/Enum/PaymentMethods.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Apiship\Enum;

final class PaymentMethods
{
/**
* Оплата наличными
* @var int
*/
public const CASH_PAYMENT = 1;

/**
* Оплата кредитной картой
* @var int
*/
public const CREDIT_CARD_PAYMENT = 2;

/**
* Оплата наличными и кредитной карточкой
* @var int
*/
public const CASH_AND_CREDIT_CARD_PAYMENT = 3;
}
18 changes: 18 additions & 0 deletions src/Enum/PickupTypes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Apiship\Enum;

final class PickupTypes
{
/**
* Забор груза от двери клиента
* @var int
*/
public const FROM_DOOR = 1;

/**
* Клиент сам доставляет груз на пункт приема СД
* @var int
*/
public const SELF_DELIVERY = 2;
}
31 changes: 31 additions & 0 deletions src/Enum/PointTypes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Apiship\Enum;

final class PointTypes
{
/**
* Пункт выдачи заказа
* @var int
*/
public const ORDER_ISSUE_POINT = 1;

/**
* Постамат
* @var int
*/
public const POSTAMAT = 2;

/**
* Отделение Почты России"
* @var int
*/
public const RUSSIAN_POST_OFFICE = 3;

/**
* Терминал
* @var int
*/
public const TERMINAL = 4;

}