MishkaPay.Address (Mishka Pay v0.0.1)

Copy Markdown View Source

A postal address: where a buyer lives for the tax (MishkaPay.TaxCalculation), or where a checkout ships to (MishkaPay.Checkout's :shipping_address). A guarded_struct.

  • :country: the two-letter ISO 3166-1 code, such as "NL"; the only field a tax calculation needs outside the US.
  • :postal_code: needed for a US address.
  • :line1, :line2, :city, :state (ISO 3166-2 when there is one, such as "CA").
  • :name: the person it goes to, on a shipping address.

Summary

Types

t()

The struct that builder/1 returns.

Functions

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

Types

t()

@type t() :: %MishkaPay.Address{
  city: String.t() | nil,
  country: String.t() | nil,
  line1: String.t() | nil,
  line2: String.t() | nil,
  name: String.t() | nil,
  postal_code: String.t() | nil,
  state: String.t() | nil
}

The struct that builder/1 returns.

FieldTypeRequiredDefaultDescriptionDerives
:countryString.t() | nilnosanitize(trim, upcase) validate(string, regex=^[A-Z]{2}$)
:postal_codeString.t() | nilnosanitize(trim) validate(string, max_len=20)
:line1String.t() | nilnosanitize(trim) validate(string, max_len=200)
:line2String.t() | nilnosanitize(trim) validate(string, max_len=200)
:cityString.t() | nilnosanitize(trim) validate(string, max_len=200)
:stateString.t() | nilnosanitize(trim) validate(string, max_len=200)
:nameString.t() | nilnosanitize(trim) validate(string, max_len=250)

Functions

builder(attrs_or_input, error \\ false)

enforce_keys()

enforce_keys(field)

example()

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

keys()

keys(field)