MishkaPay.File (Mishka Pay v0.0.1)

Copy Markdown View Source

A file the provider keeps (file_... at Stripe), uploaded with MishkaPay.upload_file/1 or read with MishkaPay.fetch_file/3. Put its :id in a dispute's evidence to send it to the bank. A guarded_struct the provider fills in.

  • :id: the provider's id of the file.
  • :purpose: :dispute_evidence, or :other for a file kept for something else.
  • :filename, :size (in bytes), :type (the provider's word for its format, such as "pdf" or "png").
  • :url: where the provider serves its bytes, when it does. At Stripe this address needs the secret key; MishkaPay.file_link/4 makes one a page can show.
  • :expires_at: when the provider deletes it (Stripe keeps dispute evidence for 9 months).
  • :created_at.

Summary

Types

t()

The struct that builder/1 returns.

Functions

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

Types

t()

@type t() :: %MishkaPay.File{
  created_at: DateTime.t() | nil,
  expires_at: DateTime.t() | nil,
  filename: String.t() | nil,
  id: String.t(),
  link: MishkaPay.File.Link.t() | nil,
  provider: String.t(),
  purpose: atom() | nil,
  size: non_neg_integer() | nil,
  tenant: term() | nil,
  type: String.t() | nil,
  upload: MishkaPay.File.Upload.t() | nil,
  url: String.t() | nil
}

The struct that builder/1 returns.

FieldTypeRequiredDefaultDescriptionDerives
:providerString.t()yesvalidate(not_nil_value, string)
:tenantterm() | nilno
:idString.t()yesvalidate(not_nil_value, string, not_empty)
:purposeatom() | nilnovalidate(enum=Atom[dispute_evidence::other])
:filenameString.t() | nilnovalidate(string)
:sizenon_neg_integer() | nilnovalidate(integer)
:typeString.t() | nilnovalidate(string)
:urlString.t() | nilnovalidate(string)
:expires_atDateTime.t() | nilnovalidate(struct)
:created_atDateTime.t() | nilnovalidate(struct)
:linkMishkaPay.File.Link.t() | nilnoA public address of a MishkaPay.File, made with MishkaPay.file_link/4: anyone with :url can open the file without a key, so a site can show it to a person, until :expires_at. A guarded_struct the provider fills in.
:uploadMishkaPay.File.Upload.t() | nilnoA file to upload to the provider with MishkaPay.upload_file/1, such as a receipt, a download log or a screenshot that answers a dispute. The provider keeps it and answers a MishkaPay.File; its :id then goes in the dispute's evidence (MishkaPay.update_dispute/1). A guarded_struct.

Functions

builder(attrs_or_input, error \\ false)

enforce_keys()

enforce_keys(field)

example()

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

keys()

keys(field)