Skip to content

Commit ef531fd

Browse files
authored
Merge pull request #189 from Info-Expert-B24/feature/188-add-requisite-bankdetail
Feature/188 add requisite bankdetail
2 parents 9da9aac + 771a6a8 commit ef531fd

34 files changed

+2511
-36
lines changed

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
->in(__DIR__ . '/src/Services/CRM/Quote/')
1313
->in(__DIR__ . '/src/Services/CRM/Lead/')
1414
->in(__DIR__ . '/src/Services/CRM/Currency/')
15+
->in(__DIR__ . '/src/Services/CRM/Requisites/')
1516
->in(__DIR__ . '/src/Services/CRM/Status/')
1617
->in(__DIR__ . '/src/Services/CRM/Timeline/')
1718
->in(__DIR__ . '/src/Services/Entity/Section/')

CHANGELOG.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,36 @@
3535

3636
### Added
3737

38+
- Added service `CRM\Requisites\Service\RequisiteUserfield` with support methods,
39+
see [add crm.requisite.userfield.* methods](https://github.com/bitrix24/b24phpsdk/issues/188):
40+
- `add` add userfield to requisite
41+
- `get` get userfield to requisite
42+
- `list` list userfields
43+
- `delete` delete userfield
44+
- `update` update userfield
45+
- Added service `CRM\Requisites\Service\RequisiteBankdetail` with support methods:
46+
- `add` add bank detail to requisite
47+
- `get` get bank detail to requisite
48+
- `fields` get fields for bank details
49+
- `list` list bank details
50+
- `delete` delete bank detail
51+
- `update` update bank detail
52+
- `countByFilter` count bank details by filter
53+
- Added service `CRM\Requisites\Service\RequisiteLink` with support methods:
54+
- `register` registers the link between requisites and an object
55+
- `unregister` removes the link between requisites and an object
56+
- `fields` get a formal description of the fields of the requisites link
57+
- `get` returns the link between requisites and an object
58+
- `list` returns a list of links between requisites based on a filter
59+
- `countByFilter` count links by filter
60+
- Added service `CRM\Requisites\Service\RequisitePresetField` with support methods:
61+
- `add` adds a customizable field to the requisites template
62+
- `get` returns the description of the custom field in the requisites template by identifier
63+
- `fields` returns the description of the custom field in the requisites template by identifier
64+
- `list` returns a list of all custom fields for a specific requisites template
65+
- `delete` deletes a customizable field from the requisites template
66+
- `update` modifies a custom field in the requisites template
67+
- `availabletoadd` returns fields available for addition to the specified requisites template
3868
- Added service `Services\CRM\Status\Service\Status` with support methods,
3969
see [crm.status.* methods](https://github.com/bitrix24/b24phpsdk/issues/194):
4070
- `fields` returns descriptions of reference book fields
@@ -79,7 +109,7 @@
79109
- `countByFilter` counts product items by filter
80110
- Added service `Services\CRM\Lead\Service\LeadContact` with support methods,
81111
see [crm.lead.contact.* methods](https://github.com/bitrix24/b24phpsdk/issues/170):
82-
- `fields` get fiels for lead contact connection
112+
- `fields` get fields for lead contact connection
83113
- `setItems` set contacts related with lead
84114
- `get` get contacts related to lead
85115
- `deleteItems` delete all relations for lead

Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,18 @@ integration_tests_lead_productrows:
239239
integration_tests_crm_quote:
240240
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_quote
241241

242+
.PHONY: integration_tests_crm_requisite
243+
integration_tests_crm_requisite:
244+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_requisite
245+
246+
.PHONY: integration_tests_crm_preset_field
247+
integration_tests_crm_preset_field:
248+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_preset_field
249+
250+
.PHONY: integration_tests_crm_requisite_userfield
251+
integration_tests_crm_requisite_userfield:
252+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_requisite_userfield
253+
242254
.PHONY: integration_tests_crm_status
243255
integration_tests_crm_status:
244256
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_status

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ parameters:
2626
- tests/Integration/Services/CRM/Quote/Service/QuoteProductRowsTest.php
2727
- tests/Integration/Services/CRM/Lead/Service/LeadUserfieldTest.php
2828
- tests/Integration/Services/CRM/Currency
29+
- tests/Integration/Services/CRM/Requisites
30+
excludePaths:
31+
- tests/Integration/Services/CRM/Requisites/Service/RequisiteUserfieldUseCaseTest.php
2932
- tests/Integration/Services/CRM/Status
3033
- tests/Integration/Services/CRM/Timeline
3134
- tests/Integration/Services/Entity/Section

phpunit.xml.dist

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@
8585
<testsuite name="integration_tests_crm_quote">
8686
<directory>./tests/Integration/Services/CRM/Quote/</directory>
8787
</testsuite>
88+
<testsuite name="integration_tests_crm_requisite">
89+
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisiteLinkTest.php</file>
90+
</testsuite>
91+
<testsuite name="integration_tests_crm_preset_field">
92+
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisitePresetFieldTest.php</file>
93+
</testsuite>
94+
<testsuite name="integration_tests_crm_requisite_userfield">
95+
<file>./tests/Integration/Services/CRM/Requisites/Service/RequisiteUserfieldTest.php</file>
96+
</testsuite>
8897
<testsuite name="integration_tests_crm_status">
8998
<directory>./tests/Integration/Services/CRM/Status/</directory>
9099
</testsuite>

rector.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
__DIR__ . '/tests/Integration/Services/CRM/Quote/Service',
5151
__DIR__ . '/src/Services/CRM/Currency',
5252
__DIR__ . '/tests/Integration/Services/CRM/Currency',
53+
__DIR__ . '/src/Services/CRM/Requisites',
54+
__DIR__ . '/tests/Integration/Services/CRM/Requisites',
5355
__DIR__ . '/src/Services/CRM/Timeline',
5456
__DIR__ . '/tests/Integration/Services/CRM/Timeline',
5557
__DIR__ . '/src/Services/Entity/Section',

src/Services/CRM/CRMServiceBuilder.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,55 @@ public function requisitePreset(): Requisites\Service\RequisitePreset
4747

4848
return $this->serviceCache[__METHOD__];
4949
}
50+
51+
public function requisiteBankdetail(): Requisites\Service\RequisiteBankdetail
52+
{
53+
if (!isset($this->serviceCache[__METHOD__])) {
54+
$this->serviceCache[__METHOD__] = new Requisites\Service\RequisiteBankdetail(
55+
$this->core,
56+
$this->log
57+
);
58+
}
59+
60+
return $this->serviceCache[__METHOD__];
61+
}
62+
63+
public function requisiteLink(): Requisites\Service\RequisiteLink
64+
{
65+
if (!isset($this->serviceCache[__METHOD__])) {
66+
$this->serviceCache[__METHOD__] = new Requisites\Service\RequisiteLink(
67+
$this->core,
68+
$this->log
69+
);
70+
}
71+
72+
return $this->serviceCache[__METHOD__];
73+
}
74+
75+
public function requisitePresetField(): Requisites\Service\RequisitePresetField
76+
{
77+
if (!isset($this->serviceCache[__METHOD__])) {
78+
$this->serviceCache[__METHOD__] = new Requisites\Service\RequisitePresetField(
79+
$this->core,
80+
$this->log
81+
);
82+
}
83+
84+
return $this->serviceCache[__METHOD__];
85+
}
86+
87+
public function requisiteUserfield(): Requisites\Service\RequisiteUserfield
88+
{
89+
if (!isset($this->serviceCache[__METHOD__])) {
90+
$this->serviceCache[__METHOD__] = new Requisites\Service\RequisiteUserfield(
91+
new UserfieldConstraints(),
92+
$this->core,
93+
$this->log
94+
);
95+
}
96+
97+
return $this->serviceCache[__METHOD__];
98+
}
5099

51100
public function contactCompany(): Contact\Service\ContactCompany
52101
{
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the bitrix24-php-sdk package.
5+
*
6+
* © Vadim Soluyanov <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the MIT-LICENSE.txt
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace Bitrix24\SDK\Services\CRM\Requisites\Result;
15+
16+
use Bitrix24\SDK\Services\CRM\Common\Result\AbstractCrmItem;
17+
use Carbon\CarbonImmutable;
18+
19+
/**
20+
* Class RequisiteBankdetailItemResult
21+
*
22+
* @property-read int $ID
23+
* @property-read int $ENTITY_ID
24+
* @property-read int $COUNTRY_ID
25+
* @property-read CarbonImmutable|null $DATE_CREATE
26+
* @property-read CarbonImmutable|null $DATE_MODIFY
27+
* @property-read int|null $CREATED_BY_ID
28+
* @property-read int|null $MODIFY_BY_ID
29+
* @property-read string $NAME
30+
* @property-read string $CODE
31+
* @property-read string $XML_ID
32+
* @property-read bool|null $ACTIVE
33+
* @property-read int|null $SORT
34+
* @property-read string|null $RQ_BANK_NAME
35+
* @property-read string|null $RQ_BANK_ADDR
36+
* @property-read string|null $RQ_BANK_CODE
37+
* @property-read string|null $RQ_BANK_ROUTE_NUM
38+
* @property-read string|null $RQ_BIK
39+
* @property-read string|null $RQ_CODEB
40+
* @property-read string|null $RQ_CODEG
41+
* @property-read string|null $RQ_RIB
42+
* @property-read string|null $RQ_MFO
43+
* @property-read string|null $RQ_ACC_NAME
44+
* @property-read string|null $RQ_ACC_TYPE
45+
* @property-read string|null $RQ_AGENCY_NAME
46+
* @property-read string|null $RQ_IIK
47+
* @property-read string|null $RQ_ACC_CURRENCY
48+
* @property-read string|null $RQ_ACC_NUM
49+
* @property-read string|null $RQ_COR_ACC_NUM
50+
* @property-read string|null $RQ_IBAN
51+
* @property-read string|null $RQ_SWIFT
52+
* @property-read string|null $RQ_BIC
53+
* @property-read string|null $COMMENTS
54+
* @property-read string|null $ORIGINATOR_ID
55+
*/
56+
class RequisiteBankdetailItemResult extends AbstractCrmItem
57+
{
58+
/**
59+
*
60+
* @return mixed|null
61+
* @throws \Bitrix24\SDK\Services\CRM\Userfield\Exceptions\UserfieldNotFoundException
62+
*/
63+
public function getUserfieldByFieldName(string $userfieldName)
64+
{
65+
return $this->getKeyWithUserfieldByFieldName($userfieldName);
66+
}
67+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the bitrix24-php-sdk package.
5+
*
6+
* © Vadim Soluyanov <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the MIT-LICENSE.txt
9+
* file that was distributed with this source code.
10+
*/
11+
12+
13+
declare(strict_types=1);
14+
15+
namespace Bitrix24\SDK\Services\CRM\Requisites\Result;
16+
17+
use Bitrix24\SDK\Core\Result\AbstractResult;
18+
19+
/**
20+
* Class RequisiteBankdetailResult
21+
*
22+
* @package Bitrix24\SDK\Services\CRM\Requisites\Result
23+
*/
24+
class RequisiteBankdetailResult extends AbstractResult
25+
{
26+
/**
27+
* @throws \Bitrix24\SDK\Core\Exceptions\BaseException
28+
*/
29+
public function bankdetail(): RequisiteBankdetailItemResult
30+
{
31+
return new RequisiteBankdetailItemResult($this->getCoreResponse()->getResponseData()->getResult());
32+
}
33+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
/**
4+
* This file is part of the bitrix24-php-sdk package.
5+
*
6+
* © Vadim Soluyanov <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the MIT-LICENSE.txt
9+
* file that was distributed with this source code.
10+
*/
11+
12+
13+
declare(strict_types=1);
14+
15+
namespace Bitrix24\SDK\Services\CRM\Requisites\Result;
16+
17+
use Bitrix24\SDK\Core\Exceptions\BaseException;
18+
use Bitrix24\SDK\Core\Result\AbstractResult;
19+
20+
/**
21+
* Class RequisiteBankdetailsResult
22+
*
23+
* @package Bitrix24\SDK\Services\CRM\Requisites\Result
24+
*/
25+
class RequisiteBankdetailsResult extends AbstractResult
26+
{
27+
/**
28+
* @return RequisiteBankdetailItemResult[]
29+
* @throws BaseException
30+
*/
31+
public function getBankdetails(): array
32+
{
33+
$items = [];
34+
foreach ($this->getCoreResponse()->getResponseData()->getResult() as $item) {
35+
$items[] = new RequisiteBankdetailItemResult($item);
36+
}
37+
38+
return $items;
39+
}
40+
}

0 commit comments

Comments
 (0)