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.
Australian production had one JPG image which was not recognised as
such. The `content_type` was missing and trying to generate a URL for a
variant raised an error and crashed the page.
Testing for `variable?` includes testing for `attached?` and is more
defensive.
We configured Paperclip to convert images to JPG in some cases but I
omitted that here because we don't need it. If an image is better
represented as PNG or another format then the user should be able to
choose that.
Some specs were also testing the generated URL but the Active Storage
URL doesn't contain a style name anymore and it's not helpful to test
the URL.
Display only if all conditions are met:
- Variant is not a bulk buy
- Shop preference is true for `preferred_product_stock_display`
- Only 3 (or less) items are remaining in stock
- No item for this variant is already to cart
It's another read-only attribute.
Please note that JSON:API specifies a format of `date-time` which we
don't adhere to because it uses a `Z` in front of the timezone offset
which doesn't seem to be included in the default json serialisation.
So I didn't add the format and left it as simple `string`. Problem?
- This tax_category_id could be null
- Special case if the originator is a Spree::TaxRate: then use the tax_category_id of the originator
Co-Authored-By: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com>
`product.master` seems to always be `null` on
/api/v0/order_cycles/:id/products JSON response. That's because the
first of the underlying AR relation,
`order_cycle.variants_distributed_by(distributor)`, does not include
master variants. They are not in OC exchanges.
Its serializer it's only used by this endpoint and
app/assets/javascripts/templates/shop_variant.html.haml doesn't rely on
the response's product.price but the variant's price.
Because our DB schema allows NULL on spree_prices.amount, a master
variant without a price can cause the shopfront not to load products.
This was the case in
https://app.bugsnag.com/yaycode/openfoodnetwork-uk/errors/60adfcc31cf9740007f82fc9.