All checks were successful
Build and Publish / build-release (push) Successful in 1m36s
23 lines
808 B
Elixir
23 lines
808 B
Elixir
defmodule PolicyService.Aggregates.FireStructurePolicyApplication do
|
|
use PolicyService.Aggregates.PolicyApplication,
|
|
policy_type: "fire_structure",
|
|
commands: PolicyService.Commands.FireStructurePolicy
|
|
|
|
def validate_insured_object(%{
|
|
"location" => location,
|
|
"property_value" => value,
|
|
"property_use" => use_type,
|
|
"security_measures" => measures,
|
|
"market_value" => market_value
|
|
})
|
|
when is_binary(location) and byte_size(location) > 0 and
|
|
is_number(value) and value > 0 and
|
|
is_binary(use_type) and byte_size(use_type) > 0 and
|
|
is_list(measures) and
|
|
is_number(market_value) and market_value > 0 do
|
|
:ok
|
|
end
|
|
|
|
def validate_insured_object(_), do: {:error, :invalid_fire_structure_details}
|
|
end
|