Strategies, Pricing, and Sales Tax
Oscar uses a strategy object to determine product availability and pricing. A new strategy instance is assigned to each request by the basket middleware. Given a product, the strategy is responsible for selecting a stockrecord to use for fulfillment, selecting an availability policy (an object used to determine if a product is available for purchase), and most importantly for us here, selecting a "pricing policy," an object containing all price and tax information associated with a product.
Oscar provides a Structured strategy class which provides separate, overridable methods for selecting the stockrecord and determining pricing and availability policies. Oscar also ships with several strategy mixins which implement parts of the Structured strategy.
Deferred Tax
In the US, sales tax can typically only be determined once shipping (or billing) information is known. To support this case, we can use the Structured base strategy in combination with the DeferredTax pricing policy mixin, which does not specify a product tax and allows it to be determined later in the checkout process (example).
Fixed Rate Tax
Since we sell digital products, we may not need shipping or billing information to calculate sales tax. If this is the case, we'd essentially be charging VAT (example). This can be achieved by overriding the tax rate on the FixedRateTax pricing policy mixin; we can either specify a standard, fixed tax rate to use for all transactions, or we can have our modified pricing policy look up the correct tax rate in tax table stored in the database.
No Tax
If we're not required to calculate sales tax (either because we don't need to charge sales tax, or because we can let third-party payment processors handle the tax calculation), we can use the Structured base strategy in combination with the NoTax pricing policy mixin, which specifies zero tax and uses the price_excl_tax included in the selected stockrecord.