NikolaGavric94 / laravel-square

Square integration with Laravel/Lumen >=5.5
MIT License
32 stars 23 forks source link

Fixes calculation issues when applying taxes with discounts #95

Open Mrkbingham opened 1 month ago

Mrkbingham commented 1 month ago

Tax Calculation Fixes

When discounts are added to individual items or entire orders, it does not match the value that Square expects in order to create a transaction via their APIs. This updates the calculation so that taxes are properly calculated, taking into account both additive and inclusive taxes, applying the discount before the taxes.

It also fixes a bug where the OrderBuilder was not properly passing in the tax scope when creating the taxes collection.

Mrkbingham commented 1 month ago

Link to successful PHPUnit pipeline: https://github.com/Mrkbingham/laravel-square/pull/23/checks