Skip to content

Instantly share code, notes, and snippets.

@talum
Created May 28, 2019 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talum/786682072ecf6db3046514e8d31f9479 to your computer and use it in GitHub Desktop.
Save talum/786682072ecf6db3046514e8d31f9479 to your computer and use it in GitHub Desktop.
Closed invoice
defmodule Registrar.Billing.Invoice do
import Ecto.Changeset
def mark_closed_changeset(%Invoice{} = invoice, attrs \\ %{}) do
  invoice
  |> cast(attrs, [
   :closed_at
  ])
  |> validate_required([
   :closed_at
  ])
  |> validate_not_paid()
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment