Payzum.Status (Payzum v0.1.0)

Copy Markdown View Source

One canonical payment status, mapped from the two vocabularies the API uses.

The merchant surface emits five values and the buyer surface emits six, with no name in common. Without one mapping every integrator invents their own, and the interesting cases are exactly where they get it wrong.

Summary

Functions

The five canonical wire values.

Map status from the buyer surface (GET /v1/invoices/{id}/status).

Map payment_status from the merchant surface.

The invoice was paid in full and is safe to fulfil.

No further transitions happen from here.

Functions

all()

The five canonical wire values.

from_buyer(value)

@spec from_buyer(term()) ::
  {:ok, String.t()} | {:error, Payzum.Errors.UnknownStatus.t()}

Map status from the buyer surface (GET /v1/invoices/{id}/status).

overpaid collapses to finished and cancelled to failed, so both surfaces produce the same canonical value for the same invoice.

from_merchant(value)

@spec from_merchant(term()) ::
  {:ok, String.t()} | {:error, Payzum.Errors.UnknownStatus.t()}

Map payment_status from the merchant surface.

unconfirmed does not exist — older docs listed it. overpaid arrives as finished and cancelled as failed.

paid?(status)

The invoice was paid in full and is safe to fulfil.

terminal?(status)

No further transitions happen from here.