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

Open
wants to merge 20 commits into
base: dev
Choose a base branch
from
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
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,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
32 changes: 31 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,39 @@

### Added

- Added service `CRM\Requisites\Service\RequisiteUserfield` with support methods,
see [add crm.requisite.userfield.* methods](https://github.com/bitrix24/b24phpsdk/issues/188):
- `add` add userfield to requisite
- `get` get userfield to requisite
- `list` list userfields
- `delete` delete userfield
- `update` update userfield
- Added service `CRM\Requisites\Service\RequisiteBankdetail` with support methods:
- `add` add bank detail to requisite
- `get` get bank detail to requisite
- `fields` get fields for bank details
- `list` list bank details
- `delete` delete bank detail
- `update` update bank detail
- `countByFilter` count bank details by filter
- Added service `CRM\Requisites\Service\RequisiteLink` with support methods:
- `register` registers the link between requisites and an object
- `unregister` removes the link between requisites and an object
- `fields` get a formal description of the fields of the requisites link
- `get` returns the link between requisites and an object
- `list` returns a list of links between requisites based on a filter
- `countByFilter` count links by filter
- Added service `CRM\Requisites\Service\RequisitePresetField` with support methods:
- `add` adds a customizable field to the requisites template
- `get` returns the description of the custom field in the requisites template by identifier
- `fields` returns the description of the custom field in the requisites template by identifier
- `list` returns a list of all custom fields for a specific requisites template
- `delete` deletes a customizable field from the requisites template
- `update` modifies a custom field in the requisites template
- `availabletoadd` returns fields available for addition to the specified requisites template
- Added service `Services\CRM\Lead\Service\LeadContact` with support methods,
see [crm.lead.contact.* methods](https://github.com/bitrix24/b24phpsdk/issues/170):
- `fields` get fiels for lead contact connection
- `fields` get fields for lead contact connection
- `setItems` set contacts related with lead
- `get` get contacts related to lead
- `deleteItems` delete all relations for lead
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ 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

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

# work dev environment
.PHONY: php-dev-server-up
Expand Down
3 changes: 3 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ 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
excludePaths:
- tests/Integration/Services/CRM/Requisites/Service/RequisiteUserfieldUseCaseTest.php
bootstrapFiles:
- tests/bootstrap.php
parallel:
Expand Down
9 changes: 9 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@
<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>
<testsuite name="integration_tests_crm_requisite_userfield">
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisiteUserfieldTest.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 @@ -50,6 +50,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());
}
}
Loading