matthiask / plata

Plata - the lean and mean Django-based Shop
https://plata-django-shop.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
202 stars 63 forks source link

Change PRICE_INCLUDES_TAX per request/order #55

Closed jonasvp closed 11 years ago

jonasvp commented 11 years ago

We're currently evaluating Plata for a multi-country shop that includes Switzerland, Germany and the US.

One thing I'm uncertain about is that US prices must include differing sales taxes depending on the location of the customer. That tax is not included in the price. In the European countries, the tax is fixed per-product and included in the price.

For our shop this means that we'd have to change PLATA_PRICE_INCLUDES_TAX per order, depending on the country version the customer is accessing. Since it's defined globally, is there a workaround for this case? I'm not very fluent in Plata yet so I might be trying to solve this the wrong way.

I thought about a pull request adding a method on "Shop" in this manner:

    def price_includes_tax(self, order=None):
        return settings.PLATA_PRICE_INCLUDES_TAX

This would recreate the current way of handling this issue. For our case, we'd return a value based on the currently set language or order.language_code. What do you think?

matthiask commented 11 years ago

I have been giving this issue some thought in the last days. Whether prices include tax or not is a similar question as the default currency for a given visitor and should therefore be implemented in a similar way as Shop.default_currency is.

The implementation of the US tax system is a different question. We have been discussing this issue here: https://github.com/matthiask/plata/issues/53.

Adding a method to the shop object is certainly the way to go. The shop is accessible from everywhere (plata.shop_instance()).

Maybe we also need a new boolean flag on the order saving the current state of price_includes_tax, so that order PDFs etc. can be generated correctly later?

jonasvp commented 11 years ago

I have been giving this issue some thought in the last days. Whether prices include tax or not is a similar question as the default currency for a given visitor and should therefore be implemented in a similar way as Shop.default_currency is.

I haven't thought about it in those terms but it sounds right. I'll get started on a pull request, hope to get it done this week. I'll close the ticket for now.

Maybe we also need a new boolean flag on the order saving the current state of price_includes_tax, so that order PDFs etc. can be generated correctly later?

Good point! I'll add a field to that effect. Incidentally, having the language_code on the order model was very helpful. It's how we're separating the different shop implementations now.

The implementation of the US tax system is a different question. We have been discussing this issue here: #53.

I don't think it's that complex, really - the US only have one tax, it's just dependent on the state of the customer. I think it'll map nicely to the current implementation.