A site's tax settings at a provider that counts the tax (Stripe Tax): where the business is and
what a price without its own tax fields counts as. A guarded_struct, read with
MishkaPay.fetch_tax_settings/2 and changed with MishkaPay.update_tax_settings/1, which sends
only the fields given.
:provider,:tenant: which provider, with whose keys.:head_office: where the business is located for tax, aMishkaPay.Address(its:countryat least; a US address needs its:stateand:postal_code).:tax_code: the tax category of a product that names none (Stripe's"txcd_10000000", general electronic services).:tax_behavior: what a price that says neither counts as::exclusive,:inclusive, or:inferred_by_currency(inclusive in currencies where prices usually hold the tax).
What the provider fills in: :status, :active once the provider can count the tax, else
:pending with the :missing_fields it still needs ("head_office"...).
Summary
Functions
A sample %MishkaPay.TaxSettings{} populated from defaults + type-based fallbacks.
Types
@type t() :: %MishkaPay.TaxSettings{ head_office: MishkaPay.Address.t() | nil, missing_fields: list() | nil, provider: String.t(), registration: MishkaPay.TaxSettings.Registration.t() | nil, status: (:active | :pending) | nil, tax_behavior: (:inclusive | :exclusive | :inferred_by_currency) | nil, tax_code: String.t() | nil, tenant: term() | nil }
The struct that builder/1 returns.
| Field | Type | Required | Default | Description | Derives |
|---|---|---|---|---|---|
:provider | String.t() | yes | sanitize(trim) validate(not_nil_value, string, not_empty) | ||
:tenant | term() | nil | no | |||
:head_office | MishkaPay.Address.t() | nil | no | |||
:tax_code | String.t() | nil | no | sanitize(trim) validate(string, not_empty, max_len=100) | ||
:tax_behavior | :inclusive | :exclusive | :inferred_by_currency | nil | no | validate(enum=Atom[inclusive::exclusive::inferred_by_currency])<br>validator {MishkaPay.TaxSettings, :tax_behavior} | ||
:status | :active | :pending | nil | no | validate(enum=Atom[active::pending]) | ||
:missing_fields | list() | nil | no | validate(list) | ||
:registration | MishkaPay.TaxSettings.Registration.t() | nil | no | Where the seller is registered to collect tax (taxreg_... at Stripe Tax): a provider that counts the tax (automatic tax, MishkaPay.calculate_tax/1) charges it only where the seller is registered. A guarded_struct, added with MishkaPay.create_tax_registration/1, listed with MishkaPay.list_tax_registrations/3 and ended with MishkaPay.expire_tax_registration/4. A provider never deletes one. |