* unit_price_price_and_unit refers UnitPrice which refers to other attributes
that belong to variant and product.
Instead of collecting all the attributes that were using indirectly by the method and adding them to the serializers
I perefered to serialize the result of the method call.
for some helpers like display_checkout_taxes_hash, it's needed to access the tax rates through the adjument's originator.
The adjustment's originator will store the minimal details: id, type and amount
For every adjustment a list of tax rates will be created using TaxRateFinder.tax_rates_of.
This will prevent running the queries to find the tax rates during the invoice generation.
1. reimplment the helper on the LintItem presenter
2. add the tax rate associated to the line items to the list of objects to serialize during the order serialization.
3. implement a presenter for the introducer tax rates.
There are three main components:
1. The invoice model
2. order serializers: serialize the order for the invoice
3. data presenters: the object that will be use to access the order's serialize data
For some reason eager-loaded data isn't passed to nested serializers when using associations. Defining the association as a method and passing in some optional paramaters resolves the issue.
This reduces queries run by the controller action by around 75%, as well as the response times.
We found that our database is quite busy querying the country all the
time. One source of these queries is the shop front which serializes
enterprises including their addresses. But addresses should be safe to
cache because:
- country records never change
- state records never change
- updating any other attribute changes the cache key
The caching was previously removed when the state_name attribute was
added. That is technically correct because it's possible to change a
state's name without updating the address. Then the cache would be out
of date. But we never update state names. And if we did, we would need
to invalidate the cache now.
The customer endpoint now serves 2-letter ISO codes for countries and
accepts these for updates. It also serves and accepts region codes
(abbreviations) like VIC for Victoria.
Updates treat these fields as case-insensitive and either code or name
have to be present.
This commit also updates the Swagger documentation.
Strips '+' and ' ' characters from the phone number for the generated
link, but doesn't guarantee the link is valid because the number
registered isn't validated for now.