defmodule Requests.Payments.Senders.Government do
alias Customers.BillingAddress
alias Requests.Payments.Senders.Identification
@type t :: %__MODULE__{
type: String.t(),
company_name: String.t(),
address: BillingAddress.t(),
reference: String.t(),
reference_type: String.t(),
source_of_funds: String.t(),
identification: Identification.t()
}
@enforce_keys [:type, :company_name, :address, :reference, :reference_type, :source_of_funds]
defstruct [
:type,
:company_name,
:address,
:reference,
:reference_type,
:source_of_funds,
:identification
]
def build(params) when is_map(params) do
%{
type: params[:type],
company_name: params[:first_name],
address: BillingAddress.build(params[:address]),
reference: params[:reference],
reference_type: params[:reference_type],
source_of_funds: params[:source_of_funds],
identification: params[:identification]
}
end
def build(_), do: nil
end