What are the Slack Archives?

Itโ€™s a history of our time together in the Slack Community! Thereโ€™s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you wonโ€™t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi all.. I've seen some things... But this one is new. This is the OrderConfirmationMail, 3 items of

Posts: 184 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
edited January 2020 in Help

Hi all..
I've seen some things... But this one is new.
This is the OrderConfirmationMail, 3 items of the same type.
I directly access the items within the orderEntity and access all of them with the same method. Can anyone explain, why they are varying? ๐Ÿ™„

I wouldn't expect that the calculation varies at the same calculation (in every case +19%)

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Lead Spryker Solution Architect / Technical Director Posts: 690 ๐Ÿช - Explorer
    edited January 2020

    Spryker has a pretty uncommon summing, where it tries to distribute the tax evenly and keeps a rest if that is not possible, which gets added add the end. I donโ€™t remember if the rest was distributed among items as well.

    But the sum should be correct.

    Itโ€™s just a blind guess as the whole calculation stack is pretty complex and hard to diagnose without debugging through it.

  • Posts: 184 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
    edited January 2020

    That's indeed uncommon, but would explain it. Thank you!

  • Domain Lead Solution Architecture Sprykee Posts: 519 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet
    edited January 2020

    @ULL0N440J the reasons most likely are following:
    1. Tax distribution is needed, to handle returns/refunds properly. If one item out of 3 is returned, you would want to refund 1/3 of a tax as well
    2. The difference you see is explained correctly by Alberto, the reason is - the so-called โ€œmissing centโ€ issue, when you try to divide letโ€™s say 10$ between 3 items, you will get 0.33 after rounding and 0.01 will be missing, so you gonna get total mis-match. Thatโ€™s why the left-over will be either distributed also evenly, until total matches

  • Domain Lead Solution Architecture Sprykee Posts: 519 ๐Ÿง‘๐Ÿปโ€๐Ÿš€ - Cadet

    you can check

    TaxFacade::getAccruedTaxAmountFromGrossPrice()
    

    for more insights

Welcome!

It looks like you're new here. Sign in or register to get started.