List deserializer added
This commit is contained in:
parent
72ec45a361
commit
368225f331
|
@ -27,6 +27,8 @@ defimpl IbanEx.Deserialize, for: Map do
|
||||||
country_code: _country_code,
|
country_code: _country_code,
|
||||||
check_digits: _check_sum_digits,
|
check_digits: _check_sum_digits,
|
||||||
bank_code: _bank_code,
|
bank_code: _bank_code,
|
||||||
|
branch_code: _branch_code,
|
||||||
|
national_check: _national_check,
|
||||||
account_number: _account_number
|
account_number: _account_number
|
||||||
} = map
|
} = map
|
||||||
) do
|
) do
|
||||||
|
@ -38,6 +40,8 @@ defimpl IbanEx.Deserialize, for: Map do
|
||||||
"country_code" => _country_code,
|
"country_code" => _country_code,
|
||||||
"check_digits" => _check_sum_digits,
|
"check_digits" => _check_sum_digits,
|
||||||
"bank_code" => _bank_code,
|
"bank_code" => _bank_code,
|
||||||
|
"branch_code" => _branch_code,
|
||||||
|
"national_check" => _national_check,
|
||||||
"account_number" => _account_number
|
"account_number" => _account_number
|
||||||
} = map
|
} = map
|
||||||
) do
|
) do
|
||||||
|
@ -47,3 +51,11 @@ defimpl IbanEx.Deserialize, for: Map do
|
||||||
|
|
||||||
def to_iban(map) when is_map(map), do: {:error, :can_not_parse_map}
|
def to_iban(map) when is_map(map), do: {:error, :can_not_parse_map}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defimpl IbanEx.Deserialize, for: List do
|
||||||
|
alias IbanEx.Iban
|
||||||
|
@type iban_or_error() :: IbanEx.Iban.t() | {:error, :can_not_parse_map}
|
||||||
|
|
||||||
|
@spec to_iban(list()) :: iban_or_error()
|
||||||
|
def to_iban(list), do: struct(Iban, Map.new(list))
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue