MishkaPay.Customer.TaxId (Mishka Pay v0.0.1)

Copy Markdown View Source

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, :unverified or :unavailable, for the kinds a provider checks against a government register (EU VAT, GB VAT and AU ABN at Stripe); nil for the others, whose format alone is checked. A check runs after the tax id is added: the provider sends customer.tax_id.updated when it ends.
  • :verified_name, :verified_address: what the register holds for the number.

Summary

Types

t()

The struct that builder/1 returns.

Functions

A sample %MishkaPay.Customer.TaxId{} populated from defaults + type-based fallbacks.

Types

t()

@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.

FieldTypeRequiredDefaultDescriptionDerives
:providerString.t() | nilnosanitize(trim) validate(string, not_empty)
:tenantterm() | nilno
:idString.t() | nilnovalidate(string)
:customer_idString.t() | nilnosanitize(trim) validate(string, not_empty)
:typeString.t() | nilnosanitize(trim, downcase) validate(string, not_empty, max_len=20, regex=^[a-z][a-z_]*$)
:valueString.t() | nilnosanitize(trim) validate(string, not_empty, max_len=100)
:countryString.t() | nilnovalidate(string)
:verification:pending | :verified | :unverified | :unavailable | nilnovalidate(enum=Atom[pending::verified::unverified::unavailable])
:verified_nameString.t() | nilnovalidate(string)
:verified_addressString.t() | nilnovalidate(string)
:created_atDateTime.t() | nilnovalidate(struct)

Functions

builder(attrs_or_input, error \\ false)

enforce_keys()

enforce_keys(field)

example()

A sample %MishkaPay.Customer.TaxId{} populated from defaults + type-based fallbacks.

keys()

keys(field)