A business buyer's tax id kept on a provider customer (txi_... at Stripe), such as an EU VAT
number. The provider prints it on the customer's invoices, and a provider that counts the tax
(Stripe Tax) may then charge no VAT and note a reverse charge. A guarded_struct.
Added with MishkaPay.create_tax_id/4, listed with MishkaPay.list_tax_ids/4 and removed with
MishkaPay.delete_tax_id/4.
What the caller gives:
:type: the provider's kind of tax id, such as"eu_vat","gb_vat","au_abn"or"us_ein"(Stripe lists them all at docs.stripe.com/billing/customer/tax-ids).:value: the number itself, such as"DE123456789".
What the provider fills in:
:id,:customer_id,:created_at.:country: the two-letter country the tax id belongs to.:verification::pending,:verified,:unverifiedor:unavailable, for the kinds a provider checks against a government register (EU VAT, GB VAT and AU ABN at Stripe);nilfor the others, whose format alone is checked. A check runs after the tax id is added: the provider sendscustomer.tax_id.updatedwhen it ends.:verified_name,:verified_address: what the register holds for the number.
Summary
Functions
A sample %MishkaPay.Customer.TaxId{} populated from defaults + type-based fallbacks.
Types
@type t() :: %MishkaPay.Customer.TaxId{ country: String.t() | nil, created_at: DateTime.t() | nil, customer_id: String.t() | nil, id: String.t() | nil, provider: String.t() | nil, tenant: term() | nil, type: String.t() | nil, value: String.t() | nil, verification: (:pending | :verified | :unverified | :unavailable) | nil, verified_address: String.t() | nil, verified_name: String.t() | nil }
The struct that builder/1 returns.
| Field | Type | Required | Default | Description | Derives |
|---|---|---|---|---|---|
:provider | String.t() | nil | no | sanitize(trim) validate(string, not_empty) | ||
:tenant | term() | nil | no | |||
:id | String.t() | nil | no | validate(string) | ||
:customer_id | String.t() | nil | no | sanitize(trim) validate(string, not_empty) | ||
:type | String.t() | nil | no | sanitize(trim, downcase) validate(string, not_empty, max_len=20, regex=^[a-z][a-z_]*$) | ||
:value | String.t() | nil | no | sanitize(trim) validate(string, not_empty, max_len=100) | ||
:country | String.t() | nil | no | validate(string) | ||
:verification | :pending | :verified | :unverified | :unavailable | nil | no | validate(enum=Atom[pending::verified::unverified::unavailable]) | ||
:verified_name | String.t() | nil | no | validate(string) | ||
:verified_address | String.t() | nil | no | validate(string) | ||
:created_at | DateTime.t() | nil | no | validate(struct) |