MoneyTransferOperator => ReceivePaymentsOperator

This commit is contained in:
Anthony Axenov 2021-11-24 18:45:01 +08:00
parent 3b75c8b983
commit 790831e933
2 changed files with 21 additions and 21 deletions

View File

@ -20,17 +20,17 @@ use Illuminate\Support\Collection;
*
* @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;
/**
* Конструктор
*
* @param array|Collection|null $phones Телефон оператора по приёму платежей (1074)
* @param array|Collection|null $phones Телефоны оператора по приёму платежей (1074)
* @throws InvalidPhoneException
*/
public function __construct(

View File

@ -10,38 +10,38 @@
namespace AtolOnline\Tests\Entities;
use AtolOnline\{
Entities\MoneyTransferOperator,
Entities\ReceivePaymentsOperator,
Exceptions\InvalidPhoneException,
Tests\BasicTestCase};
/**
* Набор тестов для проверки работы класса оператора по приёму платежей
*/
class MoneyTransferOperatorTest extends BasicTestCase
class ReceivePaymentsOperatorTest extends BasicTestCase
{
/**
* Тестирует конструктор без передачи значений и корректное приведение к json
*
* @covers \AtolOnline\Entities\MoneyTransferOperator
* @covers \AtolOnline\Entities\MoneyTransferOperator::jsonSerialize
* @covers \AtolOnline\Entities\ReceivePaymentsOperator
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::jsonSerialize
*/
public function testConstructorWithoutArgs(): void
{
$this->assertEquals('[]', (string)(new MoneyTransferOperator()));
$this->assertEquals('[]', (string)(new ReceivePaymentsOperator()));
}
/**
* Тестирует конструктор с передачей значений и корректное приведение к json
*
* @covers \AtolOnline\Entities\MoneyTransferOperator
* @covers \AtolOnline\Entities\MoneyTransferOperator::jsonSerialize
* @covers \AtolOnline\Entities\MoneyTransferOperator::setPhones
* @covers \AtolOnline\Entities\MoneyTransferOperator::getPhones
* @covers \AtolOnline\Entities\ReceivePaymentsOperator
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::jsonSerialize
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::setPhones
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::getPhones
* @throws InvalidPhoneException
*/
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
* @covers \AtolOnline\Entities\MoneyTransferOperator
* @covers \AtolOnline\Entities\MoneyTransferOperator::setPhones
* @covers \AtolOnline\Entities\MoneyTransferOperator::getPhones
* @covers \AtolOnline\Entities\ReceivePaymentsOperator
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::setPhones
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::getPhones
* @throws InvalidPhoneException
*/
public function testNullablePhones(mixed $phones): void
{
$agent = new MoneyTransferOperator($phones);
$agent = new ReceivePaymentsOperator($phones);
$this->assertIsCollection($agent->getPhones());
$this->assertTrue($agent->getPhones()->isEmpty());
}
@ -77,19 +77,19 @@ class MoneyTransferOperatorTest extends BasicTestCase
/**
* Тестирует установку невалидных телефонов
*
* @covers \AtolOnline\Entities\MoneyTransferOperator
* @covers \AtolOnline\Entities\MoneyTransferOperator::setPhones
* @covers \AtolOnline\Entities\ReceivePaymentsOperator
* @covers \AtolOnline\Entities\ReceivePaymentsOperator::setPhones
* @covers \AtolOnline\Exceptions\InvalidPhoneException
* @throws InvalidPhoneException
*/
public function testInvalidPhoneException(): void
{
$this->expectException(InvalidPhoneException::class);
(new MoneyTransferOperator())->setPhones([
(new ReceivePaymentsOperator([
'12345678901234567', // good
'+123456789012345678', // good
'12345678901234567890', // bad
'+12345678901234567890', // bad
]);
]));
}
}