MishkaPay.Dispute (Mishka Pay v0.0.1)

Copy Markdown View Source

A buyer's bank asking for a payment back (a chargeback, dp_... at Stripe). A guarded_struct the provider fills in, read with MishkaPay.fetch_dispute/3 and MishkaPay.list_disputes/3; answered with evidence (MishkaPay.update_dispute/1) or accepted (MishkaPay.accept_dispute/3). A file seller usually takes back what the payment gave while a dispute is open.

  • :id, :payment_id, :charge_id: the dispute and the payment it takes back.
  • :amount: how much, as Money.
  • :status: :warning_needs_response, :warning_under_review, :warning_closed (an inquiry before a dispute), :needs_response, :under_review, :won, :lost or :prevented.
  • :reason: the bank's reason, in the provider's words ("fraudulent", "product_not_received"...).
  • :evidence_due_by: the last moment to answer; :has_evidence, :submission_count: what was sent so far.
  • :refundable: whether the payment can still be refunded instead.
  • :metadata, :created_at.

Summary

Types

t()

The struct that builder/1 returns.

Functions

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

The statuses a dispute can have, as atoms.

Types

t()

@type t() :: %MishkaPay.Dispute{
  amount: Money.t() | nil,
  charge_id: String.t() | nil,
  created_at: DateTime.t() | nil,
  evidence: MishkaPay.Dispute.Evidence.t() | nil,
  evidence_due_by: DateTime.t() | nil,
  has_evidence: boolean() | nil,
  id: String.t(),
  metadata: map() | nil,
  payment_id: String.t() | nil,
  provider: String.t(),
  reason: String.t() | nil,
  refundable: boolean() | nil,
  status: atom() | nil,
  submission_count: non_neg_integer() | nil,
  tenant: term() | 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)
:payment_idString.t() | nilnovalidate(string)
:charge_idString.t() | nilnovalidate(string)
:amountMoney.t() | nilnovalidator {MishkaPay.Money, :field}
:statusatom() | nilnovalidate(enum=Atom[warning_needs_response::warning_under_review::warning_closed::needs_response::under_review::won::lost::prevented])
:reasonString.t() | nilnovalidate(string)
:evidence_due_byDateTime.t() | nilnovalidate(struct)
:has_evidenceboolean() | nilnofalsevalidate(boolean)
:submission_countnon_neg_integer() | nilno0validate(integer)
:refundableboolean() | nilnovalidate(boolean)
:metadatamap() | nilno%{}validate(map)
:created_atDateTime.t() | nilnovalidate(struct)
:evidenceMishkaPay.Dispute.Evidence.t() | nilnoThe answer to a MishkaPay.Dispute, given to MishkaPay.update_dispute/1. A guarded_struct.

Functions

builder(attrs_or_input, error \\ false)

enforce_keys()

enforce_keys(field)

example()

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

keys()

keys(field)

statuses()

@spec statuses() :: [atom()]

The statuses a dispute can have, as atoms.