feat: add price_treatment to the price type - #691
Conversation
|
I think this should be modeled as an object rather than a boolean on
Could we use a broader container and scope the first version to tax? For example: "price_treatment": {
"$ref": "#/$defs/price_treatment"
}with: "price_treatment": {
"type": "object",
"description": "How the price amount should be interpreted for display and downstream calculation.",
"properties": {
"tax": {
"$ref": "#/$defs/tax_treatment"
}
}
}"tax_treatment": {
"type": "object",
"required": ["inclusion"],
"properties": {
"inclusion": {
"type": "string",
"enum": ["included", "excluded", "not_applicable", "not_asserted"]
}
}
}That keeps this PR scoped to the current tax-inclusion problem, while giving the protocol a place to add tax-specific detail later without adding more sibling booleans to |
Co-authored-by: Karan Goel <karangoel16@yahoo.com>
5a7dda6 to
0572eb5
Compare
|
Agreed, the enum removes the |
Context: #256 (LATAM pricing) raised the same class of issue. This scopes it to the catalog price marker.
price_treatmentis a new optional object on thepricetype, scoped to tax for now:tax.inclusionstates whether the amount includes tax (VAT, GST, etc.), as one ofincluded,excluded,not_applicable,not_asserted. A catalog price already carriesamountandcurrency; today it never says whether tax is in it, so an agent has to infer that from the buyer's country. This makes the price self-describing, mirroring howcurrencyis already explicit, and the container leaves room for tax detail later without adding sibling fields toprice.What it looks like
A tax-inclusive EU catalog price:
{ "amount": 12000, "currency": "EUR", "price_treatment": { "tax": { "inclusion": "included" } } }A US catalog price omits it (or sets
excluded); tax is added downstream. The itemized tax breakdown stays in checkouttotals; this field only disambiguates the displayed price.Optional and backward-compatible: an absent field is equivalent to
not_asserted, behavior is unchanged; agents that ignore it fall back to today's inference, agents that read it drop the guesswork.Category (Required)
ucp-schematool (resolver, linter, validator). (Requires Maintainer approval)Checklist
ucp-schemaand super-linter not run locally (no cargo/docker); relying on CI.