-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
237 serializer test #308
Conversation
-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
…l.get,crm.deal.productrows.get)
… это путем замены области видимости с private на protected в DealProductRowItemResult.php.(Так можно делать ?)
-delete var_dump
- edit method in DealProductRows.php(work)
- edit test (delete testBatch)
There was a problem hiding this 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; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А почему ты тут добавил?
['result']['rows']
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
С этим понятно всё, как отладим, можно удалять
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
с этим тоже понятно, как отладим, можно удалять
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
переименовать в get(
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Причеши тесты, оставь тест на get( с двумя вариантами:
- мы не знаем валюту
- мы знаем валюту
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@KarlsonComplete а сейчас?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ну тесты я делаю не очень , надеюсь готово)
…(Теперь в тестах можем и указывать валюту или не указывать). - убрал лишние методы - поправил тесты - добавил в AbstractCrmItem.php остальные поля связанные с деньгами.
Занимаюсь добавлением поддержки phpmoney как базового типа для денег