Last active
August 29, 2015 14:15
-
-
Save guilleiguaran/f78ea9de1816c4f748f5 to your computer and use it in GitHub Desktop.
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 Comision do | |
defstruct estado: nil | |
def liquidar(%Comision{} = c) do | |
%{c | estado: :liquidada} | |
end | |
def anular(%Comision{estado: :liquidada} = c) do | |
%{c | estado: :anulada} | |
end | |
def aprobar(%Comision{estado: :liquidada} = c) do | |
%{c | estado: :aprobada} | |
end | |
def facturar(%Comision{estado: :aprobada} = c) do | |
%{c | estado: :facturada} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment