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

Extract tax rate provider from line items converter #181

Merged
merged 2 commits into from
Jan 31, 2020

Conversation

GSadee
Copy link
Member

@GSadee GSadee commented Jan 31, 2020

After #179

@GSadee GSadee added Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.). DX Issues and PRs aimed at improving Developer eXperience. labels Jan 31, 2020
@GSadee GSadee requested a review from a team as a code owner January 31, 2020 07:59

final class TaxRateProvider implements TaxRateProviderInterface
{
public function provide(OrderItemUnitInterface $orderItemUnit): ?string
Copy link
Member

Choose a reason for hiding this comment

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

I wonder, should we pass there $orderItemUnit or maybe tax adjustment would be more suitable? The order item unit may or may not contain tax adjustment (therefore, we're forced to allow a null return). I feel like this check should be done before and not even call this service if we have no tax adjustment to process 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess that the goal is to get a tax rate for a refunded order item unit. In the implementation of this service, there is an assumption that we take the first adjustment, but this may not be the best solution for all cases and for me, this kind of service should decide about that. So, passing here $orderItemUnit seems to me a better option to achieve the original goal.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense 👍

src/Provider/TaxRateProvider.php Outdated Show resolved Hide resolved
@GSadee GSadee force-pushed the extract-tax-rate-provider branch from 1aca927 to 6af2b26 Compare January 31, 2020 09:43
@Zales0123 Zales0123 merged commit 92c102d into Sylius:master Jan 31, 2020
@Zales0123
Copy link
Member

Thank you, Grzegorz! 🥇

@GSadee GSadee deleted the extract-tax-rate-provider branch January 31, 2020 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Issues and PRs aimed at improving Developer eXperience. Enhancement Minor issues and PRs improving the current solutions (optimizations, typo fixes, etc.).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants