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

Taxes displayed properly on credit memo #264

Merged

Conversation

AdamKasp
Copy link
Contributor

@AdamKasp AdamKasp commented Mar 10, 2021

Show Page:
Screenshot 2021-03-13 at 11 59 36

PDF:
Screenshot 2021-03-13 at 12 00 58

TODO:

  • implement behat context
  • fix row with shipment tax value
  • add subsums for net values and tax value
  • refactor PDF view

@AdamKasp AdamKasp requested a review from a team as a code owner March 10, 2021 13:30
src/Provider/TaxRateProvider.php Outdated Show resolved Hide resolved
src/Converter/ShipmentLineItemsConverter.php Outdated Show resolved Hide resolved
src/Converter/ShipmentLineItemsConverter.php Outdated Show resolved Hide resolved
spec/Provider/TaxRateAmountProviderSpec.php Outdated Show resolved Hide resolved
spec/Provider/TaxRateAmountProviderSpec.php Outdated Show resolved Hide resolved
spec/Provider/TaxRateProviderSpec.php Outdated Show resolved Hide resolved
src/Converter/ShipmentLineItemsConverter.php Outdated Show resolved Hide resolved
tests/Behat/Context/Ui/CreditMemoContext.php Outdated Show resolved Hide resolved
tests/Behat/Context/Ui/CreditMemoContext.php Outdated Show resolved Hide resolved
@AdamKasp AdamKasp force-pushed the taxes-displayed-properly-on-tax-memo branch 3 times, most recently from fdd9b77 to 36f832d Compare March 13, 2021 12:38
src/Provider/TaxRateProvider.php Outdated Show resolved Hide resolved
src/Converter/ShipmentLineItemsConverter.php Outdated Show resolved Hide resolved
src/Converter/ShipmentLineItemsConverter.php Outdated Show resolved Hide resolved
src/Entity/CreditMemo.php Outdated Show resolved Hide resolved
src/Entity/CreditMemo.php Outdated Show resolved Hide resolved
src/Resources/config/services/provider.xml Outdated Show resolved Hide resolved
tests/Behat/Context/Application/CreditMemoContext.php Outdated Show resolved Hide resolved
tests/Behat/Context/Application/CreditMemoContext.php Outdated Show resolved Hide resolved
tests/Behat/Context/Ui/CreditMemoContext.php Outdated Show resolved Hide resolved
@GSadee GSadee added the Bug Confirmed bugs or bugfixes. label Mar 16, 2021
@GSadee GSadee force-pushed the taxes-displayed-properly-on-tax-memo branch from 36f832d to af6d25e Compare March 16, 2021 07:37
@GSadee GSadee changed the title Taxes displayed properly on tax memo Taxes displayed properly on credit memo Mar 16, 2021
@GSadee GSadee force-pushed the taxes-displayed-properly-on-tax-memo branch 2 times, most recently from 48ea44d to 130932a Compare March 16, 2021 12:45
@GSadee GSadee force-pushed the taxes-displayed-properly-on-tax-memo branch from 130932a to a63ae1e Compare March 16, 2021 13:21
src/Converter/ShipmentLineItemsConverter.php Show resolved Hide resolved
}

if ($taxAdjustments->count() > 1) {
throw MoreThanOneTaxAdjustment::occur();
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider the Exception keyword at the end of the exception name as a standard in Sylius or not?

Copy link
Member

Choose a reason for hiding this comment

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

+1 for ...Exception notation

Copy link
Member

Choose a reason for hiding this comment

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

In this particular plugin, half of the exceptions have Exception suffix and half do not. As I remember, we wanted to avoid using this keyword but I don't insist and I don't have a good argument for either of these approaches.

@diimpp
Copy link
Member

diimpp commented Mar 17, 2021

image
Kind of expect to see tax rate label, not just rate over here. What do you think?

@@ -45,19 +52,45 @@ private function convertUnitRefundToLineItem(ShipmentRefund $shipmentRefund): Li
;
Assert::notNull($shippingAdjustment);

/** @var ShipmentInterface $shipment */
Copy link
Member

@diimpp diimpp Mar 17, 2021

Choose a reason for hiding this comment

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

Not exactly related to PR, but maybe it should be like so

--- private function convertUnitRefundToLineItem(ShipmentRefund $shipmentRefund): LineItemInterface
+++ private function convertShipmentRefundToLineItem(ShipmentRefund $shipmentRefund): LineItemInterface

Copy link
Member

Choose a reason for hiding this comment

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

Fixed in #271

<tr class="total">
<td colspan="6"></td>
<td>{{ 'sylius_refund.ui.net_total'|trans([], 'messages', creditMemo.localeCode) }}:</td>
<td>{{ '%0.2f'|format(creditMemo.getNetValueTotal()/100) }}</td>
Copy link
Member

Choose a reason for hiding this comment

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

I see this logic in several places, but I'm wondering why don't we use some kind of many formatter here, just to unify extract this division to separate template

@lchrusciel lchrusciel merged commit 876707f into Sylius:master Mar 17, 2021
@lchrusciel
Copy link
Member

Thank you, Adam! 🥇

/** @var TaxRateProviderInterface */
private $taxRateProvider;

public function __construct(RepositoryInterface $adjustmentRepository, TaxRateProviderInterface $taxRateProvider)
Copy link
Member

Choose a reason for hiding this comment

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

This is also a bc break. Can we add a note to upgrade?

AdamKasp added a commit that referenced this pull request Mar 17, 2021
…ineItemsConverter (GSadee)

This PR was merged into the 1.0-dev branch.

Discussion
----------

Fix for comment: #264 (comment)

Commits
-------

f8a0d9d Add missing note about changes in constructor of ShipmentLineItemsConverter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bugs or bugfixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants