Skip to content

Feature/188 add requisite bankdetail #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 15 commits into
base: dev
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
->in(__DIR__ . '/src/Services/CRM/Quote/')
->in(__DIR__ . '/src/Services/CRM/Lead/')
->in(__DIR__ . '/src/Services/CRM/Currency/')
->in(__DIR__ . '/src/Services/CRM/Requisites/')
->name('*.php')
->exclude(['vendor', 'storage', 'docker', 'docs']) // Exclude directories
->ignoreDotFiles(true)
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,14 @@ integration_tests_lead_productrows:
.PHONY: integration_tests_crm_quote
integration_tests_crm_quote:
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_quote

.PHONY: integration_tests_crm_requisite
integration_tests_crm_requisite:
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_requisite

.PHONY: integration_tests_crm_preset_field
integration_tests_crm_preset_field:
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_preset_field

# work dev environment
.PHONY: php-dev-server-up
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ parameters:
- tests/Integration/Services/CRM/Quote/Service/QuoteProductRowsTest.php
- tests/Integration/Services/CRM/Lead/Service/LeadUserfieldTest.php
- tests/Integration/Services/CRM/Currency
- tests/Integration/Services/CRM/Requisites
bootstrapFiles:
- tests/bootstrap.php
parallel:
Expand Down
6 changes: 6 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
<testsuite name="integration_tests_crm_quote">
<directory>./tests/Integration/Services/CRM/Quote/</directory>
</testsuite>
<testsuite name="integration_tests_crm_requisite">
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisiteLinkTest.php</file>
</testsuite>
<testsuite name="integration_tests_crm_preset_field">
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisitePresetFieldTest.php</file>
</testsuite>
</testsuites>
<source>
<include>
Expand Down
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
__DIR__ . '/tests/Integration/Services/CRM/Quote/Service',
__DIR__ . '/src/Services/CRM/Currency',
__DIR__ . '/tests/Integration/Services/CRM/Currency',
__DIR__ . '/src/Services/CRM/Requisites',
__DIR__ . '/tests/Integration/Services/CRM/Requisites',
__DIR__ . '/tests/Unit/',
])
->withCache(cacheDirectory: __DIR__ . '.cache/rector')
Expand Down
49 changes: 49 additions & 0 deletions src/Services/CRM/CRMServiceBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,55 @@ public function requisitePreset(): Requisites\Service\RequisitePreset

return $this->serviceCache[__METHOD__];
}

public function requisiteBankdetail(): Requisites\Service\RequisiteBankdetail
{
if (!isset($this->serviceCache[__METHOD__])) {
$this->serviceCache[__METHOD__] = new Requisites\Service\RequisiteBankdetail(
$this->core,
$this->log
);
}

return $this->serviceCache[__METHOD__];
}

public function requisiteLink(): Requisites\Service\RequisiteLink
{
if (!isset($this->serviceCache[__METHOD__])) {
$this->serviceCache[__METHOD__] = new Requisites\Service\RequisiteLink(
$this->core,
$this->log
);
}

return $this->serviceCache[__METHOD__];
}

public function requisitePresetField(): Requisites\Service\RequisitePresetField
{
if (!isset($this->serviceCache[__METHOD__])) {
$this->serviceCache[__METHOD__] = new Requisites\Service\RequisitePresetField(
$this->core,
$this->log
);
}

return $this->serviceCache[__METHOD__];
}

public function requisiteUserfield(): Requisites\Service\RequisiteUserfield
{
if (!isset($this->serviceCache[__METHOD__])) {
$this->serviceCache[__METHOD__] = new Requisites\Service\RequisiteUserfield(
new UserfieldConstraints(),
$this->core,
$this->log
);
}

return $this->serviceCache[__METHOD__];
}

public function contactCompany(): Contact\Service\ContactCompany
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Vadim Soluyanov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Bitrix24\SDK\Services\CRM\Requisites\Result;

use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem;
use Carbon\CarbonImmutable;

/**
* Class RequisiteBankdetailItemResult
*
* @property-read int $ID
* @property-read int $ENTITY_ID
* @property-read int $COUNTRY_ID
* @property-read CarbonImmutable|null $DATE_CREATE
* @property-read CarbonImmutable|null $DATE_MODIFY
* @property-read int|null $CREATED_BY_ID
* @property-read int|null $MODIFY_BY_ID
* @property-read string $NAME
* @property-read string $CODE
* @property-read string $XML_ID
* @property-read bool|null $ACTIVE
* @property-read int|null $SORT
* @property-read string|null $RQ_BANK_NAME
* @property-read string|null $RQ_BANK_ADDR
* @property-read string|null $RQ_BANK_CODE
* @property-read string|null $RQ_BANK_ROUTE_NUM
* @property-read string|null $RQ_BIK
* @property-read string|null $RQ_CODEB
* @property-read string|null $RQ_CODEG
* @property-read string|null $RQ_RIB
* @property-read string|null $RQ_MFO
* @property-read string|null $RQ_ACC_NAME
* @property-read string|null $RQ_ACC_TYPE
* @property-read string|null $RQ_AGENCY_NAME
* @property-read string|null $RQ_IIK
* @property-read string|null $RQ_ACC_CURRENCY
* @property-read string|null $RQ_ACC_NUM
* @property-read string|null $RQ_COR_ACC_NUM
* @property-read string|null $RQ_IBAN
* @property-read string|null $RQ_SWIFT
* @property-read string|null $RQ_BIC
* @property-read string|null $COMMENTS
* @property-read string|null $ORIGINATOR_ID
*/
class RequisiteBankdetailItemResult extends AbstractCrmItem
{
/**
*
* @return mixed|null
* @throws \Bitrix24\SDK\Services\CRM\Userfield\Exceptions\UserfieldNotFoundException
*/
public function getUserfieldByFieldName(string $userfieldName)
{
return $this->getKeyWithUserfieldByFieldName($userfieldName);
}
}
33 changes: 33 additions & 0 deletions src/Services/CRM/Requisites/Result/RequisiteBankdetailResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Vadim Soluyanov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/


declare(strict_types=1);

namespace Bitrix24\SDK\Services\CRM\Requisites\Result;

use Bitrix24\SDK\Core\Result\AbstractResult;

/**
* Class RequisiteBankdetailResult
*
* @package Bitrix24\SDK\Services\CRM\Requisites\Result
*/
class RequisiteBankdetailResult extends AbstractResult
{
/**
* @throws \Bitrix24\SDK\Core\Exceptions\BaseException
*/
public function bankdetail(): RequisiteBankdetailItemResult
{
return new RequisiteBankdetailItemResult($this->getCoreResponse()->getResponseData()->getResult());
}
}
40 changes: 40 additions & 0 deletions src/Services/CRM/Requisites/Result/RequisiteBankdetailsResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Vadim Soluyanov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/


declare(strict_types=1);

namespace Bitrix24\SDK\Services\CRM\Requisites\Result;

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

/**
* Class RequisiteBankdetailsResult
*
* @package Bitrix24\SDK\Services\CRM\Requisites\Result
*/
class RequisiteBankdetailsResult extends AbstractResult
{
/**
* @return RequisiteBankdetailItemResult[]
* @throws BaseException
*/
public function getBankdetails(): array
{
$items = [];
foreach ($this->getCoreResponse()->getResponseData()->getResult() as $item) {
$items[] = new RequisiteBankdetailItemResult($item);
}

return $items;
}
}
30 changes: 30 additions & 0 deletions src/Services/CRM/Requisites/Result/RequisiteLinkItemResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Vadim Soluyanov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/

declare(strict_types=1);

namespace Bitrix24\SDK\Services\CRM\Requisites\Result;

use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem;

/**
* Class RequisiteLinkItemResult
*
* @property-read int $ENTITY_TYPE_ID
* @property-read int $ENTITY_ID
* @property-read int $REQUISITE_ID
* @property-read int $BANK_DETAIL_ID
* @property-read int $MC_REQUISITE_ID
* @property-read int $MC_BANK_DETAIL_ID
*/
class RequisiteLinkItemResult extends AbstractCrmItem
{
}
33 changes: 33 additions & 0 deletions src/Services/CRM/Requisites/Result/RequisiteLinkResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Vadim Soluyanov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/


declare(strict_types=1);

namespace Bitrix24\SDK\Services\CRM\Requisites\Result;

use Bitrix24\SDK\Core\Result\AbstractResult;

/**
* Class RequisiteLinkResult
*
* @package Bitrix24\SDK\Services\CRM\Requisites\Result
*/
class RequisiteLinkResult extends AbstractResult
{
/**
* @throws \Bitrix24\SDK\Core\Exceptions\BaseException
*/
public function link(): RequisiteLinkItemResult
{
return new RequisiteLinkItemResult($this->getCoreResponse()->getResponseData()->getResult());
}
}
40 changes: 40 additions & 0 deletions src/Services/CRM/Requisites/Result/RequisiteLinksResult.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Vadim Soluyanov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/


declare(strict_types=1);

namespace Bitrix24\SDK\Services\CRM\Requisites\Result;

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

/**
* Class RequisiteLinksResult
*
* @package Bitrix24\SDK\Services\CRM\Requisites\Result
*/
class RequisiteLinksResult extends AbstractResult
{
/**
* @return RequisiteLinkItemResult[]
* @throws BaseException
*/
public function getLinks(): array
{
$items = [];
foreach ($this->getCoreResponse()->getResponseData()->getResult() as $item) {
$items[] = new RequisiteLinkItemResult($item);
}

return $items;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

/**
* This file is part of the bitrix24-php-sdk package.
*
* © Vadim Soluyanov <[email protected]>
*
* For the full copyright and license information, please view the MIT-LICENSE.txt
* file that was distributed with this source code.
*/


declare(strict_types=1);

namespace Bitrix24\SDK\Services\CRM\Requisites\Result;

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

/**
* Class RequisitePresetAvailableFieldsResult
*
* @package Bitrix24\SDK\Services\CRM\Requisites\Result
*/
class RequisitePresetAvailableFieldsResult extends AbstractResult
{
/**
* @return string[]
* @throws BaseException
*/
public function getAvailableFields(): array
{
return $this->getCoreResponse()->getResponseData()->getResult();
}
}
Loading