Skip to content
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

237 serializer test #308

Merged
merged 23 commits into from
Oct 31, 2022
Merged

Conversation

KarlsonComplete
Copy link
Contributor

Занимаюсь добавлением поддержки phpmoney как базового типа для денег

KarlsonComplete and others added 16 commits July 22, 2022 17:48
-and edit
 NetworkTimingsParser.php
-added a test to check the operation of products and transactions between themselves
- the test works with the help of services
-add improvements to the method DEAL_PRODUCT_ROW so that it can use the currency
… это путем замены области видимости с private на protected в DealProductRowItemResult.php.(Так можно делать ?)
@mesilov mesilov changed the base branch from master to 273-alpha-7-pre-build September 2, 2022 14:44
@mesilov mesilov changed the base branch from 273-alpha-7-pre-build to dev September 4, 2022 13:06
composer.json Outdated Show resolved Hide resolved
tests/Integration/Services/MixedTest/MixedTest.php Outdated Show resolved Hide resolved
tests/Unit/Services/TestPerson/Person.php Outdated Show resolved Hide resolved
tests/Unit/Services/TestPerson/PersonNormalizer.php Outdated Show resolved Hide resolved
tests/Unit/Services/TestPerson/PersonTest.php Outdated Show resolved Hide resolved
src/Services/CRM/Deal/Result/DealProductRowItemResult.php Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
src/Services/CRM/Deal/Service/DealProductRows.php Outdated Show resolved Hide resolved
src/Services/CRM/Deal/Service/DealProductRows.php Outdated Show resolved Hide resolved
Кирилл Храмов added 3 commits September 10, 2022 17:21
@mesilov mesilov self-requested a review October 19, 2022 15:23
@mesilov mesilov self-assigned this Oct 19, 2022
Copy link
Owner

@mesilov mesilov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отревьюил, жду правок

$var = $this->data[$offset] * 100;
return new Money((string)$var,new Currency($this->currency->getCode()));
}
return null;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавь остальные поля

 * @property-read Money $PRICE_EXCLUSIVE
 * @property-read Money $PRICE_NETTO
 * @property-read Money $PRICE_BRUTTO

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

готово

/**
* @return DealProductRowItemResult[]
* @throws BaseException
*/
public function getProductRows(): array
{
$res = [];
foreach ($this->getCoreResponse()->getResponseData()->getResult() as $productRow) {
$res[] = new DealProductRowItemResult($productRow);
foreach ($this->getCoreResponse()->getResponseData()->getResult()['result']['rows'] as $productRow) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему ты тут добавил?
['result']['rows']

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вообщем у меня с этим сейчас возникли проблемы , но я вроде бы пофиксил это добавив дополнительное условие. Проблема была в том что наш метод очень умный getSuperSuperSmart(get). И если мы принимаем только айдишник сделки, то у нас выполняется batch запрос в котором мы возвращаем саму сделку и строку товара, это все у нас записывается в переменную $res. Потом мы ее добавляем в наш объект DealProductRowItemsResult. После чего нам приходится дополнительно указывать [result][rows] , так как есть еще выбор выбрать [result][deal]. А вот если мы указываем в нашем методе и айдишник и валюту , то тогда в DealProductRowItemsResult у нас приходит лишь один запрос с одним массивом и нам не нужно указывать [result][rows].

*/
public function get(int $dealId): DealProductRowItemsResult
public function getStupid(int $dealId, Currency $currency): DealProductRowItemsResult
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

С этим понятно всё, как отладим, можно удалять

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

готово

* @throws \Bitrix24\SDK\Core\Exceptions\BaseException
* @throws \Bitrix24\SDK\Core\Exceptions\TransportException
*/
public function getSuperSmart(int $dealId): DealProductRowItemsResult
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

с этим тоже понятно, как отладим, можно удалять

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

готово

* @throws \Bitrix24\SDK\Core\Exceptions\BaseException
* @throws \Bitrix24\SDK\Core\Exceptions\TransportException
*/
public function getSuperSuperSmart(int $dealId, Currency $currency = null): DealProductRowItemsResult
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

переименовать в get(

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

готово

use Money\Currencies\ISOCurrencies;
use Money\Currency;
use Money\Formatter\DecimalMoneyFormatter;
use Money\Money;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Причеши тесты, оставь тест на get( с двумя вариантами:

  • мы не знаем валюту
  • мы знаем валюту

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KarlsonComplete а сейчас?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну тесты я делаю не очень , надеюсь готово)

…(Теперь в тестах можем и указывать валюту или не указывать).

- убрал лишние методы
- поправил тесты
- добавил в AbstractCrmItem.php остальные поля связанные с деньгами.
@mesilov mesilov added the 2.x issue related with 2.x sdk version label Oct 22, 2022
@mesilov mesilov added this to the CRM scope milestone Oct 22, 2022
@mesilov mesilov added hacktoberfest-accepted Hacktoberfest improve DX developer experience labels Oct 29, 2022
@mesilov mesilov changed the base branch from dev to 306-beta-1 October 31, 2022 10:40
@mesilov mesilov merged commit 2c28aa1 into mesilov:306-beta-1 Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.x issue related with 2.x sdk version hacktoberfest-accepted Hacktoberfest improve DX developer experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants