Easy-digital-downloads: Save used tax rate to payment meta

Created on 1 Jan 2016  路  34Comments  路  Source: easydigitaldownloads/easy-digital-downloads

Saving the tax rate - which was used on creating a payment - to the payment meta as well as currently the tax amount would be very helpful.

component-taxes priority-medium type-feature

Most helpful comment

@SDavisMedia @pippinsplugins @spencerfinnell Ok, so if we settle on one...which of the following:

Camera 1: 馃憤
screen shot 2017-01-24 at 1 15 45 pm

Camera 2: 馃帀
screen shot 2017-01-24 at 1 17 53 pm

All 34 comments

:+1:

Do you want to give me a tip which place would be the best to save the tax rate to the payment meta? Then I'm going to take a look and create a pull request.

If you think it's a bit complicated then I'm going to wait :smile:

It should get stored in it's own row.

:+1: for it's own row. I'd like to get away from having nested serialized array data. This will make it much easier to isolate the data later.

I've gotten started on this in the issue/4105 branch but have run into a problem with reliably saving it across gateways. Since not all gateways create payments in the same way, we can't reliably set it. This may have to come after we introduce the new EDD_Gateway class.

We should be able to do this now with EDD_Payment.

Tracking PR opened at #5403

@pippinsplugins @cklosowski Ready for testing

@sunnyratilal This looks like it should work fine, but I'd like to keep this open in regards to changes coming with EDD_Cart and EDD_Gateway.

Ideally the tax rate doesn't depend on $_POST data inside of edd_insert_payment() since that won't be reliable in all scenarios.

Ok I've updated this to not rely on $_POST. It also adds in sending the postal code which has been requested before in #4877 to allow developers who want to do finer grain tax calculations than just country/state.

While core doesn't use it, it's a nice thing to pass along for customization.

Also added in a little bit of markup on the view order details that displays the tax rate if there is one:
screen shot 2017-01-24 at 11 16 43 am

@sunnyratilal @pippinsplugins ready for quick test and review of the code.

I don't love the rate UI.

How about adding it in parentheses after Tax, so Tax (6%):?

Might not even need parentheses.

It looks super odd without parenthesis...and naming it tax gives us two references to tax

So it'd be:
Tax: <input field> Tax (6%)

Tax: <input field> 6% looks funky?

correct.

This is the requested above...not in love with it...even less:
screen shot 2017-01-24 at 1 15 45 pm

@spencerfinnell the reason it looks odd is because it's so disjointed from the row...seeing a random 6% hanging out after the input looks like it's disconnected from whatever is being referenced.

Here is after:
screen shot 2017-01-24 at 1 17 53 pm

If the percentage is now being stored as well should that be a separate input field then? If you change the actual dollar amount but not the percentage that would be confusing.

I think either both fields need to be editable or neither.

I think either both fields need to be editable or neither.

I agree.

I disagree...the field will not be editable yet. It should only be allowed to be changed by the fields for address.

I'd even love to get rid of tax and total being editable since in #3802 will allow indifivul items to be updated for all of this information and we can let the EDD_Payment class handle all of the heavy lifting.

I agree it should be a historic recording of the original purchase and not editable.

:+1:

I think showing it for now is ideal and once we are comfortable with the above mentioned issue we can take View Order Details a step further and allow fully automated Tax, Total calculation for both the overall payment as well as the individual line items.

@SDavisMedia @pippinsplugins @spencerfinnell Ok, so if we settle on one...which of the following:

Camera 1: 馃憤
screen shot 2017-01-24 at 1 15 45 pm

Camera 2: 馃帀
screen shot 2017-01-24 at 1 17 53 pm

馃帀

Second one has my vote

馃帀 It is! Thanks!

UI updated and ready for some final testing.

Works great. Merged and closing.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

julien731 picture julien731  路  5Comments

DrewAPicture picture DrewAPicture  路  5Comments

mindctrl picture mindctrl  路  4Comments

amdrew picture amdrew  路  5Comments

michaelbeil picture michaelbeil  路  5Comments