Skip to content

Commit 539ea99

Browse files
authored
Merge branch 'dev' into feature/153-add-contact-detail-configuration
2 parents 72092d7 + 12abb53 commit 539ea99

File tree

95 files changed

+5968
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+5968
-138
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ docs/api/var
1717
.env.local
1818
*.local
1919
/.php-cs-fixer.cache
20+
log.txt

.php-cs-fixer.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
$finder = Finder::create()
88
->in(__DIR__ . '/src/Infrastructure/Console/Commands/')
99
->in(__DIR__ . '/src/Services/CRM/Contact/')
10+
->in(__DIR__ . '/src/Services/CRM/Quote/')
11+
->in(__DIR__ . '/src/Services/CRM/Lead/')
12+
->in(__DIR__ . '/src/Services/CRM/Currency/')
1013
->name('*.php')
1114
->exclude(['vendor', 'storage', 'docker', 'docs']) // Exclude directories
1215
->ignoreDotFiles(true)

CHANGELOG.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,50 @@
44

55
### Added
66

7+
- Added service `Services\CRM\Lead\Service\LeadProductRows` with support methods,
8+
see [add crm.lead.productrows* methods](https://github.com/bitrix24/b24phpsdk/issues/175):
9+
- `set` Adds products to a lead
10+
- `get` Returns the products of a lead
11+
- Added service `Services\CRM\Quote\Service\Quote` with support methods,
12+
see [crm.quote.* methods](https://github.com/bitrix24/b24phpsdk/issues/179):
13+
- `fields` returns a list of fields for the quote
14+
- `get` returns the settings of the quote by Id
15+
- `list` returns a list of quote
16+
- `add` creates a new quote
17+
- `delete` deletes a quote
18+
- `update` modifies the quote
19+
- `countByFilter` count quotes by filter
20+
- Added support for events:
21+
- `OnCrmQuoteAdd`
22+
- `OnCrmQuoteDelete`
23+
- `OnCrmQuoteUpdate`
24+
- `OnCrmQuoteUserFieldAdd`
25+
- `OnCrmQuoteUserFieldDelete`
26+
- `OnCrmQuoteUserFieldSetEnumValues`
27+
- `OnCrmQuoteUserFieldUpdate`
28+
- Added service `Services\CRM\Quote\Service\QuoteUserfield` with support methods:
29+
- `add` add userfield to a quote
30+
- `get` get userfield to a quote
31+
- `list` list userfields
32+
- `delete` delete userfield
33+
- `update` update userfield
34+
- Added service `Services\CRM\Quote\Service\QuoteProductRows` with support methods:
35+
- `set` Adds products to a quote
36+
- `get` Returns the products of a quote
37+
- Added service `Services\CRM\Quote\Service\QuoteContact` with support methods,
38+
- `fields` get fiels for quote contact connection
39+
- `setItems` set contacts related with quote
40+
- `get` get contacts related to quote
41+
- `deleteItems` delete all relations for quote
42+
- `add` add contact relation with quote
43+
- `delete` delete contact relation with quote
44+
- Added service `CRM\Lead\Service\LeadUserfield` with support methods,
45+
see [add crm.lead.userfield.* methods](https://github.com/bitrix24/b24phpsdk/issues/177):
46+
- `add` add userfield to lead
47+
- `get` get userfield to lead
48+
- `list` list userfields
49+
- `delete` delete userfield
50+
- `update` update userfield
751
- Added service `Services\CRM\Deal\Service\DealRecurring` with support methods,
852
see [crm.deal.recurring.* methods](https://github.com/bitrix24/b24phpsdk/issues/160):
953
- `fields` returns a list of fields for the recurring deal template
@@ -19,11 +63,25 @@
1963
- `delete` delete trigger, with batch calls support
2064
- `list` get list of triggers, with batch calls support
2165
- `execute` execute trigger, with batch calls support
66+
- Added service `Services\CRM\Currency` with support methods,
67+
see [Add crm.currency.* methods](https://github.com/bitrix24/b24phpsdk/issues/155):
68+
- `get` get currency
69+
- `fields` get currency fields
70+
- `list` get currency list
71+
- `add` add new currency, with batch calls support
72+
- `delete` delete currency, with batch calls support
73+
- `update` update currency, with batch calls support
74+
- Added service `Services\CRM\Currency\Localizations` with support methods,
75+
see [Add crm.currency.* methods](https://github.com/bitrix24/b24phpsdk/issues/155):
76+
- `set` set localizations, with batch calls support
77+
- `get` get localizations
78+
- `fields` get localization fields
79+
- `delete` delete currency, with batch calls support
2280

2381
### Fixed
2482

2583
- Fixed error in arguments in service for method `placement.bind`, [see details](https://github.com/bitrix24/b24phpsdk/issues/151)
26-
84+
- Fixed errors in `task.elapseditem.*` call in ApiClient [see details](https://github.com/bitrix24/b24phpsdk/issues/180)
2785
### Changed
2886

2987
-**️️BC** Changed contract `Bitrix24\SDK\Application\Contracts\Bitrix24Accounts\Entity\Bitrix24AccountInterface`, this change needs to process corner cases

Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,33 @@ test-integration-scope-ai-admin:
183183
integration_tests_scope_crm_contact_details:
184184
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_scope_crm_contact_details
185185

186+
.PHONY: integration_tests_lead_userfield
187+
integration_tests_lead_userfield:
188+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_lead_userfield
189+
190+
.PHONY: integration_tests_lead_userfield_use_case
191+
integration_tests_lead_userfield_use_case:
192+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_lead_userfield_use_case
193+
194+
.PHONY: integration_tests_scope_crm_currency
195+
integration_tests_scope_crm_currency:
196+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_scope_crm_currency
197+
186198
.PHONY: integration_tests_deal_recurring
187199
integration_tests_deal_recurring:
188200
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_deal_recurring
189201

190202
.PHONY: integration_tests_scope_automation
191203
integration_tests_scope_automation:
192204
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_scope_automation
205+
206+
.PHONY: integration_tests_lead_productrows
207+
integration_tests_lead_productrows:
208+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_lead_productrows
209+
210+
.PHONY: integration_tests_crm_quote
211+
integration_tests_crm_quote:
212+
docker-compose run --rm php-cli vendor/bin/phpunit --testsuite integration_tests_crm_quote
193213

194214
# work dev environment
195215
.PHONY: php-dev-server-up

phpstan.neon.dist

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ parameters:
1212
- tests/Integration/Services/Main
1313
- tests/Integration/Services/Placement
1414
- tests/Integration/Services/CRM/Contact/Service/ContactDetailsConfigurationTest.php
15+
- tests/Integration/Services/CRM/Lead/Service/LeadProductRowsTest.php
16+
- tests/Integration/Services/CRM/Quote/Service/QuoteTest.php
17+
- tests/Integration/Services/CRM/Quote/Service/BatchTest.php
18+
- tests/Integration/Services/CRM/Quote/Service/QuoteContactTest.php
19+
- tests/Integration/Services/CRM/Quote/Service/QuoteUserfieldTest.php
20+
- tests/Integration/Services/CRM/Quote/Service/QuoteProductRowsTest.php
21+
- tests/Integration/Services/CRM/Lead/Service/LeadUserfieldTest.php
22+
- tests/Integration/Services/CRM/Currency
1523
bootstrapFiles:
1624
- tests/bootstrap.php
1725
parallel:

phpunit.xml.dist

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,27 @@
4646
<testsuite name="integration_tests_scope_crm_contact_details">
4747
<file>./tests/Integration/Services/CRM/Contact/Service/ContactDetailsConfigurationTest.php</file>
4848
</testsuite>
49+
<testsuite name="integration_tests_lead_productrows">
50+
<file>./tests/Integration/Services/CRM/Lead/Service/LeadProductRowsTest.php</file>
51+
</testsuite>
52+
<testsuite name="integration_tests_lead_userfield">
53+
<file>./tests/Integration/Services/CRM/Lead/Service/LeadUserfieldTest.php</file>
54+
</testsuite>
55+
<testsuite name="integration_tests_lead_userfield_use_case">
56+
<file>./tests/Integration/Services/CRM/Lead/Service/LeadUserfieldUseCaseTest.php</file>
57+
</testsuite>
58+
<testsuite name="integration_tests_scope_crm_currency">
59+
<directory>./tests/Integration/Services/CRM/Currency/</directory>
60+
</testsuite>
4961
<testsuite name="integration_tests_deal_recurring">
5062
<file>./tests/Integration/Services/CRM/Deal/Service/DealRecurringTest.php</file>
5163
</testsuite>
5264
<testsuite name="integration_tests_scope_automation">
5365
<directory>./tests/Integration/Services/CRM/Automation/</directory>
5466
</testsuite>
67+
<testsuite name="integration_tests_crm_quote">
68+
<directory>./tests/Integration/Services/CRM/Quote/</directory>
69+
</testsuite>
5570
</testsuites>
5671
<source>
5772
<include>

rector.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
__DIR__ . '/tests/Integration/Services/Placement',
3939
__DIR__ . '/src/Services/CRM/Contact/Service/ContactDetailsConfiguration.php',
4040
__DIR__ . '/tests/Integration/Services/CRM/Contact/Service/ContactDetailsConfigurationTest.php',
41+
__DIR__ . '/src/Services/CRM/Lead',
42+
__DIR__ . '/tests/Integration/Services/CRM/Lead/Service',
43+
__DIR__ . '/src/Services/CRM/Quote',
44+
__DIR__ . '/tests/Integration/Services/CRM/Quote/Service',
45+
__DIR__ . '/src/Services/CRM/Currency',
46+
__DIR__ . '/tests/Integration/Services/CRM/Currency',
4147
__DIR__ . '/tests/Unit/',
4248
])
4349
->withCache(cacheDirectory: __DIR__ . '.cache/rector')

src/Core/ApiClient.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,15 @@ public function getResponse(string $apiMethod, array $parameters = []): Response
210210
'task.commentitem.update',
211211
'task.commentitem.getlist',
212212
'task.commentitem.delete',
213-
'task.commentitem.isactionallowed'
213+
'task.commentitem.isactionallowed',
214+
'task.elapseditem.add',
215+
'task.elapseditem.update',
216+
'task.elapseditem.get',
217+
'task.elapseditem.getlist',
218+
'task.elapseditem.delete',
219+
'task.elapseditem.isactionallowed',
220+
'task.elapseditem.getmanifest',
221+
'tasks.task.add',
214222
];
215223
if (!in_array($apiMethod, $strictApiMethods, true)) {
216224
$url .= '?' . $this->requestIdGenerator->getQueryStringParameterName() . '=' . $requestId;

src/Core/Batch.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ protected function getTraversable(bool $isHaltOnError): Generator
837837
* @throws BaseException
838838
* @throws Exceptions\TransportException
839839
*/
840-
private function getTraversableBatchResults(bool $isHaltOnError): Generator
840+
protected function getTraversableBatchResults(bool $isHaltOnError): Generator
841841
{
842842
$this->logger->debug(
843843
'getTraversableBatchResults.start',

src/Services/CRM/CRMServiceBuilder.php

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,40 @@ public function vat(): VatRates\Service\Vat
9595

9696
return $this->serviceCache[__METHOD__];
9797
}
98+
99+
public function currency(): Currency\Service\Currency
100+
{
101+
if (!isset($this->serviceCache[__METHOD__])) {
102+
$batch = new Currency\Batch(
103+
$this->core,
104+
$this->log
105+
);
106+
$this->serviceCache[__METHOD__] = new Currency\Service\Currency(
107+
new Currency\Service\Batch($batch, $this->log),
108+
$this->core,
109+
$this->log
110+
);
111+
}
112+
113+
return $this->serviceCache[__METHOD__];
114+
}
115+
116+
public function localizations(): Currency\Localizations\Service\Localizations
117+
{
118+
if (!isset($this->serviceCache[__METHOD__])) {
119+
$batch = new Currency\Localizations\Batch(
120+
$this->core,
121+
$this->log
122+
);
123+
$this->serviceCache[__METHOD__] = new Currency\Localizations\Service\Localizations(
124+
new Currency\Localizations\Service\Batch($batch, $this->log),
125+
$this->core,
126+
$this->log
127+
);
128+
}
129+
130+
return $this->serviceCache[__METHOD__];
131+
}
98132

99133
public function companyContact(): Company\Service\CompanyContact
100134
{
@@ -289,6 +323,81 @@ public function lead(): Lead\Service\Lead
289323

290324
return $this->serviceCache[__METHOD__];
291325
}
326+
327+
/**
328+
* @return Lead\Service\LeadProductRows
329+
*/
330+
public function leadProductRows(): Lead\Service\LeadProductRows
331+
{
332+
if (!isset($this->serviceCache[__METHOD__])) {
333+
$this->serviceCache[__METHOD__] = new Lead\Service\LeadProductRows($this->core, $this->log);
334+
}
335+
336+
return $this->serviceCache[__METHOD__];
337+
}
338+
339+
public function leadUserfield(): Lead\Service\LeadUserfield
340+
{
341+
if (!isset($this->serviceCache[__METHOD__])) {
342+
$this->serviceCache[__METHOD__] = new Lead\Service\LeadUserfield(
343+
new UserfieldConstraints(),
344+
$this->core,
345+
$this->log
346+
);
347+
}
348+
349+
return $this->serviceCache[__METHOD__];
350+
}
351+
352+
public function quote(): Quote\Service\Quote
353+
{
354+
if (!isset($this->serviceCache[__METHOD__])) {
355+
$this->serviceCache[__METHOD__] = new Quote\Service\Quote(
356+
new Quote\Service\Batch($this->batch, $this->log),
357+
$this->core,
358+
$this->log
359+
);
360+
}
361+
362+
return $this->serviceCache[__METHOD__];
363+
}
364+
365+
public function quoteContact(): Quote\Service\QuoteContact
366+
{
367+
if (!isset($this->serviceCache[__METHOD__])) {
368+
$this->serviceCache[__METHOD__] = new Quote\Service\QuoteContact(
369+
$this->core,
370+
$this->log
371+
);
372+
}
373+
374+
return $this->serviceCache[__METHOD__];
375+
}
376+
377+
/**
378+
* @return Quote\Service\QuoteProductRows
379+
*/
380+
public function quoteProductRows(): Quote\Service\QuoteProductRows
381+
{
382+
if (!isset($this->serviceCache[__METHOD__])) {
383+
$this->serviceCache[__METHOD__] = new Quote\Service\QuoteProductRows($this->core, $this->log);
384+
}
385+
386+
return $this->serviceCache[__METHOD__];
387+
}
388+
389+
public function quoteUserfield(): Quote\Service\QuoteUserfield
390+
{
391+
if (!isset($this->serviceCache[__METHOD__])) {
392+
$this->serviceCache[__METHOD__] = new Quote\Service\QuoteUserfield(
393+
new UserfieldConstraints(),
394+
$this->core,
395+
$this->log
396+
);
397+
}
398+
399+
return $this->serviceCache[__METHOD__];
400+
}
292401

293402
public function activity(): Activity\Service\Activity
294403
{

0 commit comments

Comments
 (0)