mirror of
https://github.com/anthonyaxenov/atol-online.git
synced 2024-11-21 23:54:33 +00:00
MoneyTransferOperator
=> ReceivePaymentsOperator
This commit is contained in:
parent
3b75c8b983
commit
790831e933
@ -20,17 +20,17 @@ use Illuminate\Support\Collection;
|
|||||||
*
|
*
|
||||||
* @see https://online.atol.ru/files/API_atol_online_v4.pdf Документация, стр 19-20
|
* @see https://online.atol.ru/files/API_atol_online_v4.pdf Документация, стр 19-20
|
||||||
*/
|
*/
|
||||||
class MoneyTransferOperator extends Entity
|
class ReceivePaymentsOperator extends Entity
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var Collection Телефоны платёжного агента (1073)
|
* @var Collection Телефоны оператора по приёму платежей (1074)
|
||||||
*/
|
*/
|
||||||
protected Collection $phones;
|
protected Collection $phones;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Конструктор
|
* Конструктор
|
||||||
*
|
*
|
||||||
* @param array|Collection|null $phones Телефон оператора по приёму платежей (1074)
|
* @param array|Collection|null $phones Телефоны оператора по приёму платежей (1074)
|
||||||
* @throws InvalidPhoneException
|
* @throws InvalidPhoneException
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
@ -10,38 +10,38 @@
|
|||||||
namespace AtolOnline\Tests\Entities;
|
namespace AtolOnline\Tests\Entities;
|
||||||
|
|
||||||
use AtolOnline\{
|
use AtolOnline\{
|
||||||
Entities\MoneyTransferOperator,
|
Entities\ReceivePaymentsOperator,
|
||||||
Exceptions\InvalidPhoneException,
|
Exceptions\InvalidPhoneException,
|
||||||
Tests\BasicTestCase};
|
Tests\BasicTestCase};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Набор тестов для проверки работы класса оператора по приёму платежей
|
* Набор тестов для проверки работы класса оператора по приёму платежей
|
||||||
*/
|
*/
|
||||||
class MoneyTransferOperatorTest extends BasicTestCase
|
class ReceivePaymentsOperatorTest extends BasicTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Тестирует конструктор без передачи значений и корректное приведение к json
|
* Тестирует конструктор без передачи значений и корректное приведение к json
|
||||||
*
|
*
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator::jsonSerialize
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::jsonSerialize
|
||||||
*/
|
*/
|
||||||
public function testConstructorWithoutArgs(): void
|
public function testConstructorWithoutArgs(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals('[]', (string)(new MoneyTransferOperator()));
|
$this->assertEquals('[]', (string)(new ReceivePaymentsOperator()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Тестирует конструктор с передачей значений и корректное приведение к json
|
* Тестирует конструктор с передачей значений и корректное приведение к json
|
||||||
*
|
*
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator::jsonSerialize
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::jsonSerialize
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator::setPhones
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::setPhones
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator::getPhones
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::getPhones
|
||||||
* @throws InvalidPhoneException
|
* @throws InvalidPhoneException
|
||||||
*/
|
*/
|
||||||
public function testConstructorWithArgs(): void
|
public function testConstructorWithArgs(): void
|
||||||
{
|
{
|
||||||
$this->assertAtolable(new MoneyTransferOperator(['+122997365456']), ['phones' => ['+122997365456']]);
|
$this->assertAtolable(new ReceivePaymentsOperator(['+122997365456']), ['phones' => ['+122997365456']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,14 +62,14 @@ class MoneyTransferOperatorTest extends BasicTestCase
|
|||||||
* Тестирует установку пустых телефонов
|
* Тестирует установку пустых телефонов
|
||||||
*
|
*
|
||||||
* @dataProvider providerNullablePhonesArrays
|
* @dataProvider providerNullablePhonesArrays
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator::setPhones
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::setPhones
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator::getPhones
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::getPhones
|
||||||
* @throws InvalidPhoneException
|
* @throws InvalidPhoneException
|
||||||
*/
|
*/
|
||||||
public function testNullablePhones(mixed $phones): void
|
public function testNullablePhones(mixed $phones): void
|
||||||
{
|
{
|
||||||
$agent = new MoneyTransferOperator($phones);
|
$agent = new ReceivePaymentsOperator($phones);
|
||||||
$this->assertIsCollection($agent->getPhones());
|
$this->assertIsCollection($agent->getPhones());
|
||||||
$this->assertTrue($agent->getPhones()->isEmpty());
|
$this->assertTrue($agent->getPhones()->isEmpty());
|
||||||
}
|
}
|
||||||
@ -77,19 +77,19 @@ class MoneyTransferOperatorTest extends BasicTestCase
|
|||||||
/**
|
/**
|
||||||
* Тестирует установку невалидных телефонов
|
* Тестирует установку невалидных телефонов
|
||||||
*
|
*
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator
|
||||||
* @covers \AtolOnline\Entities\MoneyTransferOperator::setPhones
|
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::setPhones
|
||||||
* @covers \AtolOnline\Exceptions\InvalidPhoneException
|
* @covers \AtolOnline\Exceptions\InvalidPhoneException
|
||||||
* @throws InvalidPhoneException
|
* @throws InvalidPhoneException
|
||||||
*/
|
*/
|
||||||
public function testInvalidPhoneException(): void
|
public function testInvalidPhoneException(): void
|
||||||
{
|
{
|
||||||
$this->expectException(InvalidPhoneException::class);
|
$this->expectException(InvalidPhoneException::class);
|
||||||
(new MoneyTransferOperator())->setPhones([
|
(new ReceivePaymentsOperator([
|
||||||
'12345678901234567', // good
|
'12345678901234567', // good
|
||||||
'+123456789012345678', // good
|
'+123456789012345678', // good
|
||||||
'12345678901234567890', // bad
|
'12345678901234567890', // bad
|
||||||
'+12345678901234567890', // bad
|
'+12345678901234567890', // bad
|
||||||
]);
|
]));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user