lib/responses/void_payment.ex
defmodule Responses.VoidPayment do
@derive Jason.Encoder
defstruct [:links, :action_id]
def build(%{"_links" => links, "action_id" => action_id}) do
%__MODULE__{
links: build_link(links),
action_id: action_id
}
end
defp build_link(%{"payment" => %{"href" => href}}) do
%{payment: %{href: href}}
end
end