-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Rework invoice template on pdf and admin show page #234
Conversation
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.
The invoice doesn't have the same columns as you have described in the task, I would be for changing them to be exactly the same.
What is more, there are missing tests for cases like:
- items with a promotion applied
- shipments with taxes
- shipments with a promotion applied
- shipments with taxes and a promotion applied
I also wonder if a view of invoice show should be the same as PDF file, it wasn't in the scope of task, so I'm not convinced to changing that in this PR 🤔 /cc @CoderMaggie
features/managing_invoices/seeing_invoices_when_items_has_promitions_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_invoices_when_items_has_promitions_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_invoices_when_items_has_promitions_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_invoices_when_shipment_has_promotions_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_invoices_when_items_has_promitions_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_invoices_when_items_has_promitions_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_invoices_when_shipment_has_promotions_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_invoices_when_shipment_has_taxes.feature
Outdated
Show resolved
Hide resolved
...res/managing_invoices/seeing_invoices_when_shipment_has_taxes_and_promotions_applied.feature
Outdated
Show resolved
Hide resolved
...res/managing_invoices/seeing_invoices_when_shipment_has_taxes_and_promotions_applied.feature
Outdated
Show resolved
Hide resolved
3d5841d
to
c7f12b2
Compare
features/managing_invoices/seeing_an_invoice_with_items_having_promotion_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_an_invoice_with_shipment_having_promotion_applied.feature
Outdated
Show resolved
Hide resolved
features/managing_invoices/seeing_an_invoice_with_shipment_having_taxes_applied.feature
Outdated
Show resolved
Hide resolved
45ef97b
to
6539dc5
Compare
...anaging_invoices/seeing_an_invoice_with_items_and_shipments_having_promotion_applied.feature
Outdated
Show resolved
Hide resolved
...anaging_invoices/seeing_an_invoice_with_items_and_shipments_having_promotion_applied.feature
Outdated
Show resolved
Hide resolved
...anaging_invoices/seeing_an_invoice_with_items_and_shipments_having_promotion_applied.feature
Outdated
Show resolved
Hide resolved
...managing_invoices/seeing_an_invoice_with_shipment_having_taxes_and_promotion_applied.feature
Outdated
Show resolved
Hide resolved
...managing_invoices/seeing_an_invoice_with_shipment_having_taxes_and_promotion_applied.feature
Outdated
Show resolved
Hide resolved
...managing_invoices/seeing_an_invoice_with_shipment_having_taxes_and_promotion_applied.feature
Outdated
Show resolved
Hide resolved
...managing_invoices/seeing_an_invoice_with_shipment_having_taxes_and_promotion_applied.feature
Outdated
Show resolved
Hide resolved
23205ec
to
65cb889
Compare
3c14b49
to
1c2fdb8
Compare
1c2fdb8
to
00d7b2c
Compare
00d7b2c
to
7a19695
Compare
7a19695
to
2a8ceb0
Compare
2a8ceb0
to
ee8ea4e
Compare
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.
The "Name" column should be aligned to left, not right :)
Done 👌🏻 |
/** | ||
* @Then it should have :quantity :name item with unit price :unitPrice, net value :netValue, tax total :taxTotal and total :total in :currencyCode currency | ||
* @Then it should have :quantity :name items with unit price :unitPrice, net value :netValue, tax total :taxTotal and total :total in :currencyCode currency | ||
*/ |
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.
Wouldn't here this funny structure with ?:s
( I don't remember it exactly :D ) work?
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.
You are right, I would use the structure with optional s
, but then I would have to change the whole definition to a regexp, which in my opinion is less readable with so many arguments
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.
👌 I will stay with Team readable then 😄
739088d
to
10d34a0
Compare
} | ||
|
||
if ($taxAdjustments->isEmpty()) { | ||
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.
Is there any reason why we throw an exception in one undesired situation (more tax adjustments than one), but return a null in another (no tax adjustments at all)?
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.
no tax adjustment seems like totally ok situation. I'm considering if two tax adjustments are such an edge case, but I'm fine with this decision
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.
No tax adjustment is the normal case, but more than 2 tax adjustments is the case not supported by default by Sylius, so this is the reason why this exception is thrown here. What is more, there is a similar behaviour in RefundPlugin.
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.
Doubled taxation is not a particularly not supported feature of the main Sylius. We already support both included and excluded taxes on order items. Therefore it may happen. Nonetheless, I'm still fine with it for the first iteration. Especially, as RefundPlugin works in similar fashion
@@ -0,0 +1,30 @@ | |||
@managing_invoices | |||
Feature: Seeing an invoice with items and shipment having promotion applied | |||
In order to have items with proper amounts |
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.
I don't want to be picky 😄 But I feel we should work over these features descriptions a little bit 🚀 Having proper amounts is not a goal in the essence, it's more a way to... what? Not having legal problems? 🤯 I can leave with it, but I know we can do better 😄
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.
Yup, you're 😄 For me, the intention of Administrator to have proper amounts on the invoice is enough, but feel free to refactor these features 😃
e0b0893
to
ced4305
Compare
$this->shouldImplement(LineItemsConverterInterface::class); | ||
} | ||
|
||
function it_extracts_line_items_from_orders_shipping_adjusments( |
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.
We could cover a few more cases here, like lack of tax adjustment or having two of them.
Thank you, Tomasz and Grzegorz! 🎉 |
PDF:
Before:
After:
Show Page:
Before:
After: