Created
May 28, 2019 17:31
-
-
Save talum/786682072ecf6db3046514e8d31f9479 to your computer and use it in GitHub Desktop.
Closed invoice
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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